Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_monsters.qh File Reference
#include "all.qh"
Include dependency graph for sv_monsters.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _MSOUND(m)
#define ALLMONSTERSOUNDS
#define MONSTER_SKILLMOD(mon)

Functions

bool Monster_Attack_Leap (entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime)
float Monster_Attack_Melee (entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop)
void Monster_Delay (entity this, int repeat_count, float defer_amnt, void(entity) func)
entity Monster_FindTarget (entity this)
void monster_makevectors (entity this, entity targ)
void Monster_Move_2D (entity this, float mspeed, float allow_jumpoff)
void Monster_Remove (entity this)
void monster_setupcolors (entity this)
void Monster_Sound (entity this,.string samplefield, float sound_delay, float delaytoo, float chan)
bool Monster_Spawn (entity this, bool check_appear, Monster mon)
void Monster_Touch (entity this, entity toucher)
void monsters_setstatus (entity this)
 STATIC_INIT (g_monster_targets)
 STATIC_INIT (g_monsters)

Variables

float anim_finished
float attack_range
float autocvar_g_monsters
float autocvar_g_monsters_armor_blockpercent
float autocvar_g_monsters_attack_range
float autocvar_g_monsters_damageforcescale = 0.8
float autocvar_g_monsters_drop_time = 10
bool autocvar_g_monsters_edit
float autocvar_g_monsters_healthbars
bool autocvar_g_monsters_lineofsight = true
int autocvar_g_monsters_max
int autocvar_g_monsters_max_perplayer
float autocvar_g_monsters_miniboss_chance
float autocvar_g_monsters_miniboss_healthboost
string autocvar_g_monsters_miniboss_loot = "vortex"
bool autocvar_g_monsters_owners
bool autocvar_g_monsters_playerclip_collisions
bool autocvar_g_monsters_quake_resize = true
bool autocvar_g_monsters_respawn
float autocvar_g_monsters_respawn_delay
int autocvar_g_monsters_score_kill
int autocvar_g_monsters_score_spawned
bool autocvar_g_monsters_sounds
float autocvar_g_monsters_spawnshieldtime
bool autocvar_g_monsters_target_infront
bool autocvar_g_monsters_target_infront_2d = true
float autocvar_g_monsters_target_infront_range = 0.3
float autocvar_g_monsters_target_range
bool autocvar_g_monsters_teams
bool autocvar_g_monsters_typefrag
bool candrop
IntrusiveList g_monster_targets
IntrusiveList g_monsters
ALLMONSTERSOUNDS float GetMonsterSoundSampleField_notFound
float last_enemycheck
float last_trace
string mdl_dead
bool monster_attack
const int MONSTER_ATTACK_MELEE = 6
const int MONSTER_ATTACK_RANGED = 7
vector monster_face
entity monster_follow
bool monster_item
float monster_lifetime
const int MONSTER_MOVE_ENEMY = 5
const int MONSTER_MOVE_FOLLOW = 1
const int MONSTER_MOVE_NOMOVE = 4
const int MONSTER_MOVE_SPAWNLOC = 3
const int MONSTER_MOVE_WANDER = 2
int monster_moveflags
int monster_movestate
vector monster_moveto
int monster_skill
const int MONSTER_SKILL_EASY = 1
const int MONSTER_SKILL_HARD = 5
const int MONSTER_SKILL_INSANE = 7
const int MONSTER_SKILL_MEDIUM = 3
const int MONSTER_SKILL_NIGHTMARE = 10
const int MONSTERFLAG_APPEAR = 2
const int MONSTERFLAG_FLY_VERTICAL = 8
const int MONSTERFLAG_INFRONT = 32
const int MONSTERFLAG_INVINCIBLE = 128
const int MONSTERFLAG_MINIBOSS = 64
const int MONSTERFLAG_NORESPAWN = 4
const int MONSTERFLAG_RESPAWNED = 32768
const int MONSTERFLAG_SPAWNED = 16384
int monsters_killed
int monsters_total
const int MONSTERSKILL_NOTEASY = 256
const int MONSTERSKILL_NOTHARD = 1024
const int MONSTERSKILL_NOTMEDIUM = 512
float msound_delay
int oldskin
string oldtarget2
float spawn_time
float speed2
float stopspeed
int totalspawned
 number of monsters spawned with mobspawn command
float wander_delay
float wander_distance

Macro Definition Documentation

◆ _MSOUND

#define _MSOUND ( m)
Value:
.string monstersound_##m;

Definition at line 141 of file sv_monsters.qh.

◆ ALLMONSTERSOUNDS

#define ALLMONSTERSOUNDS
Value:
_MSOUND(death) \
_MSOUND(sight) \
_MSOUND(ranged) \
_MSOUND(melee) \
_MSOUND(pain) \
_MSOUND(spawn) \
_MSOUND(idle) \
_MSOUND(attack)
#define spawn
#define _MSOUND(m)

Definition at line 131 of file sv_monsters.qh.

