]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/spawnpoints.qc
Little off topic (fix spawnpoints attached to moving objects)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / spawnpoints.qc
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;