if (this.count < 0)
return;
+ bool doactivate = (this.spawnflags & 4);
+
if (this.count == 0)
{
if(IS_PLAYER(actor) && !(this.spawnflags & SPAWNFLAG_NOMESSAGE))
Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COMPLETED);
- SUB_UseTargets(this, actor, trigger);
+ doactivate = true;
if(this.respawntime)
{
Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, this.count);
}
}
+
+ if(doactivate)
+ SUB_UseTargets(this, actor, trigger);
}
void counter_reset(entity this)
#include "delay.qh"
#ifdef SVQC
+void delay_delayeduse(entity this)
+{
+ SUB_UseTargets(this, this.enemy, this.goalentity);
+ this.enemy = this.goalentity = NULL;
+}
+
void delay_use(entity this, entity actor, entity trigger)
{
- setthink(this, SUB_UseTargets_self);
- this.nextthink = time + this.wait;
+ this.enemy = actor;
+ this.goalentity = trigger;
+ setthink(this, delay_delayeduse);
+ this.nextthink = time + this.wait;
}
void delay_reset(entity this)
{
+ this.enemy = this.goalentity = NULL;
setthink(this, func_null);
this.nextthink = 0;
}
bool is_trigger = !boolean(!this.nottargeted && this.targetname != "");
if(is_trigger)
EXACTTRIGGER_TOUCH(this, toucher);
- toucher.triggerhealtime = time + 1;
+ toucher.triggerhealtime = time + this.delay;
bool playthesound = (this.spawnflags & 4);
if (toucher.health < this.max_health)
trigger_heal_touch(this, actor);
}
-spawnfunc(trigger_heal)
+void trigger_heal_init(entity this)
{
this.active = ACTIVE_ACTIVE;
-
- EXACTTRIGGER_INIT;
- settouch(this, trigger_heal_touch);
- if (!this.health)
+ if(!this.delay)
+ this.delay = 1;
+ if(!this.health)
this.health = 10;
- if (!this.max_health)
- this.max_health = 200; //Max health topoff for field
+ if(!this.max_health)
+ this.max_health = 200; // max health topoff for field
if(this.noise == "")
this.noise = "misc/mediumhealth.wav";
precache_sound(this.noise);
}
+spawnfunc(trigger_heal)
+{
+ EXACTTRIGGER_INIT;
+ settouch(this, trigger_heal_touch);
+ trigger_heal_init(this);
+}
+
spawnfunc(target_heal)
{
- this.active = ACTIVE_ACTIVE;
this.use = trigger_heal_use;
- if (!this.health)
- this.health = 10;
- if (!this.max_health)
- this.max_health = 200; //Max health topoff for field
- if(this.noise == "")
- this.noise = "misc/mediumhealth.wav";
- precache_sound(this.noise);
+ trigger_heal_init(this);
}
#endif
void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false); }
void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true); }
-
-void SUB_UseTargets_self(entity this)
-{
- SUB_UseTargets(this, NULL, NULL);
-}