diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Bindings/Plugin.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 4 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 2 | ||||
-rw-r--r-- | src/BlockArea.cpp | 172 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 4 | ||||
-rw-r--r-- | src/Generating/Prefabs/AlchemistVillagePrefabs.cpp | 208 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp | 18 | ||||
-rw-r--r-- | src/main.cpp | 4 |
10 files changed, 239 insertions, 181 deletions
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 0bd9270c4..c6461c861 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -90,7 +90,7 @@ public: virtual bool OnPluginsLoaded (void) = 0; virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0; virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0; - virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile) = 0; + virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) = 0; virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) = 0; virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) = 0; virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 59708bf59..625931931 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1113,14 +1113,14 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a -bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile) +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Projectile, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, &a_BlockHitPos, cLuaState::Return, res); if (res) { return true; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 3357dd87b..598e031c0 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -113,7 +113,7 @@ public: virtual bool OnPluginsLoaded (void) override; virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; - virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile) override; + virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) override; virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) override; virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override; virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index fc690d4de..acfc91bf8 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -1155,7 +1155,7 @@ bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCrafti -bool cPluginManager::CallHookProjectileHitBlock(cProjectileEntity & a_Projectile) +bool cPluginManager::CallHookProjectileHitBlock(cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PROJECTILE_HIT_BLOCK); if (Plugins == m_Hooks.end()) @@ -1164,7 +1164,7 @@ bool cPluginManager::CallHookProjectileHitBlock(cProjectileEntity & a_Projectile } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnProjectileHitBlock(a_Projectile)) + if ((*itr)->OnProjectileHitBlock(a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, a_BlockHitPos)) { return true; } diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 3b3091957..be40bd2f7 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -206,7 +206,7 @@ public: // tolua_export bool CallHookPluginsLoaded (void); bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); - bool CallHookProjectileHitBlock (cProjectileEntity & a_Projectile); + bool CallHookProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos); bool CallHookProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity); bool CallHookSpawnedEntity (cWorld & a_World, cEntity & a_Entity); bool CallHookSpawnedMonster (cWorld & a_World, cMonster & a_Monster); diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp index 40fdd68c0..e3a859e4f 100644 --- a/src/BlockArea.cpp +++ b/src/BlockArea.cpp @@ -1835,87 +1835,133 @@ bool cBlockArea::cChunkReader::Coords(int a_ChunkX, int a_ChunkZ) -void cBlockArea::cChunkReader::ChunkData(const cChunkData & a_BlockBuffer) +void cBlockArea::cChunkReader::ChunkData(const cChunkData & a_BlockBuffer) { + int SizeY = m_Area.m_Size.y; + int MinY = m_Origin.y; + + // SizeX, SizeZ are the dimensions of the block data to copy from the current chunk (size of the geometric union) + // OffX, OffZ are the offsets of the current chunk data from the area origin + // BaseX, BaseZ are the offsets of the area data within the current chunk from the chunk borders + int SizeX = cChunkDef::Width; + int SizeZ = cChunkDef::Width; + int OffX, OffZ; + int BaseX, BaseZ; + OffX = m_CurrentChunkX * cChunkDef::Width - m_Origin.x; + if (OffX < 0) { - if (m_Area.m_BlockTypes != NULL) - { - int SizeY = m_Area.m_Size.y; - int MinY = m_Origin.y; + BaseX = -OffX; + SizeX += OffX; // SizeX is decreased, OffX is negative + OffX = 0; + } + else + { + BaseX = 0; + } + OffZ = m_CurrentChunkZ * cChunkDef::Width - m_Origin.z; + if (OffZ < 0) + { + BaseZ = -OffZ; + SizeZ += OffZ; // SizeZ is decreased, OffZ is negative + OffZ = 0; + } + else + { + BaseZ = 0; + } + // If the chunk extends beyond the area in the X or Z axis, cut off the Size: + if ((m_CurrentChunkX + 1) * cChunkDef::Width > m_Origin.x + m_Area.m_Size.x) + { + SizeX -= (m_CurrentChunkX + 1) * cChunkDef::Width - (m_Origin.x + m_Area.m_Size.x); + } + if ((m_CurrentChunkZ + 1) * cChunkDef::Width > m_Origin.z + m_Area.m_Size.z) + { + SizeZ -= (m_CurrentChunkZ + 1) * cChunkDef::Width - (m_Origin.z + m_Area.m_Size.z); + } - // SizeX, SizeZ are the dimensions of the block data to copy from the current chunk (size of the geometric union) - // OffX, OffZ are the offsets of the current chunk data from the area origin - // BaseX, BaseZ are the offsets of the area data within the current chunk from the chunk borders - int SizeX = cChunkDef::Width; - int SizeZ = cChunkDef::Width; - int OffX, OffZ; - int BaseX, BaseZ; - OffX = m_CurrentChunkX * cChunkDef::Width - m_Origin.x; - if (OffX < 0) - { - BaseX = -OffX; - SizeX += OffX; // SizeX is decreased, OffX is negative - OffX = 0; - } - else - { - BaseX = 0; - } - OffZ = m_CurrentChunkZ * cChunkDef::Width - m_Origin.z; - if (OffZ < 0) - { - BaseZ = -OffZ; - SizeZ += OffZ; // SizeZ is decreased, OffZ is negative - OffZ = 0; - } - else - { - BaseZ = 0; - } - // If the chunk extends beyond the area in the X or Z axis, cut off the Size: - if ((m_CurrentChunkX + 1) * cChunkDef::Width > m_Origin.x + m_Area.m_Size.x) - { - SizeX -= (m_CurrentChunkX + 1) * cChunkDef::Width - (m_Origin.x + m_Area.m_Size.x); - } - if ((m_CurrentChunkZ + 1) * cChunkDef::Width > m_Origin.z + m_Area.m_Size.z) - { - SizeZ -= (m_CurrentChunkZ + 1) * cChunkDef::Width - (m_Origin.z + m_Area.m_Size.z); - } - - for (int y = 0; y < SizeY; y++) + // Copy the blocktypes: + if (m_Area.m_BlockTypes != NULL) + { + for (int y = 0; y < SizeY; y++) + { + int InChunkY = MinY + y; + int AreaY = y; + for (int z = 0; z < SizeZ; z++) { - int ChunkY = MinY + y; - int AreaY = y; - for (int z = 0; z < SizeZ; z++) + int InChunkZ = BaseZ + z; + int AreaZ = OffZ + z; + for (int x = 0; x < SizeX; x++) { - int ChunkZ = BaseZ + z; - int AreaZ = OffZ + z; - for (int x = 0; x < SizeX; x++) - { - int ChunkX = BaseX + x; - int AreaX = OffX + x; - m_Area.m_BlockTypes[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = a_BlockBuffer.GetBlock(ChunkX, ChunkY, ChunkZ); - } // for x - } // for z - } // for y - } + int InChunkX = BaseX + x; + int AreaX = OffX + x; + m_Area.m_BlockTypes[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = a_BlockBuffer.GetBlock(InChunkX, InChunkY, InChunkZ); + } // for x + } // for z + } // for y } + // Copy the block metas: if (m_Area.m_BlockMetas != NULL) { - a_BlockBuffer.CopyMetas(m_Area.m_BlockMetas); + for (int y = 0; y < SizeY; y++) + { + int InChunkY = MinY + y; + int AreaY = y; + for (int z = 0; z < SizeZ; z++) + { + int InChunkZ = BaseZ + z; + int AreaZ = OffZ + z; + for (int x = 0; x < SizeX; x++) + { + int InChunkX = BaseX + x; + int AreaX = OffX + x; + m_Area.m_BlockMetas[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = a_BlockBuffer.GetMeta(InChunkX, InChunkY, InChunkZ); + } // for x + } // for z + } // for y } + // Copy the blocklight: if (m_Area.m_BlockLight != NULL) { - a_BlockBuffer.CopyBlockLight(m_Area.m_BlockLight); + for (int y = 0; y < SizeY; y++) + { + int InChunkY = MinY + y; + int AreaY = y; + for (int z = 0; z < SizeZ; z++) + { + int InChunkZ = BaseZ + z; + int AreaZ = OffZ + z; + for (int x = 0; x < SizeX; x++) + { + int InChunkX = BaseX + x; + int AreaX = OffX + x; + m_Area.m_BlockLight[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = a_BlockBuffer.GetBlockLight(InChunkX, InChunkY, InChunkZ); + } // for x + } // for z + } // for y } + // Copy the skylight: if (m_Area.m_BlockSkyLight != NULL) { - a_BlockBuffer.CopySkyLight(m_Area.m_BlockSkyLight); + for (int y = 0; y < SizeY; y++) + { + int InChunkY = MinY + y; + int AreaY = y; + for (int z = 0; z < SizeZ; z++) + { + int InChunkZ = BaseZ + z; + int AreaZ = OffZ + z; + for (int x = 0; x < SizeX; x++) + { + int InChunkX = BaseX + x; + int AreaX = OffX + x; + m_Area.m_BlockSkyLight[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = a_BlockBuffer.GetSkyLight(InChunkX, InChunkY, InChunkZ); + } // for x + } // for z + } // for y } - } diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 3e48d310c..95c494569 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -76,12 +76,12 @@ protected: eBlockFace Face; if (bb.CalcLineIntersection(Line1, Line2, LineCoeff, Face)) { - if (cPluginManager::Get()->CallHookProjectileHitBlock(*m_Projectile)) + Vector3d Intersection = Line1 + m_Projectile->GetSpeed() * LineCoeff; + if (cPluginManager::Get()->CallHookProjectileHitBlock(*m_Projectile, a_BlockX, a_BlockY, a_BlockZ, Face, &Intersection)) { return false; } - Vector3d Intersection = Line1 + m_Projectile->GetSpeed() * LineCoeff; m_Projectile->OnHitSolidBlock(Intersection, Face); return true; } diff --git a/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp b/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp index 6e3f82212..eb0d30fdf 100644 --- a/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp +++ b/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp @@ -23,8 +23,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 11, 12, 10, // SizeX = 11, SizeY = 12, SizeZ = 10 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 10, 11, 9, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 11, 11, 10, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -270,8 +270,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 11, 8, 10, // SizeX = 11, SizeY = 8, SizeZ = 10 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 10, 7, 9, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 11, 7, 10, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -455,8 +455,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 11, 5, 13, // SizeX = 11, SizeY = 5, SizeZ = 13 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 10, 4, 12, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 11, 4, 13, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -606,26 +606,28 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 15, 13, 11, // SizeX = 15, SizeY = 13, SizeZ = 11 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 14, 12, 10, // MaxX, MaxY, MaxZ + -1, 0, -1, // MinX, MinY, MinZ + 14, 12, 11, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ - "A:128: 7\n" /* sandstonestairs */ - "B: 44: 1\n" /* step */ - "C:128: 2\n" /* sandstonestairs */ - "D:128: 0\n" /* sandstonestairs */ - "E: 87: 0\n" /* netherstone */ - "F:128: 3\n" /* sandstonestairs */ - "G: 51: 0\n" /* fire */ - "H: 44: 9\n" /* step */ + "A:128: 4\n" /* sandstonestairs */ + "B:128: 5\n" /* sandstonestairs */ + "C:128: 7\n" /* sandstonestairs */ + "D: 44: 1\n" /* step */ + "E:128: 2\n" /* sandstonestairs */ + "F:128: 0\n" /* sandstonestairs */ + "G: 87: 0\n" /* netherstone */ + "H:128: 3\n" /* sandstonestairs */ + "I: 51: 0\n" /* fire */ + "J: 44: 9\n" /* step */ "a: 12: 0\n" /* sand */ "b: 5: 0\n" /* wood */ "c: 24: 2\n" /* sandstone */ "d: 24: 0\n" /* sandstone */ "e: 85: 0\n" /* fence */ "f: 5: 1\n" /* wood */ - "g: 64: 2\n" /* wooddoorblock */ + "g: 64: 6\n" /* wooddoorblock */ "h: 64: 0\n" /* wooddoorblock */ "i: 61: 2\n" /* furnace */ "j:118: 0\n" /* cauldronblock */ @@ -633,18 +635,18 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = "l: 65: 2\n" /* ladder */ "m: 19: 0\n" /* sponge */ "n:101: 0\n" /* ironbars */ - "o:140: 0\n" /* flowerpotblock */ - "p: 64: 8\n" /* wooddoorblock */ - "q: 50: 3\n" /* torch */ - "r: 69:12\n" /* lever */ - "s: 50: 4\n" /* torch */ - "t:128: 6\n" /* sandstonestairs */ - "u: 44:10\n" /* step */ - "v:128: 1\n" /* sandstonestairs */ - "w: 47: 0\n" /* bookshelf */ - "x: 96:12\n" /* trapdoor */ - "y:128: 4\n" /* sandstonestairs */ - "z:128: 5\n" /* sandstonestairs */, + "o: 50: 1\n" /* torch */ + "p:140: 0\n" /* flowerpotblock */ + "q: 64:12\n" /* wooddoorblock */ + "r: 50: 3\n" /* torch */ + "s: 64: 8\n" /* wooddoorblock */ + "t: 69:12\n" /* lever */ + "u: 50: 4\n" /* torch */ + "v:128: 6\n" /* sandstonestairs */ + "w: 44:10\n" /* step */ + "x:128: 1\n" /* sandstonestairs */ + "y: 47: 0\n" /* bookshelf */ + "z: 96:10\n" /* trapdoor */, // Block data: // Level 0 @@ -681,12 +683,12 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* z\x* 11111 */ /* * 012345678901234 */ /* 0 */ "....cddnnnddc.." - /* 1 */ "....d......od.c" - /* 2 */ "....p.......d.q" - /* 3 */ "....d.......p.." - /* 4 */ "....d.r...l.d.s" + /* 1 */ "....do.....pd.c" + /* 2 */ "....q.......d.r" + /* 3 */ "....d.......s.." + /* 4 */ "....d.t...l.d.u" /* 5 */ "....dddd.dddd.c" - /* 6 */ "....n.......n.." + /* 6 */ "....n..r.r..n.." /* 7 */ "mmmmn.......n.." /* 8 */ "mmmmn.......n.." /* 9 */ "mmmmd.......d.." @@ -695,32 +697,32 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = // Level 3 /* z\x* 11111 */ /* * 012345678901234 */ - /* 0 */ "....cddtttddc.." - /* 1 */ "....duuuuuuuddv" - /* 2 */ "....duuuuuuud.." - /* 3 */ "....duuuuuuud.." - /* 4 */ "....dwwwuuxud.." - /* 5 */ "....ddddddddddv" - /* 6 */ "....yuuuuuuuz.." - /* 7 */ "mmmmyuuuuuuuz.." - /* 8 */ "mmmmyuuuuuuuz.." - /* 9 */ "mmmmduuuuuuud.." - /* 10 */ "mmmmcddAAAddc.." + /* 0 */ "....cddvvvddc.." + /* 1 */ "....dwwwwwwwddx" + /* 2 */ "....dwwwwwwwd.." + /* 3 */ "....dwwwwwwwd.." + /* 4 */ "....dyyywwzwd.." + /* 5 */ "....ddddddddddx" + /* 6 */ "....AwwwwwwwB.." + /* 7 */ "mmmmAwwwwwwwB.." + /* 8 */ "mmmmAwwwwwwwB.." + /* 9 */ "mmmmdwwwwwwwd.." + /* 10 */ "mmmmcddCCCddc.." // Level 4 /* z\x* 11111 */ /* * 012345678901234 */ - /* 0 */ "....dBBBdBBBd.." - /* 1 */ "....BcdddddcB.." - /* 2 */ "....Bd.....dB.." - /* 3 */ "....Bd.....dB.." - /* 4 */ "....Bd.....dB.." + /* 0 */ "....dDDDdDDDd.." + /* 1 */ "....DcdddddcD.." + /* 2 */ "....Dd.....dD.." + /* 3 */ "....Dd.....dD.." + /* 4 */ "....Dd.....dD.." /* 5 */ "....dcdd.ddcd.." - /* 6 */ "....B.......B.." - /* 7 */ "mmmmB.......B.." - /* 8 */ "mmmmB.......B.." - /* 9 */ "mmmmB.......B.." - /* 10 */ "mmmmdBBBdBBBd.." + /* 6 */ "....D.......D.." + /* 7 */ "mmmmD.......D.." + /* 8 */ "mmmmD.......D.." + /* 9 */ "mmmmD.......D.." + /* 10 */ "mmmmdDDDdDDDd.." // Level 5 /* z\x* 11111 */ @@ -741,10 +743,10 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* z\x* 11111 */ /* * 012345678901234 */ /* 0 */ "..............." - /* 1 */ ".....cddtddc..." - /* 2 */ ".....yuuuuuz..." - /* 3 */ ".....yuuuuuz..." - /* 4 */ ".....yuuuuuz..." + /* 1 */ ".....cddvddc..." + /* 2 */ ".....AwwwwwB..." + /* 3 */ ".....AwwwwwB..." + /* 4 */ ".....AwwwwwB..." /* 5 */ ".....cdddddc..." /* 6 */ "..............." /* 7 */ "..............." @@ -756,11 +758,11 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* z\x* 11111 */ /* * 012345678901234 */ /* 0 */ "..............." - /* 1 */ ".....dBBdBBd..." - /* 2 */ ".....B.ddd.B..." + /* 1 */ ".....dDDdDDd..." + /* 2 */ ".....D.ddd.D..." /* 3 */ ".....d.ddd.d..." - /* 4 */ ".....B.ddd.B..." - /* 5 */ ".....dBBdBBd..." + /* 4 */ ".....D.ddd.D..." + /* 5 */ ".....dDDdDDd..." /* 6 */ "..............." /* 7 */ "..............." /* 8 */ "..............." @@ -772,9 +774,9 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* * 012345678901234 */ /* 0 */ "..............." /* 1 */ "..............." - /* 2 */ ".......cCc....." - /* 3 */ ".......DEv....." - /* 4 */ ".......cFc....." + /* 2 */ ".......cEc....." + /* 3 */ ".......FGx....." + /* 4 */ ".......cHc....." /* 5 */ "..............." /* 6 */ "..............." /* 7 */ "..............." @@ -788,7 +790,7 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* 0 */ "..............." /* 1 */ "..............." /* 2 */ ".......c.c....." - /* 3 */ "........G......" + /* 3 */ "........I......" /* 4 */ ".......c.c....." /* 5 */ "..............." /* 6 */ "..............." @@ -802,9 +804,9 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* * 012345678901234 */ /* 0 */ "..............." /* 1 */ "..............." - /* 2 */ ".......ctc....." - /* 3 */ ".......y.z....." - /* 4 */ ".......cAc....." + /* 2 */ ".......cvc....." + /* 3 */ ".......A.B....." + /* 4 */ ".......cCc....." /* 5 */ "..............." /* 6 */ "..............." /* 7 */ "..............." @@ -818,7 +820,7 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* 0 */ "..............." /* 1 */ "..............." /* 2 */ ".......ddd....." - /* 3 */ ".......dHd....." + /* 3 */ ".......dJd....." /* 4 */ ".......ddd....." /* 5 */ "..............." /* 6 */ "..............." @@ -832,9 +834,9 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = /* * 012345678901234 */ /* 0 */ "..............." /* 1 */ "..............." - /* 2 */ ".......B.B....." + /* 2 */ ".......D.D....." /* 3 */ "..............." - /* 4 */ ".......B.B....." + /* 4 */ ".......D.D....." /* 5 */ "..............." /* 6 */ "..............." /* 7 */ "..............." @@ -877,8 +879,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 7, 11, 7, // SizeX = 7, SizeY = 11, SizeZ = 7 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 6, 10, 6, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 7, 10, 7, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1050,8 +1052,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 5, 5, 7, // SizeX = 5, SizeY = 5, SizeZ = 7 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 4, 4, 6, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 5, 4, 7, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1160,8 +1162,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 7, 5, 11, // SizeX = 7, SizeY = 5, SizeZ = 11 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 6, 4, 10, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 7, 4, 11, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1291,8 +1293,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 9, 5, 7, // SizeX = 9, SizeY = 5, SizeZ = 7 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 8, 4, 6, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 9, 4, 7, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1400,8 +1402,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 5, 5, 11, // SizeX = 5, SizeY = 5, SizeZ = 11 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 4, 4, 10, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 5, 4, 11, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1428,7 +1430,7 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = "u:128: 5\n" /* sandstonestairs */ "v:128: 7\n" /* sandstonestairs */ "w: 44: 1\n" /* step */ - "x: 96: 7\n" /* trapdoor */, + "x: 96: 1\n" /* trapdoor */, // Block data: // Level 0 @@ -1536,8 +1538,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 9, 5, 9, // SizeX = 9, SizeY = 5, SizeZ = 9 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 8, 4, 8, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 9, 4, 9, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1657,8 +1659,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 9, 5, 9, // SizeX = 9, SizeY = 5, SizeZ = 9 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 8, 4, 8, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 9, 4, 9, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1783,8 +1785,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 9, 5, 11, // SizeX = 9, SizeY = 5, SizeZ = 11 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 8, 4, 10, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 9, 4, 11, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -1914,8 +1916,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 5, 8, 7, // SizeX = 5, SizeY = 8, SizeZ = 7 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 4, 7, 6, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 5, 7, 7, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -2054,8 +2056,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 15, 8, 9, // SizeX = 15, SizeY = 8, SizeZ = 9 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 14, 7, 8, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 15, 7, 9, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -2219,8 +2221,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 11, 9, 9, // SizeX = 11, SizeY = 9, SizeZ = 9 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 10, 8, 8, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 11, 8, 9, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -2413,8 +2415,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 12, 10, 11, // SizeX = 12, SizeY = 10, SizeZ = 11 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 11, 9, 10, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 12, 9, 11, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -2441,7 +2443,7 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = "u:128: 5\n" /* sandstonestairs */ "v:128: 7\n" /* sandstonestairs */ "w: 44: 1\n" /* step */ - "x: 96: 6\n" /* trapdoor */ + "x: 96: 4\n" /* trapdoor */ "y:126: 0\n" /* woodenslab */ "z:128: 4\n" /* sandstonestairs */, @@ -2631,8 +2633,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 9, 5, 11, // SizeX = 9, SizeY = 5, SizeZ = 11 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 8, 4, 10, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 9, 4, 11, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ @@ -2762,8 +2764,8 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] = 13, 9, 9, // SizeX = 13, SizeY = 9, SizeZ = 9 // Hitbox (relative to bounding box): - 0, 0, 0, // MinX, MinY, MinZ - 12, 8, 8, // MaxX, MaxY, MaxZ + -1, 0, 0, // MinX, MinY, MinZ + 13, 8, 9, // MaxX, MaxY, MaxZ // Block definitions: ".: 0: 0\n" /* air */ diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index a9ca7a2fa..5843ca5a6 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -301,7 +301,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk) if (DoesPosYRequireJump((int)floor(m_Destination.y))) { m_bOnGround = false; - AddPosY(1.5); // Jump!! + AddSpeedY(5.2); // Jump!! } } @@ -310,9 +310,19 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk) { Distance.y = 0; Distance.Normalize(); - Distance *= 5; - SetSpeedX(Distance.x); - SetSpeedZ(Distance.z); + + if (m_bOnGround) + { + Distance *= 2.5; + } + else + { + // Don't let the mob move too much if he's falling. + Distance *= 0.25; + } + + AddSpeedX(Distance.x); + AddSpeedZ(Distance.z); if (m_EMState == ESCAPING) { //Runs Faster when escaping :D otherwise they just walk away diff --git a/src/main.cpp b/src/main.cpp index 68eea7f4d..6925d9ff1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -61,7 +61,7 @@ void NonCtrlHandler(int a_Signal) std::signal(SIGSEGV, SIG_DFL); LOGERROR(" D: | MCServer has encountered an error and needs to close"); LOGERROR("Details | SIGSEGV: Segmentation fault"); - exit(EXIT_FAILURE); + abort(); } case SIGABRT: #ifdef SIGABRT_COMPAT @@ -71,7 +71,7 @@ void NonCtrlHandler(int a_Signal) std::signal(a_Signal, SIG_DFL); LOGERROR(" D: | MCServer has encountered an error and needs to close"); LOGERROR("Details | SIGABRT: Server self-terminated due to an internal fault"); - exit(EXIT_FAILURE); + abort(); } case SIGINT: case SIGTERM: |