131#define ALLMONSTERSOUNDS \
132 _MSOUND(death) \
133 _MSOUND(sight) \
134 _MSOUND(ranged) \
135 _MSOUND(melee) \
136 _MSOUND(pain) \
137 _MSOUND(spawn) \
138 _MSOUND(idle) \
139 _MSOUND(attack)

Referenced by Monster_Sound_SampleField(), and Monster_Sounds_Clear().

◆ MONSTER_SKILLMOD

#define MONSTER_SKILLMOD ( mon)
Value:
(0.5 + mon.monster_skill * ((1.2 - 0.3) / 10))

Definition at line 62 of file sv_monsters.qh.

Referenced by M_Golem_Attack_Smash(), M_Zombie_Attack_Leap_Touch(), Monster_Attack_Melee(), Monster_Move(), and Monster_Spawn_Setup().

Function Documentation

◆ Monster_Attack_Leap()

bool Monster_Attack_Leap ( entity this,
vector anm,
void(entity this, entity toucher) touchfunc,
vector vel,
float animtime )

Definition at line 430 of file sv_monsters.qc.

431{
432 if(!Monster_Attack_Leap_Check(this, vel))
433 return false;
434
435 setanim(this, anm, false, true, false);
436
437 if(this.animstate_endtime > time && IS_MONSTER(this))
439 else
440 this.attack_finished_single[0] = this.anim_finished = time + animtime;
441
442 if(IS_MONSTER(this))
444 settouch(this, touchfunc);
445 this.origin_z += 1;
446 this.velocity = vel;
447 UNSET_ONGROUND(this);
448
449 return true;
450}
float animstate_endtime
Definition anim.qh:38
#define setanim(...)
Definition anim.qh:45
vector velocity
float time
int state
#define UNSET_ONGROUND(s)
Definition movetypes.qh:18
#define settouch(e, f)
Definition self.qh:73
bool Monster_Attack_Leap_Check(entity this, vector vel)
float anim_finished
const int MONSTER_ATTACK_RANGED
#define IS_MONSTER(v)
Definition utils.qh:21
float attack_finished_single[MAX_WEAPONSLOTS]

References anim_finished, animstate_endtime, attack_finished_single, entity(), IS_MONSTER, Monster_Attack_Leap_Check(), MONSTER_ATTACK_RANGED, setanim, settouch, state, time, toucher, UNSET_ONGROUND, vector, and velocity.

Referenced by M_Zombie_Attack().

◆ Monster_Attack_Melee()

float Monster_Attack_Melee ( entity this,
entity targ,
float damg,
vector anim,
float er,
float animtime,
int deathtype,
float dostop )

References anim, entity(), toucher, and vector.

◆ Monster_Delay()

void Monster_Delay ( entity this,
int repeat_count,
float defer_amnt,
void(entity) func )

Definition at line 246 of file sv_monsters.qc.

247{
248 // deferred attacking, checks if monster is still alive and target is still valid before attacking
250
252 e.nextthink = time + defer_amnt;
253 e.count = defer_amnt;
254 e.owner = this;
255 e.monster_delayedfunc = func;
256 e.cnt = repeat_count;
257}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
#define setthink(e, f)
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
void Monster_Delay_Action(entity this)

References entity(), Monster_Delay(), Monster_Delay_Action(), new_pure, setthink, and time.

Referenced by M_Golem_Attack(), M_Wyvern_Attack(), M_Zombie_Defend_Block(), and Monster_Delay().

◆ Monster_FindTarget()

entity Monster_FindTarget ( entity this)

Definition at line 142 of file sv_monsters.qc.

143{
144 if(MUTATOR_CALLHOOK(MonsterFindTarget)) { return this.enemy; } // Handled by a mutator
145
146 entity closest_target = NULL;
147 vector my_center = CENTER_OR_VIEWOFS(this);
148
149 // find the closest acceptable target to pass to
150 IL_EACH(g_monster_targets, it.monster_attack,
151 {
152 float trange = this.target_range;
153 if(PHYS_INPUT_BUTTON_CROUCH(it))
154 trange *= 0.75; // TODO cvar this
155 vector theirmid = (it.absmin + it.absmax) * 0.5;
156 if(vdist(theirmid - this.origin, >, trange))
157 continue;
158 if(!Monster_ValidTarget(this, it, false))
159 continue;
160
161 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
162 vector targ_center = CENTER_OR_VIEWOFS(it);
163
164 if(closest_target)
165 {
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; }
169 }
170 else { closest_target = it; }
171 });
172
173 return closest_target;
174}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
#define IL_EACH(this, cond, body)
#define NULL
Definition post.qh:14
vector
Definition self.qh:92
entity enemy
Definition sv_ctf.qh:153
IntrusiveList g_monster_targets
#define CENTER_OR_VIEWOFS(ent)
Definition utils.qh:29

References CENTER_OR_VIEWOFS, enemy, entity(), g_monster_targets, IL_EACH, MUTATOR_CALLHOOK, NULL, and vector.

Referenced by Monster_Enemy_Check().

◆ monster_makevectors()

void monster_makevectors ( entity this,
entity targ )

Definition at line 85 of file sv_monsters.qc.

