public override void generateRecoilerPartonObject() { //MessageQueue.AddPlayerMessage($"Adding local Recoilondeath part!"); RecoilOnDeath teleporter = ParentObject.RequirePart <RecoilOnDeath>(); ZoneManager zoneManager = XRLCore.Core.Game.ZoneManager; teleporter.DestinationZone = zoneManager.ActiveZone.ZoneID; teleporter.DestinationX = -1; teleporter.DestinationY = -1; }
public virtual void generateRecoilerPartonObject() { List <JournalMapNote> mapNotes = JournalAPI.GetMapNotes((JournalMapNote note) => note.Has("ruins") || note.Has("historic")); if (mapNotes.Count > 0) { //MessageQueue.AddPlayerMessage($"Adding Recoilondeath part!"); ZoneManager zoneManager = XRLCore.Core.Game.ZoneManager; JournalMapNote randomElement = mapNotes.GetRandomElement(); RecoilOnDeath teleporter = ParentObject.RequirePart <RecoilOnDeath>(); Zone destinationZone = zoneManager.GetZone(randomElement.zoneid); List <Cell> emptyReachableCells = destinationZone.GetEmptyReachableCells(); Cell destinationcell = ((emptyReachableCells.Count <= 0) ? destinationZone.GetCell(40, 20) : emptyReachableCells.GetRandomElement()); teleporter.DestinationZone = randomElement.zoneid; teleporter.DestinationX = destinationcell.X; teleporter.DestinationY = destinationcell.Y; //MessageQueue.AddPlayerMessage($"DestinationZone: {randomElement.zoneid}!"); } }