djcev.com

//

Git Repos / fte_dogmode / qc / triggers / monsterjump.qc

Last update to this file was on 2024-06-15 at 19:50.

Show monsterjump.qc

//==============================================================================
// trigger_monsterjump -- id1 monsterjump with additions from progs_dump 3
//==============================================================================

//======================================================================
// constants
//======================================================================

#ifdef SSQC
const float TRIGGER_MONSTERJUMP_STARTOFF = 8;
#endif

//======================================================================
// forward declarations
//======================================================================

#ifdef SSQC
// trigger_monsterjump
void() trigger_monsterjump_touch;
void() trigger_monsterjump_use;
void(entity e) trigger_monsterjump_init;
void() trigger_monsterjump;
#endif

//------------------------------------------------------------------------------

#ifdef SSQC
/*QUAKED trigger_monsterjump (.5 .5 .5) ? X X X TRIGGER_MONSTERJUMP_STARTOFF X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

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

If TRIGGER_MONSTERJUMP_STARTOFF flag is set, this makes the trigger inactive. This can
be targeted and toggled off and on.
*/
//----------------------------------------------------------------------
// class trigger_monsterjump: base_trigger
// {
//--------------------------------------------------------------
void() trigger_monsterjump_touch =
{
if (self.estate != STATE_ACTIVE)
return;

if (other.flags &
(FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER)
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))
return;

other.flags = other.flags - FL_ONGROUND;

other.velocity_z = self.height;
};

//--------------------------------------------------------------
// dumptruck_ds was based on hipnotic blocker_use now Alkaline estate
//--------------------------------------------------------------
void() trigger_monsterjump_use =
{
// TODO CEV duplicating some code here between this and
// trigger_push_custom
if (self.estate != STATE_ACTIVE)
self.estate = STATE_ACTIVE;
else
self.estate = STATE_INACTIVE;
};

//--------------------------------------------------------------
void(entity e) trigger_monsterjump_init =
{
e.classname = "trigger_monsterjump";
e.classtype = CT_TRIGGER_MONSTERJUMP;
e.touch = trigger_monsterjump_touch;
e.use = trigger_monsterjump_use;

// dumptruck_ds
if (e.spawnflags & TRIGGER_MONSTERJUMP_STARTOFF)
{
e.estate = STATE_INACTIVE;
}

if (!e.speed)
e.speed = 200;
if (!e.height)
e.height = 200;
if (e.angles == '0 0 0')
e.angles = '0 360 0';

base_trigger_init (e);
sub_checkwaiting (e);
};

//--------------------------------------------------------------
void() trigger_monsterjump =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

trigger_monsterjump_init (self);
};
// };
#endif

Return to the top of this page or return to the overview of this repo.

Log monsterjump.qc

Return to the top of this page or return to the overview of this repo.