mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
Make in range distance configurable
This commit is contained in:
parent
2f7a304303
commit
ebec29563f
6 changed files with 20 additions and 1 deletions
|
@ -10,6 +10,7 @@ HotSwap = true
|
||||||
ListenIp = 0.0.0.0
|
ListenIp = 0.0.0.0
|
||||||
ListenPort = 54992
|
ListenPort = 54992
|
||||||
DisconnectTimeout = 20
|
DisconnectTimeout = 20
|
||||||
|
InRangeDistance = 100.0
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
|
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace Sapphire::Common::Config
|
||||||
uint16_t listenPort;
|
uint16_t listenPort;
|
||||||
|
|
||||||
uint16_t disconnectTimeout;
|
uint16_t disconnectTimeout;
|
||||||
|
|
||||||
|
float inRangeDistance;
|
||||||
} network;
|
} network;
|
||||||
|
|
||||||
struct Housing
|
struct Housing
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
|
|
||||||
|
#include "ServerMgr.h"
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
@ -59,6 +61,10 @@ bool Sapphire::World::Manager::TerritoryMgr::init()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& cfg = framework()->get< World::ServerMgr >()->getConfig();
|
||||||
|
|
||||||
|
m_inRangeDistance = cfg.network.inRangeDistance;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,5 +590,9 @@ void Sapphire::World::Manager::TerritoryMgr::disableCurrentFestival()
|
||||||
setCurrentFestival( 0 );
|
setCurrentFestival( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Sapphire::World::Manager::TerritoryMgr::getInRangeDistance() const
|
||||||
|
{
|
||||||
|
return m_inRangeDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,8 @@ namespace Sapphire::World::Manager
|
||||||
*/
|
*/
|
||||||
const std::pair< uint16_t, uint16_t >& getCurrentFestival() const;
|
const std::pair< uint16_t, uint16_t >& getCurrentFestival() const;
|
||||||
|
|
||||||
|
float getInRangeDistance() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
||||||
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||||
|
@ -202,6 +204,9 @@ namespace Sapphire::World::Manager
|
||||||
/*! current festival(s) to set for public zones from festival.exd */
|
/*! current festival(s) to set for public zones from festival.exd */
|
||||||
std::pair< uint16_t, uint16_t > m_currentFestival;
|
std::pair< uint16_t, uint16_t > m_currentFestival;
|
||||||
|
|
||||||
|
/*! Max distance at which actors in range of a player are sent */
|
||||||
|
float m_inRangeDistance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*! returns a list of instanceContent InstanceIds currently active */
|
/*! returns a list of instanceContent InstanceIds currently active */
|
||||||
InstanceIdList getInstanceContentIdList( uint16_t instanceContentId ) const;
|
InstanceIdList getInstanceContentIdList( uint16_t instanceContentId ) const;
|
||||||
|
|
|
@ -101,6 +101,7 @@ bool Sapphire::World::ServerMgr::loadSettings( int32_t argc, char* argv[] )
|
||||||
m_config.network.disconnectTimeout = pConfig->getValue< uint16_t >( "Network", "DisconnectTimeout", 20 );
|
m_config.network.disconnectTimeout = pConfig->getValue< uint16_t >( "Network", "DisconnectTimeout", 20 );
|
||||||
m_config.network.listenIp = pConfig->getValue< std::string >( "Network", "ListenIp", "0.0.0.0" );
|
m_config.network.listenIp = pConfig->getValue< std::string >( "Network", "ListenIp", "0.0.0.0" );
|
||||||
m_config.network.listenPort = pConfig->getValue< uint16_t >( "Network", "ListenPort", 54992 );
|
m_config.network.listenPort = pConfig->getValue< uint16_t >( "Network", "ListenPort", 54992 );
|
||||||
|
m_config.network.inRangeDistance = pConfig->getValue< float >( "Network", "InRangeDistance", 100.f );
|
||||||
|
|
||||||
m_config.motd = pConfig->getValue< std::string >( "General", "MotD", "" );
|
m_config.motd = pConfig->getValue< std::string >( "General", "MotD", "" );
|
||||||
|
|
||||||
|
|
|
@ -645,7 +645,7 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
||||||
|
|
||||||
auto iter = pCell->m_actors.begin();
|
auto iter = pCell->m_actors.begin();
|
||||||
|
|
||||||
float fRange = 100.0f;
|
float fRange = pTeriMgr->getInRangeDistance();
|
||||||
int32_t count = 0;
|
int32_t count = 0;
|
||||||
while( iter != pCell->m_actors.end() )
|
while( iter != pCell->m_actors.end() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue