// monoflop
const int MONOFLOP_FIXED = BIT(0);
+// relay_if
+const int RELAYIF_NEGATE = BIT(0);
+
+// relay_teamcheck
+const int RELAYTEAMCHECK_NOTEAM = BIT(0);
+const int RELAYTEAMCHECK_INVERT = BIT(1);
+
//----------
// SENDFLAGS
//----------
void multivibrator_reset(entity this)
{
- if(!(this.spawnflags & 1))
+ if(!(this.spawnflags & START_ENABLED))
this.nextthink = 0; // wait for a trigger event
else
this.nextthink = max(1, time);
}
-/*QUAKED trigger_multivibrator (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ON
+/*QUAKED trigger_multivibrator (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ENABLED
"Multivibrator" trigger gate... repeatedly sends trigger events. When triggered, turns on or off.
-------- KEYS --------
target: trigger all entities with this targetname when it goes off
wait: "on" cycle time (default: 1)
respawntime: "off" cycle time (default: same as wait)
-------- SPAWNFLAGS --------
-START_ON: assume it is already turned on (when targeted)
+START_ENABLED: assume it is already turned on (when targeted)
*/
spawnfunc(trigger_multivibrator)
{
this.reset = spawnfunc_trigger_relay; // this spawnfunc resets fully
}
-spawnfunc(target_relay) { spawnfunc_trigger_relay(this); }
+spawnfunc(target_relay)
+{
+ spawnfunc_trigger_relay(this);
+}
#endif
// TODO make this generic AND faster than nextent()ing through all, if somehow possible
n = (cvar_string(this.netname) == cvar_string(this.message));
- if(this.spawnflags & 1)
+ if(this.spawnflags & RELAYIF_NEGATE)
n = !n;
if(n)
{
if(actor.team)
{
- if(this.spawnflags & 2)
+ if(this.spawnflags & RELAYTEAMCHECK_INVERT)
{
if(DIFF_TEAM(actor, this))
SUB_UseTargets(this, actor, trigger);
}
else
{
- if(this.spawnflags & 1)
+ if(this.spawnflags & RELAYTEAMCHECK_NOTEAM)
SUB_UseTargets(this, actor, trigger);
}
}
return false;
if(this.team)
- if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, player)))
+ if(((this.spawnflags & INVERT_TEAMS) == 0) == (DIFF_TEAM(this, player)))
return false;
return true;
string s = this.target; this.target = string_null;
SUB_UseTargets(this, player, player); // TODO: should we be using toucher for trigger too?
- if (!this.target) this.target = s;
+ if (!this.target)
+ {
+ this.target = s;
+ }
SUB_UseTargets(e, player, player);
}
this.classname = "trigger_teleport";
if(isnew)
IL_PUSH(g_teleporters, this);
- int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
+ int mytm = ReadByte();
+ if(mytm)
+ {
+ this.team = mytm - 1;
+ }
this.spawnflags = ReadInt24_t();
this.active = ReadByte();
this.speed = ReadCoord();
}
// compatibility
-spawnfunc(target_viewlocation) { spawnfunc_target_viewlocation_start(this); }
+spawnfunc(target_viewlocation)
+{
+ spawnfunc_target_viewlocation_start(this);
+}
#elif defined(CSQC)