47 e.spawnfunc_checked =
true;
54 if(e && e.monster_loot)
60 e.velocity =
randomvec() * 175 +
'0 0 325';
61 e.item_spawnshieldtime =
time + 0.7;
70 vector v = targ.origin + (targ.mins + targ.maxs) * 0.5;
72 this.v_angle_x = -this.v_angle_x;
85 if(!
this || !targ) {
return false; }
90 || (
time < game_starttime)
99 || (STAT(FROZEN, targ))
100 || (targ.alpha != 0 && targ.alpha < 0.5)
108 vector targ_origin = ((targ.absmin + targ.absmax) * 0.5);
115 if(this.
enemy != targ)
136 if(Monster_ValidTarget(this, it))
139 vector targ_center = CENTER_OR_VIEWOFS(it);
143 vector closest_target_center = CENTER_OR_VIEWOFS(closest_target);
144 if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center))
145 { closest_target = it; }
147 else { closest_target = it; }
151 return closest_target;
189 WaypointSprite_UpdateTeamRadar(this.
sprite, RADARICON_DANGER, ((newteam) ?
Team_ColorRGB(newteam) :
'1 0 0'));
191 this.
sprite.team = newteam;
192 this.
sprite.SendFlags |= 1;
196 .void(
entity) monster_delayedfunc;
202 this.monster_delayedfunc(this.
owner);
224 e.nextthink =
time + defer_amnt;
225 e.count = defer_amnt;
227 e.monster_delayedfunc = func;
228 e.cnt = repeat_count;
241 m =
"models/monsters/*_";
246 return strcat(m,
".", fil);
256 while((s =
fgets(fh)))
270 string m = this.
monsterdef.m_model.model_str();
271 float globhandle, n, i;
278 for (i = 0; i < n; ++i)
289 #define _MSOUND(m) strfree(this.monstersound_##m); 299 #define _MSOUND(m) case #m: return monstersound_##m; 317 while((s =
fgets(fh)))
348 string sample = this.(samplefield);
350 float myscale = ((this.
scale) ? this.
scale : 1);
366 setanim(
this, anim,
false,
true,
false);
395 tracetoss(
this,
this);
408 setanim(
this, anm,
false,
true,
false);
417 settouch(
this, touchfunc);
430 || (!this.monster_attackfunc)
434 if(
vdist(targ.origin -
this.origin, <=,
this.attack_range))
438 if(attack_success == 1)
440 else if(attack_success > 0)
444 if(
vdist(targ.origin -
this.origin, >,
this.attack_range))
448 if(attack_success == 1)
450 else if(attack_success > 0)
476 mon.mr_anim(mon,
this);
481 if(toucher ==
NULL) {
return; }
483 if(toucher.monster_attack)
484 if(this.
enemy != toucher)
487 this.
enemy = toucher;
495 float chance =
random() * 100;
503 this.
weapon = WEP_VORTEX.m_id;
575 || (STAT(FROZEN, this.
enemy))
577 || (
this.enemy.alpha < 0.5 &&
this.enemy.alpha != 0)
579 || (
vdist(this.
origin - targ_origin, >, this.target_range))
683 targpos = (to + (
'0 0 1' * current_height));
695 else { targpos =
to; }
702 else { this.
velocity = (desired_direction * movespeed); }
716 if(STAT(FROZEN,
this))
718 movelib_brake_simple(
this, stpspeed);
719 setanim(
this, this.anim_idle,
true,
false,
false);
735 this.velocity_y +=
random() * 50;
736 this.velocity_x -=
random() * 50;
740 this.velocity_y -=
random() * 50;
741 this.velocity_x +=
random() * 50;
743 this.velocity_z +=
random() * 150;
765 ||
time < game_starttime
769 runspeed = walkspeed = 0;
771 setanim(
this, this.anim_idle,
true,
false,
false);
772 movelib_brake_simple(
this, stpspeed);
801 this.moveto = this.
origin;
807 this.moveto_z = this.origin_z;
819 setanim(
this, ((do_run) ? this.anim_run : this.
anim_walk),
true,
false,
false);
821 setanim(
this, this.anim_idle,
true,
false,
false);
827 if(e.target2 && e.target2 !=
"")
829 else if(e.target && e.target !=
"")
832 movelib_brake_simple(
this, stpspeed);
836 setanim(
this, this.anim_idle,
true,
false,
false);
848 this.angles_y += turny;
857 if(!
this) {
return; }
860 Send_Effect(EFFECT_ITEM_PICKUP, this.
origin,
'0 0 0', 1);
865 if(this.(weaponentity))
866 delete(this.(weaponentity));
869 WaypointSprite_Kill(this.
sprite);
917 this.moveto = this.
origin;
924 Violence_GibSplash_At(hitloc, force, 2,
bound(0, damage, 200) / 16,
this, attacker);
928 Violence_GibSplash_At(hitloc, force, 2,
bound(0, damage, 200) / 16,
this, attacker);
945 if(STAT(FROZEN,
this))
975 this.moveto = this.
origin;
988 mon.mr_death(mon,
this);
1002 if(STAT(FROZEN,
this) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id)
1008 if(StatusEffects_active(STATUSEFFECT_SpawnShield,
this) && deathtype != DEATH_KILL.m_id)
1011 if(deathtype == DEATH_FALL.m_id &&
this.draggedby !=
NULL)
1014 vector v = healtharmor_applydamage(100,
GetResource(
this, RES_ARMOR) / 100, deathtype, damage);
1019 take = mon.mr_pain(mon,
this, take, attacker, deathtype);
1030 this.dmg_time =
time;
1032 if(deathtype != DEATH_DROWN.m_id && deathtype != DEATH_FIRE.m_id && sound_allowed(
MSG_BROADCAST, attacker))
1037 if(deathtype != DEATH_DROWN.m_id && take)
1039 Violence_GibSplash_At(hitloc, force, 2,
bound(0, take, 200) / 16,
this, attacker);
1041 Violence_GibSplash_At(hitloc, force * -0.1, 3, 1,
this, attacker);
1043 Violence_GibSplash_At(hitloc, force * -0.2, 3, 1,
this, attacker);
1048 if(deathtype == DEATH_KILL.m_id)
1057 WaypointSprite_Kill(this.
sprite);
1063 Violence_GibSplash(
this, 1, 0.5, attacker);
1073 float true_limit = ((limit !=
RES_LIMIT_NONE) ? limit : targ.max_health);
1090 setanim(
this, this.anim_idle,
true,
false,
false);
1091 movelib_brake_simple(
this, 0.6);
1101 bool reverse =
false;
1118 this.angles_y =
anglemods(this.angles_y - 180);
1122 movelib_move_simple_gravity(
this,
v_forward, mspeed, 1);
1129 setanim(
this, this.anim_idle,
true,
false,
false);
1152 int animbits = deadbits;
1153 if(STAT(FROZEN,
this))
1177 this.
iceblock.alpha =
bound(0.2, 1 - STAT(REVIVE_PROGRESS,
this), 1);
1182 if(STAT(REVIVE_PROGRESS,
this) >= 1)
1196 if(this.event_damage)
1197 this.event_damage(
this,
this, this.
frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id,
DMG_NOWEP,
this.origin,
'0 0 0');
1199 else if ( STAT(REVIVE_PROGRESS,
this) <= 0 )
1238 if(STAT(FROZEN,
this))
1247 if(mon.mr_think(mon,
this))
1257 CSQCMODEL_AUTOUPDATE(
this);
1263 mon.mr_setup(mon,
this);
1306 entity wp = WaypointSprite_Spawn(WP_Monster, 0, 1024,
this,
'0 0 1' * (this.
maxs.z + 15),
NULL,
this.team,
this,
sprite,
true, RADARICON_DANGER);
1329 if(!mon || mon == MON_Null) {
return false; }
1335 if(this.mdl && this.mdl !=
"")
1336 precache_model(this.mdl);
1355 if(!(this.
spawnflags & MONSTERFLAG_RESPAWNED))
1358 if(this.mdl && this.mdl !=
"")
1359 _setmodel(
this, this.mdl);
1363 if(this.statuseffects && this.statuseffects.owner ==
this)
1365 StatusEffects_clearall(this.statuseffects);
1366 StatusEffects_update(
this);
1369 this.statuseffects =
NULL;
1392 this.moveto = this.
origin;
1397 this.monster_attackfunc = mon.monster_attackfunc;
1400 this.
view_ofs =
'0 0 0.7' * (this.maxs_z * 0.5);
1426 if(!(this.
spawnflags & MONSTERFLAG_RESPAWNED))
1436 setsize(
this, mon.
m_mins *
this.scale, mon.
m_maxs *
this.scale);
1455 if(!(this.
spawnflags & MONSTERFLAG_RESPAWNED))
1458 CSQCMODEL_AUTOINIT(
this);
bool autocvar_g_monsters_edit
const int MONSTERFLAG_RESPAWNED
#define round_handler_IsActive()
#define IL_EACH(this, cond, body)
void Monster_Frozen_Think(entity this)
#define PHYS_INPUT_BUTTON_CHAT(s)
bool Monster_ValidTarget(entity this, entity targ)
const int ANIMSTATE_FROZEN
entity Monster_FindTarget(entity this)
const int MONSTERSKILL_NOTEASY
bool Monster_Spawn_Setup(entity this)
IntrusiveList g_monster_targets
const int MONSTER_SIZE_QUAKE
bool autocvar_g_nodepthtestplayers
ERASEABLE float anglemods(float v)
void monster_dropitem(entity this, entity attacker)
string monster_name
human readable name
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void Monster_Sound_Precache(string f)
void WarpZone_RefSys_AddInverse(entity me, entity wz)
void animdecide_setstate(entity e, int newstate, float restart)
void Monster_UpdateModel(entity this)
const int MONSTER_SKILL_MEDIUM
bool autocvar_g_monsters_quake_resize
void Monster_CalculateVelocity(entity this, vector to, vector from, float turnrate, float movespeed)
void Monster_Sound(entity this,.string samplefield, float sound_delay, bool delaytoo, float chan)
float DPCONTENTS_MONSTERCLIP
vector Team_ColorRGB(int teamid)
bool autocvar_g_monsters_sounds
bool Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, bool dostop)
void Monster_Appear(entity this, entity actor, entity trigger)
void Monster_Reset(entity this)
int skin_for_monstersound
const int MONSTER_SKILL_EASY
IntrusiveList g_damagedbycontents
const int MON_FLAG_RANGED
void WarpZone_RefSys_Copy(entity me, entity from)
void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
const int MONSTER_MOVE_ENEMY
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
void Monster_Sounds_Clear(entity this)
float autocvar_g_monsters_think_delay
#define GameRules_scoring_add(client, fld, value)
bool Monster_Heal(entity targ, entity inflictor, float amount, float limit)
float checkpvs(vector viewpos, entity viewee)
void SUB_UseTargets(entity this, entity actor, entity trigger)
float autocvar_g_monsters_target_infront_range
bool Monster_Attack_Leap_Check(entity this, vector vel)
bool autocvar_g_monsters_respawn
ALLMONSTERSOUNDS float GetMonsterSoundSampleField_notFound
float DPCONTENTS_PLAYERCLIP
float autocvar_g_monsters_miniboss_healthboost
const int MONSTER_SIZE_BROKEN
const int MONSTERFLAG_NORESPAWN
float autocvar_g_monsters_spawnshieldtime
#define round_handler_IsRoundStarted()
const float EF_NODEPTHTEST
void Monster_Attack_Check(entity this, entity targ,.entity weaponentity)
const int MONSTER_TYPE_FLY
#define UNSET_ONGROUND(s)
const int MONSTERFLAG_APPEAR
void Monster_Dead_Think(entity this)
void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime)
IntrusiveList g_bot_targets
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
int autocvar_g_monsters_score_spawned
int weaponslot(.entity weaponentity)
const int MONSTERFLAG_INFRONT
#define setmodel(this, m)
bool autocvar_g_monsters_typefrag
void monster_setupcolors(entity this)
const int MONSTER_MOVE_NOMOVE
void Monster_Respawn(entity this)
const int MONSTER_SKILL_INSANE
void Unfreeze(entity targ, bool reset_health)
const float EF_FULLBRIGHT
const int MONSTER_SKILL_HARD
vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org)
float autocvar_g_monsters_attack_range
const float MOVE_NOMONSTERS
const int MONSTERFLAG_MINIBOSS
void Monster_Sounds_Update(entity this)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void monster_changeteam(entity this, int newteam)
float autocvar_g_monsters_target_range
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
const int MONSTERFLAG_INVINCIBLE
#define MONSTER_SKILLMOD(mon)
bool autocvar_g_monsters_teams
bool autocvar_g_monsters_lineofsight
float autocvar_g_monsters
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const int MAX_WEAPONSLOTS
vector Monster_Move_Target(entity this, entity targ)
const int MONSTER_SKILL_NIGHTMARE
void monsters_setstatus(entity this)
bool Monster_Appear_Check(entity this, Monster monster_id)
void StartItem(entity this, GameItem def)
void Monster_Dead(entity this, entity attacker, float gibbed)
void animdecide_setimplicitstate(entity e, float onground)
void Monster_Enemy_Check(entity this)
void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo,.entity weaponentity)
const int MONSTER_MOVE_SPAWNLOC
void Monster_Think(entity this)
const int MONSTER_ATTACK_MELEE
ERASEABLE float shortangle_f(float ang1, float ang2)
void Monster_Remove(entity this)
string get_monster_model_datafilename(string m, float sk, string fil)
const int MONSTER_ATTACK_RANGED
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
const int WATERLEVEL_WETFEET
const int MONSTERSKILL_NOTHARD
void monster_makevectors(entity this, entity targ)
void Monster_Sounds_Precache(entity this)
void PrecacheGlobalSound(string sample)
void Monster_Miniboss_Check(entity this)
void Monster_Touch(entity this, entity toucher)
#define CENTER_OR_VIEWOFS(ent)
bool campaign_bots_may_start
campaign mode: bots shall spawn but wait for the player to spawn before they do anything in other gam...
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void Monster_Anim(entity this)
int totalspawned
number of monsters spawned with mobspawn command
float autocvar_g_monsters_miniboss_chance
const int MONSTERFLAG_FLY_VERTICAL
#define ITEM_DAMAGE_NEEDKILL(dt)
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
string GlobalSound_sample(string pair, float r)
bool autocvar_g_fullbrightplayers
const int FROZEN_TEMP_REVIVING
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool Monster_Spawn(entity this, bool check_appear, Monster mon)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
float autocvar_g_monsters_drop_time
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
vector steerlib_attract2(entity this, vector point, float min_influense, float max_distance, float max_influense)
const int MONSTER_TYPE_SWIM
int autocvar_g_monsters_score_kill
void CSQCModel_UnlinkEntity(entity e)
#define MUTATOR_CALLHOOK(id,...)
const int ANIMSTATE_DEAD2
bool Monster_Sounds_Load(entity this, string f, int first)
const int MONSTERSKILL_NOTMEDIUM
entity weaponentities[MAX_WEAPONSLOTS]
float autocvar_g_monsters_damageforcescale
#define new_pure(class)
purely logical entities (.origin doesn't work)
const int ANIMSTATE_DEAD1
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
string Monster_Sound_SampleField(string type)
const int MONSTER_MOVE_WANDER
void Monster_Use(entity this, entity actor, entity trigger)
float autocvar_g_monsters_healthbars
void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
bool autocvar_g_playerclip_collisions
void Monster_Delay_Action(entity this)
void Monster_Dead_Fade(entity this)
bool Monster_Respawn_Check(entity this)
const int MONSTER_RESPAWN_DEATHPOINT
const int FROZEN_TEMP_DYING
bool autocvar_g_monsters_target_infront
const int MONSTER_MOVE_FOLLOW
float autocvar_g_monsters_respawn_delay
void set_movetype(entity this, int mt)
float attack_finished_single[MAX_WEAPONSLOTS]
const int MONSTERFLAG_SPAWNED
void Item_SetLoot(entity item, bool loot)
Sets the item loot status.