]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/sv_monsters.qh
Merge branch 'terencehill/lms_itemtimes_fix' into 'master'
[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
37 // monster state declarations
38 const int MONSTER_MOVE_FOLLOW = 1; // monster will follow if in range, or stand still
39 const int MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around
40 const int MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking
41 const int MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
42 const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate
43 const int MONSTER_ATTACK_MELEE = 6;
44 const int MONSTER_ATTACK_RANGED = 7;
45
46 // skill declarations
47 const int MONSTER_SKILL_EASY = 1;
48 const int MONSTER_SKILL_MEDIUM = 3;
49 const int MONSTER_SKILL_HARD = 5;
50 const int MONSTER_SKILL_INSANE = 7;
51 const int MONSTER_SKILL_NIGHTMARE = 10;
52
53 const int MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1
54 const int MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2
55 const int MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3
56
57 // spawn flags
58 const int MONSTERFLAG_APPEAR = 2; // delay spawn until triggered
59 const int MONSTERFLAG_NORESPAWN = 4;
60 const int MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically
61 const int MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us
62 const int MONSTERFLAG_MINIBOSS = 64;    // monster spawns as mini-boss (also has a chance of naturally becoming one)
63 const int MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters)
64 const int MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters
65 const int MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters
66
67 // compatibility with old maps (soon to be removed)
68 .float monster_lifetime;
69 .int monster_skill;
70
71 // functions used elsewhere
72 void Monster_Remove(entity this);
73
74 void monsters_setstatus(entity this);
75
76 bool Monster_Spawn(entity this, int mon_id);
77
78 void monster_setupcolors(entity this);
79
80 void Monster_Touch();
81
82 void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
83
84 void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func);
85
86 float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
87
88 bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel, float animtime);
89
90 entity Monster_FindTarget(entity this);
91
92 void monster_makevectors(entity this, entity targ);
93
94 void Monster_Sound(entity this, .string samplefield, float sound_delay, float delaytoo, float chan);
95
96 /** number of monsters spawned with mobspawn command */
97 int totalspawned;
98
99 // monster sounds
100 .float msound_delay; // temporary antilag system
101 #define ALLMONSTERSOUNDS \
102                 _MSOUND(death) \
103                 _MSOUND(sight) \
104                 _MSOUND(ranged) \
105                 _MSOUND(melee) \
106                 _MSOUND(pain) \
107                 _MSOUND(spawn) \
108                 _MSOUND(idle) \
109                 _MSOUND(attack)
110
111 #define _MSOUND(m) .string monstersound_##m;
112 ALLMONSTERSOUNDS
113 #undef _MSOUND
114
115 float GetMonsterSoundSampleField_notFound;
116
117 #endif