3 #include <common/sounds/sound.qh>
5 void StartItem(entity this, entity a);
9 float autocvar_sv_simple_items;
10 bool ItemSend(entity this, entity to, int sf);
12 bool have_pickup_item(entity this);
14 const float ITEM_RESPAWN_TICKS = 10;
16 .float max_armorvalue;
19 .float item_respawncounter;
21 .float superweapons_finished; // NOTE: this field is used only by map entities, it does not directly apply the superweapons stat
23 // delay before this item can be picked up
24 .float item_spawnshieldtime;
26 void Item_Show (entity e, int mode);
28 void Item_Respawn (entity this);
30 void Item_RespawnCountdown(entity this);
31 void Item_ScheduleRespawnIn(entity e, float t);
33 void Item_ScheduleRespawn(entity e);
35 void Item_ScheduleInitialRespawn(entity e);
37 /// \brief Give several random weapons and ammo to the entity.
38 /// \param[in,out] receiver Entity to give weapons to.
39 /// \param[in] num_weapons Number of weapons to give.
40 /// \param[in] weapon_names Names of weapons to give separated by spaces.
41 /// \param[in] ammo Entity containing the ammo amount for each possible weapon.
42 /// \return No return.
43 void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity);
45 bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax);
47 bool Item_GiveTo(entity item, entity player);
49 void Item_Touch(entity this, entity toucher);
51 void Item_Reset(entity this);
53 void Item_FindTeam(entity this);
54 // Savage: used for item garbage-collection
56 bool ItemSend(entity this, entity to, int sf);
57 void ItemUpdate(entity this);
59 void UpdateItemAfterTeleport(entity this);
61 // pickup evaluation functions
62 // these functions decide how desirable an item is to the bots
64 float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
66 float weapon_pickupevalfunc(entity player, entity item);
67 float ammo_pickupevalfunc(entity player, entity item);
68 float healtharmor_pickupevalfunc(entity player, entity item);
72 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
74 void setItemGroup(entity this);
75 void setItemGroupCount();
77 float GiveWeapon(entity e, float wpn, float op, float val);
79 float GiveBit(entity e, .float fld, float bit, float op, float val);
81 float GiveValue(entity e, .float fld, float op, float val);
83 void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr);
85 void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
87 spawnfunc(target_items);
89 #define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = STAT(WEAPONS, e)
90 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
91 #define PREGIVE_RESOURCE(e,f) float save_##f = GetResource((e), (f))
92 #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)
93 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
94 #define POSTGIVE_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResource((e), (f)), t, snd_incr, snd_decr)
95 #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)
96 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
97 #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)
99 float GiveItems(entity e, float beginarg, float endarg);