public static int Hook_AfterPlacement(int i, int j, int type, int style, int direction) { if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendTileRange(Main.myPlayer, i, j, 1, 1); NetHelper.SendSearchAndRefresh(i, j); return(0); } TEStorageComponent.SearchAndRefreshNetwork(new Point16(i, j)); return(0); }
public override TEStorageHeart GetHeart(int i, int j) { Point16 point = TEStorageComponent.FindStorageCenter(new Point16(i, j)); if (point.X < 0 || point.Y < 0 || !TileEntity.ByPosition.ContainsKey(point)) { return(null); } TileEntity heart = TileEntity.ByPosition[point]; if (!(heart is TEStorageCenter)) { return(null); } return(((TEStorageCenter)heart).GetHeart()); }
public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (fail || effectOnly) { return; } TStorageComponent.killTile = new Point16(i, j); if (Main.netMode == NetmodeID.MultiplayerClient) { NetHelper.SendSearchAndRefresh(TStorageComponent.killTile.X, TStorageComponent.killTile.Y); MagicStorageTwo.Instance.guiM.Refresh(); } else { TEStorageComponent.SearchAndRefreshNetwork(TStorageComponent.killTile); } TStorageComponent.killTile = new Point16(-1, -1); }
public int CanPlace(int i, int j, int type, int style, int direction) { int count = 0; if (GetTileEntity() != null && GetTileEntity() is TEStorageCenter) { count++; } Point16 startSearch = new Point16(i, j - 1); HashSet <Point16> explored = new HashSet <Point16>(); explored.Add(startSearch); Queue <Point16> toExplore = new Queue <Point16>(); foreach (Point16 point in TEStorageComponent.AdjacentComponents(startSearch)) { toExplore.Enqueue(point); } while (toExplore.Count > 0) { Point16 explore = toExplore.Dequeue(); if (!explored.Contains(explore) && explore != TStorageComponent.killTile) { explored.Add(explore); if (TEStorageCenter.IsStorageCenter(explore)) { count++; if (count >= 2) { return(-1); } } foreach (Point16 point in TEStorageComponent.AdjacentComponents(explore)) { toExplore.Enqueue(point); } } } return(count); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, ItemType(frameX, frameY)); killTile = new Point16(i, j); ModTileEntity tileEntity = GetTileEntity(); if (tileEntity != null) { tileEntity.Kill(i, j); } else { if (Main.netMode == NetmodeID.MultiplayerClient) { NetHelper.SendSearchAndRefresh(killTile.X, killTile.Y); } else { TEStorageComponent.SearchAndRefreshNetwork(killTile); } } killTile = new Point16(-1, -1); }