Spiral borers can't dig in deserialised zones

Issue #1170 resolved
Armithaig created an issue

The exception received upon activating the borer, both stable & beta:

Logged exception TwiddleObject :System.NullReferenceException: Object reference not set to an instance of an object
  at XRL.World.Zone.CacheZoneConnection (System.String TargetZoneDirection, System.Int32 X, System.Int32 Y, System.String Type, System.String ConnectionObject) [0x00012] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.Parts.StairsDown.HandleEvent (XRL.World.EnteredCellEvent E) [0x0007c] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.EnteredCellEvent.handlePartDispatch (XRL.World.IPart part) [0x0000b] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.GameObject.HandleEventInner (XRL.World.MinEvent E, System.Int32 ID) [0x0004b] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.GameObject.HandleEvent[T] (T E) [0x00169] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.GameObject.ProcessEnteredCell (XRL.World.Cell DestinationCell, System.Boolean Forced, System.Boolean System, System.String Direction, System.String Type, XRL.World.GameObject Dragging) [0x0005c] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.Cell.AddObject (XRL.World.GameObject GO, System.Boolean Forced, System.Boolean System, System.String Direction, System.String Type, XRL.World.GameObject Dragging, System.Collections.Generic.List`1[T] Tracking) [0x00055] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.Cell.AddObject (System.String Blueprint, System.String Context, System.Collections.Generic.List`1[T] Tracking, System.Action`1[T] beforeObjectCreated, System.Action`1[T] afterObjectCreated) [0x00022] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.Parts.SpiralBorerCurio.HandleEvent (XRL.World.InventoryActionEvent E) [0x0012f] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.InventoryActionEvent.handlePartDispatch (XRL.World.IPart part) [0x0000b] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.GameObject.HandleEventInner (XRL.World.MinEvent E, System.Int32 ID) [0x0004b] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.GameObject.HandleEvent[T] (T E) [0x00169] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at XRL.World.InventoryActionEvent.Check (XRL.World.IEvent& GeneratedEvent, XRL.World.GameObject Object, XRL.World.GameObject Actor, XRL.World.GameObject Item, System.String Command, System.Boolean Auto, System.Boolean OwnershipHandled, System.Boolean OverrideEnergyCost, System.Int32 EnergyCostOverride, System.Int32 MinimumCharge, XRL.World.GameObject ObjectTarget, XRL.World.Cell CellTarget, XRL.World.Cell FromCell) [0x00038] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0 
  at Qud.API.EquipmentAPI.TwiddleObject (XRL.World.GameObject Owner, XRL.World.GameObject GO, System.Boolean& Done, System.Boolean Distant) [0x00459] in <52807248c43e4d4eb5bb601f2e5a0e5b>:0

Sniffed it to the Zone.ZoneConnectionCache being null for deserialised zones since constructors/field inits aren’t run with the binary formatter.

Repro: New game → Save & reload → Wish for spiral borer & activate it.

Comments (3)

  1. Log in to comment