public override void PostLoad() { PlaceItems[0] = SimplePrototypeItem.MakePlaceable(mod, "SmallButtonItem", Type, 20, 20, 0, Item.sellPrice(0, 0, 4, 0)); PlaceItems[0].item.rare = ItemRarityID.White; NetRouter.AddHandler(this); }
public override void PostLoad() { PlaceItems[0] = SimplePrototypeItem.MakePlaceable(mod, "BigButtonItem", Type, 24, 20); PlaceItems[0].item.rare = ItemRarityID.White; NetRouter.AddHandler(this); }
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 PostLoad() { SimplePlaceableItem i = new SimplePlaceableItem(); i.placeType = Type; i.value = Item.sellPrice(0, 0, 4, 0); mod.AddItem("SmallButtonItem", i); i.DisplayName.AddTranslation(LangID.English, "Small button"); placeItems[0] = i; NetRouter.AddHandler(this); }
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); }
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(); } } }
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 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 override void PostLoad() { PlaceItems = new ModItem[3]; int sell = Item.sellPrice(0, 1, 0, 0); //Omni turret PlaceItems[0] = SimplePrototypeItem.MakePlaceable(mod, "OmniTurretItem", Type, 32, 32, 0, sell); PlaceItems[0].item.rare = ItemRarityID.Green; //Super omni turret PlaceItems[1] = SimplePrototypeItem.MakePlaceable(mod, "SuperOmniTurretItem", Type, 32, 32, 1, sell); PlaceItems[1].item.rare = ItemRarityID.LightRed; //Matter projector PlaceItems[2] = SimplePrototypeItem.MakePlaceable(mod, "MatterProjectorItem", Type, 32, 32, 2, sell); PlaceItems[2].item.rare = ItemRarityID.Cyan; NetRouter.AddHandler(this); }
public override void PostLoad() { placeItems = new ModItem[3]; //Omni turret SimplePlaceableItem i = new SimplePlaceableItem(); i.placeType = Type; i.value = Item.sellPrice(0, 1, 0, 0); mod.AddItem("OmniTurretItem", i); i.DisplayName.AddTranslation(LangID.English, "Omni turret"); i.Tooltip.AddTranslation(LangID.English, "Shoots any standard ammo"); placeItems[0] = i; //Super omni turret i = new SimplePlaceableItem(); i.placeType = Type; i.value = Item.sellPrice(0, 1, 0, 0); i.style = 1; mod.AddItem("SuperOmniTurretItem", i); i.DisplayName.AddTranslation(LangID.English, "Super omni turret"); i.Tooltip.AddTranslation(LangID.English, "Shoots any standard ammo"); placeItems[1] = i; //Matter projector i = new SimplePlaceableItem(); i.placeType = Type; i.value = Item.sellPrice(0, 1, 0, 0); i.style = 2; mod.AddItem("MatterProjectorItem", i); i.DisplayName.AddTranslation(LangID.English, "Matter projector"); i.Tooltip.AddTranslation(LangID.English, "Shoots any standard ammo really, really fast"); placeItems[2] = i; NetRouter.AddHandler(this); }
public PlayerInterfaceAdapter(Mod mod) { this.mod = mod; NetRouter.AddHandler(this); }
public OmniTurretAdapter(Mod mod) { this.mod = mod; NetRouter.AddHandler(this); }
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); }
public override void PostLoadPrototype() { NetRouter.AddHandler(this); }
public ChestAdapter(Mod mod) { this.mod = mod; NetRouter.AddHandler(this); }