]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/items/items.qh
825bd2f019d5ff4e2cbd0a4cd4ea71c3369396ec
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / items / items.qh
1 #pragma once
2
3 void StartItem(entity this, entity a);
4 .int item_group;
5 .int item_group_count;
6
7 float autocvar_sv_simple_items;
8 bool ItemSend(entity this, entity to, int sf);
9
10 bool have_pickup_item(entity this);
11
12 const float ITEM_RESPAWN_TICKS = 10;
13
14 .float max_armorvalue;
15 .float pickup_anyway;
16
17 .float item_respawncounter;
18
19 void Item_Show (entity e, int mode);
20
21 void Item_Respawn (entity this);
22
23 void Item_RespawnCountdown(entity this);
24 void Item_ScheduleRespawnIn(entity e, float t);
25
26 void Item_ScheduleRespawn(entity e);
27
28 void Item_ScheduleInitialRespawn(entity e);
29
30 /// \brief Give several random weapons and ammo to the entity.
31 /// \param[in,out] receiver Entity to give weapons to.
32 /// \param[in] num_weapons Number of weapons to give.
33 /// \param[in] weapon_names Names of weapons to give separated by spaces.
34 /// \param[in] ammo Entity containing the ammo amount for each possible weapon.
35 /// \return No return.
36 void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity);
37
38 bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax);
39
40 bool Item_GiveTo(entity item, entity player);
41
42 void Item_Touch(entity this, entity toucher);
43
44 void Item_Reset(entity this);
45
46 void Item_FindTeam(entity this);
47 // Savage: used for item garbage-collection
48
49 bool ItemSend(entity this, entity to, int sf);
50 void ItemUpdate(entity this);
51
52 void UpdateItemAfterTeleport(entity this);
53
54 // pickup evaluation functions
55 // these functions decide how desirable an item is to the bots
56
57 float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
58
59 float weapon_pickupevalfunc(entity player, entity item);
60 float ammo_pickupevalfunc(entity player, entity item);
61 float healtharmor_pickupevalfunc(entity player, entity item);
62
63 .bool is_item;
64 .entity itemdef;
65 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
66
67 void setItemGroup(entity this);
68 void setItemGroupCount();
69
70 float GiveWeapon(entity e, float wpn, float op, float val);
71
72 float GiveBit(entity e, .float fld, float bit, float op, float val);
73
74 float GiveValue(entity e, .float fld, float op, float val);
75
76 void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr);
77
78 void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
79
80 spawnfunc(target_items);
81
82 #define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = STAT(WEAPONS, e)
83 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
84 #define PREGIVE_RESOURCE(e,f) float save_##f = GetResource((e), (f))
85 #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)
86 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
87 #define POSTGIVE_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResource((e), (f)), t, snd_incr, snd_decr)
88 #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)
89 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
90 #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)
91
92 float GiveItems(entity e, float beginarg, float endarg);