86{
87 if(IS_MONSTER(this))
88 {
89 vector v = targ.origin + (targ.mins + targ.maxs) * 0.5;
90 this.v_angle = vectoangles(v - (this.origin + this.view_ofs));
91 this.v_angle_x = -this.v_angle_x;
92 }
93
94 makevectors(this.v_angle);
95}
vector v_angle
Definition player.qh:237
vector origin
vector vectoangles(vector v)
#define makevectors
Definition post.qh:21
vector view_ofs
Definition progsdefs.qc:151

References entity(), IS_MONSTER, makevectors, origin, v_angle, vectoangles(), vector, and view_ofs.

Referenced by M_Golem_Attack_Lightning(), Monster_Attack_Check(), and Monster_Delay_Action().

◆ Monster_Move_2D()

void Monster_Move_2D ( entity this,
float mspeed,
float allow_jumpoff )

References entity().

◆ Monster_Remove()

void Monster_Remove ( entity this)

Definition at line 943 of file sv_monsters.qc.

944{
945 if(IS_CLIENT(this))
946 return; // don't remove it?
947
948 if(!this) { return; }
949
950 if(!MUTATOR_CALLHOOK(MonsterRemove, this))
951 Send_Effect(EFFECT_ITEM_PICKUP, this.origin, '0 0 0', 1);
952
953 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
954 {
955 .entity weaponentity = weaponentities[slot];
956 if(this.(weaponentity))
957 delete(this.(weaponentity));
958 }
960 delete(this);
961}
#define IS_CLIENT(s)
Definition player.qh:242
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
entity sprite
Definition sv_assault.qc:11
void WaypointSprite_Kill(entity wp)
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17

References entity(), IS_CLIENT, MAX_WEAPONSLOTS, MUTATOR_CALLHOOK, origin, Send_Effect(), sprite, WaypointSprite_Kill(), and weaponentities.

Referenced by CommonCommand_editmob(), Invasion_CheckWinner(), Monster_Reset(), and Monster_Spawn().

◆ monster_setupcolors()

void monster_setupcolors ( entity this)

Definition at line 176 of file sv_monsters.qc.

177{
178 if(teamplay && this.team)
179 this.colormap = 1024 + (this.team - 1) * 17;
180 else if(IS_PLAYER(this.realowner))
181 this.colormap = this.realowner.colormap;
182 else
183 {
185 this.colormap = 1126;
186 else if(this.monster_skill <= MONSTER_SKILL_MEDIUM)
187 this.colormap = 1075;
188 else if(this.monster_skill <= MONSTER_SKILL_HARD)
189 this.colormap = 1228;
190 else if(this.monster_skill <= MONSTER_SKILL_INSANE)
191 this.colormap = 1092;
193 this.colormap = 1160;
194 else
195 this.colormap = 1024;
196 }
197
198 if(this.colormap > 0)
199 this.glowmod = colormapPaletteColor(this.colormap & 0x0F, false);
200 else
201 this.glowmod = '1 1 1';
202}
int team
Definition main.qh:188
#define colormapPaletteColor(c, isPants)
Definition color.qh:5
#define IS_PLAYER(s)
Definition player.qh:243
float colormap
vector glowmod
const int MONSTER_SKILL_EASY
const int MONSTER_SKILL_MEDIUM
int monster_skill
const int MONSTER_SKILL_INSANE
const int MONSTER_SKILL_HARD
const int MONSTER_SKILL_NIGHTMARE
bool teamplay
Definition teams.qh:59
entity realowner

References colormap, colormapPaletteColor, entity(), glowmod, IS_PLAYER, monster_skill, MONSTER_SKILL_EASY, MONSTER_SKILL_HARD, MONSTER_SKILL_INSANE, MONSTER_SKILL_MEDIUM, MONSTER_SKILL_NIGHTMARE, realowner, team, and teamplay.

Referenced by monster_changeteam(), and Monster_Spawn().

◆ Monster_Sound()

void Monster_Sound ( entity this,
.string samplefield,
float sound_delay,
float delaytoo,
float chan )

References entity().

◆ Monster_Spawn()

bool Monster_Spawn ( entity this,
bool check_appear,
Monster mon )

Definition at line 1397 of file sv_monsters.qc.

