djcev.com

//

Git Repos / fte_dogmode / qc / triggers / ladder.qc

Last update to this file was on 2024-03-24 at 02:40.

Show ladder.qc

//==============================================================================
// trigger_ladder -- selections from Rubicon 2 qc by john fitzgibbons
//==============================================================================

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

void() trigger_ladder_touch;
void(entity e) trigger_ladder_init;
void() trigger_ladder;

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

/*QUAKED trigger_ladder (.5 .5 .5) ? X X X X 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
invisible ladder entity. when player is touching this entity, he can climb by pushing 'jump'

Keys:

"angle" the direction player must be facing to climb ladder
*/
//----------------------------------------------------------------------
// class trigger_ladder: base_trigger
// {
//--------------------------------------------------------------
// trigger_ladder_touch
//--------------------------------------------------------------
void() trigger_ladder_touch =
{
// from Copper -- dumptruck_ds
if (sub_checkvalidtouch(other) == FALSE)
return;

// prevent the player "sticking" to a ladder if they are
// standing on the platform at the top of the ladder with
// the bottom of their bounding box flush with the top of
// the trigger -- iw
if (other.absmin_z + 1 >= self.absmax_z - 1)
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)
// not facing the right way
return;
}

// changed to PMFLAGS -- CEV
other.pmove_flags |= PMF_ONLADDER;
};

//--------------------------------------------------------------
void(entity e) trigger_ladder_init =
{
e.classname = "trigger_ladder";
e.classtype = CT_TRIGGER_LADDER;

// ignore an "up" or "down" angle (doesn't make sense
// for a ladder)
if (e.angles_y == -1 || e.angles_y == -2)
{
dprint (sprintf("trigger_ladder_init: ignoring bad "
"'angle' value: %g\n", e.angles_y));

e.angles_y = 0;
}

base_trigger_init (e);
e.touch = trigger_ladder_touch;
sub_checkwaiting (e);
};

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

trigger_ladder_init (self);
};
// };

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

Log ladder.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +37 -20
2024-01-09 Continue OO / Class-based refactor cev +13 -14
2023-12-09 Start OO / class-based refactor, work on items cev +52 -50
2023-11-16 pmove bug fixes, moved q3 compat code, cleanup cev +67  

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