Exemplo n.º 1
0
        protected virtual void AddedToWorld(Actor self)
        {
            if (Info.RemoveSmudgesOnBuild)
            {
                RemoveSmudges();
            }

            self.World.AddToMaps(self, this);
            influence.AddInfluence(self, Info.Tiles(self.Location));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
		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));
		}
Exemplo n.º 4
0
        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);
                }
            }
        }
Exemplo n.º 5
0
        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)));
        }
Exemplo n.º 6
0
        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)));
        }