1398{
1399 // setup the basic required properties for a monster
1400
1401 if(!mon || mon == MON_Null) { return false; } // invalid monster
1402 if(!autocvar_g_monsters) { Monster_Remove(this); return false; }
1403
1404 if(!(this.spawnflags & MONSTERFLAG_RESPAWNED) && !(this.flags & FL_MONSTER))
1405 {
1406 IL_PUSH(g_monsters, this);
1407 if(this.mdl && this.mdl != "")
1408 precache_model(this.mdl);
1409 if(this.mdl_dead && this.mdl_dead != "")
1410 precache_model(this.mdl_dead);
1411 }
1412
1413 if(check_appear && Monster_Appear_Check(this, mon)) { return true; } // return true so the monster isn't removed
1414
1415 if(!this.monster_skill)
1416 this.monster_skill = cvar("g_monsters_skill");
1417
1418 // support for quake style removing monsters based on skill
1419 if(this.monster_skill == MONSTER_SKILL_EASY) if(this.spawnflags & MONSTERSKILL_NOTEASY) { Monster_Remove(this); return false; }
1420 if(this.monster_skill == MONSTER_SKILL_MEDIUM) if(this.spawnflags & MONSTERSKILL_NOTMEDIUM) { Monster_Remove(this); return false; }
1421 if(this.monster_skill == MONSTER_SKILL_HARD) if(this.spawnflags & MONSTERSKILL_NOTHARD) { Monster_Remove(this); return false; }
1422
1423 if(this.team && !teamplay)
1424 this.team = 0;
1425
1426 if(!(this.spawnflags & MONSTERFLAG_SPAWNED)) // naturally spawned monster
1427 if(!(this.spawnflags & MONSTERFLAG_RESPAWNED)) // don't count re-spawning monsters either
1428 monsters_total += 1;
1429
1430 if(this.mdl && this.mdl != "")
1431 _setmodel(this, this.mdl);
1432 else
1433 setmodel(this, mon.m_model);
1434
1435 if(!this.m_name || this.m_name == "")
1436 this.m_name = mon.m_name;
1437
1438 if(this.statuseffects && this.statuseffects.owner == this)
1439 {
1442 }
1443 else
1444 this.statuseffects = NULL;
1445
1446 this.flags = FL_MONSTER;
1447 this.classname = "monster";
1448 this.takedamage = DAMAGE_AIM;
1449 if(!this.bot_attack)
1450 IL_PUSH(g_bot_targets, this);
1451 this.bot_attack = true;
1452 this.iscreature = true;
1453 this.teleportable = true;
1454 if(!this.damagedbycontents)
1456 this.damagedbycontents = true;
1457 this.monsterdef = mon;
1458 this.event_damage = Monster_Damage;
1459 this.event_heal = Monster_Heal;
1460 settouch(this, Monster_Touch);
1461 this.use = Monster_Use;
1462 this.solid = SOLID_BBOX;
1464 StatusEffects_apply(STATUSEFFECT_SpawnShield, this, time + autocvar_g_monsters_spawnshieldtime, 0);
1465 this.enemy = NULL;
1466 this.velocity = '0 0 0';
1467 this.moveto = this.origin;
1468 this.pos1 = this.origin;
1469 this.pos2 = this.angles;
1470 this.reset = Monster_Reset;
1471 this.netname = mon.netname;
1472 this.monster_attackfunc = mon.monster_attackfunc;
1473 this.candrop = true;
1474 this.oldtarget2 = this.target2;
1475 this.deadflag = DEAD_NO;
1476 this.spawn_time = time;
1477 this.gravity = 1;
1478 this.monster_moveto = '0 0 0';
1479 this.monster_face = '0 0 0';
1481
1482 if(!this.noalign) { this.noalign = (mon.spawnflags & (MONSTER_TYPE_FLY | MONSTER_TYPE_SWIM)); }
1483 if(!this.scale) { this.scale = 1; }
1484 if(autocvar_g_monsters_edit) { this.grab = 1; }
1487 if(mon.spawnflags & MONSTER_TYPE_SWIM) { this.flags |= FL_SWIM; }
1488
1491
1493 {
1494 this.flags |= FL_FLY;
1496 }
1497
1499 this.scale *= 1.3;
1500
1501 setsize(this, RoundPerfectVector(mon.m_mins * this.scale), RoundPerfectVector(mon.m_maxs * this.scale));
1502 this.view_ofs = '0 0 0.7' * (this.maxs_z * 0.5);
1503
1504 Monster_UpdateModel(this);
1505
1506 if(!Monster_Spawn_Setup(this))
1507 {
1508 Monster_Remove(this);
1509 return false;
1510 }
1511
1512 if(!this.noalign)
1513 {
1514 setorigin(this, this.origin + '0 0 20');
1515 tracebox(this.origin + '0 0 64', this.mins, this.maxs, this.origin - '0 0 10000', MOVE_WORLDONLY, this);
1516 setorigin(this, trace_endpos);
1517 }
1518
1519 if (!nudgeoutofsolid_OrFallback(this))
1520 {
1521 // Stuck and not fixable
1522 Monster_Remove(this);
1523 return false;
1524 }
1525
1526 if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
1527 monster_setupcolors(this);
1528
1529 CSQCMODEL_AUTOINIT(this);
1530
1531 return true;
1532}
float bot_attack
Definition api.qh:38
IntrusiveList g_bot_targets
Definition api.qh:149
string mdl_dead
Definition breakable.qc:27
int grab
Definition cheats.qh:26
string netname
short name
Definition monster.qh:42
string m_name
human readable name
Definition monster.qh:40
vector m_mins
hitbox size
Definition monster.qh:50
int spawnflags
attributes
Definition monster.qh:38
vector m_maxs
hitbox size
Definition monster.qh:52
string netname
Definition powerups.qc:20
float gravity
Definition items.qh:17
int spawnflags
Definition ammo.qh:15
string mdl
Definition item.qh:89
#define setmodel(this, m)
Definition model.qh:26
string m_name
Definition scores.qh:142
const int FL_SWIM
Definition constants.qh:71
const int FL_MONSTER
Definition constants.qh:74
const int FL_FLY
Definition constants.qh:70
string classname
float flags
float DPCONTENTS_BOTCLIP
float DPCONTENTS_SOLID
vector mins
float DPCONTENTS_BODY
const float SOLID_BBOX
const float EF_FULLBRIGHT
float effects
float DPCONTENTS_PLAYERCLIP
vector trace_endpos
vector maxs
float DPCONTENTS_MONSTERCLIP
float MOVE_WORLDONLY
const float EF_NODEPTHTEST
float dphitcontentsmask
#define use
#define CSQCMODEL_AUTOINIT(e)
float damagedbycontents
Definition damage.qh:45
IntrusiveList g_damagedbycontents
Definition damage.qh:135
ent angles
Definition ent_cs.qc:121
solid
Definition ent_cs.qc:165
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float cvar(string name)
entity monsterdef
Definition monster.qh:24
const int MONSTER_TYPE_FLY
Definition monster.qh:9
const int MONSTER_TYPE_SWIM
Definition monster.qh:10
const int MONSTER_SIZE_QUAKE
Definition monster.qh:17
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_WALK
Definition movetypes.qh:132
const int MOVETYPE_FLY
Definition movetypes.qh:134
float DEAD_NO
Definition progsdefs.qc:274
float deadflag
Definition progsdefs.qc:149
float scale
Definition projectile.qc:14
bool autocvar_g_fullbrightplayers
Definition client.qh:17
bool autocvar_g_nodepthtestplayers
Definition client.qh:34
bool noalign
Definition items.qh:36
bool iscreature
Definition main.qh:46
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 pos2
Definition subs.qh:50
vector pos1
Definition subs.qh:50
const int DAMAGE_AIM
Definition subs.qh:81
float takedamage
Definition subs.qh:78
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)
void Monster_Use(entity this, entity actor, entity trigger)
void Monster_Reset(entity this)
void Monster_Touch(entity this, entity toucher)
bool Monster_Appear_Check(entity this, Monster monster_id)
void Monster_UpdateModel(entity this)
bool Monster_Spawn_Setup(entity this)
vector monster_moveto
const int MONSTERSKILL_NOTHARD
bool autocvar_g_monsters_quake_resize
bool autocvar_g_monsters_playerclip_collisions
const int MONSTERFLAG_SPAWNED
float spawn_time
const int MONSTERSKILL_NOTMEDIUM
int monsters_total
float autocvar_g_monsters_spawnshieldtime
float autocvar_g_monsters
Definition sv_monsters.qh:5
vector monster_face
bool candrop
bool autocvar_g_monsters_edit
Definition sv_monsters.qh:6
const int MONSTERFLAG_RESPAWNED
string oldtarget2
const int MONSTERSKILL_NOTEASY
IntrusiveList g_monsters
string target2
float teleportable
ERASEABLE vector RoundPerfectVector(vector v)
Definition vector.qh:206
vector moveto
Definition zombie.qc:17

