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