]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/sv_monsters.qh
Merge branch 'master' into terencehill/quickmenu
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_monsters.qh
1 #ifndef SV_MONSTERS_H
2 #define SV_MONSTERS_H
3
4 // stats networking
5 .int stat_monsters_killed;
6 .int stat_monsters_total;
7 int monsters_total;
8 int monsters_killed;
9
10 // monster properties
11 .int monster_movestate; // move target priority
12 .entity monster_follow; // follow target
13 .float wander_delay; // logic delay between moving while idle
14 .float wander_distance; // distance to move between wander delays
15 .float monster_lifetime; // monster dies instantly after this delay, set from spawn
16 .float attack_range; // melee attack if closer, ranged attack if further away (TODO: separate ranged attack range?)
17 .float spawn_time; // delay monster thinking until spawn animation has completed
18 .bool candrop; // toggle to allow disabling monster item drops
19 .int monster_movestate; // will be phased out
20 .int monster_moveflags;
21 .string oldtarget2; // a copy of the original follow target string
22 .float last_trace; // logic delay between target tracing
23 .float last_enemycheck; // for checking enemy
24 .float anim_finished; // will be phased out when we have proper animations system
25 .vector monster_moveto; // custom destination for monster (reset to '0 0 0' when you're done!)
26 .vector monster_face; // custom looking direction for monster (reset to '0 0 0' when you're done!)
27 .float speed2; // run speed
28 .float stopspeed;
29 .int oldskin;
30 .string mdl_dead; // dead model for goombas
31
32 #define MONSTER_SKILLMOD(mon) (0.5 + mon.monster_skill * ((1.2 - 0.3) / 10))
33
34 // other properties
35 .bool monster_attack; // indicates whether an entity can be attacked by monsters
36 .float spider_slowness; // effect time of slowness inflicted by spiders
37
38 // monster state declarations
39 const int MONSTER_MOVE_FOLLOW = 1; // monster will follow if in range, or stand still
40 const int MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around
41 const int MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking
42 const int MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
43 const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate
44 const int MONSTER_ATTACK_MELEE = 6;
45 const int MONSTER_ATTACK_RANGED = 7;
46
47 // skill declarations
48 const int MONSTER_SKILL_EASY = 1;
49 const int MONSTER_SKILL_MEDIUM = 3;
50 const int MONSTER_SKILL_HARD = 5;
51 const int MONSTER_SKILL_INSANE = 7;
52 const int MONSTER_SKILL_NIGHTMARE = 10;
53
54 const int MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1
55 const int MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2
56 const int MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3
57
58 // spawn flags
59 const int MONSTERFLAG_APPEAR = 2; // delay spawn until triggered
60 const int MONSTERFLAG_NORESPAWN = 4;
61 const int MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically
62 const int MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us
63 const int MONSTERFLAG_MINIBOSS = 64;    // monster spawns as mini-boss (also has a chance of naturally becoming one)
64 const int MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters)
65 const int MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters
66 const int MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters
67
68 // compatibility with old maps (soon to be removed)
69 .float monster_lifetime;
70 .int monster_skill;
71
72 // functions used elsewhere
73 void Monster_Remove(entity mon);
74
75 void monsters_setstatus();
76
77 bool Monster_Spawn(int mon_id);
78
79 void monster_setupcolors(entity mon);
80
81 void Monster_Touch();
82
83 void Monster_Move_2D(float mspeed, float allow_jumpoff);
84
85 void Monster_Delay(float repeat_count, float repeat_defer, float defer_amnt, void() func);
86
87 float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
88
89 bool Monster_Attack_Leap(vector anm, void() touchfunc, vector vel, float animtime);
90
91 entity Monster_FindTarget(entity mon);
92
93 void monster_makevectors(entity e);
94
95 void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float chan);
96
97 // monster sounds
98 .float msound_delay; // temporary antilag system
99 #define ALLMONSTERSOUNDS \
100                 _MSOUND(death) \
101                 _MSOUND(sight) \
102                 _MSOUND(ranged) \
103                 _MSOUND(melee) \
104                 _MSOUND(pain) \
105                 _MSOUND(spawn) \
106                 _MSOUND(idle) \
107                 _MSOUND(attack)
108
109 #define _MSOUND(m) .string monstersound_##m;
110 ALLMONSTERSOUNDS
111 #undef _MSOUND
112
113 float GetMonsterSoundSampleField_notFound;
114
115 #endif