References angles, autocvar_g_fullbrightplayers, autocvar_g_monsters, autocvar_g_monsters_edit, autocvar_g_monsters_playerclip_collisions, autocvar_g_monsters_quake_resize, autocvar_g_monsters_spawnshieldtime, autocvar_g_nodepthtestplayers, bot_attack, candrop, classname, CSQCMODEL_AUTOINIT, cvar(), DAMAGE_AIM, damagedbycontents, DEAD_NO, deadflag, DPCONTENTS_BODY, DPCONTENTS_BOTCLIP, DPCONTENTS_MONSTERCLIP, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SOLID, dphitcontentsmask, EF_FULLBRIGHT, EF_NODEPTHTEST, effects, enemy, entity(), FL_FLY, FL_MONSTER, FL_SWIM, flags, g_bot_targets, g_damagedbycontents, g_monsters, grab, gravity, IL_PUSH(), iscreature, Monster::m_maxs, Monster::m_mins, m_name, Monster::m_name, maxs, mdl, mdl_dead, mins, Monster_Appear_Check(), Monster_Damage(), monster_face, Monster_Heal(), monster_moveto, Monster_Remove(), Monster_Reset(), monster_setupcolors(), MONSTER_SIZE_QUAKE, monster_skill, MONSTER_SKILL_EASY, MONSTER_SKILL_HARD, MONSTER_SKILL_MEDIUM, Monster_Spawn_Setup(), Monster_Touch(), MONSTER_TYPE_FLY, MONSTER_TYPE_SWIM, Monster_UpdateModel(), Monster_Use(), monsterdef, MONSTERFLAG_RESPAWNED, MONSTERFLAG_SPAWNED, monsters_total, MONSTERSKILL_NOTEASY, MONSTERSKILL_NOTHARD, MONSTERSKILL_NOTMEDIUM, MOVE_WORLDONLY, moveto, MOVETYPE_FLY, MOVETYPE_WALK, Monster::netname, netname, noalign, NULL, oldtarget2, origin, pos1, RoundPerfectVector(), scale, set_movetype(), setmodel, settouch, solid, SOLID_BBOX, spawn_time, Monster::spawnflags, spawnflags, statuseffects, StatusEffects_apply(), StatusEffects_clearall(), StatusEffects_update(), takedamage, target2, team, teamplay, teleportable, time, trace_endpos, use, velocity, and view_ofs.

