djcev.com

//

Git Repos / fte_dogmode / qc / info / teleport_changedest.qc

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

Show teleport_changedest.qc

//==============================================================================
// info_teleport_changedest -- by Qmaster, from progs_dump 3
//==============================================================================

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

void() info_teleport_changedest_use;
entity(entity src, vector org, string tname, string t, string m)
spawn_info_teleport_changedest;
void(entity e) info_teleport_changedest_init;
void() info_teleport_changedest;

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

/*QUAKED info_teleport_changedest (0 0.5 0) (-4 -4 -4) (4 4 4) 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
Allows a mapper to change the target of a teleport_trigger. Useful in maps where
the player may fall into a void and the mapper wants to update where they "respawn"
as they progress through the level. Could also be used for teleport puzzles and more.
target = trigger_teleport to change
message = new info_teleport_destination's targetname to switch to
targetname = name of this entity so we can use it
*/

//----------------------------------------------------------------------
// class info_teleport_changedest: base_mapentity
// {
//--------------------------------------------------------------
// this is from Qmaster:
//
// "I created an info_teleport_changedest
// target = targetname of trigger_teleport to affect
// message = targetname of new info_teleport_destination (or
// whatever entity really) to now teleport to
//
// So that I can automatically update the teleporter under my coagula
// map as you progress rather than have a bunch of triggers that I
// need to killtarget. Falling is not fatal then, but it does put you
// back some. Works as a sorta checkpoint system but also builds on my
// older idea for saving time in coop implemented in my Terracity map
// eons ago.
//
// looking at vanilla, you would only need to change trig.target to
// match self.message if you were to add this."
//--------------------------------------------------------------
void() info_teleport_changedest_use =
{
local entity trig;

trig = find (world, targetname, self.target);
if (!trig || trig.classtype != CT_TRIGGER_TELEPORT)
{
dprint ("\b[TELEPORT_DESTCHANGE]\b ");
dprint ("Cannot find trigger_teleport\n");
return;
}

trig.goalentity = find (world, ::targetname, self.message);
if (!trig.goalentity)
{
dprint ("\b[TELEPORT_DESTCHANGE]\b ");
dprint ("Cannot find teleport destination\n");
return;
}

makevectors (trig.goalentity.mangle);
trig.goalentity.movedir = v_forward;
trig.goalentity.pos1 = trig.goalentity.origin + 32 *
trig.goalentity.movedir;

// dumptruck_ds see comment above
trig.target = self.message;
};

//--------------------------------------------------------------
entity(entity src, vector org, string tname, string t, string m)
spawn_info_teleport_changedest =
{
local entity e = spawn ();
e.owner = src;
e.origin = org;
e.targetname = tname;
e.target = t;
e.message = m;
info_teleport_changedest_init (e);
return e;
};

//--------------------------------------------------------------
void(entity e) info_teleport_changedest_init =
{
base_mapentity_init (e);
e.classname = "info_teleport_changedest";
e.classtype = CT_INFO_TELEPORT_CHANGEDEST;

if (e.targetname == "")
{
dprint ("\b[ERROR]\b info_teleport_changedest ");
dprint ("with no targetname\n");
remove (e);
}

if (e.target == "")
{
dprint ("\b[ERROR]\b info_teleport_changedest ");
dprint ("with no target\n");
remove (e);
}

if (e.message == "")
{
dprint ("\b[ERROR]\b info_teleport_changedest ");
dprint ("with no message set for new destination\n");
remove (e);
}

e.use = info_teleport_changedest_use;
};

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

info_teleport_changedest_init (self);
};
// };

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

Log teleport_changedest.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +54 -19
2024-01-31 Class based monster refactor & start projectiles cev +3 -2
2024-01-09 Continue OO / Class-based refactor cev +9 -11
2023-12-09 Start OO / class-based refactor, work on items cev +96  

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