public override void Initialize() { if (Agent.Status.Hunger.IsUnhappy()) { Room commonRoom = Creature.Faction.GetNearestRoomOfType("CommonRoom", Agent.Position); if (commonRoom != null && commonRoom.IsBuilt) { Tree = (new GoToZoneAct(Agent, commonRoom) & new GoToChairAndSitAct(Agent) & new Wrap(Creature.EatStockedFood)); } else { Stockpile stockRoom = Creature.Faction.GetNearestStockpile(Agent.Position); if (stockRoom != null && stockRoom.IsBuilt) { Tree = new GoToZoneAct(Agent, stockRoom) & new Wrap(Creature.EatStockedFood); } } } else { Tree = null; } base.Initialize(); }
public override void Initialize() { if(Agent.Status.Hunger.IsUnhappy()) { Room commonRoom = Creature.Faction.GetNearestRoomOfType("CommonRoom", Agent.Position); if (commonRoom != null && commonRoom.IsBuilt) { Tree = (new GoToZoneAct(Agent, commonRoom) & new GoToChairAndSitAct(Agent) & new Wrap(Creature.EatStockedFood)); } else { Stockpile stockRoom = Creature.Faction.GetNearestStockpile(Agent.Position); if (stockRoom != null && stockRoom.IsBuilt) { Tree = new GoToZoneAct(Agent, stockRoom) & new Wrap(Creature.EatStockedFood); } } } else { Tree = null; } base.Initialize(); }
public override MaybeNull <Act> CreateScript(Creature creature) { var above = VoxelHelpers.GetVoxelAbove(creature.Physics.CurrentVoxel); if ((above.IsValid && above.LiquidLevel > 0) || creature.AI.Movement.CanFly) { return(new Wrap(() => SwimUp(creature)) { Name = "Swim up" }); } Act fallback = null; if (creature.World.EnumerateZones().Count() == 0) { fallback = new LongWanderAct(creature.AI) { PathLength = 20, Radius = 30, Is2D = true, Name = "Randomly wander." } } ; else { fallback = new GoToZoneAct(creature.AI, Datastructures.SelectRandom(creature.World.EnumerateZones())); } return(new Select(new Sequence(new Wrap(() => FindLandEnum(creature)) { Name = "Search for land." }, new GoToNamedVoxelAct("Land", PlanAct.PlanType.Into, creature.AI)), fallback) { Name = "Find Land" }); }