Referenced by Monster_Appear(), Monster_Respawn(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), and spawnmonster().

◆ Monster_Touch()

void Monster_Touch ( entity this,
entity toucher )

Definition at line 508 of file sv_monsters.qc.

509{
510 if(!toucher) { return; }
511
512 if(toucher.monster_attack && this.enemy != toucher && !IS_MONSTER(toucher) && time >= this.spawn_time)
513 if(Monster_ValidTarget(this, toucher, true))
514 this.enemy = toucher;
515}
entity entity toucher
Definition self.qh:72
bool Monster_ValidTarget(entity this, entity targ, bool skipfacing)

References enemy, entity(), IS_MONSTER, Monster_ValidTarget(), spawn_time, time, and toucher.

Referenced by M_Zombie_Attack_Leap_Touch(), Monster_Dead(), Monster_Move(), and Monster_Spawn().

◆ monsters_setstatus()

void monsters_setstatus ( entity this)

Definition at line 34 of file sv_monsters.qc.

35{
36 STAT(MONSTERS_TOTAL, this) = monsters_total;
37 STAT(MONSTERS_KILLED, this) = monsters_killed;
38}
#define STAT(...)
Definition stats.qh:82
int monsters_killed

References entity(), monsters_killed, monsters_total, and STAT.

Referenced by PlayerThink().

◆ STATIC_INIT() [1/2]

STATIC_INIT ( g_monster_targets )

Definition at line 151 of file sv_monsters.qh.

#define IL_NEW()

References g_monster_targets, and IL_NEW.

◆ STATIC_INIT() [2/2]

STATIC_INIT ( g_monsters )

Definition at line 148 of file sv_monsters.qh.

148{ g_monsters = IL_NEW(); }

References g_monsters, and IL_NEW.

Variable Documentation

◆ anim_finished

◆ attack_range

float attack_range

Definition at line 45 of file sv_monsters.qh.

Referenced by M_Golem_Attack_Swing(), and Monster_Spawn_Setup().

◆ autocvar_g_monsters

float autocvar_g_monsters

◆ autocvar_g_monsters_armor_blockpercent

float autocvar_g_monsters_armor_blockpercent

Definition at line 30 of file sv_monsters.qh.

Referenced by M_Zombie_Defend_Block_End().

◆ autocvar_g_monsters_attack_range

float autocvar_g_monsters_attack_range

Definition at line 15 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup().

◆ autocvar_g_monsters_damageforcescale

float autocvar_g_monsters_damageforcescale = 0.8

Definition at line 10 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup().

◆ autocvar_g_monsters_drop_time

float autocvar_g_monsters_drop_time = 10

Definition at line 24 of file sv_monsters.qh.

Referenced by monster_dropitem().

◆ autocvar_g_monsters_edit

bool autocvar_g_monsters_edit

Definition at line 6 of file sv_monsters.qh.

Referenced by CommonCommand_editmob(), and Monster_Spawn().

◆ autocvar_g_monsters_healthbars

float autocvar_g_monsters_healthbars

Definition at line 31 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup().

◆ autocvar_g_monsters_lineofsight

bool autocvar_g_monsters_lineofsight = true

Definition at line 32 of file sv_monsters.qh.

Referenced by Monster_ValidTarget().

◆ autocvar_g_monsters_max

int autocvar_g_monsters_max

Definition at line 8 of file sv_monsters.qh.

Referenced by CommonCommand_editmob().

◆ autocvar_g_monsters_max_perplayer

int autocvar_g_monsters_max_perplayer

Definition at line 9 of file sv_monsters.qh.

Referenced by CommonCommand_editmob().

◆ autocvar_g_monsters_miniboss_chance

float autocvar_g_monsters_miniboss_chance

Definition at line 21 of file sv_monsters.qh.

Referenced by Monster_Miniboss_Setup().

◆ autocvar_g_monsters_miniboss_healthboost

float autocvar_g_monsters_miniboss_healthboost

Definition at line 22 of file sv_monsters.qh.

Referenced by Monster_Miniboss_Setup().

◆ autocvar_g_monsters_miniboss_loot

string autocvar_g_monsters_miniboss_loot = "vortex"

Definition at line 23 of file sv_monsters.qh.

Referenced by monster_dropitem().

◆ autocvar_g_monsters_owners

bool autocvar_g_monsters_owners

Definition at line 19 of file sv_monsters.qh.

Referenced by spawnmonster().

◆ autocvar_g_monsters_playerclip_collisions

bool autocvar_g_monsters_playerclip_collisions

