diff --git a/src/MobManager.hpp b/src/MobManager.hpp index fb03351..5cb3b9d 100644 --- a/src/MobManager.hpp +++ b/src/MobManager.hpp @@ -45,8 +45,8 @@ struct Mob : public BaseNPC { // temporary; until we're sure what's what nlohmann::json data; - Mob(int x, int y, int z, int iID, int type, int hp, int angle, nlohmann::json d, int32_t id) - : BaseNPC(x, y, z, iID, type, id), maxHealth(hp) { + Mob(int x, int y, int z, int angle, int iID, int type, int hp, nlohmann::json d, int32_t id) + : BaseNPC(x, y, z, angle, iID, type, id), maxHealth(hp) { state = MobState::ROAMING; data = d; @@ -72,7 +72,7 @@ struct Mob : public BaseNPC { // constructor for /summon Mob(int x, int y, int z, int iID, int type, nlohmann::json d, int32_t id) - : Mob(x, y, z, iID, type, 0, 0, d, id) { + : Mob(x, y, z, 0, iID, type, 0, d, id) { summoned = true; // will be despawned and deallocated when killed appearanceData.iHP = maxHealth = d["m_iHP"]; } diff --git a/src/NPC.hpp b/src/NPC.hpp index c48b5c9..724d8de 100644 --- a/src/NPC.hpp +++ b/src/NPC.hpp @@ -12,13 +12,13 @@ public: std::vector currentChunks; BaseNPC() {}; - BaseNPC(int x, int y, int z, int iID, int type, int id) { + BaseNPC(int x, int y, int z, int angle, int iID, int type, int id) { appearanceData.iX = x; appearanceData.iY = y; appearanceData.iZ = z; appearanceData.iNPCType = type; appearanceData.iHP = 400; - appearanceData.iAngle = 0; + appearanceData.iAngle = angle; appearanceData.iConditionBitFlag = 0; appearanceData.iBarkerType = 0; appearanceData.iNPC_ID = id; @@ -27,7 +27,7 @@ public: chunkPos = std::make_tuple(0, 0, instanceID); }; - BaseNPC(int x, int y, int z, int iID, int type, int id, NPCClass classType) : BaseNPC(x, y, z, iID, type, id) { + BaseNPC(int x, int y, int z, int angle, int iID, int type, int id, NPCClass classType) : BaseNPC(x, y, z, angle, iID, type, id) { npcClass = classType; } }; diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index bf81be7..7663e6b 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -548,7 +548,7 @@ void NPCManager::npcSummonHandler(CNSocket* sock, CNPacketData* data) { NPCs[id] = new Mob(plr->x, plr->y, plr->z, plr->instanceID, req->iNPCType, NPCData[req->iNPCType], id); MobManager::Mobs[id] = (Mob*)NPCs[id]; } else - NPCs[id] = new BaseNPC(plr->x, plr->y, plr->z, plr->instanceID, req->iNPCType, id); + NPCs[id] = new BaseNPC(plr->x, plr->y, plr->z, 0, plr->instanceID, req->iNPCType, id); updateNPCPosition(id, plr->x, plr->y, plr->z); } diff --git a/src/TableData.cpp b/src/TableData.cpp index 27999ee..5181fc0 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -29,7 +29,7 @@ void TableData::init() { for (nlohmann::json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) { auto npc = _npc.value(); - BaseNPC *tmp = new BaseNPC(npc["x"], npc["y"], npc["z"], INSTANCE_OVERWORLD, npc["id"], nextId); + BaseNPC *tmp = new BaseNPC(npc["x"], npc["y"], npc["z"], npc["angle"], INSTANCE_OVERWORLD, npc["id"], nextId); NPCManager::NPCs[nextId] = tmp; NPCManager::updateNPCPosition(nextId, npc["x"], npc["y"], npc["z"]); @@ -181,7 +181,7 @@ void TableData::init() { for (nlohmann::json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) { auto npc = _npc.value(); auto td = NPCManager::NPCData[(int)npc["iNPCType"]]; - Mob *tmp = new Mob(npc["iX"], npc["iY"], npc["iZ"], INSTANCE_OVERWORLD, npc["iNPCType"], npc["iHP"], npc["iAngle"], td, nextId); + Mob *tmp = new Mob(npc["iX"], npc["iY"], npc["iZ"], npc["iAngle"], INSTANCE_OVERWORLD, npc["iNPCType"], npc["iHP"], td, nextId); NPCManager::NPCs[nextId] = tmp; MobManager::Mobs[nextId] = (Mob*)NPCManager::NPCs[nextId]; @@ -250,7 +250,7 @@ void TableData::loadPaths(int* nextId) { auto sliderPoint = _sliderPoint.value(); if (sliderPoint["stop"] && sliders % 2 == 0) { // check if this point in the circuit is a stop // spawn a slider - BaseNPC* slider = new BaseNPC(sliderPoint["iX"], sliderPoint["iY"], sliderPoint["iZ"], INSTANCE_OVERWORLD, 1, (*nextId)++, NPC_BUS); + BaseNPC* slider = new BaseNPC(sliderPoint["iX"], sliderPoint["iY"], sliderPoint["iZ"], 0, INSTANCE_OVERWORLD, 1, (*nextId)++, NPC_BUS); NPCManager::NPCs[slider->appearanceData.iNPC_ID] = slider; NPCManager::updateNPCPosition(slider->appearanceData.iNPC_ID, slider->appearanceData.iX, slider->appearanceData.iY, slider->appearanceData.iZ); // set slider path to a rotation of the circuit diff --git a/tdata b/tdata index f943077..b9a74bd 160000 --- a/tdata +++ b/tdata @@ -1 +1 @@ -Subproject commit f9430771644d21b2c7c350ab0cf46e27987e91f3 +Subproject commit b9a74bd8145f093b7fa8aef8b74191ac672d3dd2