Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
onslaught.qc
Go to the documentation of this file.
1#include "onslaught.qh"
2
4
5#ifdef GAMEQC
6REGISTER_NET_LINKED(ENT_ONSCAMERA)
7#endif
8
9#ifdef CSQC
10
12NET_HANDLE(ENT_ONSCAMERA, bool isnew)
13{
14 this.origin = ReadVector();
15 setorigin(this, this.origin);
16
17 this.angles = ReadAngleVector();
18
19 this.drawmask = MASK_NORMAL;
20 setmodel(this, MDL_Null); // give it a size for clientcamera
21 setsize(this, '-1 -1 -1', '1 1 1');
22
23 generator_camera = this;
24 return true;
25}
26
27REGISTER_MUTATOR(cl_ons, true);
28
34{
35 ons_roundlost = STAT(ROUNDLOST);
36 entity gen = NULL;
38 {
39 IL_EACH(g_onsgenerators, GetResource(it, RES_HEALTH) <= 0,
40 {
41 gen = it;
42 break;
43 });
44 if(!gen)
45 ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
46 }
47
49 {
50 generator_origin = gen.origin;
51 return true;
52 }
53 return false;
54}
55
56MUTATOR_HOOKFUNCTION(cl_ons, CustomizeEventchase)
57{
59 {
60 M_ARGV(0, vector) = generator_camera.origin;
63 return true;
64 }
65 return false;
66}
67
68#endif // CSQC
69#ifdef MENUQC
72
73METHOD(Onslaught, describe, string(Onslaught this))
74{
75 TC(Onslaught, this);
77 PAR(_("%s is a team-based gametype similar to %s where the final goal is to destroy the enemy team core generator. "
78 "In order to destroy the generator, control points on the map (similar to those in %s) must first be captured."), COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_ASSAULT), COLORED_NAME(MAPINFO_TYPE_DOMINATION));
79 PAR(_("Since your team can only capture a control point if it is connected to another control point currently owned by your team, you have to systematically work through the map to reach the enemy generator."));
80 PAR(_("A control point is captured by walking into it then waiting for it to finish constructing. "
81 "Control points of the opposing team are destroyed by attacking the \"info bot\" that hovers above them, converting the control point to neutral once it is destroyed."));
82 PAR(_("When in overtime, the enemy's generator will start to decay, at a faster rate the more control points your team has."));
83 return PAGE_TEXT;
84}
85
86#endif // MENUQC
#define REGISTER_MUTATOR(...)
Definition base.qh:295
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define COLORED_NAME(this)
Definition color.qh:195
#define setmodel(this, m)
Definition model.qh:26
#define M_ARGV(x, type)
Definition events.qh:17
float drawmask
const float MASK_NORMAL
vector origin
ent angles
Definition ent_cs.qc:121
#define IL_EACH(this, cond, body)
#define TC(T, sym)
Definition _all.inc:82
#define NET_HANDLE(id, param)
Definition net.qh:15
#define ReadVector()
Definition net.qh:367
#define ReadAngleVector()
Definition net.qh:369
#define REGISTER_NET_LINKED(id)
Definition net.qh:55
#define STAT(...)
Definition stats.qh:82
float ons_roundlost
Definition onslaught.qc:29
vector autocvar_cl_eventchase_generator_viewoffset
Definition onslaught.qc:31
float autocvar_cl_eventchase_generator_distance
Definition onslaught.qc:32
entity generator_camera
Definition onslaught.qc:11
vector generator_origin
Definition onslaught.qc:30
IntrusiveList g_onsgenerators
Definition onslaught.qh:30
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define NULL
Definition post.qh:14
vector
Definition self.qh:92
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
int WantEventchase(entity this, bool want_vehiclechase)
Definition view.qc:730