Definition at line 20 of file sv_monsters.qh.

Referenced by Monster_Spawn().

◆ autocvar_g_monsters_quake_resize

bool autocvar_g_monsters_quake_resize = true

Definition at line 26 of file sv_monsters.qh.

Referenced by Monster_Spawn().

◆ autocvar_g_monsters_respawn

bool autocvar_g_monsters_respawn

Definition at line 29 of file sv_monsters.qh.

Referenced by Monster_Respawn_Check().

◆ autocvar_g_monsters_respawn_delay

float autocvar_g_monsters_respawn_delay

Definition at line 28 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup().

◆ autocvar_g_monsters_score_kill

int autocvar_g_monsters_score_kill

Definition at line 16 of file sv_monsters.qh.

Referenced by Monster_Dead().

◆ autocvar_g_monsters_score_spawned

int autocvar_g_monsters_score_spawned

Definition at line 17 of file sv_monsters.qh.

Referenced by Monster_Dead().

◆ autocvar_g_monsters_sounds

bool autocvar_g_monsters_sounds

Definition at line 7 of file sv_monsters.qh.

Referenced by Monster_Sound().

◆ autocvar_g_monsters_spawnshieldtime

float autocvar_g_monsters_spawnshieldtime

Definition at line 25 of file sv_monsters.qh.

Referenced by Monster_Spawn().

◆ autocvar_g_monsters_target_infront

bool autocvar_g_monsters_target_infront

Definition at line 12 of file sv_monsters.qh.

Referenced by Monster_Attack_Check(), and Monster_ValidTarget().

◆ autocvar_g_monsters_target_infront_2d

bool autocvar_g_monsters_target_infront_2d = true

Definition at line 14 of file sv_monsters.qh.

Referenced by monster_facing().

◆ autocvar_g_monsters_target_infront_range

float autocvar_g_monsters_target_infront_range = 0.3

Definition at line 13 of file sv_monsters.qh.

Referenced by monster_facing().

◆ autocvar_g_monsters_target_range

float autocvar_g_monsters_target_range

Definition at line 11 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup(), and SOUND().

◆ autocvar_g_monsters_teams

bool autocvar_g_monsters_teams

Definition at line 27 of file sv_monsters.qh.

Referenced by Monster_Move(), and spawnmonster().

◆ autocvar_g_monsters_typefrag

bool autocvar_g_monsters_typefrag

Definition at line 18 of file sv_monsters.qh.

Referenced by Monster_ValidTarget().

◆ candrop

bool candrop

Definition at line 47 of file sv_monsters.qh.

Referenced by Monster_Damage(), monster_dropitem(), and Monster_Spawn().

◆ g_monster_targets

◆ g_monsters

◆ GetMonsterSoundSampleField_notFound

ALLMONSTERSOUNDS float GetMonsterSoundSampleField_notFound

Definition at line 145 of file sv_monsters.qh.

Referenced by Monster_Sound_SampleField(), and Monster_Sounds_Load().

◆ last_enemycheck

float last_enemycheck

Definition at line 52 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup(), and Monster_Think().

◆ last_trace

float last_trace

Definition at line 51 of file sv_monsters.qh.

Referenced by Monster_Move(), and Monster_Move_Target().

◆ mdl_dead

string mdl_dead

Definition at line 59 of file sv_monsters.qh.

◆ monster_attack

◆ MONSTER_ATTACK_MELEE

◆ MONSTER_ATTACK_RANGED

◆ monster_face

vector monster_face

Definition at line 55 of file sv_monsters.qh.

Referenced by Monster_Enemy_Check(), Monster_Move(), and Monster_Spawn().

◆ monster_follow

entity monster_follow

◆ monster_item

bool monster_item

Definition at line 60 of file sv_monsters.qh.

◆ monster_lifetime

float monster_lifetime

Definition at line 44 of file sv_monsters.qh.

Referenced by Monster_Dead(), Monster_Dead_Fade(), Monster_Dead_Think(), and Monster_Think().

◆ MONSTER_MOVE_ENEMY

const int MONSTER_MOVE_ENEMY = 5

Definition at line 72 of file sv_monsters.qh.

Referenced by Monster_Move_Target().

◆ MONSTER_MOVE_FOLLOW

const int MONSTER_MOVE_FOLLOW = 1

Definition at line 68 of file sv_monsters.qh.

Referenced by Monster_Move_Target().

◆ MONSTER_MOVE_NOMOVE

const int MONSTER_MOVE_NOMOVE = 4

Definition at line 71 of file sv_monsters.qh.

Referenced by Monster_Move_Target().

◆ MONSTER_MOVE_SPAWNLOC

const int MONSTER_MOVE_SPAWNLOC = 3

Definition at line 70 of file sv_monsters.qh.

Referenced by Monster_Move_Target().

◆ MONSTER_MOVE_WANDER

const int MONSTER_MOVE_WANDER = 2

Definition at line 69 of file sv_monsters.qh.

Referenced by Monster_Move_Target(), and Monster_Spawn_Setup().

◆ monster_moveflags

int monster_moveflags

