52 itemlist =
M_ARGV(1,
string);
59 e.monster_item =
true;
62 e.itemdef = loot_itemdef;
64 e.velocity =
randomvec() * 175 +
'0 0 325';
77 targ_org =
vec2(targ_org);
78 my_org =
vec2(my_org);
89 vector v = targ.origin + (targ.mins + targ.maxs) * 0.5;
91 this.v_angle_x = -this.v_angle_x;
104 if(!
this || !targ) {
return false; }
117 || (targ.alpha != 0 && targ.alpha < 0.5)
126 vector targ_origin = ((targ.absmin + targ.absmax) * 0.5);
133 if(this.
enemy != targ)
152 float trange = this.target_range;
153 if(PHYS_INPUT_BUTTON_CROUCH(it))
155 vector theirmid = (it.absmin + it.absmax) * 0.5;
156 if(vdist(theirmid - this.origin, >, trange))
158 if(!Monster_ValidTarget(this, it, false))
162 vector targ_center = CENTER_OR_VIEWOFS(it);
166 vector closest_target_center = CENTER_OR_VIEWOFS(closest_target);
167 if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center))
168 { closest_target = it; }
170 else { closest_target = it; }
173 return closest_target;
218 this.
sprite.team = newteam;
219 this.
sprite.SendFlags |= 1;
230 this.monster_delayedfunc(this.
owner);
252 e.nextthink =
time + defer_amnt;
253 e.count = defer_amnt;
255 e.monster_delayedfunc = func;
256 e.cnt = repeat_count;
269 m =
"models/monsters/*_";
274 return strcat(m,
".", fil);
284 while((s =
fgets(fh)))
298 string m = this.
monsterdef.m_model.model_str();
299 float globhandle, n, i;
306 for (i = 0; i < n; ++i)
317#define _MSOUND(m) strfree(this.monstersound_##m);
327#define _MSOUND(m) case #m: return monstersound_##m;
345 while((s =
fgets(fh)))
376 string sample = this.(samplefield);
378 float myscale = ((this.
scale) ? this.
scale : 1);
422 tracetoss(
this,
this);
435 setanim(
this, anm,
false,
true,
false);
457 || (!this.monster_attackfunc)
463 if(
vdist(targ.origin -
this.origin, <=,
this.attack_range))
467 if(attack_success == 1)
469 else if(attack_success > 0)
473 if(
vdist(targ.origin -
this.origin, >,
this.attack_range))
477 if(attack_success == 1)
479 else if(attack_success > 0)
579 setorigin(
this, this.
pos1);
604 ang_x = this.angles_x;
605 ang_z = this.angles_z;
743 vector dst_down = dst_ahead -
'0 0 3000';
746 traceline(dst_ahead, dst_down,
true,
NULL);
756 if (
trace_endpos.z < (
this.origin.z +
this.mins.z) - (
this.enemy ? 1024 : 100))
769 tracebox(dst_ahead, this.
mins, this.
maxs, dst_down,
true,
this);
806 this.velocity_y +=
random() * 50;
807 this.velocity_x -=
random() * 50;
811 this.velocity_y -=
random() * 50;
812 this.velocity_x +=
random() * 50;
814 this.velocity_z +=
random() * 150;
840 runspeed = walkspeed = 0;
880 this.moveto_z = this.origin_z;
896 float vz = this.velocity_z;
899 float bboxwidth =
min(this.maxs_x - this.mins_x, this.maxs_y - this.mins_y);
912 setanim(
this, ((do_run) ? this.anim_run : this.
anim_walk),
true,
false,
false);
920 if(e.target2 && e.target2 !=
"")
922 else if(e.target && e.target !=
"")
933 this.velocity_z = vz;
948 if(!
this) {
return; }
956 if(this.(weaponentity))
957 delete(this.(weaponentity));
1006 setorigin(
this, this.
pos1);
1097 if(deathtype == DEATH_FALL.m_id &&
this.draggedby !=
NULL)
1105 take = mon.
mr_pain(mon,
this, take, attacker, deathtype);
1123 if(deathtype != DEATH_DROWN.m_id && take)
1134 if(deathtype == DEATH_KILL.m_id)
1147 if(
GetResource(
this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id)
1159 float true_limit = ((limit !=
RES_LIMIT_NONE) ? limit : targ.max_health);
1187 bool reverse =
false;
1238 int animbits = deadbits;
1269 || (
this.enemy.alpha < 0.5 &&
this.enemy.alpha != 0)
1271 || (
vdist(this.
origin - targ_origin, >, this.target_range))
1378 entity wp =
WaypointSprite_Spawn(WP_Monster, 0, 1024,
this,
'0 0 1' * (this.
maxs.z + 15),
NULL,
this.team,
this,
sprite,
true, RADARICON_DANGER);
1401 if(!mon || mon == MON_Null) {
return false; }
1407 if(this.
mdl && this.
mdl !=
"")
1408 precache_model(this.
mdl);
1430 if(this.
mdl && this.
mdl !=
"")
1431 _setmodel(
this, this.
mdl);
1472 this.monster_attackfunc = mon.monster_attackfunc;
1502 this.
view_ofs =
'0 0 0.7' * (this.maxs_z * 0.5);
1514 setorigin(
this, this.
origin +
'0 0 20');
1519 if (!nudgeoutofsolid_OrFallback(
this))
ERASEABLE float anglemods(float v)
ERASEABLE float shortangle_f(float ang1, float ang2)
void animdecide_setimplicitstate(entity e, float onground)
void animdecide_setstate(entity e, int newstate, float restart)
const int ANIMSTATE_FROZEN
const int ANIMSTATE_DEAD1
const int ANIMSTATE_DEAD2
IntrusiveList g_bot_targets
#define MUTATOR_CALLHOOK(id,...)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
string m_name
human readable name
virtual void mr_deadthink()
(SERVER) logic to run every frame after the monster has died
virtual void mr_death()
(SERVER) called when monster dies
virtual void mr_setup()
(SERVER) setup monster data
virtual void mr_anim()
(BOTH?) sets animations for monster
virtual void mr_pain()
(SERVER) called when monster is damaged
virtual void mr_think()
(SERVER) logic to run every frame
#define colormapPaletteColor(c, isPants)
#define setmodel(this, m)
#define PHYS_INPUT_BUTTON_CHAT(s)
vector healtharmor_applydamage(float a, float armorblock, int deathtype, float damage)
const float MOVE_NOMONSTERS
const float CONTENT_SOLID
const float EF_FULLBRIGHT
float DPCONTENTS_PLAYERCLIP
float checkpvs(vector viewpos, entity viewee)
float DPCONTENTS_MONSTERCLIP
float trace_dphitq3surfaceflags
const float EF_NODEPTHTEST
const float CONTENT_SLIME
#define CSQCMODEL_AUTOUPDATE(e)
#define CSQCMODEL_AUTOINIT(e)
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
IntrusiveList g_damagedbycontents
void SUB_Remove(entity this)
Remove entity.
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
void Violence_GibSplash(entity source, float type, float amount, entity attacker)
void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
void PrecacheGlobalSound(string sample)
string GlobalSound_sample(string pair, float r)
bool tracebox_hits_trigger_hurt(vector start, vector e_min, vector e_max, vector end)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
entity Item_RandomFromList(string itemlist)
Takes a space-separated list of netnames, returns the itemdef of one of them (or NULL if none are ava...
bool Item_Initialise(entity item)
An optimised and generic way to initialise items (loot or permanent)
#define ITEM_SET_LOOT(item, loot)
Sets the item loot status.
void SUB_UseTargets(entity this, entity actor, entity trigger)
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
void WarpZone_RefSys_AddInverse(entity me, entity wz)
vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org)
void WarpZone_RefSys_Copy(entity me, entity from)
const int MONSTER_TYPE_FLY
const int MON_FLAG_RANGED
const int MONSTER_RESPAWN_DEATHPOINT
const int MONSTER_TYPE_SWIM
const int MONSTER_SIZE_QUAKE
void movelib_brake_simple(entity this, float force)
#define movelib_move_simple(e, newdir, velo, blendrate)
#define movelib_move_simple_gravity(e, newdir, velo, blendrate)
void set_movetype(entity this, int mt)
const int WATERLEVEL_WETFEET
#define UNSET_ONGROUND(s)
const int MOVETYPE_BOUNCE
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define new_pure(class)
purely logical entities (not linked to the area grid)
#define REGISTRY_GET(id, i)
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()
bool campaign_bots_may_start
campaign mode: bots shall spawn but wait for the player to spawn before they do anything in other gam...
bool autocvar_g_fullbrightplayers
bool autocvar_g_nodepthtestplayers
#define ITEM_DAMAGE_NEEDKILL(dt)
float spamsound(entity e, int chan, Sound samp, float vol, float _atten)
use this one if you might be causing spam (e.g.
bool sound_allowed(int to, entity e)
bool StatusEffects_active(StatusEffect this, entity actor)
void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)
StatusEffect statuseffects
Entity statuseffects.
void StatusEffects_update(entity e)
void StatusEffects_clearall(entity store)
vector steerlib_attract2(entity this, vector point, float min_influense, float max_distance, float max_influense)
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
void CSQCModel_UnlinkEntity(entity e)
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
void Monster_Remove(entity this)
void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
bool Monster_Heal(entity targ, entity inflictor, float amount, float limit)
void monster_setupcolors(entity this)
bool Monster_Attack_Leap_Check(entity this, vector vel)
bool Monster_Respawn_Check(entity this)
void Monster_Sound(entity this,.string samplefield, float sound_delay, bool delaytoo, float chan)
void Monster_Sounds_Clear(entity this)
void Monster_Respawn(entity this)
void monster_dropitem(entity this, entity attacker)
void Monster_Dead_Think(entity this)
void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
void Monster_Use(entity this, entity actor, entity trigger)
vector Monster_Move_Target(entity this, entity targ)
bool Monster_Spawn(entity this, bool check_appear, Monster mon)
void monster_changeteam(entity this, int newteam)
void Monster_Reset(entity this)
void Monster_Dead_Fade(entity this)
string get_monster_model_datafilename(string m, float sk, string fil)
void Monster_Delay_Action(entity this)
void Monster_Sound_Precache(string f)
void Monster_Sounds_Update(entity this)
void Monster_Anim(entity this)
void Monster_Touch(entity this, entity toucher)
void Monster_Miniboss_Setup(entity this)
void Monster_Sounds_Precache(entity this)
entity Monster_FindTarget(entity this)
void Monster_Dead(entity this, entity attacker, float gibbed)
bool Monster_ValidTarget(entity this, entity targ, bool skipfacing)
void monster_makevectors(entity this, entity targ)
bool Monster_Appear_Check(entity this, Monster monster_id)
bool Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, bool dostop)
bool monster_facing(entity this, entity targ)
void Monster_UpdateModel(entity this)
int skin_for_monstersound
string Monster_Sound_SampleField(string type)
void Monster_Enemy_Check(entity this)
int Monster_CheckDanger(entity this, vector dst_ahead)
void Monster_Attack_Check(entity this, entity targ,.entity weaponentity)
bool Monster_Spawn_Setup(entity this)
void Monster_Appear(entity this, entity actor, entity trigger)
bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime)
void monsters_setstatus(entity this)
vector Monster_WanderTarget(entity this, vector targetorigin)
Returns an origin that's near targetorigin and visible to this monster.
void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void Monster_Think(entity this)
bool Monster_Sounds_Load(entity this, string f, int first)
const int MONSTERFLAG_NORESPAWN
#define MONSTER_SKILLMOD(mon)
int autocvar_g_monsters_score_spawned
float autocvar_g_monsters_attack_range
bool autocvar_g_monsters_respawn
const int MONSTER_SKILL_EASY
int totalspawned
number of monsters spawned with mobspawn command
const int MONSTER_MOVE_FOLLOW
const int MONSTERSKILL_NOTHARD
bool autocvar_g_monsters_quake_resize
bool autocvar_g_monsters_playerclip_collisions
const int MONSTER_SKILL_MEDIUM
bool autocvar_g_monsters_target_infront_2d
const int MONSTER_MOVE_ENEMY
const int MONSTERFLAG_SPAWNED
bool autocvar_g_monsters_typefrag
bool autocvar_g_monsters_sounds
const int MONSTERFLAG_INFRONT
const int MONSTERSKILL_NOTMEDIUM
IntrusiveList g_monster_targets
float autocvar_g_monsters_damageforcescale
const int MONSTERFLAG_APPEAR
const int MONSTER_MOVE_SPAWNLOC
const int MONSTERFLAG_MINIBOSS
const int MONSTER_MOVE_WANDER
float autocvar_g_monsters_miniboss_chance
float autocvar_g_monsters_spawnshieldtime
float autocvar_g_monsters
float autocvar_g_monsters_target_range
const int MONSTER_SKILL_INSANE
ALLMONSTERSOUNDS float GetMonsterSoundSampleField_notFound
float autocvar_g_monsters_healthbars
float autocvar_g_monsters_respawn_delay
string autocvar_g_monsters_miniboss_loot
bool autocvar_g_monsters_lineofsight
const int MONSTER_ATTACK_MELEE
bool autocvar_g_monsters_edit
float autocvar_g_monsters_drop_time
const int MONSTER_SKILL_HARD
const int MONSTER_SKILL_NIGHTMARE
float autocvar_g_monsters_miniboss_healthboost
const int MONSTERFLAG_INVINCIBLE
int autocvar_g_monsters_score_kill
bool autocvar_g_monsters_target_infront
const int MONSTERFLAG_RESPAWNED
const int MONSTERSKILL_NOTEASY
const int MONSTER_ATTACK_RANGED
const int MONSTERFLAG_FLY_VERTICAL
bool autocvar_g_monsters_teams
const int MONSTER_MOVE_NOMOVE
float autocvar_g_monsters_target_infront_range
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
#define GameRules_scoring_add(client, fld, value)
bool turret_closetotarget(entity this, vector targ, float range)
vector Team_ColorRGB(int teamid)
#define CENTER_OR_VIEWOFS(ent)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
ERASEABLE vector RoundPerfectVector(vector v)
void WaypointSprite_Kill(entity wp)
void WaypointSprite_UpdateTeamRadar(entity e, entity icon, vector col)
void WaypointSprite_UpdateMaxHealth(entity e, float f)
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)
void WaypointSprite_UpdateHealth(entity e, float f)
const int MAX_WEAPONSLOTS
entity weaponentities[MAX_WEAPONSLOTS]
int weaponslot(.entity weaponentity)
float attack_finished_single[MAX_WEAPONSLOTS]