#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
- #include "../../dpdefs/progsdefs.qh"
- #include "../../dpdefs/dpextensions.qh"
- #include "../../warpzonelib/common.qh"
+ #include "../../lib/warpzone/common.qh"
#include "../constants.qh"
#include "../teams.qh"
#include "../util.qh"
#include "../weapons/all.qh"
#include "../../server/autocvars.qh"
#include "../../server/defs.qh"
- #include "../deathtypes.qh"
+ #include "../deathtypes/all.qh"
#include "../../server/mutators/mutators_include.qh"
#include "../../server/steerlib.qh"
#include "../turrets/sv_turrets.qh"
#include "../../server/command/common.qh"
#include "../../server/command/cmd.qh"
#include "../triggers/triggers.qh"
- #include "../../csqcmodellib/sv_model.qh"
+ #include "../../lib/csqcmodel/sv_model.qh"
#include "../../server/round_handler.qh"
#endif
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_changeteam(entity ent, float newteam)
{
if(!teamplay) { return; }
-
+
ent.team = newteam;
ent.monster_attack = true; // new team, activate attacking
monster_setupcolors(ent);
-
+
if(ent.sprite)
{
WaypointSprite_UpdateTeamRadar(ent.sprite, RADARICON_DANGER, ((newteam) ? Team_ColorRGB(newteam) : '1 0 0'));
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()
setorigin(self, self.pos1);
self.angles = self.pos2;
self.health = self.max_health;
- setmodel(self, "null");
+ setmodel(self, MDL_Null);
}
else
{
Unfreeze(self);
self.health = 0;
if(self.event_damage)
- self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0');
+ self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
}
else if ( self.revive_progress <= 0 )
{
self.last_trace = time + 0.4;
- Damage (self, world, world, 2, DEATH_DROWN, self.origin, '0 0 0');
+ Damage (self, world, world, 2, DEATH_DROWN.m_id, self.origin, '0 0 0');
self.angles = '90 90 0';
if(random() < 0.5)
{
self.moveto = WarpZone_RefSys_TransformOrigin(self.enemy, self, (0.5 * (self.enemy.absmin + self.enemy.absmax)));
self.monster_moveto = '0 0 0';
self.monster_face = '0 0 0';
-
+
self.pass_distance = vlen((('1 0 0' * self.enemy.origin_x) + ('0 1 0' * self.enemy.origin_y)) - (('1 0 0' * self.origin_x) + ('0 1 0' * self.origin_y)));
Monster_Sound(monstersound_sight, 0, false, CH_VOICE);
}
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.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype))
return;
- if(self.frozen && deathtype != DEATH_KILL && deathtype != DEATH_NADE_ICE_FREEZE)
+ if(self.frozen && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id)
return;
- //if(time < self.pain_finished && deathtype != DEATH_KILL)
+ //if(time < self.pain_finished && deathtype != DEATH_KILL.m_id)
//return;
- if(time < self.spawnshieldtime && deathtype != DEATH_KILL)
+ if(time < self.spawnshieldtime && deathtype != DEATH_KILL.m_id)
return;
- if(deathtype == DEATH_FALL && self.draggedby != world)
+ if(deathtype == DEATH_FALL.m_id && self.draggedby != world)
return;
vector v;
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)
self.dmg_time = time;
- if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN)
- spamsound (self, CH_PAIN, "misc/bodyimpact1.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
+ if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN.m_id)
+ spamsound (self, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
self.velocity += force * self.damageforcescale;
- if(deathtype != DEATH_DROWN && take)
+ if(deathtype != DEATH_DROWN.m_id && take)
{
Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, self, attacker);
if (take > 50)
if(self.health <= 0)
{
- if(deathtype == DEATH_KILL)
+ if(deathtype == DEATH_KILL.m_id)
self.candrop = false; // killed by mobkill command
// TODO: fix this?
SUB_UseTargets();
self.target2 = self.oldtarget2; // reset to original target on death, incase we respawn
- Monster_Dead(attacker, (self.health <= -100 || deathtype == DEATH_KILL));
+ Monster_Dead(attacker, (self.health <= -100 || deathtype == DEATH_KILL.m_id));
WaypointSprite_Kill(self.sprite);
frag_target = self;
MUTATOR_CALLHOOK(MonsterDies, attacker);
- if(self.health <= -100 || deathtype == DEATH_KILL) // check if we're already gibbed
+ if(self.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
{
Violence_GibSplash(self, 1, 0.5, attacker);
float reverse = FALSE;
vector a, b;
-
+
makevectors(self.angles);
a = self.origin + '0 0 16';
b = self.origin + '0 0 16' + v_forward * 32;
-
+
traceline(a, b, MOVE_NORMAL, self);
-
+
if(trace_fraction != 1.0)
{
reverse = TRUE;
-
+
if(trace_ent)
if(IS_PLAYER(trace_ent) && !(trace_ent.items & IT_STRENGTH))
reverse = FALSE;
}
-
+
// TODO: fix this... tracing is broken if the floor is thin
/*
if(!allow_jumpoff)
if(trace_fraction == 1.0)
reverse = TRUE;
} */
-
+
if(reverse)
{
self.angles_y = anglemods(self.angles_y - 180);
makevectors(self.angles);
}
-
+
movelib_move_simple_gravity(v_forward, mspeed, 1);
if(time > self.pain_finished)
if(self.monster_lifetime)
if(time >= self.monster_lifetime)
{
- Damage(self, self, self, self.health + self.max_health, DEATH_KILL, self.origin, self.origin);
+ Damage(self, self, self, self.health + self.max_health, DEATH_KILL.m_id, self.origin, self.origin);
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;
self.monster_moveto = '0 0 0';
self.monster_face = '0 0 0';
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
-
+
if(!self.scale) { self.scale = 1; }
if(autocvar_g_monsters_edit) { self.grab = 1; }
if(autocvar_g_fullbrightplayers) { self.effects |= EF_FULLBRIGHT; }