From f4749cc5a56425d462e421a980730eea4e8b8031 Mon Sep 17 00:00:00 2001 From: savagex Date: Fri, 18 May 2007 12:15:31 +0000 Subject: [PATCH] rename entities according to convention, introduce target_objective_decrease that if triggered decreases the health of targeted entities (that'd be target_objective entities) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@2590 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/assault.qc | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/data/qcsrc/server/assault.qc b/data/qcsrc/server/assault.qc index 7776e1677..0eff237d7 100644 --- a/data/qcsrc/server/assault.qc +++ b/data/qcsrc/server/assault.qc @@ -41,13 +41,33 @@ void assault_objective_think() { } -void func_objective() { - self.classname = "func_objective"; +void target_objective() { + self.classname = "target_objective"; self.think = assault_objective_think; self.use = assault_objective_use; assault_objective_reset(); } +// decrease the health of targeted objectives +void assault_objective_decrease() { + + local entity ent; + local entity oldself; + ent = find(world, targetname, self.target); + while(ent) { + ent.health = ent.health - self.dmg; + ent = find(ent, targetname, self.target); + } +} + +// this entity should target an objective and be targeted by triggers +void target_objective_decrease() { + if(!self.dmg) { + self.dmg = 101; + } + self.use = assault_objective_decrease; +} + // trigger new round // reset objectives, toggle spawnpoints, reset triggers, ... void assault_new_round() { @@ -76,7 +96,7 @@ void assault_new_round() { // reset all objectives - ent = find(world, classname, "func_objective"); + ent = find(world, classname, "target_objective"); while (ent) { oldself = self; @@ -84,15 +104,15 @@ void assault_new_round() { assault_objective_reset(); self = oldself; - ent = find(ent, classname, "func_objective"); + ent = find(ent, classname, "target_objective"); } // actually restart round... how to do that? } -void func_assault_roundend() { +void target_assault_roundend() { self.cnt = 0; // round counter - self.classname = "func_assault_roundend"; + self.classname = "target_assault_roundend"; self.use = assault_new_round; } -- 2.39.2