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#ifndef SVQC
4#include <common/util.qh> // for icon_path_from_menuskin
5#endif
6
7// special spawn flags
8const int MONSTER_RESPAWN_DEATHPOINT = BIT(4); // re-spawn where we died
9const int MONSTER_TYPE_FLY = BIT(5);
10const int MONSTER_TYPE_SWIM = BIT(6);
11// bit 7 now unused
12const int MON_FLAG_SUPERMONSTER = BIT(8); // incredibly powerful monster
13const int MON_FLAG_RANGED = BIT(9); // monster shoots projectiles
14const int MON_FLAG_MELEE = BIT(10);
15const int MON_FLAG_CRUSH = BIT(11); // monster can be stomped in special modes
16const int MON_FLAG_RIDE = BIT(12); // monster can be ridden in special modes
17const int MONSTER_SIZE_QUAKE = BIT(13);
18const int MONSTER_TYPE_PASSIVE = BIT(14); // doesn't target or chase enemies
19const int MONSTER_TYPE_UNDEAD = BIT(15); // monster is by most definitions a zombie (doesn't fully die unless gibbed)
20const int MON_FLAG_HIDDEN = BIT(16);
21
22// entity properties of monsterinfo:
23.bool(int, entity actor, entity targ, .entity weaponentity) monster_attackfunc;
24.entity monsterdef;
25
26// animations
32.vector anim_walk;
33.vector anim_spawn;
34
40 ATTRIB(Monster, m_name, string, _("Monster"));
42 ATTRIB(Monster, netname, string, "");
46 ATTRIB(Monster, m_icon, string);
48 ATTRIB(Monster, m_model, entity);
50 ATTRIB(Monster, m_mins, vector, '-0 -0 -0');
53
55 METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
57 METHOD(Monster, mr_think, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
59 METHOD(Monster, mr_deadthink, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
61 METHOD(Monster, mr_death, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
63 METHOD(Monster, mr_pain, float(Monster this, entity actor, float damage_take, entity attacker, float deathtype)) { TC(Monster, this); return damage_take; }
65 METHOD(Monster, mr_anim, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
66#ifdef MENUQC
68 {
69 TC(Monster, this);
70 return SUPER(Monster).describe(this);
71 }
72 METHOD(Monster, display, void(Monster this, void(string name, string icon) returns))
73 {
74 TC(Monster, this);
75 returns(this.m_name, icon_path_from_menuskin(this.m_icon));
76 }
77#endif
79
80
81#ifdef SVQC
82#include "sv_monsters.qh"
83#include <server/damage.qh>
84#include <server/bot/api.qh>
90#endif
91
92#ifdef GAMEQC
93#include "../animdecide.qh"
94#include "../anim.qh"
96#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_icon, string)
icon
string netname
short name
Definition monster.qh:42
int monsterid
Definition monster.qh:36
vector m_color
color
Definition monster.qh:44
string m_name
human readable name
Definition monster.qh:40
virtual void mr_deadthink()
(SERVER) logic to run every frame after the monster has died
Definition monster.qh:59
virtual void mr_death()
(SERVER) called when monster dies
Definition monster.qh:61
vector m_mins
hitbox size
Definition monster.qh:50
virtual void mr_setup()
(SERVER) setup monster data
Definition monster.qh:55
virtual void mr_anim()
(BOTH?) sets animations for monster
Definition monster.qh:65
virtual void mr_pain()
(SERVER) called when monster is damaged
Definition monster.qh:63
int spawnflags
attributes
Definition monster.qh:38
virtual void display()
Definition monster.qh:72
virtual void mr_think()
(SERVER) logic to run every frame
Definition monster.qh:57
virtual void describe()
Definition monster.qh:67
vector m_maxs
hitbox size
Definition monster.qh:52
#define TC(T, sym)
Definition _all.inc:82
string name
Definition menu.qh:30
vector anim_melee2
Definition monster.qh:30
vector anim_spawn
Definition monster.qh:33
const int MON_FLAG_CRUSH
Definition monster.qh:15
const int MONSTER_TYPE_PASSIVE
Definition monster.qh:18
entity monsterdef
Definition monster.qh:24
const int MONSTER_TYPE_FLY
Definition monster.qh:9
const int MON_FLAG_RANGED
Definition monster.qh:13
vector anim_blockend
Definition monster.qh:27
const int MON_FLAG_MELEE
Definition monster.qh:14
const int MONSTER_RESPAWN_DEATHPOINT
Definition monster.qh:8
const int MON_FLAG_RIDE
Definition monster.qh:16
vector anim_walk
Definition monster.qh:32
const int MONSTER_TYPE_UNDEAD
Definition monster.qh:19
vector anim_blockstart
Definition monster.qh:28
const int MON_FLAG_HIDDEN
Definition monster.qh:20
const int MON_FLAG_SUPERMONSTER
Definition monster.qh:12
const int MONSTER_TYPE_SWIM
Definition monster.qh:10
const int MONSTER_SIZE_QUAKE
Definition monster.qh:17
vector animfixfps(entity e, vector a, vector b)
Definition util.qc:1808
vector anim_melee1
Definition monster.qh:29
vector anim_melee3
Definition monster.qh:31
#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
vector
Definition self.qh:92
entity this
Definition self.qh:72