]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add target_spawnpoint (allows setting temporary checkpoints)
authorMario <mario@smbclan.net>
Wed, 7 Feb 2018 15:10:25 +0000 (01:10 +1000)
committerMario <mario@smbclan.net>
Wed, 7 Feb 2018 15:10:25 +0000 (01:10 +1000)
qcsrc/common/triggers/target/_mod.inc
qcsrc/common/triggers/target/_mod.qh
qcsrc/common/triggers/target/include.qc
qcsrc/common/triggers/target/spawnpoint.qc [new file with mode: 0644]
qcsrc/common/triggers/target/spawnpoint.qh [new file with mode: 0644]
qcsrc/server/client.qc
qcsrc/server/spawnpoints.qc

index 34c02ba79418fbd2ee5f9d6d3d980c13ea0fcb2b..afd1050b90895d859885081645eff269dadef99a 100644 (file)
@@ -6,5 +6,6 @@
 #include <common/triggers/target/location.qc>
 #include <common/triggers/target/music.qc>
 #include <common/triggers/target/spawn.qc>
+#include <common/triggers/target/spawnpoint.qc>
 #include <common/triggers/target/speaker.qc>
 #include <common/triggers/target/voicescript.qc>
index c59ee797615bfbd03a753f28a37fb119924263ea..7c9fbeec5425b7f6e13bafce1102ed4744269da6 100644 (file)
@@ -6,5 +6,6 @@
 #include <common/triggers/target/location.qh>
 #include <common/triggers/target/music.qh>
 #include <common/triggers/target/spawn.qh>
+#include <common/triggers/target/spawnpoint.qh>
 #include <common/triggers/target/speaker.qh>
 #include <common/triggers/target/voicescript.qh>
index 4558b71bfcdfc519b97588b9a4f75bc114dad50f..a45c65ed05a6eceb86d9cb7c35b88e1569d1f754 100644 (file)
@@ -6,5 +6,6 @@
 #include "location.qc"
 #include "music.qc"
 #include "spawn.qc"
+#include "spawnpoint.qc"
 #include "speaker.qc"
 #include "voicescript.qc"
diff --git a/qcsrc/common/triggers/target/spawnpoint.qc b/qcsrc/common/triggers/target/spawnpoint.qc
new file mode 100644 (file)
index 0000000..fe15385
--- /dev/null
@@ -0,0 +1,24 @@
+#include "spawnpoint.qh"
+
+#ifdef SVQC
+void target_spawnpoint_use(entity this, entity actor, entity trigger)
+{
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
+       actor.spawnpoint_targ = this;
+}
+
+void target_spawnpoint_reset(entity this)
+{
+       this.active = ACTIVE_ACTIVE;
+}
+
+// TODO: persistent spawnflag?
+spawnfunc(target_spawnpoint)
+{
+       this.active = ACTIVE_ACTIVE;
+       this.use = target_spawnpoint_use;
+       this.reset = target_spawnpoint_reset;
+}
+#endif
diff --git a/qcsrc/common/triggers/target/spawnpoint.qh b/qcsrc/common/triggers/target/spawnpoint.qh
new file mode 100644 (file)
index 0000000..2eeb8da
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#ifdef SVQC
+.entity spawnpoint_targ;
+#endif
index 3d5877f6b0f0afc7247b0e4643169edfffbfbccd..4159f0bb4bfddbbf35513ceecef0d6ab0b774c3c 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "../common/triggers/func/conveyor.qh"
 #include "../common/triggers/teleporters.qh"
+#include "../common/triggers/target/spawnpoint.qh"
 
 #include "../common/vehicles/all.qh"
 
@@ -354,6 +355,8 @@ void PutObserverInServer(entity this)
 
        this.viewloc = NULL;
 
+       //this.spawnpoint_targ = NULL; // keep it so they can return to where they were?
+
        this.weaponmodel = "";
        for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
@@ -637,6 +640,8 @@ void PutPlayerInServer(entity this)
 
        this.viewloc = NULL;
 
+       this.spawnpoint_targ = NULL;
+
        this.crouch = false;
        this.view_ofs = STAT(PL_VIEW_OFS, this);
        setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
index cd393b64196a1cbab9f0128623f3ef8be7adc612..b6bbc3f51ca217dd5238ade151b31c2fa79040ca 100644 (file)
@@ -341,6 +341,9 @@ entity SelectSpawnPoint(entity this, bool anypoint)
        if (spot)
                return spot;
 
+       if(this.spawnpoint_targ)
+               return this.spawnpoint_targ;
+
        if(anypoint || autocvar_g_spawn_useallspawns)
                teamcheck = -1;
        else if(have_team_spawns > 0)