Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
items.qh
Go to the documentation of this file.
1#pragma once
2
5#include <common/mutators/mutator/buffs/_mod.qh> // for the `Buff` "class"
6
13#define autocvar_g_weapon_stay cvar("g_weapon_stay")
14
16
17bool ItemSend(entity this, entity to, int sf);
18
19const float ITEM_RESPAWN_TICKS = 10;
20
21// string overrides entity
25
28.int count;
29
34
36
37.bool noalign; // if set to 1, the item or spawnpoint won't be dropped to the floor
38
39.float superweapons_finished; // NOTE: this field is used only by map entities, it does not directly apply the superweapons stat
40
41// delay before this item can be picked up
43
44void Item_Show (entity e, int mode);
45
46void Item_Respawn (entity this);
47
49void Item_ScheduleRespawnIn(entity e, float t);
50
52
54
61void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity);
62
63bool Item_GiveAmmoTo(entity item, entity player, Resource res_type, float ammomax);
64
65bool Item_GiveTo(entity item, entity player);
66
68
69void Item_Reset(entity this);
70
71void Item_FindTeam(entity this);
72
73void Item_CopyFields(entity this, entity to);
74
75bool ItemSend(entity this, entity to, int sf);
76void ItemUpdate(entity this);
77
79
80void RemoveItem(entity this);
81
82// pickup evaluation functions
83// these functions decide how desirable an item is to the bots
84
85float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
86
87float weapon_pickupevalfunc(entity player, entity item);
88float ammo_pickupevalfunc(entity player, entity item);
89float healtharmor_pickupevalfunc(entity player, entity item);
90
91.bool is_item;
92.entity itemdef;
93void StartItem(entity this, entity def);
94
97void setItemGroup(entity this);
99
100float GiveWeapon(entity e, float wpn, float op, float val);
101bool GiveBuff(entity e, Buff thebuff, int op, int val);
102void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr);
103void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
104
105#define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = STAT(WEAPONS, e)
106#define PREGIVE(e,f) float save_##f; save_##f = (e).f
107#define PREGIVE_STATUSEFFECT(e,f) bool save_##f = StatusEffects_active(f, (e))
108#define PREGIVE_RESOURCE(e,f) float save_##f = GetResource((e), (f))
109#define POSTGIVE_WEAPON(e,b,snd_incr,snd_decr) GiveSound((e), !!(save_weapons & WepSet_FromWeapon(b)), !!(STAT(WEAPONS, e) & WepSet_FromWeapon(b)), 0, snd_incr, snd_decr)
110#define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
111#define POSTGIVE_STATUSEFFECT(e,f,snd_incr,snd_decr) GiveSound((e), save_##f, StatusEffects_active(f, (e)), 0, snd_incr, snd_decr)
112#define POSTGIVE_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResource((e), (f)), t, snd_incr, snd_decr)
113#define POSTGIVE_RES_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e),save_##f,GetResource((e),(f)),rotfield,rottime,regenfield,regentime);GiveSound((e),save_##f,GetResource((e),(f)),t,snd_incr,snd_decr)
114#define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
115#define POSTGIVE_VALUE_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e), save_##f, (e).f, rotfield, rottime, regenfield, regentime); GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
116
117float GiveItems(entity e, float beginarg, float endarg);
118
121
122#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
123#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
Definition buffs.qh:17
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
float count
Definition powerups.qc:22
#define IL_NEW()
entity entity toucher
Definition self.qh:72
float generic_pickupevalfunc(entity player, entity item)
Definition items.qc:885
float ammo_pickupevalfunc(entity player, entity item)
Definition items.qc:909
float autocvar_g_balance_superweapons_time
Definition items.qh:7
entity item_pickupsound_ent
Definition items.qh:23
float respawntimestart
Definition items.qh:33
int autocvar_g_pickup_items
Definition items.qh:11
float respawntimejitter
Definition items.qh:32
float item_respawncounter
Definition items.qh:35
IntrusiveList g_items
Definition items.qh:119
void GiveRot(entity e, float v0, float v1,.float rotfield, float rottime,.float regenfield, float regentime)
Definition items.qc:1378
void Item_ScheduleRespawn(entity e)
Definition items.qc:385
void Item_CopyFields(entity this, entity to)
Definition items.qc:851
float autocvar_sv_simple_items
Definition items.qh:15
entity itemdef
Definition items.qh:92
bool GiveBuff(entity e, Buff thebuff, int op, int val)
Definition items.qc:1326
float max_armorvalue
Definition items.qh:26
int item_group
Definition items.qh:95
entity item_model_ent
Definition items.qh:24
bool ItemSend(entity this, entity to, int sf)
Definition items.qc:31
bool Item_GiveAmmoTo(entity item, entity player, Resource res_type, float ammomax)
Definition items.qc:485
void setItemGroupCount()
Definition items.qc:1284
void ItemUpdate(entity this)
Definition items.qc:100
void StartItem(entity this, entity def)
Definition items.qc:1007
void Item_ScheduleInitialRespawn(entity e)
Definition items.qc:405
void Item_ScheduleRespawnIn(entity e, float t)
Definition items.qc:325
void UpdateItemAfterTeleport(entity this)
Definition items.qc:106
int item_group_count
Definition items.qh:96
void RemoveItem(entity this)
Definition items.qc:865
float weapon_pickupevalfunc(entity player, entity item)
Definition items.qc:887
bool autocvar_g_fullbrightitems
Definition items.qh:8
float GiveWeapon(entity e, float wpn, float op, float val)
Definition items.qc:1295
void Item_RespawnCountdown(entity this)
Definition items.qc:257
float superweapons_finished
Definition items.qh:39
const float ITEM_RESPAWN_TICKS
Definition items.qh:19
void Item_Show(entity e, int mode)
Definition items.qc:130
bool noalign
Definition items.qh:37
void setItemGroup(entity this)
Definition items.qc:1250
float scheduledrespawntime
Definition items.qh:30
float pickup_anyway
Definition items.qh:27
void Item_FindTeam(entity this)
Definition items.qc:813
float GiveItems(entity e, float beginarg, float endarg)
Definition items.qc:1435
void Item_Reset(entity this)
Definition items.qc:783
float autocvar_g_items_maxdist
Definition items.qh:9
bool autocvar_g_nodepthtestitems
Definition items.qh:12
float item_spawnshieldtime
Definition items.qh:42
string item_pickupsound
Definition items.qh:22
float healtharmor_pickupevalfunc(entity player, entity item)
Definition items.qc:957
void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr)
Definition items.qc:1362
bool is_item
Definition items.qh:91
void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity)
Give several random weapons and ammo to the entity.
Definition items.qc:440
float respawntime
Definition items.qh:31
bool Item_GiveTo(entity item, entity player)
Definition items.qc:522
void Item_Respawn(entity this)
Definition items.qc:241
void Item_Touch(entity this, entity toucher)
Definition items.qc:686
float autocvar_g_items_dropped_lifetime
Definition items.qh:10
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32