mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Misc changes.
The first two fixes were caught by infer. The Big Bug(tm) remains unfixed. * Fixed the Leech nano power * Fixed an unlikely nullptr dereference in ItemManager * /toggleai now makes mobs retreat immediately, instead of waiting for their next movement tick * Static path mobs will now stop in place instead of retreating to their spawn points when AI is disabled * Changed the misleading config option name from "chunksize" to "viewdistance", since it's actually only a third of the chunk size
This commit is contained in:
parent
6ee5e6d1ae
commit
5784e77654
@ -19,8 +19,9 @@ dbsaveinterval=240
|
|||||||
[shard]
|
[shard]
|
||||||
port=8002
|
port=8002
|
||||||
ip=127.0.0.1
|
ip=127.0.0.1
|
||||||
# distance at which other players and NPCs become visible
|
# distance at which other players and NPCs become visible.
|
||||||
chunksize=30000
|
# this value is used for calculating chunk size
|
||||||
|
viewdistance=30000
|
||||||
# time, in milliseconds, to wait before kicking a non-responsive client
|
# time, in milliseconds, to wait before kicking a non-responsive client
|
||||||
# default is 1 minute
|
# default is 1 minute
|
||||||
timeout=60000
|
timeout=60000
|
||||||
|
@ -279,12 +279,20 @@ void toggleAiCommand(std::string full, std::vector<std::string>& args, CNSocket*
|
|||||||
for (auto& pair : MobManager::Mobs) {
|
for (auto& pair : MobManager::Mobs) {
|
||||||
pair.second->state = MobState::RETREAT;
|
pair.second->state = MobState::RETREAT;
|
||||||
pair.second->target = nullptr;
|
pair.second->target = nullptr;
|
||||||
|
pair.second->nextMovement = getTime();
|
||||||
|
|
||||||
|
// mobs with static paths can chill where they are
|
||||||
|
if (pair.second->staticPath) {
|
||||||
|
pair.second->roamX = pair.second->appearanceData.iX;
|
||||||
|
pair.second->roamY = pair.second->appearanceData.iY;
|
||||||
|
pair.second->roamZ = pair.second->appearanceData.iZ;
|
||||||
|
} else {
|
||||||
pair.second->roamX = pair.second->spawnX;
|
pair.second->roamX = pair.second->spawnX;
|
||||||
pair.second->roamY = pair.second->spawnY;
|
pair.second->roamY = pair.second->spawnY;
|
||||||
pair.second->roamZ = pair.second->spawnZ;
|
pair.second->roamZ = pair.second->spawnZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void npcRotateCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
void npcRotateCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||||
PlayerView& plrv = PlayerManager::players[sock];
|
PlayerView& plrv = PlayerManager::players[sock];
|
||||||
|
@ -109,7 +109,7 @@ bool ChunkManager::checkChunk(std::tuple<int, int, int> chunk) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<int, int, int> ChunkManager::grabChunk(int posX, int posY, int instanceID) {
|
std::tuple<int, int, int> ChunkManager::grabChunk(int posX, int posY, int instanceID) {
|
||||||
return std::make_tuple(posX / (settings::CHUNKSIZE / 3), posY / (settings::CHUNKSIZE / 3), instanceID);
|
return std::make_tuple(posX / (settings::VIEWDISTANCE / 3), posY / (settings::VIEWDISTANCE / 3), instanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Chunk*> ChunkManager::grabChunks(std::tuple<int, int, int> chunk) {
|
std::vector<Chunk*> ChunkManager::grabChunks(std::tuple<int, int, int> chunk) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "NanoManager.hpp"
|
#include "NanoManager.hpp"
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
|
|
||||||
#include <string.h> // for memset() and memcmp()
|
#include <string.h> // for memset()
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
std::map<std::pair<int32_t, int32_t>, Item> ItemManager::ItemData;
|
std::map<std::pair<int32_t, int32_t>, Item> ItemManager::ItemData;
|
||||||
@ -911,6 +911,10 @@ void ItemManager::setItemStats(Player* plr) {
|
|||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
itemStatsDat = ItemManager::getItemData(plr->Equip[i].iID, plr->Equip[i].iType);
|
itemStatsDat = ItemManager::getItemData(plr->Equip[i].iID, plr->Equip[i].iType);
|
||||||
|
if (itemStatsDat == nullptr) {
|
||||||
|
std::cout << "[WARN] setItemStats(): getItemData() returned NULL" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
plr->pointDamage += itemStatsDat->pointDamage;
|
plr->pointDamage += itemStatsDat->pointDamage;
|
||||||
plr->groupDamage += itemStatsDat->groupDamage;
|
plr->groupDamage += itemStatsDat->groupDamage;
|
||||||
plr->defense += itemStatsDat->defense;
|
plr->defense += itemStatsDat->defense;
|
||||||
|
@ -625,8 +625,8 @@ void activePower(CNSocket *sock, CNPacketData *data,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pkt->iTargetCnt = otherPlr->groupCnt;
|
pkt->iTargetCnt = otherPlr->groupCnt;
|
||||||
}
|
resplen = sizeof(sP_FE2CL_NANO_SKILL_USE_SUCC) + pkt->iTargetCnt * sizeof(sPAYLOAD);
|
||||||
|
} else
|
||||||
resplen = sizeof(sP_FE2CL_NANO_SKILL_USE_SUCC) + pkt->iTargetCnt * sizeof(sPAYLOAD);
|
resplen = sizeof(sP_FE2CL_NANO_SKILL_USE_SUCC) + pkt->iTargetCnt * sizeof(sPAYLOAD);
|
||||||
|
|
||||||
// validate response packet
|
// validate response packet
|
||||||
|
@ -12,7 +12,7 @@ int settings::DBSAVEINTERVAL = 240;
|
|||||||
int settings::SHARDPORT = 8002;
|
int settings::SHARDPORT = 8002;
|
||||||
std::string settings::SHARDSERVERIP = "127.0.0.1";
|
std::string settings::SHARDSERVERIP = "127.0.0.1";
|
||||||
time_t settings::TIMEOUT = 60000;
|
time_t settings::TIMEOUT = 60000;
|
||||||
int settings::CHUNKSIZE = 40000;
|
int settings::VIEWDISTANCE = 40000;
|
||||||
bool settings::SIMULATEMOBS = true;
|
bool settings::SIMULATEMOBS = true;
|
||||||
|
|
||||||
// default spawn point is Sector V (future)
|
// default spawn point is Sector V (future)
|
||||||
@ -47,7 +47,7 @@ void settings::init() {
|
|||||||
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
|
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
|
||||||
DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL);
|
DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL);
|
||||||
TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT);
|
TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT);
|
||||||
CHUNKSIZE = reader.GetInteger("shard", "chunksize", CHUNKSIZE);
|
VIEWDISTANCE = reader.GetInteger("shard", "viewdistance", VIEWDISTANCE);
|
||||||
SIMULATEMOBS = reader.GetBoolean("shard", "simulatemobs", SIMULATEMOBS);
|
SIMULATEMOBS = reader.GetBoolean("shard", "simulatemobs", SIMULATEMOBS);
|
||||||
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
|
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
|
||||||
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
|
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
|
||||||
|
@ -8,7 +8,7 @@ namespace settings {
|
|||||||
extern int SHARDPORT;
|
extern int SHARDPORT;
|
||||||
extern std::string SHARDSERVERIP;
|
extern std::string SHARDSERVERIP;
|
||||||
extern time_t TIMEOUT;
|
extern time_t TIMEOUT;
|
||||||
extern int CHUNKSIZE;
|
extern int VIEWDISTANCE;
|
||||||
extern bool SIMULATEMOBS;
|
extern bool SIMULATEMOBS;
|
||||||
extern int SPAWN_X;
|
extern int SPAWN_X;
|
||||||
extern int SPAWN_Y;
|
extern int SPAWN_Y;
|
||||||
|
Loading…
Reference in New Issue
Block a user