Definition at line 49 of file sv_monsters.qh.

Referenced by Monster_Move_Target(), Monster_Spawn_Setup(), and spawner_use().

◆ monster_movestate

int monster_movestate

Definition at line 40 of file sv_monsters.qh.

Referenced by Monster_Move_Target().

◆ monster_moveto

vector monster_moveto

◆ monster_skill

int monster_skill

Definition at line 99 of file sv_monsters.qh.

Referenced by monster_setupcolors(), Monster_Spawn(), and spawner_use().

◆ MONSTER_SKILL_EASY

const int MONSTER_SKILL_EASY = 1

Definition at line 77 of file sv_monsters.qh.

Referenced by monster_setupcolors(), and Monster_Spawn().

◆ MONSTER_SKILL_HARD

const int MONSTER_SKILL_HARD = 5

Definition at line 79 of file sv_monsters.qh.

Referenced by monster_setupcolors(), and Monster_Spawn().

◆ MONSTER_SKILL_INSANE

const int MONSTER_SKILL_INSANE = 7

Definition at line 80 of file sv_monsters.qh.

Referenced by monster_setupcolors(), and nade_monster_boom().

◆ MONSTER_SKILL_MEDIUM

const int MONSTER_SKILL_MEDIUM = 3

Definition at line 78 of file sv_monsters.qh.

Referenced by monster_setupcolors(), and Monster_Spawn().

◆ MONSTER_SKILL_NIGHTMARE

const int MONSTER_SKILL_NIGHTMARE = 10

Definition at line 81 of file sv_monsters.qh.

Referenced by monster_setupcolors().

◆ MONSTERFLAG_APPEAR

const int MONSTERFLAG_APPEAR = 2

Definition at line 88 of file sv_monsters.qh.

Referenced by Monster_Appear_Check().

◆ MONSTERFLAG_FLY_VERTICAL

const int MONSTERFLAG_FLY_VERTICAL = 8

Definition at line 90 of file sv_monsters.qh.

Referenced by Monster_Move(), and Monster_WanderTarget().

◆ MONSTERFLAG_INFRONT

const int MONSTERFLAG_INFRONT = 32

Definition at line 91 of file sv_monsters.qh.

Referenced by Monster_Attack_Check(), and Monster_ValidTarget().

◆ MONSTERFLAG_INVINCIBLE

const int MONSTERFLAG_INVINCIBLE = 128

Definition at line 93 of file sv_monsters.qh.

Referenced by M_Mage_Defend_Heal(), Monster_Damage(), and Monster_Spawn_Setup().

◆ MONSTERFLAG_MINIBOSS

const int MONSTERFLAG_MINIBOSS = 64

◆ MONSTERFLAG_NORESPAWN

const int MONSTERFLAG_NORESPAWN = 4

Definition at line 89 of file sv_monsters.qh.

Referenced by Monster_Respawn_Check(), and spawnmonster().

◆ MONSTERFLAG_RESPAWNED

◆ MONSTERFLAG_SPAWNED

const int MONSTERFLAG_SPAWNED = 16384

◆ monsters_killed

int monsters_killed

◆ monsters_total

int monsters_total

◆ MONSTERSKILL_NOTEASY

const int MONSTERSKILL_NOTEASY = 256

Definition at line 83 of file sv_monsters.qh.

Referenced by Monster_Spawn().

◆ MONSTERSKILL_NOTHARD

const int MONSTERSKILL_NOTHARD = 1024

Definition at line 85 of file sv_monsters.qh.

Referenced by Monster_Spawn().

◆ MONSTERSKILL_NOTMEDIUM

const int MONSTERSKILL_NOTMEDIUM = 512

Definition at line 84 of file sv_monsters.qh.

Referenced by Monster_Spawn().

◆ msound_delay

float msound_delay

Definition at line 130 of file sv_monsters.qh.

Referenced by Monster_Sound().

◆ oldskin

int oldskin

Definition at line 58 of file sv_monsters.qh.

Referenced by FixPlayermodel().

◆ oldtarget2

string oldtarget2

Definition at line 50 of file sv_monsters.qh.

Referenced by Monster_Damage(), and Monster_Spawn().

◆ spawn_time

float spawn_time

◆ speed2

float speed2

Definition at line 56 of file sv_monsters.qh.

Referenced by Monster_Think(), and tubasound().

◆ stopspeed

float stopspeed

Definition at line 57 of file sv_monsters.qh.

Referenced by Monster_Think().

◆ totalspawned

int totalspawned

number of monsters spawned with mobspawn command

Definition at line 127 of file sv_monsters.qh.

Referenced by CommonCommand_editmob(), Monster_Dead(), Monster_Dead_Damage(), and Monster_Dead_Fade().

◆ wander_delay

float wander_delay

Definition at line 42 of file sv_monsters.qh.

Referenced by Monster_Move_Target(), and Monster_Spawn_Setup().

◆ wander_distance

float wander_distance

Definition at line 43 of file sv_monsters.qh.

Referenced by Monster_Spawn_Setup(), and Monster_WanderTarget().