Beispiel #1
0
        private void CheckFrameableHouse()
        {
            int tileX = (int)this.player.Center.X >> 4;
            int tileY = (int)this.player.position.Y >> 4;

            ISet <(int, int)> tiles;
            bool canErect = HouseFramingKitItem.Validate(ref tileX, ref tileY, out tiles);

            Color   color;
            Vector2 pos;

            foreach ((int x, int y) in tiles)
            {
                pos   = new Vector2((x << 4) + 8, (y << 4) + 8);
                color = canErect ? Color.Lime : Color.Red;

                Dust dust = Dust.NewDustPerfect(
                    Position: pos,
                    Velocity: default(Vector2),
                    Type: 59,
                    Alpha: 0,
                    newColor: color,
                    Scale: 1.25f
                    );
                dust.noGravity = true;
                dust.noLight   = true;
            }
        }
        ////

        protected override void Receive(int fromWho)
        {
            ISet <(int TileX, int TileY)> houseTiles;
            bool isValid = HouseFramingKitItem.Validate(ref this.TileX, ref this.TileY, out houseTiles);

            if (isValid)
            {
                HouseFramingKitItem.MakeHouseFrame(this.TileX, this.TileY);
            }
            else
            {
                LogHelpers.Alert("Could not place house frame");
            }
        }
        ////

        public override void ReceiveOnServer(int fromWho)
        {
            ISet <(int TileX, int TileY)> houseTiles;
            bool isValid = HouseFramingKitItem.Validate(ref this.TileX, ref this.TileY, out houseTiles);

            if (isValid)
            {
                HouseFramingKitItem.MakeHouseFrame(this.TileX, this.TileY);
            }
            else
            {
                LogLibraries.Alert("Could not place house frame");
            }
        }