From 1b2ffa5dd7ef6a029c3bb85f1b1c195b9cc5cc42 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 16 Oct 2008 10:44:32 +0000 Subject: [PATCH] allow target_spawn to edit entities too git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4764 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/target_spawn.qc | 22 +++++++++++++++++++--- data/scripts/entities.def | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/data/qcsrc/server/target_spawn.qc b/data/qcsrc/server/target_spawn.qc index f40ae508a..b2e2dd564 100644 --- a/data/qcsrc/server/target_spawn.qc +++ b/data/qcsrc/server/target_spawn.qc @@ -10,17 +10,15 @@ float target_spawn_initialized; float target_spawn_spawnfunc_field; .entity target_spawn_activator; -void target_spawn_use() +void target_spawn_useon(entity e) { float i, n, valuefieldpos, sPWNed; - entity e; string key, value, valuefield, valueoffset, valueoffsetrandom; entity valueent; vector data, data2; entity oldself; entity oldactivator; - e = spawn(); n = tokenize_sane(self.message); sPWNed = FALSE; @@ -183,6 +181,24 @@ void target_spawn_use() } } +void target_spawn_use() +{ + entity e; + + if(self.target == "") + { + // spawn new entity + e = spawn(); + target_spawn_useon(e); + } + else + { + // edit entity + for(e = world; (e = find(e, targetname, self.target)); ) + target_spawn_useon(e); + } +} + void target_spawn_spawnfirst() { activator = self.target_spawn_activator; diff --git a/data/scripts/entities.def b/data/scripts/entities.def index 5601f9a5a..889234ae5 100644 --- a/data/scripts/entities.def +++ b/data/scripts/entities.def @@ -1100,6 +1100,7 @@ Example is a Mario-style question mark block which could throw a new weapon_nex -------- KEYS -------- targetname: used to trigger this message: entity field list +target: when set, target_spawn edits entities, instead of creating new ones -------- SPAWNFLAGS -------- SPAWNFUNC: call the spawn function when the "classname" key is mentioned in the fields list ONLOAD: create a first entity on map load -- 2.39.2