From 96f7246df1f48107367f1ea5490ed09e6bde0180 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 28 Oct 2012 14:57:35 +0000 Subject: Added cWorld:SpawnMob(PosX, PosY, PosZ, EntityType) to Lua API git-svn-id: http://mc-server.googlecode.com/svn/trunk@1014 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Items/ItemSpawnEgg.h | 147 ++------------------------------------------ 1 file changed, 6 insertions(+), 141 deletions(-) (limited to 'source/Items/ItemSpawnEgg.h') diff --git a/source/Items/ItemSpawnEgg.h b/source/Items/ItemSpawnEgg.h index 974129d6f..f3018075b 100644 --- a/source/Items/ItemSpawnEgg.h +++ b/source/Items/ItemSpawnEgg.h @@ -5,29 +5,6 @@ #include "../World.h" #include "../Player.h" -// Mobs: -#include "../Mobs/Chicken.h" -#include "../Mobs/Spider.h" -#include "../Mobs/Cow.h" -#include "../Mobs/Squid.h" -#include "../Mobs/Wolf.h" -#include "../Mobs/Slime.h" -#include "../Mobs/Skeleton.h" -#include "../Mobs/Silverfish.h" -#include "../Mobs/Pig.h" -#include "../Mobs/Sheep.h" -#include "../Mobs/Zombie.h" -#include "../Mobs/Enderman.h" -#include "../Mobs/Creeper.h" -#include "../Mobs/Cavespider.h" -#include "../Mobs/Ghast.h" -#include "../Mobs/Zombiepigman.h" -#include "../Mobs/Villager.h" -#include "../Mobs/Ocelot.h" -#include "../Mobs/Mooshroom.h" -#include "../Mobs/Magmacube.h" -#include "../Mobs/Blaze.h" - @@ -56,126 +33,14 @@ public: a_BlockY--; } - cMonster * Monster = NULL; - - switch (a_Item->m_ItemDamage) + if (a_World->SpawnMob(a_BlockX + 0.5, a_BlockY, a_BlockZ + 0.5, a_Item->m_ItemDamage) >= 0) { - case E_META_SPAWN_EGG_BLAZE: - { - Monster = new cBlaze(); - break; - } - case E_META_SPAWN_EGG_CAVE_SPIDER: - { - Monster = new cCavespider(); - break; - } - case E_META_SPAWN_EGG_CHICKEN: - { - Monster = new cChicken(); - break; - } - case E_META_SPAWN_EGG_COW: - { - Monster = new cCow(); - break; - } - case E_META_SPAWN_EGG_CREEPER: - { - Monster = new cCreeper(); - break; - } - case E_META_SPAWN_EGG_ENDERMAN: - { - Monster = new cEnderman(); - break; - } - case E_META_SPAWN_EGG_GHAST: - { - Monster = new cGhast(); - break; - } - case E_META_SPAWN_EGG_MAGMA_CUBE: - { - Monster = new cMagmacube(); - break; - } - case E_META_SPAWN_EGG_MOOSHROOM: - { - Monster = new cMooshroom(); - break; - } - case E_META_SPAWN_EGG_OCELOT: - { - Monster = new cOcelot(); - break; - } - case E_META_SPAWN_EGG_PIG: - { - Monster = new cPig(); - break; - } - case E_META_SPAWN_EGG_SHEEP: - { - Monster = new cSheep(); - break; - } - case E_META_SPAWN_EGG_SILVERFISH: - { - Monster = new cSilverfish(); - break; - } - case E_META_SPAWN_EGG_SKELETON: - { - Monster = new cSkeleton(); - break; - } - case E_META_SPAWN_EGG_SLIME: - { - Monster = new cSlime(); - break; - } - case E_META_SPAWN_EGG_SPIDER: - { - Monster = new cSpider(); - break; - } - case E_META_SPAWN_EGG_SQUID: - { - Monster = new cSquid(); - break; - } - case E_META_SPAWN_EGG_VILLAGER: - { - Monster = new cVillager(); - break; - } - case E_META_SPAWN_EGG_WOLF: - { - Monster = new cWolf(); - break; - } - case E_META_SPAWN_EGG_ZOMBIE: - { - Monster = new cZombie(); - break; - } - case E_META_SPAWN_EGG_ZOMBIE_PIGMAN: - { - Monster = new cZombiepigman(); - break; - } - default: - { - return false; - } + // The mob was spawned, "use" the item: + a_Player->UseEquippedItem(); + return true; } - Monster->Initialize(a_World); - Monster->TeleportTo(a_BlockX + 0.5, a_BlockY, a_BlockZ + 0.5); - a_World->BroadcastSpawn(*Monster); - - a_Player->UseEquippedItem(); - return true; + + return false; } } ; -- cgit v1.2.3