From 1ac0b3a7953e7eaee19cb8988ff9d62cf267a0c9 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 15 Oct 2015 01:42:05 +1000 Subject: [PATCH] Little off topic (fix spawnpoints attached to moving objects) --- qcsrc/client/main.qc | 8 ++++---- qcsrc/server/spawnpoints.qc | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 47bf7044e..bcbe32bb9 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -679,11 +679,11 @@ void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint spn_origin.y = ReadShort(); spn_origin.z = ReadShort(); - if(is_new) - { + //if(is_new) + //{ self.origin = spn_origin; setsize(self, PL_MIN_CONST, PL_MAX_CONST); - droptofloor(); + //droptofloor(); /*if(autocvar_cl_spawn_point_model) // needs a model first { @@ -712,7 +712,7 @@ void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint self.draw = Spawn_Draw; } - } + //} //printf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(self.origin), teamnum, self.cnt); } diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 05cadbc70..c004215ab 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -14,6 +14,8 @@ bool SpawnPoint_Send(entity this, entity to, int sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); + print("Sending spawnpoint\n"); + WriteByte(MSG_ENTITY, self.team); WriteShort(MSG_ENTITY, self.origin.x); WriteShort(MSG_ENTITY, self.origin.y); @@ -46,6 +48,17 @@ bool SpawnEvent_Send(entity this, entity to, int sf) return send; } +.vector spawnpoint_prevorigin; +void spawnpoint_think() +{ + self.nextthink = time + 0.1; + if(self.origin != self.spawnpoint_prevorigin) + { + self.spawnpoint_prevorigin = self.origin; + self.SendFlags |= 1; + } +} + void spawnpoint_use() {SELFPARAM(); if(teamplay) @@ -91,6 +104,8 @@ void relocate_spawnpoint() } self.use = spawnpoint_use; + self.think = spawnpoint_think; + self.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second self.team_saved = self.team; if (!self.cnt) self.cnt = 1; -- 2.39.2