protected virtual void AddedToWorld(Actor self) { if (Info.RemoveSmudgesOnBuild) { RemoveSmudges(); } self.World.AddToMaps(self, this); influence.AddInfluence(self, Info.Tiles(self.Location)); }
protected virtual void AddedToWorld(Actor self) { if (Info.RemoveSmudgesOnBuild) { RemoveSmudges(); } self.World.ActorMap.AddInfluence(self, this); self.World.ActorMap.AddPosition(self, this); if (!self.Bounds.Size.IsEmpty) { self.World.ScreenMap.Add(self); } influence.AddInfluence(self, Info.Tiles(self.Location)); }
public static bool CanPlaceBuilding(this World world, CPos cell, ActorInfo ai, BuildingInfo bi, Actor toIgnore) { if (bi.AllowInvalidPlacement) return true; var resourceLayer = world.WorldActor.TraitOrDefault<IResourceLayer>(); return bi.Tiles(cell).All(t => world.Map.Contains(t) && (bi.AllowPlacementOnResources || resourceLayer == null || resourceLayer.GetResource(t).Type == null) && world.IsCellBuildable(t, ai, bi, toIgnore)); }
public void RemoveSmudges() { var smudgeLayers = self.World.WorldActor.TraitsImplementing <SmudgeLayer>(); foreach (var smudgeLayer in smudgeLayers) { foreach (var footprintTile in Info.Tiles(self.Location)) { smudgeLayer.RemoveSmudge(footprintTile); } } }
public static bool CanPlaceBuilding(this World world, string name, BuildingInfo building, CPos topLeft, Actor toIgnore) { if (building.AllowInvalidPlacement) { return(true); } var res = world.WorldActor.TraitOrDefault <ResourceLayer>(); return(building.Tiles(topLeft).All( t => world.Map.Contains(t) && (res == null || res.GetResource(t) == null) && world.IsCellBuildable(t, building, toIgnore))); }
public static bool CanPlaceBuilding(this World world, CPos cell, ActorInfo ai, BuildingInfo bi, Actor toIgnore) { if (bi.AllowInvalidPlacement) { return(true); } var res = world.WorldActor.TraitOrDefault <ResourceLayer>(); return(bi.Tiles(cell).All( t => world.Map.Contains(t) && (res == null || res.GetResourceType(t) == null) && world.IsCellBuildable(t, ai, bi, toIgnore))); }