#define ACTIVE_TOGGLE 3
.float active;
.float (float act_state) setactive;
-=======
.entity realowner;
.float triggerhurttime;
void trigger_hurt_touch()
{
+ if (self.active != ACTIVE_ACTIVE)
+ return;
+
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
if (other.iscreature)
{
void spawnfunc_trigger_hurt()
{
EXACTTRIGGER_INIT;
+ self.active = ACTIVE_ACTIVE;
self.touch = trigger_hurt_touch;
if (!self.dmg)
self.dmg = 1000;
.float triggerhealtime;
void trigger_heal_touch()
{
+ if (self.active != ACTIVE_ACTIVE)
+ return;
+
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
if (other.iscreature)
{
void spawnfunc_trigger_heal()
{
+ self.active = ACTIVE_ACTIVE;
+
EXACTTRIGGER_INIT;
self.touch = trigger_heal_touch;
if (!self.health)
float pushdeltatime;
float str;
+ if (self.active != ACTIVE_ACTIVE)
+ return;
+
// FIXME: Better checking for what to push and not.
if not(other.iscreature)
if (other.classname != "corpse")
{
float pushdeltatime;
+ if (self.active != ACTIVE_ACTIVE)
+ return;
+
// FIXME: Better checking for what to push and not.
if not(other.iscreature)
if (other.classname != "corpse")
float pushdeltatime;
float str;
+ if (self.active != ACTIVE_ACTIVE)
+ return;
+
// FIXME: Better checking for what to push and not.
if not(other.iscreature)
if (other.classname != "corpse")
void spawnfunc_trigger_impulse()
{
+ self.active = ACTIVE_ACTIVE;
+
EXACTTRIGGER_INIT;
if(self.radius)
{
// what to trigger
}
-void relay_activateors_use()
+void relay_activators_use()
{
entity trg, os;
trg.setactive(os.cnt);
else
{
+ bprint("Not using setactive\n");
if(os.cnt == ACTIVE_TOGGLE)
- if(trg.active)
+ if(trg.active == ACTIVE_ACTIVE)
trg.active = ACTIVE_NOT;
else
trg.active = ACTIVE_ACTIVE;
void spawnfunc_relay_activate()
{
self.cnt = ACTIVE_ACTIVE;
- self.use = relay_activateors_use;
+ self.use = relay_activators_use;
}
void spawnfunc_relay_deactivate()
{
self.cnt = ACTIVE_NOT;
- self.use = relay_activateors_use;
+ self.use = relay_activators_use;
}
void spawnfunc_relay_activatetoggle()
{
self.cnt = ACTIVE_TOGGLE;
- self.use = relay_activateors_use;
+ self.use = relay_activators_use;
}
}
};
-void trigger_push_setactive(float astate)
-{
- self.active = astate;
-
- if(astate == ACTIVE_NOT)
- self.touch = SUB_Null;
- else if (astate == ACTIVE_TOGGLE)
- {
- if(self.active)
- self.active = ACTIVE_NOT;
- else
- self.active = ACTIVE_ACTIVE;
- }
- else
- self.touch = trigger_push_touch;
-}
-
-
-
.vector dest;
void trigger_push_findtarget()
{
EXACTTRIGGER_INIT;
self.active = ACTIVE_ACTIVE;
- self.setactive = trigger_push_setactive;
self.use = trigger_push_use;
self.touch = trigger_push_touch;
{
if (astate == ACTIVE_TOGGLE)
- {
- if(self.active)
+ {
+ if(self.active == ACTIVE_ACTIVE)
self.active = ACTIVE_NOT;
else
self.active = ACTIVE_ACTIVE;
else
self.active = astate;
- if(astate == ACTIVE_NOT)
+ if(self.active == ACTIVE_NOT)
self.avelocity = '0 0 0';
else
self.avelocity = self.pos1;
{
local vector v;
self.nextthink = time + 0.1;
+
+ if not (self.owner.active == ACTIVE_ACTIVE)
+ {
+ self.owner.velocity = '0 0 0';
+ return;
+ }
+
// calculate sinewave using makevectors
makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
v = self.owner.destvec + self.owner.movedir * v_forward_y;
// time scale to get degrees
self.cnt = 360 / self.speed;
+ self.active = ACTIVE_ACTIVE;
+
// damage when blocked
self.blocked = bobbing_blocked;
if(self.dmg & (!self.message))
// dprint(activator.classname);
// dprint(" triggered a button\n");
// }
+
+ if not (self.active == ACTIVE_ACTIVE)
+ return;
+
self.enemy = activator;
button_fire ();
};
if(self.noise != "")
precache_sound(self.noise);
+ self.active = ACTIVE_ACTIVE;
+
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
self.flags |= FL_NOTARGET;
float n, i, t;
self.nextthink = time + 0.1;
+ if not (self.owner.active == ACTIVE_ACTIVE)
+ {
+ self.owner.velocity = '0 0 0';
+ return;
+ }
+
n = floor((tokenize_console(self.owner.netname)) / 5);
t = self.nextthink * self.owner.cnt + self.owner.phase * 360;
if not(InitMovingBrushTrigger())
return;
+ self.active = ACTIVE_ACTIVE;
+
// wait for targets to spawn
controller = spawn();
controller.classname = "func_fourier_controller";
void func_vectormamamam_controller_think()
{
self.nextthink = time + 0.1;
+
+ if not (self.owner.active == ACTIVE_ACTIVE)
+ {
+ self.owner.velocity = '0 0 0';
+ return;
+ }
+
self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
}
// Savage: Reduce bandwith, critical on e.g. nexdm02
self.effects |= EF_LOWPRECISION;
+ self.active = ACTIVE_ACTIVE;
+
InitializeEntity(self, func_vectormamamam_findtarget, INITPRIO_FINDTARGET);
}
float p;
string s;
+ if (self.active != ACTIVE_ACTIVE)
+ return;
+
if (other.health < 1)
return;
if not(other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too
self.angles = '0 0 0';
EXACTTRIGGER_INIT;
-
+
+ self.active = ACTIVE_ACTIVE;
+
self.use = trigger_teleport_use;
// this must be called to spawn the teleport waypoints for bots