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