Replaced E_ENTITY_TYPE_XXX with cMonster::mtXXX.
Also slightly improved the spawning algorithm.master
parent
78b329a9b5
commit
0cb00996de
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 08/15/13 22:11:03.
|
||||
** Generated automatically by tolua++-1.0.92 on 08/16/13 10:46:12.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
@ -13883,12 +13883,12 @@ static int tolua_AllToLua_cWorld_SpawnMob00(lua_State* tolua_S)
|
|||
double a_PosX = ((double) tolua_tonumber(tolua_S,2,0));
|
||||
double a_PosY = ((double) tolua_tonumber(tolua_S,3,0));
|
||||
double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0));
|
||||
int a_EntityType = ((int) tolua_tonumber(tolua_S,5,0));
|
||||
cMonster::eType a_MonsterType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,5,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnMob'", NULL);
|
||||
#endif
|
||||
{
|
||||
int tolua_ret = (int) self->SpawnMob(a_PosX,a_PosY,a_PosZ,a_EntityType);
|
||||
int tolua_ret = (int) self->SpawnMob(a_PosX,a_PosY,a_PosZ,a_MonsterType);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||
}
|
||||
}
|
||||
|
@ -28687,6 +28687,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||
tolua_constant(tolua_S,"biHell",biHell);
|
||||
tolua_constant(tolua_S,"biNether",biNether);
|
||||
tolua_constant(tolua_S,"biSky",biSky);
|
||||
tolua_constant(tolua_S,"biEnd",biEnd);
|
||||
tolua_constant(tolua_S,"biFrozenOcean",biFrozenOcean);
|
||||
tolua_constant(tolua_S,"biFrozenRiver",biFrozenRiver);
|
||||
tolua_constant(tolua_S,"biIcePlains",biIcePlains);
|
||||
|
@ -29243,6 +29244,9 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_BLAZE",E_META_SPAWN_EGG_BLAZE);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_MAGMA_CUBE",E_META_SPAWN_EGG_MAGMA_CUBE);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_DRAGON",E_META_SPAWN_EGG_ENDER_DRAGON);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITHER",E_META_SPAWN_EGG_WITHER);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_BAT",E_META_SPAWN_EGG_BAT);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITCH",E_META_SPAWN_EGG_WITCH);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_PIG",E_META_SPAWN_EGG_PIG);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_SHEEP",E_META_SPAWN_EGG_SHEEP);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_COW",E_META_SPAWN_EGG_COW);
|
||||
|
@ -29253,35 +29257,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_SNOW_GOLEM",E_META_SPAWN_EGG_SNOW_GOLEM);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_OCELOT",E_META_SPAWN_EGG_OCELOT);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_IRON_GOLEM",E_META_SPAWN_EGG_IRON_GOLEM);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_HORSE",E_META_SPAWN_EGG_HORSE);
|
||||
tolua_constant(tolua_S,"E_META_SPAWN_EGG_VILLAGER",E_META_SPAWN_EGG_VILLAGER);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_CREEPER",E_ENTITY_TYPE_CREEPER);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SKELETON",E_ENTITY_TYPE_SKELETON);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SPIDER",E_ENTITY_TYPE_SPIDER);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_GIANT",E_ENTITY_TYPE_GIANT);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_ZOMBIE",E_ENTITY_TYPE_ZOMBIE);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SLIME",E_ENTITY_TYPE_SLIME);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_GHAST",E_ENTITY_TYPE_GHAST);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_ZOMBIE_PIGMAN",E_ENTITY_TYPE_ZOMBIE_PIGMAN);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_ENDERMAN",E_ENTITY_TYPE_ENDERMAN);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_CAVE_SPIDER",E_ENTITY_TYPE_CAVE_SPIDER);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SILVERFISH",E_ENTITY_TYPE_SILVERFISH);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_BLAZE",E_ENTITY_TYPE_BLAZE);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_MAGMA_CUBE",E_ENTITY_TYPE_MAGMA_CUBE);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_ENDER_DRAGON",E_ENTITY_TYPE_ENDER_DRAGON);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_WITHER",E_ENTITY_TYPE_WITHER);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_BAT",E_ENTITY_TYPE_BAT);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_WITCH",E_ENTITY_TYPE_WITCH);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_PIG",E_ENTITY_TYPE_PIG);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SHEEP",E_ENTITY_TYPE_SHEEP);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_COW",E_ENTITY_TYPE_COW);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_CHICKEN",E_ENTITY_TYPE_CHICKEN);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SQUID",E_ENTITY_TYPE_SQUID);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_WOLF",E_ENTITY_TYPE_WOLF);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_MOOSHROOM",E_ENTITY_TYPE_MOOSHROOM);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_SNOW_GOLEM",E_ENTITY_TYPE_SNOW_GOLEM);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_OCELOT",E_ENTITY_TYPE_OCELOT);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_IRON_GOLEM",E_ENTITY_TYPE_IRON_GOLEM);
|
||||
tolua_constant(tolua_S,"E_ENTITY_TYPE_VILLAGER",E_ENTITY_TYPE_VILLAGER);
|
||||
tolua_constant(tolua_S,"dimNether",dimNether);
|
||||
tolua_constant(tolua_S,"dimOverworld",dimOverworld);
|
||||
tolua_constant(tolua_S,"dimEnd",dimEnd);
|
||||
|
@ -30553,6 +30530,34 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||
tolua_endmodule(tolua_S);
|
||||
tolua_cclass(tolua_S,"cMonster","cMonster","cPawn",NULL);
|
||||
tolua_beginmodule(tolua_S,"cMonster");
|
||||
tolua_constant(tolua_S,"mtCreeper",cMonster::mtCreeper);
|
||||
tolua_constant(tolua_S,"mtSkeleton",cMonster::mtSkeleton);
|
||||
tolua_constant(tolua_S,"mtSpider",cMonster::mtSpider);
|
||||
tolua_constant(tolua_S,"mtGiant",cMonster::mtGiant);
|
||||
tolua_constant(tolua_S,"mtZombie",cMonster::mtZombie);
|
||||
tolua_constant(tolua_S,"mtSlime",cMonster::mtSlime);
|
||||
tolua_constant(tolua_S,"mtGhast",cMonster::mtGhast);
|
||||
tolua_constant(tolua_S,"mtZombiePigman",cMonster::mtZombiePigman);
|
||||
tolua_constant(tolua_S,"mtEnderman",cMonster::mtEnderman);
|
||||
tolua_constant(tolua_S,"mtCaveSpider",cMonster::mtCaveSpider);
|
||||
tolua_constant(tolua_S,"mtSilverfish",cMonster::mtSilverfish);
|
||||
tolua_constant(tolua_S,"mtBlaze",cMonster::mtBlaze);
|
||||
tolua_constant(tolua_S,"mtMagmaCube",cMonster::mtMagmaCube);
|
||||
tolua_constant(tolua_S,"mtEnderDragon",cMonster::mtEnderDragon);
|
||||
tolua_constant(tolua_S,"mtWither",cMonster::mtWither);
|
||||
tolua_constant(tolua_S,"mtBat",cMonster::mtBat);
|
||||
tolua_constant(tolua_S,"mtWitch",cMonster::mtWitch);
|
||||
tolua_constant(tolua_S,"mtPig",cMonster::mtPig);
|
||||
tolua_constant(tolua_S,"mtSheep",cMonster::mtSheep);
|
||||
tolua_constant(tolua_S,"mtCow",cMonster::mtCow);
|
||||
tolua_constant(tolua_S,"mtChicken",cMonster::mtChicken);
|
||||
tolua_constant(tolua_S,"mtSquid",cMonster::mtSquid);
|
||||
tolua_constant(tolua_S,"mtWolf",cMonster::mtWolf);
|
||||
tolua_constant(tolua_S,"mtMooshroom",cMonster::mtMooshroom);
|
||||
tolua_constant(tolua_S,"mtSnowGolem",cMonster::mtSnowGolem);
|
||||
tolua_constant(tolua_S,"mtOcelot",cMonster::mtOcelot);
|
||||
tolua_constant(tolua_S,"mtIronGolem",cMonster::mtIronGolem);
|
||||
tolua_constant(tolua_S,"mtVillager",cMonster::mtVillager);
|
||||
tolua_endmodule(tolua_S);
|
||||
tolua_cclass(tolua_S,"cLineBlockTracer","cLineBlockTracer","",NULL);
|
||||
tolua_beginmodule(tolua_S,"cLineBlockTracer");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 08/15/13 22:11:04.
|
||||
** Generated automatically by tolua++-1.0.92 on 08/16/13 10:46:13.
|
||||
*/
|
||||
|
||||
/* Exported function */
|
||||
|
|
|
@ -112,7 +112,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
|
|||
{
|
||||
double MobX = 0.5 + (DispX + DispChunk->GetPosX() * cChunkDef::Width);
|
||||
double MobZ = 0.5 + (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
|
||||
if (m_World->SpawnMob(MobX, DispY, MobZ, m_Contents.GetSlot(a_SlotNum).m_ItemDamage) >= 0)
|
||||
if (m_World->SpawnMob(MobX, DispY, MobZ, (cMonster::eType)m_Contents.GetSlot(a_SlotNum).m_ItemDamage) >= 0)
|
||||
{
|
||||
m_Contents.ChangeSlotCount(a_SlotNum, -1);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "BlockID.h"
|
||||
#include "../iniFile/iniFile.h"
|
||||
#include "Item.h"
|
||||
#include "Mobs/Monster.h"
|
||||
|
||||
|
||||
|
||||
|
@ -287,10 +288,10 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
|
|||
{biTaiga, "Taiga"},
|
||||
{biSwampland, "Swampland"},
|
||||
{biRiver, "River"},
|
||||
{biHell, "Hell"},
|
||||
{biHell, "Nether"},
|
||||
{biSky, "Sky"},
|
||||
{biSky, "End"},
|
||||
{biNether, "Hell"},
|
||||
{biNether, "Nether"},
|
||||
{biEnd, "Sky"},
|
||||
{biEnd, "End"},
|
||||
{biFrozenOcean, "FrozenOcean"},
|
||||
{biFrozenRiver, "FrozenRiver"},
|
||||
{biIcePlains, "IcePlains"},
|
||||
|
@ -328,34 +329,34 @@ int StringToMobType(const AString & a_MobString)
|
|||
const char * m_String;
|
||||
} MobMap [] =
|
||||
{
|
||||
{E_ENTITY_TYPE_CREEPER, "Creeper"},
|
||||
{E_ENTITY_TYPE_SKELETON, "Skeleton"},
|
||||
{E_ENTITY_TYPE_SPIDER, "Spider"},
|
||||
{E_ENTITY_TYPE_GIANT, "Giant"},
|
||||
{E_ENTITY_TYPE_ZOMBIE, "Zombie"},
|
||||
{E_ENTITY_TYPE_SLIME, "Slime"},
|
||||
{E_ENTITY_TYPE_GHAST, "Ghast"},
|
||||
{E_ENTITY_TYPE_ZOMBIE_PIGMAN, "ZombiePigman"},
|
||||
{E_ENTITY_TYPE_ENDERMAN, "Enderman"},
|
||||
{E_ENTITY_TYPE_CAVE_SPIDER, "CaveSpider"},
|
||||
{E_ENTITY_TYPE_SILVERFISH, "SilverFish"},
|
||||
{E_ENTITY_TYPE_BLAZE, "Blaze"},
|
||||
{E_ENTITY_TYPE_MAGMA_CUBE, "MagmaCube"},
|
||||
{E_ENTITY_TYPE_ENDER_DRAGON, "EnderDragon"},
|
||||
{E_ENTITY_TYPE_WITHER, "Wither"},
|
||||
{E_ENTITY_TYPE_BAT, "Bat"},
|
||||
{E_ENTITY_TYPE_WITCH, "Witch"},
|
||||
{E_ENTITY_TYPE_PIG, "Pig"},
|
||||
{E_ENTITY_TYPE_SHEEP, "Sheep"},
|
||||
{E_ENTITY_TYPE_COW, "Cow"},
|
||||
{E_ENTITY_TYPE_CHICKEN, "Chicken"},
|
||||
{E_ENTITY_TYPE_SQUID, "Squid"},
|
||||
{E_ENTITY_TYPE_WOLF, "Wolf"},
|
||||
{E_ENTITY_TYPE_MOOSHROOM, "Mushroom"},
|
||||
{E_ENTITY_TYPE_SNOW_GOLEM, "SnowGolem"},
|
||||
{E_ENTITY_TYPE_OCELOT, "Ocelot"},
|
||||
{E_ENTITY_TYPE_IRON_GOLEM, "IronGolem"},
|
||||
{E_ENTITY_TYPE_VILLAGER, "Villager"},
|
||||
{cMonster::mtCreeper, "Creeper"},
|
||||
{cMonster::mtSkeleton, "Skeleton"},
|
||||
{cMonster::mtSpider, "Spider"},
|
||||
{cMonster::mtGiant, "Giant"},
|
||||
{cMonster::mtZombie, "Zombie"},
|
||||
{cMonster::mtSlime, "Slime"},
|
||||
{cMonster::mtGhast, "Ghast"},
|
||||
{cMonster::mtZombiePigman, "ZombiePigman"},
|
||||
{cMonster::mtEnderman, "Enderman"},
|
||||
{cMonster::mtCaveSpider, "CaveSpider"},
|
||||
{cMonster::mtSilverfish, "SilverFish"},
|
||||
{cMonster::mtBlaze, "Blaze"},
|
||||
{cMonster::mtMagmaCube, "MagmaCube"},
|
||||
{cMonster::mtEnderDragon, "EnderDragon"},
|
||||
{cMonster::mtWither, "Wither"},
|
||||
{cMonster::mtBat, "Bat"},
|
||||
{cMonster::mtWitch, "Witch"},
|
||||
{cMonster::mtPig, "Pig"},
|
||||
{cMonster::mtSheep, "Sheep"},
|
||||
{cMonster::mtCow, "Cow"},
|
||||
{cMonster::mtChicken, "Chicken"},
|
||||
{cMonster::mtSquid, "Squid"},
|
||||
{cMonster::mtWolf, "Wolf"},
|
||||
{cMonster::mtMooshroom, "Mooshroom"},
|
||||
{cMonster::mtSnowGolem, "SnowGolem"},
|
||||
{cMonster::mtOcelot, "Ocelot"},
|
||||
{cMonster::mtIronGolem, "IronGolem"},
|
||||
{cMonster::mtVillager, "Villager"},
|
||||
};
|
||||
for (int i = 0; i < ARRAYCOUNT(MobMap); i++)
|
||||
{
|
||||
|
@ -364,7 +365,7 @@ int StringToMobType(const AString & a_MobString)
|
|||
return MobMap[i].m_MobType;
|
||||
}
|
||||
} // for i - MobMap[]
|
||||
return (int)-1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -541,8 +541,8 @@ enum
|
|||
E_META_TRACKS_X = 1,
|
||||
E_META_TRACKS_Z = 0,
|
||||
|
||||
// E_ITEM_SPAWN_EGG spawn EntityIDs:
|
||||
// See also E_ENTITY_TYPE_XXX, since entity type and spawn egg meta are the same
|
||||
// E_ITEM_SPAWN_EGG metas:
|
||||
// See also cMonster::eType, since monster type and spawn egg meta are the same
|
||||
E_META_SPAWN_EGG_CREEPER = 50,
|
||||
E_META_SPAWN_EGG_SKELETON = 51,
|
||||
E_META_SPAWN_EGG_SPIDER = 52,
|
||||
|
@ -557,6 +557,9 @@ enum
|
|||
E_META_SPAWN_EGG_BLAZE = 61,
|
||||
E_META_SPAWN_EGG_MAGMA_CUBE = 62,
|
||||
E_META_SPAWN_EGG_ENDER_DRAGON = 63,
|
||||
E_META_SPAWN_EGG_WITHER = 64,
|
||||
E_META_SPAWN_EGG_BAT = 65,
|
||||
E_META_SPAWN_EGG_WITCH = 66,
|
||||
E_META_SPAWN_EGG_PIG = 90,
|
||||
E_META_SPAWN_EGG_SHEEP = 91,
|
||||
E_META_SPAWN_EGG_COW = 92,
|
||||
|
@ -567,48 +570,15 @@ enum
|
|||
E_META_SPAWN_EGG_SNOW_GOLEM = 97,
|
||||
E_META_SPAWN_EGG_OCELOT = 98,
|
||||
E_META_SPAWN_EGG_IRON_GOLEM = 99,
|
||||
E_META_SPAWN_EGG_HORSE = 100,
|
||||
E_META_SPAWN_EGG_VILLAGER = 120,
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
// See also E_META_SPAWN_EGG_XXX, since entity type and spawn egg meta are the same
|
||||
E_ENTITY_TYPE_CREEPER = 50,
|
||||
E_ENTITY_TYPE_SKELETON = 51,
|
||||
E_ENTITY_TYPE_SPIDER = 52,
|
||||
E_ENTITY_TYPE_GIANT = 53,
|
||||
E_ENTITY_TYPE_ZOMBIE = 54,
|
||||
E_ENTITY_TYPE_SLIME = 55,
|
||||
E_ENTITY_TYPE_GHAST = 56,
|
||||
E_ENTITY_TYPE_ZOMBIE_PIGMAN = 57,
|
||||
E_ENTITY_TYPE_ENDERMAN = 58,
|
||||
E_ENTITY_TYPE_CAVE_SPIDER = 59,
|
||||
E_ENTITY_TYPE_SILVERFISH = 60,
|
||||
E_ENTITY_TYPE_BLAZE = 61,
|
||||
E_ENTITY_TYPE_MAGMA_CUBE = 62,
|
||||
E_ENTITY_TYPE_ENDER_DRAGON = 63,
|
||||
E_ENTITY_TYPE_WITHER = 64,
|
||||
E_ENTITY_TYPE_BAT = 65,
|
||||
E_ENTITY_TYPE_WITCH = 66,
|
||||
E_ENTITY_TYPE_PIG = 90,
|
||||
E_ENTITY_TYPE_SHEEP = 91,
|
||||
E_ENTITY_TYPE_COW = 92,
|
||||
E_ENTITY_TYPE_CHICKEN = 93,
|
||||
E_ENTITY_TYPE_SQUID = 94,
|
||||
E_ENTITY_TYPE_WOLF = 95,
|
||||
E_ENTITY_TYPE_MOOSHROOM = 96,
|
||||
E_ENTITY_TYPE_SNOW_GOLEM = 97,
|
||||
E_ENTITY_TYPE_OCELOT = 98,
|
||||
E_ENTITY_TYPE_IRON_GOLEM = 99,
|
||||
E_ENTITY_TYPE_VILLAGER = 120,
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
/// Dimension of a world
|
||||
enum eDimension
|
||||
{
|
||||
dimNether = -1,
|
||||
|
|
|
@ -76,7 +76,8 @@ enum EMCSBiome
|
|||
biRiver = 7,
|
||||
biHell = 8, // same as Nether
|
||||
biNether = 8,
|
||||
biSky = 9,
|
||||
biSky = 9, // same as biEnd
|
||||
biEnd = 9,
|
||||
biFrozenOcean = 10,
|
||||
biFrozenRiver = 11,
|
||||
biIcePlains = 12,
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
a_BlockY--;
|
||||
}
|
||||
|
||||
if (a_World->SpawnMob(a_BlockX + 0.5, a_BlockY, a_BlockZ + 0.5, a_Item.m_ItemDamage) >= 0)
|
||||
if (a_World->SpawnMob(a_BlockX + 0.5, a_BlockY, a_BlockZ + 0.5, (cMonster::eType)(a_Item.m_ItemDamage)) >= 0)
|
||||
{
|
||||
if (a_Player->GetGameMode() != 1)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "AggressiveMonster.h"
|
||||
|
||||
#include "../World.h"
|
||||
#include "../Vector3f.h"
|
||||
#include "../Player.h"
|
||||
#include "../MersenneTwister.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "Cavespider.h"
|
||||
#include "../World.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "../Pawn.h"
|
||||
#include "../Defines.h"
|
||||
#include "../World.h"
|
||||
#include "../BlockID.h"
|
||||
#include "../Item.h"
|
||||
|
||||
|
@ -13,6 +12,7 @@
|
|||
|
||||
class Vector3f;
|
||||
class cClientHandle;
|
||||
class cWorld;
|
||||
|
||||
|
||||
|
||||
|
@ -23,7 +23,41 @@ class cMonster :
|
|||
{
|
||||
typedef cPawn super;
|
||||
public:
|
||||
/// This identifies individual monster type, as well as their network type-ID
|
||||
enum eType
|
||||
{
|
||||
mtCreeper = E_META_SPAWN_EGG_CREEPER,
|
||||
mtSkeleton = E_META_SPAWN_EGG_SKELETON,
|
||||
mtSpider = E_META_SPAWN_EGG_SPIDER,
|
||||
mtGiant = E_META_SPAWN_EGG_GIANT,
|
||||
mtZombie = E_META_SPAWN_EGG_ZOMBIE,
|
||||
mtSlime = E_META_SPAWN_EGG_SLIME,
|
||||
mtGhast = E_META_SPAWN_EGG_GHAST,
|
||||
mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN,
|
||||
mtEnderman = E_META_SPAWN_EGG_ENDERMAN,
|
||||
mtCaveSpider = E_META_SPAWN_EGG_CAVE_SPIDER,
|
||||
mtSilverfish = E_META_SPAWN_EGG_SILVERFISH,
|
||||
mtBlaze = E_META_SPAWN_EGG_BLAZE,
|
||||
mtMagmaCube = E_META_SPAWN_EGG_MAGMA_CUBE,
|
||||
mtEnderDragon = E_META_SPAWN_EGG_ENDER_DRAGON,
|
||||
mtWither = E_META_SPAWN_EGG_WITHER,
|
||||
mtBat = E_META_SPAWN_EGG_BAT,
|
||||
mtWitch = E_META_SPAWN_EGG_WITCH,
|
||||
mtPig = E_META_SPAWN_EGG_PIG,
|
||||
mtSheep = E_META_SPAWN_EGG_SHEEP,
|
||||
mtCow = E_META_SPAWN_EGG_COW,
|
||||
mtChicken = E_META_SPAWN_EGG_CHICKEN,
|
||||
mtSquid = E_META_SPAWN_EGG_SQUID,
|
||||
mtWolf = E_META_SPAWN_EGG_WOLF,
|
||||
mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM,
|
||||
mtSnowGolem = E_META_SPAWN_EGG_SNOW_GOLEM,
|
||||
mtOcelot = E_META_SPAWN_EGG_OCELOT,
|
||||
mtIronGolem = E_META_SPAWN_EGG_IRON_GOLEM,
|
||||
mtVillager = E_META_SPAWN_EGG_VILLAGER,
|
||||
} ;
|
||||
|
||||
// tolua_end
|
||||
|
||||
float m_SightDistance;
|
||||
|
||||
/** Creates the mob object.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "PassiveMonster.h"
|
||||
#include "../MersenneTwister.h"
|
||||
#include "../World.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "Skeleton.h"
|
||||
#include "../World.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "Zombie.h"
|
||||
#include "../World.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "Zombiepigman.h"
|
||||
#include "../World.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ Documentation:
|
|||
#include "Protocol125.h"
|
||||
|
||||
#include "../ClientHandle.h"
|
||||
#include "../World.h"
|
||||
#include "ChunkDataSerializer.h"
|
||||
#include "../Entity.h"
|
||||
#include "../Mobs/Monster.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "Protocol132.h"
|
||||
#include "../Root.h"
|
||||
#include "../Server.h"
|
||||
#include "../World.h"
|
||||
#include "../ClientHandle.h"
|
||||
#include "../../CryptoPP/randpool.h"
|
||||
#include "../Item.h"
|
||||
|
|
144
source/World.cpp
144
source/World.cpp
|
@ -746,55 +746,73 @@ void cWorld::TickSpawnMobs(float a_Dt)
|
|||
int Height = GetHeight((int)SpawnPos.x, (int)SpawnPos.z);
|
||||
|
||||
int MobType = -1;
|
||||
if (m_TimeOfDay >= 12000 + 1000)
|
||||
int Biome = GetBiomeAt((int)SpawnPos.x, (int)SpawnPos.z);
|
||||
switch (Biome)
|
||||
{
|
||||
if (GetBiomeAt((int)SpawnPos.x, (int)SpawnPos.z) == biHell) // Spawn nether mobs
|
||||
case biNether:
|
||||
{
|
||||
// Spawn nether mobs
|
||||
switch (nightRand)
|
||||
{
|
||||
case 5: MobType = E_ENTITY_TYPE_GHAST; break;
|
||||
case 6: MobType = E_ENTITY_TYPE_ZOMBIE_PIGMAN; break;
|
||||
case 5: MobType = cMonster::mtGhast; break;
|
||||
case 6: MobType = cMonster::mtZombiePigman; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (GetBiomeAt((int)SpawnPos.x, (int)SpawnPos.z) == biSky)
|
||||
|
||||
case biEnd:
|
||||
{
|
||||
switch (nightRand)
|
||||
// Only endermen spawn in the End
|
||||
MobType = cMonster::mtEnderman;
|
||||
break;
|
||||
}
|
||||
|
||||
case biMushroomIsland:
|
||||
case biMushroomShore:
|
||||
{
|
||||
// Mushroom land gets only mooshrooms
|
||||
MobType = cMonster::mtMooshroom;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// Overworld biomes depend on whether it's night or day:
|
||||
if (m_TimeOfDay >= 12000 + 1000)
|
||||
{
|
||||
case 5: MobType = E_ENTITY_TYPE_ENDERMAN; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (nightRand)
|
||||
{
|
||||
case 0: MobType = E_ENTITY_TYPE_SPIDER; break;
|
||||
case 1: MobType = E_ENTITY_TYPE_ZOMBIE; break;
|
||||
case 2: MobType = E_ENTITY_TYPE_ENDERMAN; break;
|
||||
case 3: MobType = E_ENTITY_TYPE_CREEPER; break;
|
||||
case 4: MobType = E_ENTITY_TYPE_CAVE_SPIDER; break;
|
||||
case 7: MobType = E_ENTITY_TYPE_SLIME; break;
|
||||
case 8: MobType = E_ENTITY_TYPE_SILVERFISH; break;
|
||||
case 9: MobType = E_ENTITY_TYPE_SKELETON; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (dayRand)
|
||||
{
|
||||
case 0: MobType = E_ENTITY_TYPE_CHICKEN; break;
|
||||
case 1: MobType = E_ENTITY_TYPE_COW; break;
|
||||
case 2: MobType = E_ENTITY_TYPE_PIG; break;
|
||||
case 3: MobType = E_ENTITY_TYPE_SHEEP; break;
|
||||
case 4: MobType = E_ENTITY_TYPE_SQUID; break;
|
||||
case 5: MobType = E_ENTITY_TYPE_WOLF; break;
|
||||
}
|
||||
}
|
||||
// Night mobs:
|
||||
switch (nightRand)
|
||||
{
|
||||
case 0: MobType = cMonster::mtSpider; break;
|
||||
case 1: MobType = cMonster::mtZombie; break;
|
||||
case 2: MobType = cMonster::mtEnderman; break;
|
||||
case 3: MobType = cMonster::mtCreeper; break;
|
||||
case 4: MobType = cMonster::mtCaveSpider; break;
|
||||
case 7: MobType = cMonster::mtSlime; break;
|
||||
case 8: MobType = cMonster::mtSilverfish; break;
|
||||
case 9: MobType = cMonster::mtSkeleton; break;
|
||||
}
|
||||
} // if (night)
|
||||
else
|
||||
{
|
||||
// During the day:
|
||||
switch (dayRand)
|
||||
{
|
||||
case 0: MobType = cMonster::mtChicken; break;
|
||||
case 1: MobType = cMonster::mtCow; break;
|
||||
case 2: MobType = cMonster::mtPig; break;
|
||||
case 3: MobType = cMonster::mtSheep; break;
|
||||
case 4: MobType = cMonster::mtSquid; break;
|
||||
case 5: MobType = cMonster::mtWolf; break;
|
||||
}
|
||||
} // else (night)
|
||||
} // case overworld biomes
|
||||
} // switch (biome)
|
||||
|
||||
if (MobType >= 0)
|
||||
{
|
||||
// A proper mob type was selected, now spawn the mob:
|
||||
SpawnMob(SpawnPos.x, SpawnPos.y, SpawnPos.z, MobType);
|
||||
SpawnMob(SpawnPos.x, SpawnPos.y, SpawnPos.z, (cMonster::eType)MobType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2553,41 +2571,41 @@ bool cWorld::IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||
|
||||
|
||||
|
||||
int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityType)
|
||||
int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType)
|
||||
{
|
||||
cMonster * Monster = NULL;
|
||||
|
||||
int Size = GetTickRandomNumber(2) + 1; // 1 .. 3
|
||||
|
||||
switch (a_EntityType)
|
||||
switch (a_MonsterType)
|
||||
{
|
||||
case E_ENTITY_TYPE_BAT: Monster = new cBat(); break;
|
||||
case E_ENTITY_TYPE_BLAZE: Monster = new cBlaze(); break;
|
||||
case E_ENTITY_TYPE_CAVE_SPIDER: Monster = new cCavespider(); break;
|
||||
case E_ENTITY_TYPE_CHICKEN: Monster = new cChicken(); break;
|
||||
case E_ENTITY_TYPE_COW: Monster = new cCow(); break;
|
||||
case E_ENTITY_TYPE_CREEPER: Monster = new cCreeper(); break;
|
||||
case E_ENTITY_TYPE_ENDERMAN: Monster = new cEnderman(); break;
|
||||
case E_ENTITY_TYPE_GHAST: Monster = new cGhast(); break;
|
||||
case E_ENTITY_TYPE_MAGMA_CUBE: Monster = new cMagmacube(Size); break;
|
||||
case E_ENTITY_TYPE_MOOSHROOM: Monster = new cMooshroom(); break;
|
||||
case E_ENTITY_TYPE_OCELOT: Monster = new cOcelot(); break;
|
||||
case E_ENTITY_TYPE_PIG: Monster = new cPig(); break;
|
||||
case E_ENTITY_TYPE_SHEEP: Monster = new cSheep(); break;
|
||||
case E_ENTITY_TYPE_SILVERFISH: Monster = new cSilverfish(); break;
|
||||
case E_ENTITY_TYPE_SKELETON: Monster = new cSkeleton(); break;
|
||||
case E_ENTITY_TYPE_SLIME: Monster = new cSlime(Size); break;
|
||||
case E_ENTITY_TYPE_SPIDER: Monster = new cSpider(); break;
|
||||
case E_ENTITY_TYPE_SQUID: Monster = new cSquid(); break;
|
||||
case E_ENTITY_TYPE_VILLAGER: Monster = new cVillager(); break;
|
||||
case E_ENTITY_TYPE_WITCH: Monster = new cWitch(); break;
|
||||
case E_ENTITY_TYPE_WOLF: Monster = new cWolf(); break;
|
||||
case E_ENTITY_TYPE_ZOMBIE: Monster = new cZombie(); break;
|
||||
case E_ENTITY_TYPE_ZOMBIE_PIGMAN: Monster = new cZombiepigman(); break;
|
||||
case cMonster::mtBat: Monster = new cBat(); break;
|
||||
case cMonster::mtBlaze: Monster = new cBlaze(); break;
|
||||
case cMonster::mtCaveSpider: Monster = new cCavespider(); break;
|
||||
case cMonster::mtChicken: Monster = new cChicken(); break;
|
||||
case cMonster::mtCow: Monster = new cCow(); break;
|
||||
case cMonster::mtCreeper: Monster = new cCreeper(); break;
|
||||
case cMonster::mtEnderman: Monster = new cEnderman(); break;
|
||||
case cMonster::mtGhast: Monster = new cGhast(); break;
|
||||
case cMonster::mtMagmaCube: Monster = new cMagmacube(Size); break;
|
||||
case cMonster::mtMooshroom: Monster = new cMooshroom(); break;
|
||||
case cMonster::mtOcelot: Monster = new cOcelot(); break;
|
||||
case cMonster::mtPig: Monster = new cPig(); break;
|
||||
case cMonster::mtSheep: Monster = new cSheep(); break;
|
||||
case cMonster::mtSilverfish: Monster = new cSilverfish(); break;
|
||||
case cMonster::mtSkeleton: Monster = new cSkeleton(); break;
|
||||
case cMonster::mtSlime: Monster = new cSlime(Size); break;
|
||||
case cMonster::mtSpider: Monster = new cSpider(); break;
|
||||
case cMonster::mtSquid: Monster = new cSquid(); break;
|
||||
case cMonster::mtVillager: Monster = new cVillager(); break;
|
||||
case cMonster::mtWitch: Monster = new cWitch(); break;
|
||||
case cMonster::mtWolf: Monster = new cWolf(); break;
|
||||
case cMonster::mtZombie: Monster = new cZombie(); break;
|
||||
case cMonster::mtZombiePigman: Monster = new cZombiepigman(); break;
|
||||
|
||||
default:
|
||||
{
|
||||
LOGWARNING("%s: Unhandled entity type: %d. Not spawning.", __FUNCTION__, a_EntityType);
|
||||
LOGWARNING("%s: Unhandled monster type: %d. Not spawning.", __FUNCTION__, a_MonsterType);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "Defines.h"
|
||||
#include "LightingThread.h"
|
||||
#include "Item.h"
|
||||
#include "Mobs/Monster.h"
|
||||
|
||||
|
||||
|
||||
|
@ -546,8 +547,8 @@ public:
|
|||
|
||||
bool IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
||||
|
||||
/// Spawns a mob of the specified entity type. Returns the mob's EntityID if recognized and spawned, <0 otherwise
|
||||
int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityType); // tolua_export
|
||||
/// Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise
|
||||
int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType); // tolua_export
|
||||
|
||||
/// Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread!
|
||||
int GetTickRandomNumber(unsigned a_Range) { return (int)(m_TickRand.randInt(a_Range)); }
|
||||
|
|
Loading…
Reference in New Issue