#endif
void monsters_setstatus()
-{
+{SELFPARAM();
self.stat_monsters_total = monsters_total;
self.stat_monsters_killed = monsters_killed;
}
void monster_dropitem()
-{
+{SELFPARAM();
if(!self.candrop || !self.monster_loot)
return;
}
void monster_makevectors(entity e)
-{
+{SELFPARAM();
if(IS_MONSTER(self))
{
vector v;
// ===============
bool Monster_ValidTarget(entity mon, entity player)
-{
+{SELFPARAM();
// ensure we're not checking nonexistent monster/target
if(!mon || !player) { return false; }
}
void Monster_Delay_Action()
-{
+{SELFPARAM();
entity oldself = self;
self = self.owner;
if(Monster_ValidTarget(self, self.enemy)) { oldself.use(); }
}
void Monster_Delay(float repeat_count, float repeat_defer, float defer_amnt, void() func)
-{
+{SELFPARAM();
// deferred attacking, checks if monster is still alive and target is still valid before attacking
entity e = spawn();
}
void Monster_Sounds_Precache()
-{
+{SELFPARAM();
string m = (get_monsterinfo(self.monsterid)).model;
float globhandle, n, i;
string f;
}
void Monster_Sounds_Clear()
-{
+{SELFPARAM();
#define _MSOUND(m) if(self.monstersound_##m) { strunzone(self.monstersound_##m); self.monstersound_##m = string_null; }
ALLMONSTERSOUNDS
#undef _MSOUND
}
bool Monster_Sounds_Load(string f, int first)
-{
+{SELFPARAM();
float fh;
string s;
var .string field;
.int skin_for_monstersound;
void Monster_Sounds_Update()
-{
+{SELFPARAM();
if(self.skin == self.skin_for_monstersound) { return; }
self.skin_for_monstersound = self.skin;
}
void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float chan)
-{
+{SELFPARAM();
if(!autocvar_g_monsters_sounds) { return; }
if(delaytoo)
// =======================
float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop)
-{
+{SELFPARAM();
if(dostop && (self.flags & FL_MONSTER)) { self.state = MONSTER_ATTACK_MELEE; }
setanim(self, anim, false, true, false);
}
float Monster_Attack_Leap_Check(vector vel)
-{
+{SELFPARAM();
if(self.state && (self.flags & FL_MONSTER))
return false; // already attacking
if(!(self.flags & FL_ONGROUND))
}
bool Monster_Attack_Leap(vector anm, void() touchfunc, vector vel, float animtime)
-{
+{SELFPARAM();
if(!Monster_Attack_Leap_Check(vel))
return false;
// ======================
void Monster_UpdateModel()
-{
+{SELFPARAM();
// assume some defaults
/*self.anim_idle = animfixfps(self, '0 1 0.01', '0 0 0');
self.anim_walk = animfixfps(self, '1 1 0.01', '0 0 0');
}
void Monster_Touch()
-{
+{SELFPARAM();
if(other == world) { return; }
if(other.monster_attack)
}
void Monster_Miniboss_Check()
-{
+{SELFPARAM();
if(MUTATOR_CALLHOOK(MonsterCheckBossFlag))
return;
}
bool Monster_Respawn_Check()
-{
+{SELFPARAM();
if(self.deadflag == DEAD_DEAD) // don't call when monster isn't dead
if(MUTATOR_CALLHOOK(MonsterRespawn, self))
return true; // enabled by a mutator
return true;
}
-void Monster_Respawn() { Monster_Spawn(self.monsterid); }
+void Monster_Respawn() { SELFPARAM(); Monster_Spawn(self.monsterid); }
void Monster_Dead_Fade()
-{
+{SELFPARAM();
if(Monster_Respawn_Check())
{
self.spawnflags |= MONSTERFLAG_RESPAWNED;
}
void Monster_Use()
-{
+{SELFPARAM();
if(Monster_ValidTarget(self, activator)) { self.enemy = activator; }
}
vector Monster_Move_Target(entity targ)
-{
+{SELFPARAM();
// enemy is always preferred target
if(self.enemy)
{
}
void Monster_CalculateVelocity(entity mon, vector to, vector from, float turnrate, float movespeed)
-{
+{SELFPARAM();
float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
float initial_height = 0; //min(50, (targ_distance * tanh(20)));
float current_height = (initial_height * min(1, (self.pass_distance) ? (current_distance / self.pass_distance) : current_distance));
}
void Monster_Move(float runspeed, float walkspeed, float stpspeed)
-{
+{SELFPARAM();
if(self.target2) { self.goalentity = find(world, targetname, self.target2); }
entity targ;
}
void Monster_Dead_Think()
-{
+{SELFPARAM();
self.nextthink = time + self.ticrate;
if(self.monster_lifetime != 0)
}
void Monster_Appear()
-{
+{SELFPARAM();
self.enemy = activator;
self.spawnflags &= ~MONSTERFLAG_APPEAR; // otherwise, we get an endless loop
Monster_Spawn(self.monsterid);
}
void Monster_Reset()
-{
+{SELFPARAM();
setorigin(self, self.pos1);
self.angles = self.pos2;
}
void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
self.health -= damage;
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
}
void Monster_Dead(entity attacker, float gibbed)
-{
+{SELFPARAM();
self.think = Monster_Dead_Think;
self.nextthink = time;
self.monster_lifetime = time + 5;
}
void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL)
return;
// don't check for enemies, just keep walking in a straight line
void Monster_Move_2D(float mspeed, float allow_jumpoff)
-{
+{SELFPARAM();
if(gameover || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || self.draggedby != world || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time)
{
mspeed = 0;
}
void Monster_Anim()
-{
+{SELFPARAM();
int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
if(self.deadflag)
{
}
void Monster_Think()
-{
+{SELFPARAM();
self.think = Monster_Think;
self.nextthink = self.ticrate;
Monster_Anim();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
float Monster_Spawn_Setup()
-{
+{SELFPARAM();
MON_ACTION(self.monsterid, MR_SETUP);
// ensure some basic needs are met
}
bool Monster_Spawn(int mon_id)
-{
+{SELFPARAM();
// setup the basic required properties for a monster
entity mon = get_monsterinfo(mon_id);
if(!mon.monsterid) { return false; } // invalid monster
if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
monster_setupcolors(self);
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
return true;
}