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