vector org = self.origin + ((self.mins + self.maxs) * 0.5);
entity e = spawn();
+ e.spawnfunc_checked = true;
e.monster_loot = self.monster_loot;
{
setself(e);
e.noalign = true;
- e.monster_loot();
+ e.monster_loot(e);
e.gravity = 1;
e.movetype = MOVETYPE_TOSS;
e.reset = SUB_Remove;
makevectors (mon.angles);
dot = normalize (player.origin - mon.origin) * v_forward;
- if(dot <= 0.3) { return false; }
+ if(dot <= autocvar_g_monsters_target_infront_range) { return false; }
}
return true; // this target is valid!
void Monster_Sounds_Precache()
{SELFPARAM();
- string m = (get_monsterinfo(self.monsterid)).model;
+ string m = (get_monsterinfo(self.monsterid)).m_model.model_str();
float globhandle, n, i;
string f;
if(targ_vlen <= e.attack_range)
{
- float attack_success = e.monster_attackfunc(MONSTER_ATTACK_MELEE);
+ float attack_success = e.monster_attackfunc(MONSTER_ATTACK_MELEE, targ);
if(attack_success == 1)
Monster_Sound(monstersound_melee, 0, false, CH_VOICE);
else if(attack_success > 0)
if(targ_vlen > e.attack_range)
{
- float attack_success = e.monster_attackfunc(MONSTER_ATTACK_RANGED);
+ float attack_success = e.monster_attackfunc(MONSTER_ATTACK_RANGED, targ);
if(attack_success == 1)
Monster_Sound(monstersound_melee, 0, false, CH_VOICE);
else if(attack_success > 0)
self.anim_die2 = animfixfps(self, '9 1 0.01', '0 0 0');*/
// then get the real values
- MON_ACTION(self.monsterid, MR_ANIM);
+ Monster mon = get_monsterinfo(self.monsterid);
+ mon.mr_anim(mon);
}
void Monster_Touch()
if(!((self.flags & FL_FLY) || (self.flags & FL_SWIM)))
self.velocity = '0 0 0';
- CSQCModel_UnlinkEntity();
+ CSQCModel_UnlinkEntity(self);
- MON_ACTION(self.monsterid, MR_DEATH);
+ Monster mon = get_monsterinfo(self.monsterid);
+ mon.mr_death(mon);
if(self.candrop && self.weapon)
W_ThrowNewWeapon(self, self.weapon, 0, self.origin, randomvec() * 150 + '0 0 325');
void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{SELFPARAM();
- if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL)
+ if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL && !ITEM_DAMAGE_NEEDKILL(deathtype))
return;
if(self.frozen && deathtype != DEATH_KILL && deathtype != DEATH_NADE_ICE_FREEZE)
damage_take = take;
frag_attacker = attacker;
frag_deathtype = deathtype;
- MON_ACTION(self.monsterid, MR_PAIN);
+ Monster mon = get_monsterinfo(self.monsterid);
+ mon.mr_pain(mon);
take = damage_take;
if(take)
return;
}
- if(MON_ACTION(self.monsterid, MR_THINK))
+ Monster mon = get_monsterinfo(self.monsterid);
+ if(mon.mr_think(mon))
Monster_Move(self.speed2, self.speed, self.stopspeed);
Monster_Anim();
float Monster_Spawn_Setup()
{SELFPARAM();
- MON_ACTION(self.monsterid, MR_SETUP);
+ Monster mon = get_monsterinfo(self.monsterid);
+ mon.mr_setup(mon);
// ensure some basic needs are met
if(!self.health) { self.health = 100; }
if(!autocvar_g_monsters) { Monster_Remove(self); return false; }
- self.mdl = mon.model;
if(Monster_Appear_Check(self, mon_id)) { return true; } // return true so the monster isn't removed
if(!self.monster_skill)
if(!(self.spawnflags & MONSTERFLAG_RESPAWNED)) // don't count re-spawning monsters either
monsters_total += 1;
- _setmodel(self, self.mdl);
+ setmodel(self, mon.m_model);
self.flags = FL_MONSTER;
self.classname = "monster";
self.takedamage = DAMAGE_AIM;