prozac-qfcc/triggers.qc

828 lines
17 KiB
C++
Raw Normal View History

2001-07-17 05:58:10 +00:00
//WK
#include "defs.qh"
2001-07-17 05:58:10 +00:00
float(entity tester) IsBuilding;
void(entity foo,float bar) makeImmune;
entity stemp, otemp, s, old;
void() trigger_reactivate =
{
self.solid = SOLID_TRIGGER;
2001-07-17 05:58:10 +00:00
};
//=============================================================================
#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
// the wait time has passed, so set back up for another activation
void() multi_wait =
{
if (self.max_health)
{
self.health = self.max_health;
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
2001-07-17 05:58:10 +00:00
}
};
// the trigger was just touched/killed/used
// self.enemy should be set to the activator so it can be held through a delay
// so wait for the delay time before firing
void() multi_trigger =
{
if (self.nextthink > time)
{
return; // allready been triggered
}
if (self.classname == "trigger_secret")
{
if (self.enemy.classname != "player")
return;
found_secrets = found_secrets + 1;
WriteByte (MSG_ALL, SVC_FOUNDSECRET);
2001-07-17 05:58:10 +00:00
}
if (self.noise)
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
// don't trigger again until reset
self.takedamage = DAMAGE_NO;
2001-07-17 05:58:10 +00:00
activator = self.enemy;
SUB_UseTargets();
if (self.wait > 0)
{
self.think = multi_wait;
self.nextthink = time + self.wait;
}
else
{ // we can't just remove (self) here, because this is a touch function
// called while C code is looping through area links...
self.touch = NIL;
2001-07-17 05:58:10 +00:00
self.nextthink = time + 0.1;
self.think = SUB_Remove;
}
};
void() multi_killed =
{
self.enemy = damage_attacker;
multi_trigger();
};
void() multi_use =
{
self.enemy = activator;
multi_trigger();
};
void() multi_touch =
{
local entity te;
if (other.classname != "player")
return;
if (!Activated(self,other))
{
// If an else goal should be activated, activate it
if (self.else_goal != 0)
{
te = Findgoal(self.else_goal);
if (te)
DoResults(te, other, (self.goal_result & TFGR_ADD_BONUSES));
2001-07-17 05:58:10 +00:00
}
return;
}
// if the trigger has an angles field, check player's facing direction
if (self.movedir != '0 0 0')
{
makevectors (other.angles);
if (v_forward * self.movedir < 0)
return; // not facing the right way
}
self.enemy = other;
multi_trigger ();
};
/*QUAKED trigger_multiple (.5 .5 .5) ? notouch
Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time.
If "delay" is set, the trigger waits some time after activating before firing.
"wait" : Seconds between triggerings. (.2 default)
If notouch is set, the trigger is only fired by other entities, not by touching.
NOTOUCH has been obsoleted by trigger_relay!
sounds
1) secret
2) beep beep
3) large switch
4)
set "message" to text string
*/
void() trigger_multiple =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
if (self.sounds == 1)
{
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
}
else if (self.sounds == 2)
{
precache_sound ("misc/talk.wav");
self.noise = "misc/talk.wav";
}
else if (self.sounds == 3)
{
precache_sound ("misc/trigger1.wav");
self.noise = "misc/trigger1.wav";
}
if (!self.wait)
self.wait = 0.2;
self.use = multi_use;
InitTrigger ();
if (self.health)
{
if (self.spawnflags & SPAWNFLAG_NOTOUCH)
2001-07-17 05:58:10 +00:00
objerror ("health and notouch don't make sense\n");
self.max_health = self.health;
self.th_die = multi_killed;
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
1) Attempted to give players positive frags whenever possible. You now should get frags for blowing people up with others' dispensers/mines/expbody, airfisting rockets, etc. 2) Redid Give_Frags_Out 3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents and checkmove, now a lot cleaner and less buggy 4) You can grapple builds again. This caused really odd bugs. 5) You can now damage your own buildings again (gasp). Any time a tesla or sentry is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK and counter-spy mechanism. 6) Teslas are now entirely inside their bounding box 7) Now check every frame for players startsolid and for outside of the map cube. 8) #define WALL_HURT to make it hurt when you hit a wall 9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying 10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier. demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy gets extra grenade. 11) New and improved EMP grenade now does damage based on range. no longer blows up shells. Doesn't directly damage sentries anymore, but does significant damage to dispensers. EMP someone who's setting a det and it blows up in their face. 12) Players now do radius damage from getting EMPed (again) 13) EMPs now go through walls (again) 14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100 15) You can only have 2 frag grens, 3 with bandolier now. 16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug where their charge wasn't restored when you die is fixed now. 17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time, with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably more time the closer it is to the EMP. 18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the attacker loses 3 seconds of attack. 19) Judo missing now makes them unable to fire. 20) Shortened judo range (back to normal if w/ close combat) 21) Attempted to rework the railgun. Seems to be okay now. Probably still a lot of bugs in here, but since this is the devel version I thought I would commit all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
setmodel (self, self.model); // make sure it links into the world
// let's see if it actually does this time?
2001-07-17 05:58:10 +00:00
}
else
{
if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
2001-07-17 05:58:10 +00:00
{
self.touch = multi_touch;
}
}
};
/*QUAKED trigger_once (.5 .5 .5) ? notouch
Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching
"targetname". If "health" is set, the trigger must be killed to activate.
If notouch is set, the trigger is only fired by other entities, not by touching.
if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired.
if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0.
sounds
1) secret
2) beep beep
3) large switch
4)
set "message" to text string
*/
void() trigger_once =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
self.wait = -1;
trigger_multiple();
};
//=============================================================================
/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/
void() trigger_relay =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
self.use = SUB_UseTargets;
};
//=============================================================================
/*QUAKED trigger_secret (.5 .5 .5) ?
secret counter trigger
sounds
1) secret
2) beep beep
3)
4)
set "message" to text string
*/
void() trigger_secret =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
total_secrets = total_secrets + 1;
self.wait = -1;
if (!self.message)
self.message = "You found a secret area!";
if (!self.sounds)
self.sounds = 1;
if (self.sounds == 1)
{
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
}
else if (self.sounds == 2)
{
precache_sound ("misc/talk.wav");
self.noise = "misc/talk.wav";
}
trigger_multiple ();
};
//=============================================================================
void() counter_use =
{
self.count = self.count - 1;
if (self.count < 0)
return;
if (self.count != 0)
{
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
2001-07-17 05:58:10 +00:00
{
if (self.count >= 4)
CenterPrint (activator, "There are more to go...");
else if (self.count == 3)
CenterPrint (activator, "Only 3 more to go...");
else if (self.count == 2)
CenterPrint (activator, "Only 2 more to go...");
else
CenterPrint (activator, "Only 1 more to go...");
}
return;
}
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
2001-07-17 05:58:10 +00:00
CenterPrint(activator, "Sequence completed!");
self.enemy = activator;
multi_trigger ();
};
/*QUAKED trigger_counter (.5 .5 .5) ? nomessage
Acts as an intermediary for an action that takes multiple inputs.
If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished.
After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
*/
void() trigger_counter =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
self.wait = -1;
if (!self.count)
self.count = 2;
self.use = counter_use;
};
/*
==============================================================================
TELEPORT TRIGGERS
==============================================================================
*/
#define PLAYER_ONLY 1
#define SILENT 2
void() play_teleport =
{
local float v;
local string tmpstr;
v = random() * 5;
if (v < 1)
tmpstr = "misc/r_tele1.wav";
else if (v < 2)
tmpstr = "misc/r_tele2.wav";
else if (v < 3)
tmpstr = "misc/r_tele3.wav";
else if (v < 4)
tmpstr = "misc/r_tele4.wav";
else
tmpstr = "misc/r_tele5.wav";
sound (self, CHAN_VOICE, tmpstr, 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
remove (self);
};
void(vector org) spawn_tfog =
{
s = spawn ();
s.origin = org;
s.nextthink = time + 0.2;
s.think = play_teleport;
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_TELEPORT);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
multicast (org, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
};
void() tdeath_touch =
{
if (other == self.owner)
return;
// frag anyone who teleports in on top of an invincible player
if (other.classname == "player")
{
<Grievre> lemme see... fixes: stuck shamblers, cheat teslas, camming and sensing <Grievre> give mirvs the right death message, make them a little weaker and more spread out <Grievre> increased damage done by exp body... fixes not being able to use airfist if you have daedalus or lg with no cells <Grievre> made it so missing judo = you can't fire for 1.5 seconds, also judo doesn't always work, less chance of it working a) if they're facing you b) if they have knife, judo, or close combat <Grievre> you lose speed the more armor you have (so upgraded people can buy cougar and cheetah now) <Grievre> attempted to fix the respawn guard not telefragging bug (if it was still there) <Grievre> made it so you can tell a shambler to come, stop, or patrol even if it is fighting someone, doesn't really work most of the time but can "wake up" your shambler if it's being screwy <Grievre> (works for all demons) <Grievre> made it so a monster goes back to what it was doing before (following you, patrolling etc) once it's done with its enemy <Grievre> made the sniper rifle less cheap (or tried to), charging now = more accuracy, rather than more damage. OTR now does slightly less damage than regular, but isn't blocked by armor as much. <Grievre> autorifle now has half the rate of fire but does same damage as sniper rifle, but less accurate <Grievre> headshots always ignore armor if target has green armor, legshots always ignore armor except for red <Grievre> added bshams and shambler kings (can be disabled with infokeys) <Grievre> increased max knife blood to 32 <Grievre> made it so airfist bounces gymnasts twice as much, and bounces everyone a little more (I think), may cause stuck bugs but I think it won't. airfist does half damage to gymnasts and slightly more to hwguys <Grievre> made shamblers a little smarter and more powerful in general <Grievre> they now attack buildings (only bshams/kings) if they are attacked by them first <Grievre> bsham/king fireball now sets things on fire <Grievre> shamblers will generally attack the person who last hit them <Grievre> shortened judoka range (they have the old range if they get close combat <Grievre> shamblers will cycle the left-right slash or fireball longer than they did (but they won't keep doing it if their enemy is not visible) <Grievre> fixed shambler fireball so it doesn't miss and hurt itself so much <Grievre> #define OLD_AUTORIFLE <Grievre> will go to the old behavior of the auto rifle <Grievre> I think that's it <Grievre> oh, I changed the intro message and version string a little, you might want to change that
2003-11-12 04:58:19 +00:00
if (Teammate(self.owner.team_no, other.team_no))
{
other.invincible_finished = 0;
TF_T_Damage(other, self, self, other.health + 5000, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
return;
}
if (other.invincible_finished > time) {
2001-07-17 05:58:10 +00:00
self.classname = "teledeath2";
self.owner.invincible_finished = 0;
if (self.owner.health > 0)
TF_T_Damage (self.owner, self, self, self.owner.health + 5000,
TF_TD_IGNOREARMOUR, TF_TD_OTHER);
}
2001-07-17 05:58:10 +00:00
if (self.owner.classname != "player")
{
T_Damage (self.owner, self, self, 5000);
return;
}
}
if (other.health)
{
<Grievre> lemme see... fixes: stuck shamblers, cheat teslas, camming and sensing <Grievre> give mirvs the right death message, make them a little weaker and more spread out <Grievre> increased damage done by exp body... fixes not being able to use airfist if you have daedalus or lg with no cells <Grievre> made it so missing judo = you can't fire for 1.5 seconds, also judo doesn't always work, less chance of it working a) if they're facing you b) if they have knife, judo, or close combat <Grievre> you lose speed the more armor you have (so upgraded people can buy cougar and cheetah now) <Grievre> attempted to fix the respawn guard not telefragging bug (if it was still there) <Grievre> made it so you can tell a shambler to come, stop, or patrol even if it is fighting someone, doesn't really work most of the time but can "wake up" your shambler if it's being screwy <Grievre> (works for all demons) <Grievre> made it so a monster goes back to what it was doing before (following you, patrolling etc) once it's done with its enemy <Grievre> made the sniper rifle less cheap (or tried to), charging now = more accuracy, rather than more damage. OTR now does slightly less damage than regular, but isn't blocked by armor as much. <Grievre> autorifle now has half the rate of fire but does same damage as sniper rifle, but less accurate <Grievre> headshots always ignore armor if target has green armor, legshots always ignore armor except for red <Grievre> added bshams and shambler kings (can be disabled with infokeys) <Grievre> increased max knife blood to 32 <Grievre> made it so airfist bounces gymnasts twice as much, and bounces everyone a little more (I think), may cause stuck bugs but I think it won't. airfist does half damage to gymnasts and slightly more to hwguys <Grievre> made shamblers a little smarter and more powerful in general <Grievre> they now attack buildings (only bshams/kings) if they are attacked by them first <Grievre> bsham/king fireball now sets things on fire <Grievre> shamblers will generally attack the person who last hit them <Grievre> shortened judoka range (they have the old range if they get close combat <Grievre> shamblers will cycle the left-right slash or fireball longer than they did (but they won't keep doing it if their enemy is not visible) <Grievre> fixed shambler fireball so it doesn't miss and hurt itself so much <Grievre> #define OLD_AUTORIFLE <Grievre> will go to the old behavior of the auto rifle <Grievre> I think that's it <Grievre> oh, I changed the intro message and version string a little, you might want to change that
2003-11-12 04:58:19 +00:00
TF_T_Damage(other, self, self, other.health + 5000, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
2001-07-17 05:58:10 +00:00
}
};
void(vector org, entity death_owner) spawn_tdeath =
{
local entity death;
death = spawn();
death.classname = "teledeath";
death.movetype = MOVETYPE_NONE;
death.solid = SOLID_TRIGGER;
2001-07-17 05:58:10 +00:00
death.angles = '0 0 0';
setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
setorigin (death, org);
death.touch = tdeath_touch;
death.nextthink = time + 0.2;
death.think = SUB_Remove;
death.owner = death_owner;
force_retouch = 2; // make sure even still objects get hit
};
void() teleport_touch =
{
local entity t, te;
local vector org;
if (self.targetname)
{
if (self.nextthink < time)
{
return; // not fired yet
}
}
if (self.spawnflags & PLAYER_ONLY)
2001-07-17 05:58:10 +00:00
{
if (other.classname != "player")
return;
}
if (!Activated(self,other))
{
// If an else goal should be activated, activate it
if (self.else_goal != 0)
{
te = Findgoal(self.else_goal);
if (te)
DoResults(te, other, (self.goal_result & TFGR_ADD_BONUSES));
2001-07-17 05:58:10 +00:00
}
return;
}
// only teleport living creatures
if (other.health <= 0 || other.solid != SOLID_SLIDEBOX)
2001-07-17 05:58:10 +00:00
return;
SUB_UseTargets ();
// put a tfog where the player was
spawn_tfog (other.origin);
t = find (NIL, targetname, self.target);
2001-07-17 05:58:10 +00:00
if (!t)
objerror ("couldn't find target");
// spawn a tfog flash in front of the destination
makevectors (t.mangle);
org = t.origin + 32 * v_forward;
spawn_tfog (org);
spawn_tdeath(t.origin, other);
// move the player and lock him down for a little while
if (!other.health)
{
other.origin = t.origin;
other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y);
return;
}
setorigin (other, t.origin);
other.angles = t.mangle;
if (other.classname == "player")
{
// Teleporting - detach hook (wedge)
if (other.weapons_carried & WEAP_HOOK && other.hook_out)
2001-07-17 05:58:10 +00:00
{
sound (other, CHAN_WEAPON, "weapons/bounce2.wav", 1, ATTN_NORM);
Reset_Grapple (other.hook);
2001-07-17 05:58:10 +00:00
other.attack_finished = time + 0.75; // avoid instant rehook
}
//other.immune_to_check = time + 2; //WK Don't zap people for teleporting
makeImmune(other,time+2);
other.fixangle = 1; // turn this way immediately
other.teleport_time = time + 0.7;
if (other.flags & FL_ONGROUND)
other.flags = other.flags - FL_ONGROUND;
2001-07-17 05:58:10 +00:00
other.velocity = v_forward * 300;
}
other.flags = other.flags - other.flags & FL_ONGROUND;
2001-07-17 05:58:10 +00:00
};
/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)
This is the destination marker for a teleporter. It should have a "targetname" field with the same value as a teleporter's "target" field.
*/
void() info_teleport_destination =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
// this does nothing, just serves as a target spot
self.mangle = self.angles;
self.angles = '0 0 0';
self.model = "";
self.origin = self.origin + '0 0 27';
if (!self.targetname)
objerror ("no targetname");
};
void() teleport_use =
{
self.nextthink = time + 0.2;
force_retouch = 2; // make sure even still objects get hit
self.think = dont_think;
2001-07-17 05:58:10 +00:00
};
/*QUAKED trigger_teleport (.5 .5 .5) ? PLAYER_ONLY SILENT
2001-07-17 05:58:10 +00:00
Any object touching this will be transported to the corresponding info_teleport_destination entity. You must set the "target" field, and create an object with a "targetname" field that matches.
If the trigger_teleport has a targetname, it will only teleport entities when it has been fired.
*/
void() trigger_teleport =
{
local vector o;
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
InitTrigger ();
self.touch = teleport_touch;
// find the destination
if (!self.target)
objerror ("no target");
self.use = teleport_use;
if (!(self.spawnflags & SILENT))
2001-07-17 05:58:10 +00:00
{
precache_sound ("ambience/hum1.wav");
o = (self.mins + self.maxs)*0.5;
ambientsound (o, "ambience/hum1.wav",0.5 , ATTN_STATIC);
2001-07-17 05:58:10 +00:00
}
};
/*
==============================================================================
trigger_setskill
==============================================================================
*/
void() trigger_skill_touch =
{
local entity te;
if (other.classname != "player")
return;
if (!Activated(self,other))
{
// If an else goal should be activated, activate it
if (self.else_goal != 0)
{
te = Findgoal(self.else_goal);
if (te)
DoResults(te, other, (self.goal_result & TFGR_ADD_BONUSES));
2001-07-17 05:58:10 +00:00
}
return;
}
cvar_set ("skill", self.message);
};
/*QUAKED trigger_setskill (.5 .5 .5) ?
sets skill level to the value of "message".
Only used on start map.
*/
void() trigger_setskill =
{
dremove(self);
return;
};
/*
==============================================================================
ONLY REGISTERED TRIGGERS
==============================================================================
*/
void() trigger_onlyregistered_touch =
{
local entity te;
if (other.classname != "player")
return;
if (!Activated(self,other))
{
// If an else goal should be activated, activate it
if (self.else_goal != 0)
{
te = Findgoal(self.else_goal);
if (te)
DoResults(te, other, (self.goal_result & TFGR_ADD_BONUSES));
2001-07-17 05:58:10 +00:00
}
return;
}
if (self.attack_finished > time)
return;
self.attack_finished = time + 2;
if (cvar("registered"))
{
local integer rem = self.targetname != self.killtarget;
2001-07-17 05:58:10 +00:00
self.message = "";
SUB_UseTargets ();
if (rem)
remove (self);
2001-07-17 05:58:10 +00:00
}
else
{
if (self.message != "")
{
CenterPrint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
}
}
};
/*QUAKED trigger_onlyregistered (.5 .5 .5) ?
Only fires if playing the registered version, otherwise prints the message
*/
void() trigger_onlyregistered =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
precache_sound ("misc/talk.wav");
InitTrigger ();
self.touch = trigger_onlyregistered_touch;
};
//============================================================================
void() hurt_on =
{
self.solid = SOLID_TRIGGER;
2001-07-17 05:58:10 +00:00
self.nextthink = -1;
};
void() hurt_touch =
{
local entity te;
if (other.takedamage)
{
if (!Activated(self,other))
{
// If an else goal should be activated, activate it
if (self.else_goal != 0)
{
te = Findgoal(self.else_goal);
if (te)
DoResults(te, other, (self.goal_result & TFGR_ADD_BONUSES));
2001-07-17 05:58:10 +00:00
}
return;
}
self.solid = SOLID_NOT;
deathmsg = DMSG_TRIGGER;
TF_T_Damage (other, self, self, self.dmg, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
2001-07-17 05:58:10 +00:00
self.think = hurt_on;
self.nextthink = time + 1;
}
};
/*QUAKED trigger_hurt (.5 .5 .5) ?
Any object touching this will be hurt
set dmg to damage amount
defalt dmg = 5
*/
void() trigger_hurt =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
InitTrigger ();
self.touch = hurt_touch;
if (!self.dmg)
self.dmg = 5;
};
//============================================================================
#define PUSH_ONCE 1
void() trigger_push_touch =
{
local entity te;
if (IsBuilding(other))
return;
if (!Activated(self,other))
{
// If an else goal should be activated, activate it
if (self.else_goal != 0)
{
te = Findgoal(self.else_goal);
if (te)
DoResults(te, other, (self.goal_result & TFGR_ADD_BONUSES));
2001-07-17 05:58:10 +00:00
}
return;
}
if (other.classname == "grenade" || other.classname == "pipebomb") //CH can throw pipes now :)
other.velocity = self.speed * self.movedir * 10;
else if (other.health > 0)
{
other.velocity = self.speed * self.movedir * 10;
if (other.classname == "player")
{
if (other.fly_sound < time)
{
other.fly_sound = time + 1.5;
sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
}
}
}
if (self.spawnflags & PUSH_ONCE)
2001-07-17 05:58:10 +00:00
dremove(self);
};
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
2001-07-17 05:58:10 +00:00
Pushes the player
*/
void() trigger_push =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
InitTrigger ();
precache_sound ("ambience/windfly.wav");
self.touch = trigger_push_touch;
if (!self.speed)
self.speed = 1000;
};
//============================================================================
void() trigger_monsterjump_touch =
{
if ((other.flags & (FL_MONSTER | FL_FLY | FL_SWIM)) != FL_MONSTER )
2001-07-17 05:58:10 +00:00
return;
// set XY even if not on ground, so the jump will clear lips
other.velocity_x = self.movedir_x * self.speed;
other.velocity_y = self.movedir_y * self.speed;
if ( !(other.flags & FL_ONGROUND) )
2001-07-17 05:58:10 +00:00
return;
other.flags = other.flags - FL_ONGROUND;
2001-07-17 05:58:10 +00:00
other.velocity_z = self.height;
};
/*QUAKED trigger_monsterjump (.5 .5 .5) ?
Walking monsters that touch this will jump in the direction of the trigger's angle
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
*/
void() trigger_monsterjump =
{
if (CheckExistence() == FALSE)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
if (!self.speed)
self.speed = 200;
if (!self.height)
self.height = 200;
if (self.angles == '0 0 0')
self.angles = '0 360 0';
InitTrigger ();
self.touch = trigger_monsterjump_touch;
};