Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_monsters.qh
Go to the documentation of this file.
1#pragma once
2
3#include "all.qh"
4
33//bool autocvar_g_monsters_ignoretraces = true;
34
35// stats networking
38
39// monster properties
40.int monster_movestate; // move target priority
41.entity monster_follow; // follow target
42.float wander_delay; // logic delay between moving while idle
43.float wander_distance; // distance to move between wander delays
44.float monster_lifetime; // monster dies instantly after this delay, set from spawn
45.float attack_range; // melee attack if closer, ranged attack if further away (TODO: separate ranged attack range?)
46.float spawn_time; // delay monster thinking until spawn animation has completed
47.bool candrop; // toggle to allow disabling monster item drops
48.int monster_movestate; // will be phased out
50.string oldtarget2; // a copy of the original follow target string
51.float last_trace; // logic delay between target tracing
52.float last_enemycheck; // for checking enemy
53.float anim_finished; // will be phased out when we have proper animations system
54.vector monster_moveto; // custom destination for monster (reset to '0 0 0' when you're done!)
55.vector monster_face; // custom looking direction for monster (reset to '0 0 0' when you're done!)
56.float speed2; // run speed
57.float stopspeed;
59.string mdl_dead; // dead model for goombas
60.bool monster_item; // identifier for dropped monster loot TODO: generic identifiers? ok_item exists too!
61
62#define MONSTER_SKILLMOD(mon) (0.5 + mon.monster_skill * ((1.2 - 0.3) / 10))
63
64// other properties
65.bool monster_attack; // indicates whether an entity can be attacked by monsters
66
67// monster state declarations
68const int MONSTER_MOVE_FOLLOW = 1; // monster will follow if in range, or stand still
69const int MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around
70const int MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking
71const int MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
72const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate
75
76// skill declarations
77const int MONSTER_SKILL_EASY = 1;
79const int MONSTER_SKILL_HARD = 5;
82
83const int MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1
84const int MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2
85const int MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3
86
87// spawn flags
88const int MONSTERFLAG_APPEAR = 2; // delay spawn until triggered
90const int MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically
91const int MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us
92const int MONSTERFLAG_MINIBOSS = 64; // monster spawns as mini-boss (also has a chance of naturally becoming one)
93const int MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters)
94const int MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters
95const int MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters
96
97// compatibility with old maps (soon to be removed)
98.float monster_lifetime;
100
101// functions used elsewhere
102void Monster_Remove(entity this);
103
104void monsters_setstatus(entity this);
105
106bool Monster_Spawn(entity this, bool check_appear, Monster mon);
107
108void monster_setupcolors(entity this);
109
111
112void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
113
114void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func);
115
116float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
117
118bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime);
119
121
122void monster_makevectors(entity this, entity targ);
123
124void Monster_Sound(entity this, .string samplefield, float sound_delay, float delaytoo, float chan);
125
128
129// monster sounds
130.float msound_delay; // temporary antilag system
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)
140
141#define _MSOUND(m) .string monstersound_##m;
143#undef _MSOUND
144
146
149
string mdl_dead
Definition breakable.qc:27
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
#define IL_NEW()
entity anim
Definition menu.qh:25
vector
Definition self.qh:92
entity entity toucher
Definition self.qh:72
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32
bool monster_attack
#define ALLMONSTERSOUNDS
const int MONSTERFLAG_NORESPAWN
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
void Monster_Remove(entity this)
int autocvar_g_monsters_score_spawned
float autocvar_g_monsters_attack_range
void monster_setupcolors(entity this)
int monster_moveflags
bool autocvar_g_monsters_respawn
const int MONSTER_SKILL_EASY
int totalspawned
number of monsters spawned with mobspawn command
const int MONSTER_MOVE_FOLLOW
vector monster_moveto
float anim_finished
const int MONSTERSKILL_NOTHARD
entity monster_follow
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
float wander_delay
int monster_skill
const int MONSTERFLAG_SPAWNED
float wander_distance
bool autocvar_g_monsters_typefrag
bool autocvar_g_monsters_sounds
Definition sv_monsters.qh:7
const int MONSTERFLAG_INFRONT
bool Monster_Spawn(entity this, bool check_appear, Monster mon)
float spawn_time
int autocvar_g_monsters_max
Definition sv_monsters.qh:8
float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop)
float last_trace
const int MONSTERSKILL_NOTMEDIUM
int monsters_killed
IntrusiveList g_monster_targets
float autocvar_g_monsters_damageforcescale
float stopspeed
const int MONSTERFLAG_APPEAR
int monsters_total
void Monster_Touch(entity this, entity toucher)
bool monster_item
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
Definition sv_monsters.qh:5
vector monster_face
int oldskin
float autocvar_g_monsters_target_range
bool candrop
const int MONSTER_SKILL_INSANE
entity Monster_FindTarget(entity this)
float attack_range
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
void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff)
const int MONSTER_ATTACK_MELEE
bool autocvar_g_monsters_edit
Definition sv_monsters.qh:6
void monster_makevectors(entity this, entity targ)
float autocvar_g_monsters_drop_time
float speed2
const int MONSTER_SKILL_HARD
const int MONSTER_SKILL_NIGHTMARE
float autocvar_g_monsters_miniboss_healthboost
const int MONSTERFLAG_INVINCIBLE
void Monster_Sound(entity this,.string samplefield, float sound_delay, float delaytoo, float chan)
int autocvar_g_monsters_score_kill
bool autocvar_g_monsters_owners
bool autocvar_g_monsters_target_infront
const int MONSTERFLAG_RESPAWNED
string oldtarget2
const int MONSTERSKILL_NOTEASY
const int MONSTER_ATTACK_RANGED
int monster_movestate
const int MONSTERFLAG_FLY_VERTICAL
float autocvar_g_monsters_armor_blockpercent
float last_enemycheck
IntrusiveList g_monsters
bool autocvar_g_monsters_teams
bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime)
void monsters_setstatus(entity this)
const int MONSTER_MOVE_NOMOVE
int autocvar_g_monsters_max_perplayer
Definition sv_monsters.qh:9
float autocvar_g_monsters_target_infront_range
float msound_delay
float monster_lifetime