Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
monster.qh
Go to the documentation of this file.
1#pragma once
2
3#ifdef SVQC
4// special spawn flags
6const int MONSTER_TYPE_FLY = BIT(5);
7const int MONSTER_TYPE_SWIM = BIT(6);
8// bit 7 now unused
9const int MON_FLAG_SUPERMONSTER = BIT(8);
10const int MON_FLAG_RANGED = BIT(9);
11const int MON_FLAG_MELEE = BIT(10);
12const int MON_FLAG_CRUSH = BIT(11);
13const int MON_FLAG_RIDE = BIT(12);
14const int MONSTER_SIZE_QUAKE = BIT(13);
15const int MONSTER_TYPE_PASSIVE = BIT(14);
16const int MONSTER_TYPE_UNDEAD = BIT(15);
17const int MON_FLAG_HIDDEN = BIT(16);
18
19// entity properties of monsterinfo:
20.bool(int, entity actor, entity targ, .entity weaponentity) monster_attackfunc;
21.entity monsterdef;
22#endif
23
24#ifdef GAMEQC
25// animations
31.vector anim_walk;
32.vector anim_spawn;
33#endif
34
37#ifdef SVQC
40#endif
42 ATTRIB(Monster, m_name, string, _("Monster"));
44 ATTRIB(Monster, netname, string, "");
47#ifdef GAMEQC
49 ATTRIB(Monster, m_model, entity);
50#endif
51#ifdef SVQC
53 ATTRIB(Monster, m_mins, vector, '-0 -0 -0');
56
58 METHOD(Monster, mr_setup, bool(Monster this, entity actor))
59 {
60 TC(Monster, this);
61 return false;
62 }
63
64 METHOD(Monster, mr_think, bool(Monster this, entity actor))
65 {
66 TC(Monster, this);
67 return false;
68 }
69
71 {
72 TC(Monster, this);
73 return false;
74 }
75
76 METHOD(Monster, mr_death, bool(Monster this, entity actor))
77 {
78 TC(Monster, this);
79 return false;
80 }
81
82 METHOD(Monster, mr_pain, float(Monster this, entity actor, float damage_take, entity attacker, float deathtype))
83 {
84 TC(Monster, this);
85 return damage_take;
86 }
87#endif
88#ifdef GAMEQC
90 METHOD(Monster, mr_anim, bool(Monster this, entity actor))
91 {
92 TC(Monster, this);
93 return false;
94 }
95#endif
96#ifdef MENUQC
98 {
99 TC(Monster, this);
100 return SUPER(Monster).describe(this);
101 }
102 METHOD(Monster, display, void(Monster this, void(string name, string icon) returns))
103 {
104 TC(Monster, this);
105 returns(this.m_name, icon_path_from_menuskin(this.m_icon));
106 }
107#endif
109
110
111#ifdef SVQC
112#include "sv_monsters.qh"
113#include <server/damage.qh>
114#include <server/bot/api.qh>
119#include <lib/warpzone/server.qh>
120#endif
121
122#ifdef GAMEQC
123#include <common/animdecide.qh>
124#include <common/anim.qh>
126#endif
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
ATTRIB(Monster, m_model, entity)
model
string netname
short name
Definition monster.qh:44
int monsterid
Definition monster.qh:36
vector m_color
color
Definition monster.qh:46
string m_name
human readable name
Definition monster.qh:42
virtual void mr_deadthink()
(SERVER) logic to run every frame after the monster has died
Definition monster.qh:70
virtual void mr_death()
(SERVER) called when monster dies
Definition monster.qh:76
vector m_mins
hitbox size
Definition monster.qh:53
virtual void mr_setup()
(SERVER) setup monster data
Definition monster.qh:58
virtual void mr_anim()
(BOTH?) sets animations for monster
Definition monster.qh:90
virtual void mr_pain()
(SERVER) called when monster is damaged
Definition monster.qh:82
int spawnflags
attributes
Definition monster.qh:39
virtual void display()
Definition monster.qh:102
virtual void mr_think()
(SERVER) logic to run every frame
Definition monster.qh:64
virtual void describe()
Definition monster.qh:97
vector m_maxs
hitbox size
Definition monster.qh:55
#define TC(T, sym)
Definition _all.inc:82
string name
Definition menu.qh:30
vector anim_melee2
Definition monster.qh:29
vector anim_spawn
Definition monster.qh:32
const int MON_FLAG_CRUSH
monster can be stomped in special modes
Definition monster.qh:12
const int MONSTER_TYPE_PASSIVE
doesn't target or chase enemies
Definition monster.qh:15
entity monsterdef
Definition monster.qh:21
const int MONSTER_TYPE_FLY
Definition monster.qh:6
const int MON_FLAG_RANGED
monster shoots projectiles
Definition monster.qh:10
vector anim_blockend
Definition monster.qh:26
const int MON_FLAG_MELEE
Definition monster.qh:11
const int MONSTER_RESPAWN_DEATHPOINT
re-spawn where we died
Definition monster.qh:5
const int MON_FLAG_RIDE
monster can be ridden in special modes
Definition monster.qh:13
vector anim_walk
Definition monster.qh:31
const int MONSTER_TYPE_UNDEAD
monster is by most definitions a zombie (doesn't fully die unless gibbed)
Definition monster.qh:16
vector anim_blockstart
Definition monster.qh:27
const int MON_FLAG_HIDDEN
Definition monster.qh:17
const int MON_FLAG_SUPERMONSTER
incredibly powerful monster
Definition monster.qh:9
const int MONSTER_TYPE_SWIM
Definition monster.qh:7
const int MONSTER_SIZE_QUAKE
Definition monster.qh:14
vector animfixfps(entity e, vector a, vector b)
Definition util.qc:1905
vector anim_melee1
Definition monster.qh:28
vector anim_melee3
Definition monster.qh:30
#define SUPER(cname)
Definition oo.qh:231
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define ATTRIB(...)
Definition oo.qh:148
vector
Definition self.qh:92