From: Mario Date: Wed, 14 Oct 2015 15:42:05 +0000 (+1000) Subject: Little off topic (fix spawnpoints attached to moving objects) X-Git-Tag: xonotic-v0.8.2~1801^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1ac0b3a7953e7eaee19cb8988ff9d62cf267a0c9;p=xonotic%2Fxonotic-data.pk3dir.git Little off topic (fix spawnpoints attached to moving objects) --- 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;