mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Decoupled player and NPC view distance.
This commit is contained in:
parent
3e5101892b
commit
4178945abe
@ -18,7 +18,8 @@ randomcharacters=true
|
|||||||
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
|
||||||
view=20000
|
playerdistance=20000
|
||||||
|
npcdistance=16000
|
||||||
# little message players see when they enter the game
|
# little message players see when they enter the game
|
||||||
motd=Welcome to OpenFusion!
|
motd=Welcome to OpenFusion!
|
||||||
# NPC json data
|
# NPC json data
|
||||||
|
@ -86,7 +86,7 @@ void NPCManager::updatePlayerNPCS(CNSocket* sock, PlayerView& view) {
|
|||||||
int diffX = abs(view.plr->x - pair.second.appearanceData.iX);
|
int diffX = abs(view.plr->x - pair.second.appearanceData.iX);
|
||||||
int diffY = abs(view.plr->y - pair.second.appearanceData.iY);
|
int diffY = abs(view.plr->y - pair.second.appearanceData.iY);
|
||||||
|
|
||||||
if (diffX < settings::VIEWDISTANCE && diffY < settings::VIEWDISTANCE) {
|
if (diffX < settings::NPCDISTANCE && diffY < settings::NPCDISTANCE) {
|
||||||
yesView.push_back(pair.first);
|
yesView.push_back(pair.first);
|
||||||
} else {
|
} else {
|
||||||
noView.push_back(pair.first);
|
noView.push_back(pair.first);
|
||||||
|
@ -85,7 +85,7 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z) {
|
|||||||
int diffX = abs(pair.second.plr->x - X); // the map is like a grid, X and Y are your position on the map, Z is the height. very different from other games...
|
int diffX = abs(pair.second.plr->x - X); // the map is like a grid, X and Y are your position on the map, Z is the height. very different from other games...
|
||||||
int diffY = abs(pair.second.plr->y - Y);
|
int diffY = abs(pair.second.plr->y - Y);
|
||||||
|
|
||||||
if (diffX < settings::VIEWDISTANCE && diffY < settings::VIEWDISTANCE) {
|
if (diffX < settings::PLAYERDISTANCE && diffY < settings::PLAYERDISTANCE) {
|
||||||
yesView.push_back(pair.first);
|
yesView.push_back(pair.first);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -10,7 +10,8 @@ bool settings::LOGINRANDCHARACTERS = false;
|
|||||||
|
|
||||||
int settings::SHARDPORT = 8002;
|
int settings::SHARDPORT = 8002;
|
||||||
std::string settings::SHARDSERVERIP = "127.0.0.1";
|
std::string settings::SHARDSERVERIP = "127.0.0.1";
|
||||||
int settings::VIEWDISTANCE = 20000;
|
int settings::PLAYERDISTANCE = 20000;
|
||||||
|
int settings::NPCDISTANCE = 16000;
|
||||||
|
|
||||||
// default spawn point is city hall
|
// default spawn point is city hall
|
||||||
int settings::SPAWN_X = 179213;
|
int settings::SPAWN_X = 179213;
|
||||||
@ -39,7 +40,8 @@ void settings::init() {
|
|||||||
LOGINRANDCHARACTERS = reader.GetBoolean("login", "randomcharacters", LOGINRANDCHARACTERS);
|
LOGINRANDCHARACTERS = reader.GetBoolean("login", "randomcharacters", LOGINRANDCHARACTERS);
|
||||||
SHARDPORT = reader.GetInteger("shard", "port", SHARDPORT);
|
SHARDPORT = reader.GetInteger("shard", "port", SHARDPORT);
|
||||||
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
|
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
|
||||||
VIEWDISTANCE = reader.GetInteger("shard", "view", VIEWDISTANCE);
|
PLAYERDISTANCE = reader.GetInteger("shard", "playerdistance", PLAYERDISTANCE);
|
||||||
|
NPCDISTANCE = reader.GetInteger("shard", "npcdistance", NPCDISTANCE);
|
||||||
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);
|
||||||
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);
|
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);
|
||||||
|
@ -6,7 +6,8 @@ namespace settings {
|
|||||||
extern bool LOGINRANDCHARACTERS;
|
extern bool LOGINRANDCHARACTERS;
|
||||||
extern int SHARDPORT;
|
extern int SHARDPORT;
|
||||||
extern std::string SHARDSERVERIP;
|
extern std::string SHARDSERVERIP;
|
||||||
extern int VIEWDISTANCE;
|
extern int PLAYERDISTANCE;
|
||||||
|
extern int NPCDISTANCE;
|
||||||
extern int SPAWN_X;
|
extern int SPAWN_X;
|
||||||
extern int SPAWN_Y;
|
extern int SPAWN_Y;
|
||||||
extern int SPAWN_Z;
|
extern int SPAWN_Z;
|
||||||
|
Loading…
Reference in New Issue
Block a user