stemp = self;
otemp = other;
+ if(stemp.target_random)
+ RandomSelection_Init();
+
for(i = 0; i < 4; ++i)
{
switch(i)
for(t = world; (t = find(t, targetname, s)); )
if(t.use)
{
- //print(stemp.classname, " ", stemp.targetname, " -> ", t.classname, " ", t.targetname, "\n");
- self = t;
- other = stemp;
- activator = act;
- self.use();
+ if(stemp.target_random)
+ {
+ RandomSelection_Add(t, 0, string_null, 1, 0);
+ }
+ else
+ {
+ self = t;
+ other = stemp;
+ activator = act;
+ self.use();
+ }
}
}
}
+ if(stemp.target_random && RandomSelection_chosen_ent)
+ {
+ self = RandomSelection_chosen_ent;
+ other = stemp;
+ activator = act;
+ self.use();
+ }
+
activator = act;
self = stemp;
other = otemp;
self.reset = counter_reset;
};
+void trigger_hurt_use()
+{
+ if(activator.classname == "player")
+ self.enemy = activator;
+ else
+ self.enemy = world; // let's just destroy it, if taking over is too much work
+}
+
.float triggerhurttime;
void trigger_hurt_touch()
{
{
EXACTTRIGGER_TOUCH;
other.triggerhurttime = time + 1;
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+
+ entity own;
+ own = self.enemy;
+ if(own.classname != "player")
+ {
+ own = self;
+ self.enemy = world; // I still hate you all
+ }
+
+ Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
}
}
else
EXACTTRIGGER_INIT;
self.active = ACTIVE_ACTIVE;
self.touch = trigger_hurt_touch;
+ self.use = trigger_hurt_use;
+ self.enemy = world; // I hate you all
if (!self.dmg)
self.dmg = 1000;
if (!self.message)
attach_sameorigin(dst, src, self.message);
}
+ dst.solid = SOLID_NOT; // solid doesn't work with attachment
remove(self);
}
else