]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Little off topic (fix spawnpoints attached to moving objects)
authorMario <mario@smbclan.net>
Wed, 14 Oct 2015 15:42:05 +0000 (01:42 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Oct 2015 15:42:05 +0000 (01:42 +1000)
qcsrc/client/main.qc
qcsrc/server/spawnpoints.qc

index 47bf7044ed72b398b8629661383c67e6abe32839..bcbe32bb9e6b189a90db26599f47aa1343a8ccdf 100644 (file)
@@ -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);
 }
index 05cadbc707490c20ad902821958713c54edfb1c7..c004215ab22edbb21b007c4c044e378b252e4072 100644 (file)
@@ -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;