Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/netserver.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index 9fb5f78..467be4d 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -28,6 +28,7 @@
#include "core/cvar.h"
#include "core/func.h"
#include "core/core.h"
+#include "core/range.h"
#include "core/stats.h"
#include "core/zone.h"
@@ -366,6 +367,14 @@ void NetServer::client_frame(NetClient *client, unsigned long timestamp)
} else {
// send a server frame marker
send_frame_marker(client, server()->timer().timestamp());
+
+ // client location for server-side distance checks
+ math::Vector3f location;
+ if (client->player()->control()) {
+ location.assign(client->player()->control()->location());
+ } else if (client->player()->view()) {
+ location.assign(client->player()->view()->location());
+ }
// send updates for entities in the zone
for (Entity::Registry::iterator it = Entity::registry().begin(); it != Entity::registry().end(); it++) {
@@ -377,7 +386,9 @@ void NetServer::client_frame(NetClient *client, unsigned long timestamp)
send_entity_delete(client, entity);
}
} else if (entity->entity_created) {
- send_entity_create(client, entity);
+ if ((entity->type() != Entity::Projectile) || (math::distance(location, entity->location()) < range::fxdistance)) {
+ send_entity_create(client, entity);
+ }
} else if (entity->oldzone()) {
// this entity has entered the zone