Git Repos / fte_dogmode / qc / misc / infight.qc
Last update to this file was on 2024-06-15 at 19:50.
Show infight.qc
//==============================================================================
// misc_infight
//==============================================================================
//======================================================================
// misc_infight
//
// target = monster that gets mad
// target2 = who target1 will be angry at
//
// spawnflag 1 = mutual hate, both targets get angry at each other instantly
// spawnflag 2 = maintain activator, makes it so the player that triggers
// the infighting sees centerprints triggered by it
//======================================================================
//======================================================================
// constants
//======================================================================
#ifdef SSQC
const float INFIGHT_MUTUAL = 1;
const float INFIGHT_PLAYER_ACTIVATION = 2;
#endif
//======================================================================
// forward declarations
//======================================================================
#ifdef SSQC
// misc_infight
void(entity t1, entity t2) misc_infight_make_angry_at;
void() misc_infight_use;
void(entity e) misc_infight_init;
void() misc_infight;
#endif
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
// class misc_infight: base_mapentity
// {
#ifdef SSQC
//--------------------------------------------------------------
void(entity t1, entity t2) misc_infight_make_angry_at =
{
// checks if targets are alive
if (t2.health > 0 && t1.health > 0)
{
if (t1.enemy.classtype == CT_PLAYER)
t1.oldenemy = t1.enemy;
t1.enemy = t2;
// was FoundTargetForEntity (t1) -- CEV
if (t1.classgroup & CG_MONSTER)
{
sub_runfloatas (t1, ai_findtarget);
}
else
{
objerror (sprintf("misc_infight_make_angry_at"
": tried to make a %s fight a %s!",
t1.classname, t2.classname));
}
}
};
//--------------------------------------------------------------
void() misc_infight_use =
{
local entity t1, t2;
for (t1 = world; (t1 = find (t1, targetname, self.target)); )
{
for (t2 = world;
(t2 = find (t2, targetname, self.target2)); )
{
// t1 = find(world, targetname, self.target);
// t2 = find(world, targetname, self.target2);
if (!t1)
{
dprint ("misc_infight_use: Cannot find "
"target, trying targetname2\n");
t1 = find (world, targetname2,
self.target);
}
if (!t1)
{
dprint ("misc_infight_use: Cannot find "
"target, trying targetname3\n");
t1 = find (world, targetname3,
self.target);
}
if (!t1)
{
dprint ("misc_infight_use: Cannot find "
"target, trying targetname4\n");
t1 = find (world, targetname4,
self.target);
}
if (!t1)
{
dprint ("misc_infight_use: Cannot find "
"target, out of targetnames\n");
return;
}
if (!t2)
{
dprint ("misc_infight_use: Cannot find "
"target2 trying targetname2\n");
t2 = find (world, targetname2,
self.target2);
}
if (!t2)
{
dprint ("misc_infight_use: Cannot find "
"target2 trying targetname3\n");
t2 = find (world, targetname3,
self.target2);
}
if (!t2)
{
dprint ("misc_infight_use: Cannot find "
"target2 trying targetname4\n");
t2 = find (world, targetname4,
self.target2);
}
if (!t2)
{
dprint ("misc_infight_use: Cannot find "
"target2 out of targetnames\n");
return;
}
misc_infight_make_angry_at (t1, t2);
if (self.spawnflags & INFIGHT_PLAYER_ACTIVATION)
{
t1.infight_activator = activator;
t2.infight_activator = activator;
}
if (self.spawnflags & INFIGHT_MUTUAL)
misc_infight_make_angry_at (t2, t1);
}
}
};
//--------------------------------------------------------------
void(entity e) misc_infight_init =
{
e.classname = "misc_infight";
e.classtype = CT_MISC_INFIGHT;
base_mapentity_init (e);
e.use = misc_infight_use;
};
//--------------------------------------------------------------
void() misc_infight =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
misc_infight_init (self);
};
#endif
// };
Return to the top of this page or return to the overview of this repo.
Log infight.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-06-15 | Major update, committing as-is, will have bugs | cev | +6 | |
2024-04-12 | Moveable gibs, heads, some bugfixes | cev | +1 | -4 |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +61 | -30 |
2024-02-18 | Client/player, projectiles, entrypoints refactor | cev | +1 | -3 |
2024-01-31 | Class based monster refactor & start projectiles | cev | +13 | -3 |
2024-01-09 | Continue OO / Class-based refactor | cev | +5 | -8 |
2023-12-09 | Start OO / class-based refactor, work on items | cev | +99 | -89 |
2023-12-02 | More refactoring & moving, begin adding mdls & snd | cev | +120 |
Return to the top of this page or return to the overview of this repo.