public override bool PreAI(Projectile projectile) { if (!projectile.tileCollide && projectile.aiStyle != 26 && !projectile.minion && projectile.damage > 0 && projectile.friendly) { int x = (int)MathHelper.Clamp(projectile.Center.X / 16, 0, Main.maxTilesX - 2); int y = (int)MathHelper.Clamp(projectile.Center.Y / 16, 0, Main.maxTilesY - 2); if (Main.tile[x, y] != null && Main.tile[x, y].active()) { if (Main.tile[x, y].type == (ushort)mod.TileType("BlueHatch")) { TileLoader.HitWire(x, y, mod.TileType("BlueHatch")); } if (Main.tile[x, y].type == (ushort)mod.TileType("BlueHatchVertical")) { TileLoader.HitWire(x, y, mod.TileType("BlueHatchVertical")); } } } if (!init) { projSpeed = projectile.velocity.Length(); init = true; } return(base.PreAI(projectile)); }
public override void ResetEffects() { if (player.whoAmI != Main.myPlayer) { return; } if (timeSinceOpen < 1) { player.talkNPC = -1; Main.playerInventory = true; timeSinceOpen++; } if (storageAccess.X >= 0 && storageAccess.Y >= 0 && (player.chest != -1 || !Main.playerInventory || player.sign > -1 || player.talkNPC > -1)) { CloseStorage(); Recipe.FindRecipes(); } else if (storageAccess.X >= 0 && storageAccess.Y >= 0) { int playerX = (int)(player.Center.X / 16f); int playerY = (int)(player.Center.Y / 16f); if (!remoteAccess && (playerX < storageAccess.X - Player.tileRangeX || playerX > storageAccess.X + Player.tileRangeX + 1 || playerY < storageAccess.Y - Player.tileRangeY || playerY > storageAccess.Y + Player.tileRangeY + 1)) { Main.PlaySound(11, -1, -1, 1); CloseStorage(); Recipe.FindRecipes(); } else if (!(TileLoader.GetTile(Main.tile[storageAccess.X, storageAccess.Y].type) is StorageAccess)) { Main.PlaySound(11, -1, -1, 1); CloseStorage(); Recipe.FindRecipes(); } } }
public MainMenuScreen(OnScreenChanged screenChanged) : base(screenChanged) { UserInterfaceLoader uiLoader = UserInterfaceLoader.GetInstance(); TileLoader tileLoader = TileLoader.GetInstance(); tileBrick1Sprite = tileLoader.Get("brick1"); titleSprite = uiLoader.Get("title"); newGameSprite = uiLoader.Get("newGame"); loadGameSprite = uiLoader.Get("loadGame"); sandboxSprite = uiLoader.Get("sandbox"); adventureSprite = uiLoader.Get("adventure"); title = new StaticEntity("Title Card", new Vector2(GameConstants.WINDOW_WIDTH / 2, GameConstants.TILE_SIZE * 2), titleSprite); newGameButton = new StaticEntity("New Game Button", new Vector2(GameConstants.WINDOW_WIDTH / 2, GameConstants.TILE_SIZE * 11 / 2), newGameSprite); loadGameButton = new StaticEntity("Load Game Button", new Vector2(GameConstants.WINDOW_WIDTH / 2, GameConstants.TILE_SIZE * 8), loadGameSprite); sandboxButton = new StaticEntity("Sandbox Button", new Vector2(GameConstants.WINDOW_WIDTH / 2, GameConstants.TILE_SIZE * 21 / 2), sandboxSprite); adventureButton = new StaticEntity("Achievements Button", new Vector2(GameConstants.WINDOW_WIDTH / 2, GameConstants.TILE_SIZE * 13), adventureSprite); for (int i = 0; i < GameConstants.TILES_WIDE; i++) { for (int j = 0; j < GameConstants.TILES_HIGH + 1; j++) //The +1 allows us to cover the action bar { Vector2 tileLocation = new Vector2(i * GameConstants.TILE_SIZE + GameConstants.TILE_SIZE / 2, j * GameConstants.TILE_SIZE + GameConstants.TILE_SIZE / 2); GridEntity newTile = new GridEntity("Tile", i, j, 0, tileLocation, GameConstants.TILE_SIZE, tileBrick1Sprite); menuBackground.Add(newTile); } } }
public static TEStorageHeart GetStorageHeart() { var player = Get; if (player.StorageAccess.X < 0 || player.StorageAccess.Y < 0) { return(null); } Tile tile = Main.tile[player.StorageAccess.X, player.StorageAccess.Y]; if (tile == null) { return(null); } int tileType = tile.type; ModTile modTile = TileLoader.GetTile(tileType); if (modTile == null || !(modTile is StorageAccess)) { return(null); } return(((StorageAccess)modTile).GetHeart(player.StorageAccess.X, player.StorageAccess.Y)); }
public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { SpriteEffects effects = SpriteEffects.None; if (i % 2 == 1) { effects = SpriteEffects.FlipHorizontally; } Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); if (Main.drawToScreen) { zero = Vector2.Zero; } Tile tile = Main.tile[i, j]; int width = 16; int offsetY = 0; int height = 16; TileLoader.SetDrawPositions(i, j, ref width, ref offsetY, ref height); var flameTexture = mod.GetTexture("Tiles/ExampleLamp_Flame"); // We could also reuse Main.FlameTexture[] textures, but using our own texture is nice. ulong num190 = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)(uint)i); // We can support different flames for different styles here: int style = Main.tile[j, i].frameY / 54; for (int c = 0; c < 7; c++) { float shakeX = Utils.RandomInt(ref num190, -10, 11) * 0.15f; float shakeY = Utils.RandomInt(ref num190, -10, 1) * 0.35f; Main.spriteBatch.Draw(flameTexture, new Vector2(i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f + shakeX, j * 16 - (int)Main.screenPosition.Y + offsetY + shakeY) + zero, new Rectangle(tile.frameX, tile.frameY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, effects, 0f); } }
public override void PostUpdate() { if (Main.dedServ || !DisplayWorldTooltips) { return; } MouseText = String.Empty; SecondLine = false; var modLoaderMod = ModLoader.GetMod("ModLoader"); var tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; if (tile != null) { InitializeTileTypes(); var modTile = TileLoader.GetTile(tile.type); var name = ""; if (modTile != null) { name = modTile.Name; } if (name == "") { _tileTypeToName.TryGetValue(tile.type, out name); } MouseText = "Tile: " + name; } }
public void CanLoad() { var staticLoader = new TileLoader(); var statics = staticLoader.Load(_level, StaticsMap.TileBuilder); Assert.That(statics[0, 0].Token == '#'); Assert.That(statics[1, 1].Token == '.'); }
public override void PostUpdate() { if (Main.dedServ || !DisplayWorldTooltips) { return; } Mod displayMod = null; Mod modLoaderMod = ModLoader.GetMod("ModLoader"); //modmodloadermodmodloadermodmodloader int mysteryTile = modLoaderMod.TileType("MysteryTile"); int mysteryTile2 = modLoaderMod.TileType("PendingMysteryTile"); var tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; if (tile != null) { if (tile.active() && tile.type != mysteryTile && tile.type != mysteryTile2) { var modTile = TileLoader.GetTile(tile.type); if (modTile != null) { displayMod = modTile.mod; } } else { var modWall = WallLoader.GetWall(tile.wall); if (modWall != null) { displayMod = modWall.mod; } } } var mousePos = Main.MouseWorld; for (int i = 0; i < Main.maxNPCs; i++) { var npc = Main.npc[i]; if (mousePos.Between(npc.TopLeft, npc.BottomRight)) { var modNPC = NPCLoader.GetNPC(npc.type); if (modNPC != null && npc.active && !NPCID.Sets.ProjectileNPC[npc.type]) { displayMod = modNPC.mod; SecondLine = true; break; } } } if (displayMod != null) { MouseText = String.Format("[c/{1}:[{0}][c/{1}:]]", displayMod.DisplayName, Colors.RarityBlue.Hex3()); if (Main.mouseText) { SecondLine = true; } } }
public void DrawPath(List <Vector3Int> path) { Tile moltenCenterTile = TileLoader.GetMoltenCenterTile(); foreach (Vector3Int location in path) { groundMap.SetTile(location, moltenCenterTile); } }
public MapPainter(Map map, ScreenForm s) { Screen = s; Map = map; DrawSize = Screen.Size; Loader = new TileLoader(); Av = new List <Point>(); SwitchMap(map); }
internal static TagCompound SaveTiles() { var hasTile = new bool[TileLoader.TileCount]; var hasWall = new bool[WallLoader.WallCount]; using (var ms = new MemoryStream()) using (var writer = new BinaryWriter(ms)) { WriteTileData(writer, hasTile, hasWall); var tileList = new List <TagCompound>(); for (int type = TileID.Count; type < hasTile.Length; type++) { if (!hasTile[type]) { continue; } var modTile = TileLoader.GetTile(type); tileList.Add(new TagCompound { ["value"] = (short)type, ["mod"] = modTile.mod.Name, ["name"] = modTile.Name, ["framed"] = Main.tileFrameImportant[type], }); } var wallList = new List <TagCompound>(); for (int wall = WallID.Count; wall < hasWall.Length; wall++) { if (!hasWall[wall]) { continue; } var modWall = WallLoader.GetWall(wall); wallList.Add(new TagCompound { ["value"] = (short)wall, ["mod"] = modWall.mod.Name, ["name"] = modWall.Name, }); } if (tileList.Count == 0 && wallList.Count == 0) { return(null); } return(new TagCompound { ["tileMap"] = tileList, ["wallMap"] = wallList, ["data"] = ms.ToArray() }); } }
public void CanUpdate() { var loader = new TileLoader(); var tileSet = loader.Load(_level, StaticsMap.TileBuilder); tileSet[1, 1].Location = new Point(0, 0); tileSet[0, 0].Location = new Point(1, 1); tileSet.Update(); Assert.AreEqual(tileSet[1, 1].Token, '#'); }
public override void PostUpdate() { if (Main.dedServ || !DisplayWorldTooltips) { return; } MouseText = String.Empty; SecondLine = false; var modLoaderMod = ModLoader.GetMod("ModLoader"); //modmodloadermodmodloadermodmodloader int mysteryTile = modLoaderMod.TileType("MysteryTile"); int mysteryTile2 = modLoaderMod.TileType("PendingMysteryTile"); var tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; if (tile != null) { if (tile.active() && tile.type != mysteryTile && tile.type != mysteryTile2) { var modTile = TileLoader.GetTile(tile.type); if (modTile != null) { MouseText = DisplayTechnicalNames ? (modTile.mod.Name + ":" + modTile.Name) : modTile.mod.DisplayName; } } else { var modWall = WallLoader.GetWall(tile.wall); if (modWall != null) { MouseText = DisplayTechnicalNames ? (modWall.mod.Name + ":" + modWall.Name) : modWall.mod.DisplayName; } } } var mousePos = Main.MouseWorld; for (int i = 0; i < Main.maxNPCs; i++) { var npc = Main.npc[i]; if (mousePos.Between(npc.TopLeft, npc.BottomRight)) { var modNPC = NPCLoader.GetNPC(npc.type); if (modNPC != null && npc.active && !NPCID.Sets.ProjectileNPC[npc.type]) { MouseText = DisplayTechnicalNames ? (modNPC.mod.Name + ":" + modNPC.Name) : modNPC.mod.DisplayName; SecondLine = true; break; } } } if (MouseText != String.Empty && Main.mouseText) { SecondLine = true; } }
public static void SetupConnectors() { for (ushort i = 0; i < TileLoader.TileCount; i++) { ModTile mt = TileLoader.GetTile(i); if (mt is TStorageComponent || mt is TStorageConnector) { tilesToConnect.Add(i); } } }
public void DrawObstacles(HashSet <Vector3Int> obstacleCoordinates) { Tile basicFloorCube = TileLoader.GetBasicFloorCube(); Tile collisionCube = TileLoader.GetBasicColliderCube(); foreach (Vector3Int pos in obstacleCoordinates) { floor1Map.SetTile(pos, basicFloorCube); collisionMap.SetTile(pos, collisionCube); } }
public void AutoTorch() { for (int i = 0; i < player.inventory.Length; i++) { if (TileLoader.IsTorch(player.inventory[i].createTile)) { originalSelectedItem = player.selectedItem; autoRevertSelectedItem = true; player.selectedItem = i; player.controlUseItem = true; Player.tileTargetX = (int)(player.Center.X / 16); Player.tileTargetY = (int)(player.Center.Y / 16); //player.ItemCheck(Main.myPlayer); //break; int oldstack = player.inventory[player.selectedItem].stack; float oldClosest = float.MinValue; bool triedNewPlace = false; do { float closest = float.MaxValue; triedNewPlace = false; for (int j = -Player.tileRangeX - player.blockRange + (int)(player.position.X / 16f); j <= Player.tileRangeX + player.blockRange - 1 + (int)((player.position.X + player.width) / 16f); j++) { for (int k = -Player.tileRangeY - player.blockRange + (int)(player.position.Y / 16f); k <= Player.tileRangeY + player.blockRange - 2 + (int)((player.position.Y + player.height) / 16f); k++) { //ErrorLogger.Log(""+Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16))); if (closest > Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16)) && oldClosest < Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16))) { triedNewPlace = true; //ErrorLogger.Log("closest " + j + " " + k); closest = Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16)); Player.tileTargetX = j; Player.tileTargetY = k; } } } oldClosest = closest; // next round, try farther away from mouse. //ErrorLogger.Log("closest " + Player.tileTargetX + " " + Player.tileTargetY); //ErrorLogger.Log("stack " + player.inventory[player.selectedItem].stack); player.ItemCheck(Main.myPlayer); }while (triedNewPlace && oldstack == player.inventory[player.selectedItem].stack); break; //if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX // && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX // && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY // && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY) } } }
public static void InitializeAllContentLoaders(ContentManager content) { TextureLoader.Initialize(content); FontLoader.Initialize(content); CharmLoader.Initialize(content); CreatureLoader.Initialize(content); ProjectileLoader.Initialize(content); ShieldLoader.Initialize(content); TileLoader.Initialize(content); UserInterfaceLoader.Initialize(content); WeaponLoader.Initialize(content); }
public static ushort FindTileIDInArray(string whatItNeedToEndWith, string whatItDoesntNeedToContain, IList <int> tile) { foreach (var tileID in tile) { ModTile modTile = TileLoader.GetTile(tileID); if (modTile != null && modTile.Name.EndsWith(whatItNeedToEndWith) && !modTile.Name.Contains(whatItDoesntNeedToContain)) { return(modTile.Type); } } return(0); }
public override bool CanPlace(int i, int j, int type) { if (TileID.Sets.BasicChest[type] || TileID.Sets.BasicChestFake[type] || TileLoader.IsDresser(type)) { Tile bottom = Main.tile[i, j + 1]; if (bottom != null && bottom.active() && bottom.type == mod.TileType <WirelessTeleporterTile>()) { return(false); } } return(true); }
public TileCollection(int minX, int minY, int maxX, int maxY, int zoom) { Range = new Range { MinX = minX, MinY = minY, MaxX = maxX, MaxY = maxY, Depth = zoom }; Transfers = new WebLoader(Range); }
public override bool CanPlace(int i, int j, int type) { if (TileID.Sets.BasicChest[type] || TileID.Sets.BasicChestFake[type] || TileLoader.IsDresser(type)) { Tile bottom = Main.tile[i, j + 1]; if (bottom != null && bottom.active() && noChestTiles.Contains(bottom.type)) { return(false); } } return(true); }
public void AutoTorch() { for (int i = 0; i < player.inventory.Length; i++) { if (TileLoader.IsTorch(player.inventory[i].createTile)) { QuickUseItemAt(i, use: false); Player.tileTargetX = (int)(player.Center.X / 16); Player.tileTargetY = (int)(player.Center.Y / 16); int oldstack = player.inventory[player.selectedItem].stack; List <Tuple <float, Point> > targets = new List <Tuple <float, Point> >(); int fixedTileRangeX = Math.Min(Player.tileRangeX, 50); int fixedTileRangeY = Math.Min(Player.tileRangeY, 50); for (int j = -fixedTileRangeX - player.blockRange + (int)(player.position.X / 16f) + 1; j <= fixedTileRangeX + player.blockRange - 1 + (int)((player.position.X + player.width) / 16f); j++) { for (int k = -fixedTileRangeY - player.blockRange + (int)(player.position.Y / 16f) + 1; k <= fixedTileRangeY + player.blockRange - 2 + (int)((player.position.Y + player.height) / 16f); k++) { targets.Add(new Tuple <float, Point>(Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16)), new Point(j, k))); } } targets.Sort((a, b) => a.Item1.CompareTo(b.Item1)); bool placeSuccess = false; foreach (var target in targets) { Player.tileTargetX = target.Item2.X; Player.tileTargetY = target.Item2.Y; Tile original = (Tile)Main.tile[Player.tileTargetX, Player.tileTargetY].Clone(); player.ItemCheck(Main.myPlayer); //Dust.QuickDust(target.Item2, Color.Aqua); int v = player.itemAnimation; if (!original.isTheSameAs(Main.tile[Player.tileTargetX, Player.tileTargetY])) { placeSuccess = true; break; } } if (placeSuccess) { break; } //if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX // && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX // && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY // && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY) } } }
public override void PreUpdate() { if (!Main.mapFullscreen) { int myX = Player.tileTargetX; int myY = Player.tileTargetY; if (player.position.X / 16f - Player.tileRangeX <= myX && (player.position.X + player.width) / 16f + Player.tileRangeX - 1f >= myX && player.position.Y / 16f - Player.tileRangeY <= myY && (player.position.Y + player.height) / 16f + Player.tileRangeY - 2f >= myY) { if (Main.mouseLeft && Main.mouseLeftRelease) { if (Main.tile[myX, myY] == null) { Main.tile[myX, myY] = new Tile(); } if (Main.tile[myX, myY].active()) { int type = Main.tile[myX, myY].type; ModTile tile = TileLoader.GetTile(type); (tile as BaseTile)?.LeftClick(myX, myY); } } if (Main.mouseRight) { if (Main.tile[myX, myY] == null) { Main.tile[myX, myY] = new Tile(); } if (Main.tile[myX, myY].active()) { int type = Main.tile[myX, myY].type; ModTile tile = TileLoader.GetTile(type); (tile as BaseTile)?.RightClickCont(myX, myY); } } if (Main.mouseLeft) { if (Main.tile[myX, myY] == null) { Main.tile[myX, myY] = new Tile(); } if (Main.tile[myX, myY].active()) { int type = Main.tile[myX, myY].type; ModTile tile = TileLoader.GetTile(type); (tile as BaseTile)?.LeftClickCont(myX, myY); } } } } }
public static IEnumerable <Point16> AdjacentComponents(Point16 point, bool isConnectorCanPlace = false) { List <Point16> points = new List <Point16>(); bool isConnector = Main.tile[point.X, point.Y].type == MagicStorageTwo.Instance.TileType(nameof(TStorageConnector)) || isConnectorCanPlace; bool isLargeSocket = Main.tile[point.X, point.Y].type == MagicStorageTwo.Instance.TileType(nameof(TCraftingTileSocketLarge)); bool isSocket = Main.tile[point.X, point.Y].type == MagicStorageTwo.Instance.TileType(nameof(TCraftingTileSocket)); foreach (Point16 add in (isConnector ? checkNeighbors1x1 : isLargeSocket ? checkNeighbors3x1 : isSocket ? checkNeighbors2x1 : checkNeighbors2x2)) { int checkX = point.X + add.X; int checkY = point.Y + add.Y; Tile tile = Main.tile[checkX, checkY]; if (ModContent.GetInstance <MagicStorageConfig>().DebugDustParticles) { Dust.NewDust(new Vector2(checkX * 16 + 4, checkY * 16 + 4), 1, 1, isConnector ? 60 : isLargeSocket || isSocket ? 61 : 62, Alpha: 0, Scale: 0.3f); } if (!tile.active()) { continue; } if (TileLoader.GetTile(tile.type) is TStorageComponent) { if (tile.frameX == 36 && !(TileLoader.GetTile(tile.type) is TStorageUnit)) { checkX -= 2; } if (tile.frameX % 36 == 18) { checkX--; } if (tile.frameY % 36 == 18) { checkY--; } Point16 check = new Point16(checkX, checkY); if (!points.Contains(check)) { points.Add(check); } } else if (tile.type == MagicStorageTwo.Instance.TileType(nameof(TStorageConnector))) { Point16 check = new Point16(checkX, checkY); if (!points.Contains(check)) { points.Add(check); } } } return(points); }
public override bool UseItem(Player player) { Vector2 position = GetLightPosition(player); Point tileLocation = position.ToTileCoordinates(); ModTile tile = TileLoader.GetTile(Main.tile[tileLocation.X, tileLocation.Y].type); if (tile is IInstrument instrument) { instrument.PitchOffset(tileLocation.X, tileLocation.Y); return(true); } return(false); }
internal static bool WriteModMap(BinaryWriter writer) { ISet <ushort> types = new HashSet <ushort>(); for (int i = 0; i < Main.maxTilesX; i++) { for (int j = 0; j < Main.maxTilesY; j++) { ushort type = Main.Map[i, j].Type; if (type >= MapHelper.modPosition) { types.Add(type); } } } if (types.Count == 0) { return(false); } writer.Write((ushort)types.Count); foreach (ushort type in types) { writer.Write(type); if (MapLoader.entryToTile.ContainsKey(type)) { ModTile tile = TileLoader.GetTile(MapLoader.entryToTile[type]); writer.Write(true); writer.Write(tile.Mod.Name); writer.Write(tile.Name); writer.Write((ushort)(type - MapHelper.tileLookup[tile.Type])); } else if (MapLoader.entryToWall.ContainsKey(type)) { ModWall wall = WallLoader.GetWall(MapLoader.entryToWall[type]); writer.Write(false); writer.Write(wall.Mod.Name); writer.Write(wall.Name); writer.Write((ushort)(type - MapHelper.wallLookup[wall.Type])); } else { writer.Write(true); writer.Write(""); writer.Write(""); writer.Write((ushort)0); } } WriteMapData(writer); return(true); }
public static bool canMineTile(int x, int y, int pickPower) { int dmg = 0; Tile tile = Main.tile[x, y]; TileLoader.PickPowerCheck(tile, pickPower, ref dmg); if (dmg > 0) { return(true); } if (Main.tileNoFail[(int)tile.type]) { return(true); } if (tile.type == 211 && pickPower < 200) { return(false); } if (tile.type == 37 && pickPower < 50) { return(false); } if ((tile.type == 22 || tile.type == 204) && (double)y > Main.worldSurface && pickPower < 55) { return(false); } if ((tile.type == 25 || tile.type == 56 || tile.type == 58 || tile.type == 203 || tile.type == 117 || tile.type == 404 || Main.tileDungeon[(int)tile.type]) && pickPower < 65) { return(false); } if ((tile.type == 107 || tile.type == 221) && pickPower < 100) { return(false); } if ((tile.type == 108 || tile.type == 222) && pickPower < 110) { return(false); } if ((tile.type == 111 || tile.type == 223) && pickPower < 150) { return(false); } if ((tile.type == 226 || tile.type == 237) && pickPower < 210) { return(false); } return(true); }
//This needs to be called from SetupRecipies, because chests are made in SetupContent. private void LoadChestAdapters() { ChestAdapter chestAdapter = new ChestAdapter(this); List <int> chestTypes = new List <int>(); for (int i = 0; i < TileLoader.TileCount; i++) { if (TileID.Sets.BasicChest[i] || TileID.Sets.BasicChestFake[i] || TileLoader.IsDresser(i)) { chestTypes.Add(i); } } Call(registerAdapterReflection, chestAdapter, chestTypes.ToArray()); }
//add modded chests public void SetDefaultsPostContent() { var tileObjectData = TileObjectData.GetTileData(Type, 0); var anchorTileList = new List <int>(tileObjectData.AnchorAlternateTiles); for (int i = TileID.Count; i < TileLoader.TileCount; i++) { if (TileLoader.ModChestName(i) != String.Empty) { anchorTileList.Add(i); } } tileObjectData.AnchorAlternateTiles = anchorTileList.ToArray(); }
public static bool GrowTrees(Tile tile, int x, int y) { // Grow the tree (server auto sends netmessage and FX) if (TileLoader.IsSapling(Main.tile[x, y].type)) { Main.PlaySound(SoundID.Item60, new Point(x, y).ToWorldCoordinates()); if (Main.netMode != 1 && WorldGen.GrowTree(x, y)) { WorldGen.TreeGrowFXCheck(x, y); return(true); } } return(false); }