5 float autocvar_g_monsters;
6 bool autocvar_g_monsters_edit;
7 bool autocvar_g_monsters_sounds;
8 float autocvar_g_monsters_think_delay;
9 int autocvar_g_monsters_max;
10 int autocvar_g_monsters_max_perplayer;
11 float autocvar_g_monsters_damageforcescale = 0.8;
12 float autocvar_g_monsters_target_range;
13 bool autocvar_g_monsters_target_infront;
14 float autocvar_g_monsters_target_infront_range = 0.3;
15 float autocvar_g_monsters_attack_range;
16 int autocvar_g_monsters_score_kill;
17 int autocvar_g_monsters_score_spawned;
18 bool autocvar_g_monsters_typefrag;
19 bool autocvar_g_monsters_owners;
20 float autocvar_g_monsters_miniboss_chance;
21 float autocvar_g_monsters_miniboss_healthboost;
22 float autocvar_g_monsters_drop_time;
23 float autocvar_g_monsters_spawnshieldtime;
24 bool autocvar_g_monsters_quake_resize = true;
25 bool autocvar_g_monsters_teams;
26 float autocvar_g_monsters_respawn_delay;
27 bool autocvar_g_monsters_respawn;
28 float autocvar_g_monsters_armor_blockpercent;
29 float autocvar_g_monsters_healthbars;
30 bool autocvar_g_monsters_lineofsight = true;
31 //bool autocvar_g_monsters_ignoretraces = true;
38 .int monster_movestate; // move target priority
39 .entity monster_follow; // follow target
40 .float wander_delay; // logic delay between moving while idle
41 .float wander_distance; // distance to move between wander delays
42 .float monster_lifetime; // monster dies instantly after this delay, set from spawn
43 .float attack_range; // melee attack if closer, ranged attack if further away (TODO: separate ranged attack range?)
44 .float spawn_time; // delay monster thinking until spawn animation has completed
45 .bool candrop; // toggle to allow disabling monster item drops
46 .int monster_movestate; // will be phased out
47 .int monster_moveflags;
48 .string oldtarget2; // a copy of the original follow target string
49 .float last_trace; // logic delay between target tracing
50 .float last_enemycheck; // for checking enemy
51 .float anim_finished; // will be phased out when we have proper animations system
52 .vector monster_moveto; // custom destination for monster (reset to '0 0 0' when you're done!)
53 .vector monster_face; // custom looking direction for monster (reset to '0 0 0' when you're done!)
54 .float speed2; // run speed
57 .string mdl_dead; // dead model for goombas
59 #define MONSTER_SKILLMOD(mon) (0.5 + mon.monster_skill * ((1.2 - 0.3) / 10))
62 .bool monster_attack; // indicates whether an entity can be attacked by monsters
64 // monster state declarations
65 const int MONSTER_MOVE_FOLLOW = 1; // monster will follow if in range, or stand still
66 const int MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around
67 const int MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking
68 const int MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
69 const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate
70 const int MONSTER_ATTACK_MELEE = 6;
71 const int MONSTER_ATTACK_RANGED = 7;
74 const int MONSTER_SKILL_EASY = 1;
75 const int MONSTER_SKILL_MEDIUM = 3;
76 const int MONSTER_SKILL_HARD = 5;
77 const int MONSTER_SKILL_INSANE = 7;
78 const int MONSTER_SKILL_NIGHTMARE = 10;
80 const int MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1
81 const int MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2
82 const int MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3
85 const int MONSTERFLAG_APPEAR = 2; // delay spawn until triggered
86 const int MONSTERFLAG_NORESPAWN = 4;
87 const int MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically
88 const int MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us
89 const int MONSTERFLAG_MINIBOSS = 64; // monster spawns as mini-boss (also has a chance of naturally becoming one)
90 const int MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters)
91 const int MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters
92 const int MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters
94 // compatibility with old maps (soon to be removed)
95 .float monster_lifetime;
98 // functions used elsewhere
99 void Monster_Remove(entity this);
101 void monsters_setstatus(entity this);
103 bool Monster_Spawn(entity this, bool check_appear, Monster mon);
105 void monster_setupcolors(entity this);
107 void Monster_Touch(entity this, entity toucher);
109 void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
111 void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func);
113 float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
115 bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime);
117 entity Monster_FindTarget(entity this);
119 void monster_makevectors(entity this, entity targ);
121 void Monster_Sound(entity this, .string samplefield, float sound_delay, float delaytoo, float chan);
123 /** number of monsters spawned with mobspawn command */
127 .float msound_delay; // temporary antilag system
128 #define ALLMONSTERSOUNDS \
138 #define _MSOUND(m) .string monstersound_##m;
142 float GetMonsterSoundSampleField_notFound;
144 IntrusiveList g_monsters;
145 STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); }
147 IntrusiveList g_monster_targets;
148 STATIC_INIT(g_monster_targets) { g_monster_targets = IL_NEW(); }