X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Ftarget_spawn.qc;h=4da6b13bbbb948060ec40541307eeffddf84be95;hp=e04e2cad88f5cb33bd2639ff3f56df2593ccbdbf;hb=d91906e1bb6225cd68269812a6d2b4314e23fcdb;hpb=d6868c29436f076daf3e6c68e893d947ace437ff diff --git a/qcsrc/server/target_spawn.qc b/qcsrc/server/target_spawn.qc index e04e2cad8..4da6b13bb 100644 --- a/qcsrc/server/target_spawn.qc +++ b/qcsrc/server/target_spawn.qc @@ -22,7 +22,7 @@ void target_spawn_helper_setsize() setsize(self, self.mins, self.maxs); } -void target_spawn_useon(entity e) +void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act) { float i, n, valuefieldpos; string key, value, valuefield, valueoffset, valueoffsetrandom; @@ -30,15 +30,8 @@ void target_spawn_useon(entity e) vector data, data2; entity oldself; entity oldactivator; - entity kt, t2, t3, t4; - - n = tokenize_console(self.message); - self.target_spawn_activator = activator; - kt = find(world, targetname, self.killtarget); - t2 = find(world, targetname, self.target2); - t3 = find(world, targetname, self.target3); - t4 = find(world, targetname, self.target4); + n = tokenize_console(msg); for(i = 0; i < n-1; i += 2) { @@ -101,7 +94,7 @@ void target_spawn_useon(entity e) } else if(value == "activator") { - valueent = activator; + valueent = act; value = ""; } else if(value == "other") @@ -111,8 +104,8 @@ void target_spawn_useon(entity e) } else if(value == "pusher") { - if(time < activator.pushltime) - valueent = activator.pusher; + if(time < act.pushltime) + valueent = act.pusher; else valueent = world; value = ""; @@ -221,7 +214,7 @@ void target_spawn_useon(entity e) oldactivator = activator; self = e; - activator = oldself.target_spawn_activator; + activator = act; self.target_spawn_spawnfunc(); @@ -237,6 +230,20 @@ void target_spawn_useon(entity e) } } +void target_spawn_useon(entity e) +{ + self.target_spawn_activator = activator; + target_spawn_edit_entity( + e, + self.message, + find(world, targetname, self.killtarget), + find(world, targetname, self.target2), + find(world, targetname, self.target3), + find(world, targetname, self.target4), + activator + ); +} + float target_spawn_cancreate() { float c; @@ -249,7 +256,7 @@ float target_spawn_cancreate() ++c; // increase count to not include MYSELF for(e = world; (e = findfloat(e, target_spawn_id, self.target_spawn_id)); --c) ; - + // if c now is 0, we have AT LEAST the given count (maybe more), so don't spawn any more if(c == 0) return 0;