From: Freddy Date: Tue, 1 Nov 2016 15:03:40 +0000 (+0100) Subject: Also let the first target of func_train be random X-Git-Tag: xonotic-v0.8.2~457^2~3 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=5a2b6d85ab21c27bd9f0e501de25ab2d007bff67 Also let the first target of func_train be random For this to work, the func_train entity needs to have .target_random set initially --- diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index b7407c3ec..161c03374 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -62,11 +62,8 @@ void train_wait(entity this) } } -void train_next(entity this) +entity train_next_find(entity this) { - entity targ = NULL, cp = NULL; - vector cp_org = '0 0 0'; - if(this.target_random) { RandomSelection_Init(); @@ -74,12 +71,20 @@ void train_next(entity this) { RandomSelection_AddEnt(t, 1, 0); } - targ = RandomSelection_chosen_ent; + return = RandomSelection_chosen_ent; } else { - targ = find(NULL, targetname, this.target); + return find(NULL, targetname, this.target); } +} + +void train_next(entity this) +{ + entity targ = NULL, cp = NULL; + vector cp_org = '0 0 0'; + + targ = train_next_find(this); this.target = targ.target; this.target_random = targ.target_random; @@ -201,8 +206,7 @@ void train_use(entity this, entity actor, entity trigger) void func_train_find(entity this) { - entity targ; - targ = find(NULL, targetname, this.target); + entity targ = train_next_find(this); this.target = targ.target; this.target_random = targ.target_random; if (this.target == "")