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
46.float spawn_time;
47.bool candrop;
50.string oldtarget2;
51.float last_trace;
55.vector monster_face;
56.float speed;
57.float speed2;
58.float stopspeed;
60.string mdl_dead;
62
63#define MONSTER_SKILLMOD(mon) (0.5 + mon.monster_skill * ((1.2 - 0.3) / 10))
64
65// other properties
67
68// monster state declarations
69const int MONSTER_MOVE_FOLLOW = 1;
70const int MONSTER_MOVE_WANDER = 2;
71const int MONSTER_MOVE_SPAWNLOC = 3;
72const int MONSTER_MOVE_NOMOVE = 4;
73const int MONSTER_MOVE_ENEMY = 5;
76
77// skill declarations
78const int MONSTER_SKILL_EASY = 1;
80const int MONSTER_SKILL_HARD = 5;
83
84const int MONSTERSKILL_NOTEASY = BIT(8);
86const int MONSTERSKILL_NOTHARD = BIT(10);
87
88// spawn flags
89const int MONSTERFLAG_APPEAR = BIT(1);
90const int MONSTERFLAG_NORESPAWN = BIT(2);
92const int MONSTERFLAG_INFRONT = BIT(5);
93const int MONSTERFLAG_MINIBOSS = BIT(6);
95const int MONSTERFLAG_SPAWNED = BIT(14);
96const int MONSTERFLAG_RESPAWNED = BIT(15);
97
98// compatibility with old maps (soon to be removed)
99.float monster_lifetime;
101
102// functions used elsewhere
103void Monster_Remove(entity this);
104void monsters_setstatus(entity this);
105bool Monster_Spawn(entity this, bool check_appear, Monster mon);
106
107void monster_setupcolors(entity this);
108
110
111void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
112
113void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func);
114
115float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
116bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime);
117
119
120void monster_makevectors(entity this, entity targ);
121
122void Monster_Sound(entity this, .string samplefield, float sound_delay, float delaytoo, float chan);
123
125
126// monster sounds
128#define ALLMONSTERSOUNDS \
129 _MSOUND(death) \
130 _MSOUND(sight) \
131 _MSOUND(ranged) \
132 _MSOUND(melee) \
133 _MSOUND(pain) \
134 _MSOUND(spawn) \
135 _MSOUND(idle) \
136 _MSOUND(attack)
137
138#define _MSOUND(m) .string monstersound_##m;
140#undef _MSOUND
141
143
149
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
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...
float speed
Definition dynlight.qc:9
#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
indicates whether an entity can be attacked by monsters
#define ALLMONSTERSOUNDS
const int MONSTERFLAG_NORESPAWN
monster doesn't respawn (revive)
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
ALLMONSTERSOUNDS bool GetMonsterSoundSampleField_notFound
const int MONSTER_MOVE_FOLLOW
monster will follow if in range, or stand still
vector monster_moveto
custom destination for monster (reset to '0 0 0' when you're done!)
float anim_finished
will be phased out when we have proper animations system
const int MONSTERSKILL_NOTHARD
monster will not spawn on skill >= 3
entity monster_follow
monster follow target
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
used only as a movestate, for monsters
float wander_delay
monster logic delay between moving while idle
int monster_skill
const int MONSTERFLAG_SPAWNED
flag for spawned monsters
float wander_distance
distance to move between wander delays for monsters
bool autocvar_g_monsters_typefrag
bool autocvar_g_monsters_sounds
Definition sv_monsters.qh:7
const int MONSTERFLAG_INFRONT
only check for enemies infront of us, for monsters
bool Monster_Spawn(entity this, bool check_appear, Monster mon)
Setup the basic required properties for a monster.
float spawn_time
delay monster thinking until spawn animation has completed
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
monster logic delay between target tracing
const int MONSTERSKILL_NOTMEDIUM
monster will not spawn on skill 2
int monsters_killed
IntrusiveList g_monster_targets
float autocvar_g_monsters_damageforcescale
float stopspeed
const int MONSTERFLAG_APPEAR
delay monster spawn until triggered
int monsters_total
void Monster_Touch(entity this, entity toucher)
bool monster_item
identifier for dropped monster loot TODO: generic identifiers? ok_item exists too!
const int MONSTER_MOVE_SPAWNLOC
monster will move to its spawn location when not attacking
const int MONSTERFLAG_MINIBOSS
monster spawns as mini-boss (also has a chance of naturally becoming one)
const int MONSTER_MOVE_WANDER
monster will ignore owner & wander around
float autocvar_g_monsters_miniboss_chance
float autocvar_g_monsters_spawnshieldtime
float autocvar_g_monsters
Definition sv_monsters.qh:5
vector monster_face
custom looking direction for monster (reset to '0 0 0' when you're done!)
int oldskin
float autocvar_g_monsters_target_range
bool candrop
toggle to allow disabling monster item drops
const int MONSTER_SKILL_INSANE
entity Monster_FindTarget(entity this)
float attack_range
melee attack if closer, ranged attack if further away (TODO: separate ranged attack range?...
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
monster run speed
const int MONSTER_SKILL_HARD
const int MONSTER_SKILL_NIGHTMARE
float autocvar_g_monsters_miniboss_healthboost
const int MONSTERFLAG_INVINCIBLE
monster doesn't take damage (may be used for map objects & temporary monsters)
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
flag for respawned monsters
string oldtarget2
a copy of the original follow target string for monsters
const int MONSTERSKILL_NOTEASY
monster will not spawn on skill <= 1
const int MONSTER_ATTACK_RANGED
int monster_movestate
monster move target priority
const int MONSTERFLAG_FLY_VERTICAL
monster can fly/swim vertically
float autocvar_g_monsters_armor_blockpercent
float last_enemycheck
for checking monster enemy
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
monster simply stands still
int autocvar_g_monsters_max_perplayer
Definition sv_monsters.qh:9
float autocvar_g_monsters_target_infront_range
float msound_delay
temporary antilag system
float monster_lifetime
monster dies instantly after this delay, set from spawn