From: Mario Date: Wed, 7 Feb 2018 15:10:25 +0000 (+1000) Subject: Add target_spawnpoint (allows setting temporary checkpoints) X-Git-Tag: xonotic-v0.8.5~2342 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=a3f256a0abdd73217621c9fa6d81bdc03019a545;p=xonotic%2Fxonotic-data.pk3dir.git Add target_spawnpoint (allows setting temporary checkpoints) --- diff --git a/qcsrc/common/triggers/target/_mod.inc b/qcsrc/common/triggers/target/_mod.inc index 34c02ba79..afd1050b9 100644 --- a/qcsrc/common/triggers/target/_mod.inc +++ b/qcsrc/common/triggers/target/_mod.inc @@ -6,5 +6,6 @@ #include #include #include +#include #include #include diff --git a/qcsrc/common/triggers/target/_mod.qh b/qcsrc/common/triggers/target/_mod.qh index c59ee7976..7c9fbeec5 100644 --- a/qcsrc/common/triggers/target/_mod.qh +++ b/qcsrc/common/triggers/target/_mod.qh @@ -6,5 +6,6 @@ #include #include #include +#include #include #include diff --git a/qcsrc/common/triggers/target/include.qc b/qcsrc/common/triggers/target/include.qc index 4558b71bf..a45c65ed0 100644 --- a/qcsrc/common/triggers/target/include.qc +++ b/qcsrc/common/triggers/target/include.qc @@ -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 index 000000000..fe1538551 --- /dev/null +++ b/qcsrc/common/triggers/target/spawnpoint.qc @@ -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 index 000000000..2eeb8da62 --- /dev/null +++ b/qcsrc/common/triggers/target/spawnpoint.qh @@ -0,0 +1,5 @@ +#pragma once + +#ifdef SVQC +.entity spawnpoint_targ; +#endif diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 3d5877f6b..4159f0bb4 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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)); diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index cd393b641..b6bbc3f51 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -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)