From: Mario Date: Wed, 31 Jul 2024 04:47:11 +0000 (+1000) Subject: Add basic relay activation support to spawn points X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d2f878ec7424c31d4f005793b4be0383db51d892;p=xonotic%2Fxonotic-data.pk3dir.git Add basic relay activation support to spawn points --- diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 0a4ee0c2b..19f03f010 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -75,6 +75,27 @@ void spawnpoint_use(entity this, entity actor, entity trigger) //LOG_INFO("spawnpoint was used!\n"); } +bool spawnpoint_customize(entity this, entity client) +{ + return (this.active == ACTIVE_ACTIVE); +} + +void spawnpoint_setactive(entity this, int act) +{ + int old_status = this.active; + if(act == ACTIVE_TOGGLE) + this.active = (this.active == ACTIVE_ACTIVE) ? ACTIVE_NOT : ACTIVE_ACTIVE; + else + this.active = act; + + if(this.active != old_status) + { + // mappers may attempt to let players disable enemy spawns + if(teamplay && have_team_spawns > 0) + some_spawn_has_been_used = true; + this.SendFlags |= 1; + } +} void spawnpoint_reset(entity this) { this.SendFlags |= 1; // update team since it was restored during reset @@ -125,6 +146,9 @@ void relocate_spawnpoint(entity this) } } + this.active = ACTIVE_ACTIVE; + this.setactive = spawnpoint_setactive; + setcefc(this, spawnpoint_customize); this.use = spawnpoint_use; setthink(this, spawnpoint_think); this.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second @@ -222,6 +246,9 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck, boo if(!spot.target || spot.target == "") return '-1 0 0'; + if(spot.active != ACTIVE_ACTIVE && targetcheck) + return '-1 0 0'; + if(IS_REAL_CLIENT(this)) { if(spot.restriction == 1)