]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/weapons/weaponsystem.qh
Reorganise some more definitions out of defs.qh, show all racers on the radar in...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / weaponsystem.qh
1 #pragma once
2
3 #include <server/miscfunctions.qh>
4
5 #define INDEPENDENT_ATTACK_FINISHED 1
6
7 // there is 2 weapon tics that can run in one server frame
8 const int W_TICSPERFRAME = 2;
9
10 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
11 .float weapon_nextthink;
12 .void(Weapon thiswep, entity actor, .entity weaponentity, int fire) weapon_think;
13
14 float internalteam;
15 entity weapon_dropevent_item;
16
17 ..entity weaponentity_fld;
18
19 .float weapon_load[REGISTRY_MAX(Weapons)];
20 .int ammo_none; // used by the reloading system, must always be 0
21 .int clip_load;
22 .int old_clip_load;
23 .int clip_size;
24
25 .float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
26 .float attack_finished_single[MAX_WEAPONSLOTS];
27 #if INDEPENDENT_ATTACK_FINISHED
28 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
29 #else
30 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
31 #endif
32 #define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
33
34 void CL_SpawnWeaponentity(entity e, .entity weaponentity);
35
36 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
37
38 void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
39
40 vector CL_Weapon_GetShotOrg(float wpn);
41
42 bool weaponUseForbidden(entity player);
43 bool weaponLocked(entity player);
44
45 void W_AttachToShotorg(entity actor, .entity weaponentity, entity flash, vector offset);
46
47 void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponentity);
48
49 void W_DropEvent(.void(Weapon, entity actor, .entity) event, entity player, float weapon_type, entity weapon_item, .entity weaponentity);
50
51 void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sent_sound);
52
53 void W_ResetGunAlign(entity player, int preferred_alignment);
54
55 void W_WeaponFrame(Player actor, .entity weaponentity);
56
57 float W_WeaponRateFactor(entity this);
58
59 float W_WeaponSpeedFactor(entity this);
60
61 bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime);
62
63 bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponentity, float secondary, float attacktime);
64
65 void weapon_prepareattack_do(entity actor, .entity weaponentity, float secondary, float attacktime);
66
67 void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func);