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