]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/items/items.qh
Merge branch 'master' into Juhu/strafehud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / items / items.qh
1 #pragma once
2
3 #include <common/sounds/sound.qh>
4
5 void StartItem(entity this, entity a);
6 .int item_group;
7 .int item_group_count;
8
9 float autocvar_sv_simple_items;
10 bool ItemSend(entity this, entity to, int sf);
11
12 bool have_pickup_item(entity this);
13
14 const float ITEM_RESPAWN_TICKS = 10;
15
16 // string overrides entity
17 .string item_pickupsound;
18 .entity item_pickupsound_ent;
19 .entity item_model_ent;
20
21 .float max_armorvalue;
22 .float pickup_anyway;
23
24 .float scheduledrespawntime;
25 .float respawntime;
26 .float respawntimejitter;
27 .float respawntimestart;
28
29 .float item_respawncounter;
30
31 .float noalign; // if set to 1, the item or spawnpoint won't be dropped to the floor
32
33 .float superweapons_finished; // NOTE: this field is used only by map entities, it does not directly apply the superweapons stat
34
35 // delay before this item can be picked up
36 .float item_spawnshieldtime;
37
38 void Item_Show (entity e, int mode);
39
40 void Item_Respawn (entity this);
41
42 void Item_RespawnCountdown(entity this);
43 void Item_ScheduleRespawnIn(entity e, float t);
44
45 void Item_ScheduleRespawn(entity e);
46
47 void Item_ScheduleInitialRespawn(entity e);
48
49 /// \brief Give several random weapons and ammo to the entity.
50 /// \param[in,out] receiver Entity to give weapons to.
51 /// \param[in] num_weapons Number of weapons to give.
52 /// \param[in] weapon_names Names of weapons to give separated by spaces.
53 /// \param[in] ammo Entity containing the ammo amount for each possible weapon.
54 /// \return No return.
55 void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity);
56
57 bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax);
58
59 bool Item_GiveTo(entity item, entity player);
60
61 void Item_Touch(entity this, entity toucher);
62
63 void Item_Reset(entity this);
64
65 void Item_FindTeam(entity this);
66 // Savage: used for item garbage-collection
67
68 bool ItemSend(entity this, entity to, int sf);
69 void ItemUpdate(entity this);
70
71 void UpdateItemAfterTeleport(entity this);
72
73 // pickup evaluation functions
74 // these functions decide how desirable an item is to the bots
75
76 float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
77
78 float weapon_pickupevalfunc(entity player, entity item);
79 float ammo_pickupevalfunc(entity player, entity item);
80 float healtharmor_pickupevalfunc(entity player, entity item);
81
82 .bool is_item;
83 .entity itemdef;
84 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
85
86 void setItemGroup(entity this);
87 void setItemGroupCount();
88
89 float GiveWeapon(entity e, float wpn, float op, float val);
90
91 float GiveBit(entity e, .float fld, float bit, float op, float val);
92
93 float GiveValue(entity e, .float fld, float op, float val);
94
95 void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr);
96
97 void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
98
99 spawnfunc(target_items);
100
101 #define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = STAT(WEAPONS, e)
102 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
103 #define PREGIVE_RESOURCE(e,f) float save_##f = GetResource((e), (f))
104 #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)
105 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
106 #define POSTGIVE_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResource((e), (f)), t, snd_incr, snd_decr)
107 #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)
108 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
109 #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)
110
111 float GiveItems(entity e, float beginarg, float endarg);
112
113 IntrusiveList g_items;
114 STATIC_INIT(g_items) { g_items = IL_NEW(); }
115
116 #define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
117 #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))