mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-23 03:40:05 +00:00
Load NPC angles from NPCs.json.
This commit is contained in:
parent
3586b76888
commit
6ee5e6d1ae
@ -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"];
|
||||
}
|
||||
|
@ -12,13 +12,13 @@ public:
|
||||
std::vector<Chunk*> 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;
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
2
tdata
2
tdata
@ -1 +1 @@
|
||||
Subproject commit f9430771644d21b2c7c350ab0cf46e27987e91f3
|
||||
Subproject commit b9a74bd8145f093b7fa8aef8b74191ac672d3dd2
|
Loading…
Reference in New Issue
Block a user