]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monster.qh
#pragma once
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster.qh
1 #pragma once
2
3 #ifdef SVQC
4 #include "sv_monsters.qh"
5 #include <server/g_damage.qh>
6 #include <server/bot/api.qh>
7 #include <server/weapons/common.qh>
8 #include <server/weapons/tracing.qh>
9 #include <server/weapons/weaponsystem.qh>
10 #include <common/mutators/mutator/waypoints/waypointsprites.qh>
11 #include <lib/warpzone/server.qh>
12 #endif
13
14 #ifndef MENUQC
15 #include "../animdecide.qh"
16 #include "../anim.qh"
17 vector animfixfps(entity e, vector a, vector b);
18 #endif
19
20 // special spawn flags
21 const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
22 const int MONSTER_TYPE_FLY = 32;
23 const int MONSTER_TYPE_SWIM = 64;
24 const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
25 const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
26 const int MON_FLAG_RANGED = 512; // monster shoots projectiles
27 const int MON_FLAG_MELEE = 1024;
28 const int MON_FLAG_CRUSH = 2048; // monster can be stomped in special modes
29 const int MON_FLAG_RIDE = 4096; // monster can be ridden in special modes
30 const int MONSTER_SIZE_QUAKE = 8192;
31
32 // entity properties of monsterinfo:
33 .bool(int, entity actor, entity targ) monster_attackfunc;
34
35 // animations
36 .vector anim_blockend;
37 .vector anim_blockstart;
38 .vector anim_melee1;
39 .vector anim_melee2;
40 .vector anim_melee3;
41 .vector anim_pain3;
42 .vector anim_pain4;
43 .vector anim_pain5;
44 .vector anim_walk;
45 .vector anim_spawn;
46
47 CLASS(Monster, Object)
48     ATTRIB(Monster, monsterid, int, 0)
49     /** attributes */
50     ATTRIB(Monster, spawnflags, int, 0)
51     /** human readable name */
52     ATTRIB(Monster, monster_name, string, "Monster")
53     /** short name */
54     ATTRIB(Monster, netname, string, "")
55     /** model */
56     ATTRIB(Monster, m_model, entity, NULL)
57     /** hitbox size */
58     ATTRIB(Monster, mins, vector, '-0 -0 -0')
59     /** hitbox size */
60     ATTRIB(Monster, maxs, vector, '0 0 0')
61
62     /** (SERVER) setup monster data */
63     METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
64     /** (SERVER) logic to run every frame */
65     METHOD(Monster, mr_think, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
66     /** (SERVER) called when monster dies */
67     METHOD(Monster, mr_death, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
68     /** (BOTH) precaches models/sounds used by this monster */
69     METHOD(Monster, mr_precache, bool(Monster this)) { TC(Monster, this); return false; }
70     /** (SERVER) called when monster is damaged */
71     METHOD(Monster, mr_pain, float(Monster this, entity actor, float damage_take, entity attacker, float deathtype)) { TC(Monster, this); return damage_take; }
72     /** (BOTH?) sets animations for monster */
73     METHOD(Monster, mr_anim, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
74
75 ENDCLASS(Monster)