1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00

Make in range distance configurable

This commit is contained in:
NotAdam 2019-01-28 20:48:33 +11:00
parent 2f7a304303
commit ebec29563f
6 changed files with 20 additions and 1 deletions

View file

@ -10,6 +10,7 @@ HotSwap = true
ListenIp = 0.0.0.0
ListenPort = 54992
DisconnectTimeout = 20
InRangeDistance = 100.0
[General]
; Sent on login - each line must be shorter than 307 characters, split lines with ';'

View file

@ -44,6 +44,8 @@ namespace Sapphire::Common::Config
uint16_t listenPort;
uint16_t disconnectTimeout;
float inRangeDistance;
} network;
struct Housing

View file

@ -2,6 +2,8 @@
#include <Database/DatabaseDef.h>
#include <Exd/ExdDataGenerated.h>
#include "ServerMgr.h"
#include <unordered_map>
#include "Actor/Player.h"
@ -59,6 +61,10 @@ bool Sapphire::World::Manager::TerritoryMgr::init()
return false;
}
auto& cfg = framework()->get< World::ServerMgr >()->getConfig();
m_inRangeDistance = cfg.network.inRangeDistance;
return true;
}
@ -584,5 +590,9 @@ void Sapphire::World::Manager::TerritoryMgr::disableCurrentFestival()
setCurrentFestival( 0 );
}
float Sapphire::World::Manager::TerritoryMgr::getInRangeDistance() const
{
return m_inRangeDistance;
}

View file

@ -155,6 +155,8 @@ namespace Sapphire::World::Manager
*/
const std::pair< uint16_t, uint16_t >& getCurrentFestival() const;
float getInRangeDistance() const;
private:
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
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 */
std::pair< uint16_t, uint16_t > m_currentFestival;
/*! Max distance at which actors in range of a player are sent */
float m_inRangeDistance;
public:
/*! returns a list of instanceContent InstanceIds currently active */
InstanceIdList getInstanceContentIdList( uint16_t instanceContentId ) const;

View file

@ -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.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.inRangeDistance = pConfig->getValue< float >( "Network", "InRangeDistance", 100.f );
m_config.motd = pConfig->getValue< std::string >( "General", "MotD", "" );

View file

@ -645,7 +645,7 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
auto iter = pCell->m_actors.begin();
float fRange = 100.0f;
float fRange = pTeriMgr->getInRangeDistance();
int32_t count = 0;
while( iter != pCell->m_actors.end() )
{