djcev.com

//

Git Repos / fte_dogmode / qc / triggers / changetarget.qc

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

Show changetarget.qc

//==============================================================================
// trigger_changetarget
//==============================================================================

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

void() trigger_changetarget_use;
entity(vector org, vector nmins, vector nmaxs, string newtarg,
string newmsg, float newcnt) spawn_trigger_changetarget;
void(entity e) trigger_changetarget_init;
void() trigger_changetarget;

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

/*QUAKED trigger_changetarget (.5 .5 .5) ?
Changes an entity's target field

target = entity to change
message = new value for target field
cnt = target field to change, null defaults to target
*/
//----------------------------------------------------------------------
// class trigger_changetarget: base_trigger
// {
//--------------------------------------------------------------
void() trigger_changetarget_use =
{
if (self.estate != STATE_ACTIVE)
return;

for (entity e = world;
(e = find (e, targetname, self.target)); )
{
if (!self.cnt || self.cnt == 1)
e.target = self.message;
else if (self.cnt == 2)
e.target2 = self.message;
else if (self.cnt == 3)
e.target3 = self.message;
else if (self.cnt == 4)
e.target4 = self.message;
}
};

//--------------------------------------------------------------
entity(vector org, vector nmins, vector nmaxs, string newtarg,
string newmsg, float newcnt) spawn_trigger_changetarget =
{
local entity e = spawn ();
e.origin = org;
e.mins = nmins;
e.maxs = nmaxs;
e.target = newtarg;
e.message = newmsg;
e.cnt = newcnt;
setorigin (e, org);
setsize (e, nmins, nmaxs);
trigger_changetarget_init (e);
return e;
};

//--------------------------------------------------------------
void(entity e) trigger_changetarget_init =
{
e.classname = "trigger_changetarget";
e.classtype = CT_TRIGGER_CHANGETARGET;
e.use = trigger_changetarget_use;
};

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

trigger_changetarget_init (self);
};
// };

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

Log changetarget.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +55 -17
2024-01-09 Continue OO / Class-based refactor cev +4 -7
2023-12-09 Start OO / class-based refactor, work on items cev +31 -23
2023-11-20 changes to movement, build environment, file reorg cev +38  

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