Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_hook.qc
Go to the documentation of this file.
1#include "sv_hook.qh"
2
3// can't use the autocvar as it doesn't work in the campaign
4//AUTOCVAR(g_grappling_hook, bool, false, "let players spawn with the Grappling Hook which allows them to pull themselves up");
5#ifdef SVQC
6AUTOCVAR(g_grappling_hook_useammo, bool, false, "use ammunition with the offhand Grappling Hook");
7
10 g_grappling_hook = true;
11 if(!autocvar_g_grappling_hook_useammo)
12 WEP_HOOK.ammo_factor = 0;
13 }
15 g_grappling_hook = false;
16 if(!autocvar_g_grappling_hook_useammo)
17 WEP_HOOK.ammo_factor = 1; // we don't need to change it
18 }
19
20 return false;
21}
22
23MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
24{
25 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":grappling_hook");
26}
27
28MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
29{
30 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Hook");
31}
32
34{
35 if(autocvar_g_grappling_hook_useammo)
36 {
37 start_items |= ITEM_FuelRegen.m_itemid;
38 start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
39 warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
40 }
41}
42
44{
45 entity player = M_ARGV(0, entity);
46
47 player.offhand = OFFHAND_HOOK;
48}
49
51{
52 entity item = M_ARGV(0, entity);
53
54 return item.weapon == WEP_HOOK.m_id;
55}
56
57#endif
#define MUTATOR_ONADD
Definition base.qh:309
#define MUTATOR_ONROLLBACK_OR_REMOVE
Definition base.qh:311
#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
#define M_ARGV(x, type)
Definition events.qh:17
entity hook
Definition player.qh:239
OffhandHook OFFHAND_HOOK
Definition hook.qh:80
ERASEABLE bool expr_evaluate(string s)
Evaluate an expression of the form: [+ | -]?
Definition cvar.qh:48
#define AUTOCVAR(...)
Definition cvar.qh:161
float cvar(string name)
const string cvar_string(string name)
float max(float f,...)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
float g_grappling_hook
Definition world.qh:113
float start_ammo_fuel
Definition world.qh:88
int start_items
Definition world.qh:83
float warmup_start_ammo_fuel
Definition world.qh:106