public void RequestRotate(int i, int j) { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Write((Int16)i); packet.Write((Int16)j); packet.Send(); }
public void SyncData() { if (Main.netMode == 1) { ModPacket packet = NetRouter.GetPacketTo(mod.GetTileEntity <TransferFilterTileEntity>(), mod); packet.Write(ID); packet.WriteItem(item); packet.Send(); } }
public override void RightClick(int i, int j) { if (Main.netMode == 0) { Wiring.TripWire(i, j, 1, 1); } else { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Write((Int16)i); packet.Write((Int16)j); packet.Send(); } mod.GetModWorld <ButtonDelayWorld>().setPoint(new Point16(i, j)); Main.PlaySound(SoundID.MenuTick); }
public override bool NewRightClick(int i, int j) { if (Main.netMode == 0) { Wiring.TripWire(i, j, 1, 1); } else { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Write((Int16)i); packet.Write((Int16)j); packet.Send(); } ModContent.GetInstance <ButtonDelayWorld>().setPoint(new Point16(i, j)); Main.PlaySound(SoundID.MenuTick); return(true); }
private void HandleChestItemChange(int chest) { int targetPlayer = WhichPlayerInChest(chest); if (targetPlayer != -1) { if (Main.netMode == 2) { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Send(targetPlayer); Main.player[targetPlayer].chest = -1; } else if (Main.netMode == 0) { Recipe.FindRecipes(); } } }
private void HandleSlotChange(int owner, SlotKind kind, int slot) { if (Main.netMode == 2) { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Write(owner); packet.Write((byte)kind); packet.Write(slot); Item[] targetInventory = GetInventoryFromKind(owner, kind); ItemIO.Send(targetInventory[slot], packet, true, true); packet.Send(); } else if (Main.netMode == 0) { Recipe.FindRecipes(); } }
public override void RightClick(int i, int j) { Point16 origin = GetOrigin(i, j); Point16 topLeft = origin - tileObjectData.Origin; if (Main.netMode == 0) { Wiring.TripWire(topLeft.X, topLeft.Y, 2, 2); } else { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Write(topLeft.X); packet.Write(topLeft.Y); packet.Send(); } mod.GetModWorld <ButtonDelayWorld>().setPoint(topLeft); Main.PlaySound(SoundID.MenuTick); }
public bool InjectItem(int x, int y, Item item) { if (item.ammo == 0 || item.shoot == 0 || item.ammo == AmmoID.Rocket) { return(false); } Tile tile = Main.tile[x, y]; if (tile == null || !tile.active()) { return(false); } int originX = x - (tile.frameX % 36) / 18; int originY = y - (tile.frameY % 36) / 18; Tile origin = Main.tile[originX, originY]; if (origin == null || !origin.active()) { return(false); } int style = origin.frameX / 36; if (fireRate[style] != 0 && !Wiring.CheckMech(originX, originY, fireRate[style])) { return(false); } Vector2 position = new Vector2((originX + 1) * 16, (originY + 1) * 16); Vector2 direction = Vector2.Zero; switch (origin.frameY) { case 0: direction = new Vector2(-1f, 0f); break; case 38: direction = new Vector2(-0.5f, -0.5f); break; case 76: direction = new Vector2(0f, -1f); break; case 114: direction = new Vector2(0.5f, -0.5f); break; case 152: direction = new Vector2(1f, 0f); break; case 190: direction = new Vector2(0.5f, 0.5f); position.Y -= 8; break; case 228: direction = new Vector2(-0.5f, 0.5f); position.Y -= 8; break; } Main.PlaySound(SoundID.Item11, position); Projectile proj = Main.projectile[Projectile.NewProjectile(position, direction * shootSpeed[style], item.shoot, baseDamage[style] * (1 + item.damage / 100), item.knockBack, Main.myPlayer)]; proj.hostile = true; if (Main.netMode == 2) { ModPacket packet = NetRouter.GetPacketTo(this, mod); packet.Write((Int16)proj.identity); packet.Write((byte)proj.owner); packet.Send(); } if (item.consumable) { item.stack--; } return(true); }