Item_ScheduleRespawnIn(e, max(0, game_starttime - time) + ((e.respawntimestart) ? e.respawntimestart : ITEM_RESPAWNTIME_INITIAL(e)));
}
+void GivePlayerHealth(entity player, float amount)
+{
+ if (amount == 0)
+ {
+ return;
+ }
+ // Ugly hack. We do not check if health goes beyond hard limit since
+ // currently it is done in player_regen. We need to bring back this check
+ // when other code is ported to this function.
+ player.health = bound(player.health, player.health + amount,
+ autocvar_g_balance_health_limit);
+ // Correct code:
+ //player.health = bound(player.health, player.health + amount,
+ // min(autocvar_g_balance_health_limit, ITEM_COUNT_HARD_LIMIT));
+ player.pauserothealth_finished = max(player.pauserothealth_finished, time +
+ autocvar_g_balance_pause_health_rot);
+}
+
+void GivePlayerArmor(entity player, float amount)
+{
+ if (amount == 0)
+ {
+ return;
+ }
+ // Ugly hack. We do not check if armor goes beyond hard limit since
+ // currently it is done in player_regen. We need to bring back this check
+ // when other code is ported to this function.
+ player.armorvalue = bound(player.armorvalue, player.armorvalue + amount,
+ autocvar_g_balance_armor_limit);
+ // Correct code:
+ //player.armorvalue = bound(player.armorvalue, player.armorvalue + amount,
+ // min(autocvar_g_balance_armor_limit, ITEM_COUNT_HARD_LIMIT));
+ player.pauserotarmor_finished = max(player.pauserotarmor_finished, time +
+ autocvar_g_balance_pause_armor_rot);
+}
+
+void GivePlayerAmmo(entity player, .float ammotype, float amount)
+{
+ float maxvalue = 999;
+ switch (ammotype)
+ {
+ case ammo_shells:
+ {
+ maxvalue = g_pickup_shells_max;
+ break;
+ }
+ case ammo_cells:
+ {
+ maxvalue = g_pickup_cells_max;
+ break;
+ }
+ case ammo_rockets:
+ {
+ maxvalue = g_pickup_rockets_max;
+ break;
+ }
+ case ammo_plasma:
+ {
+ maxvalue = g_pickup_plasma_max;
+ break;
+ }
+ case ammo_nails:
+ {
+ maxvalue = g_pickup_nails_max;
+ break;
+ }
+ }
+ player.(ammotype) = min(player.(ammotype) + amount,
+ min(maxvalue, ITEM_COUNT_HARD_LIMIT));
+}
+
+void GivePlayerFuel(entity player, float amount)
+{
+ if (amount == 0)
+ {
+ return;
+ }
+ player.ammo_fuel = bound(player.ammo_fuel, player.ammo_fuel + amount,
+ min(g_pickup_fuel_max, ITEM_COUNT_HARD_LIMIT));
+ player.pauserotfuel_finished = max(player.pauserotfuel_finished, time +
+ autocvar_g_balance_pause_fuel_rot);
+}
+
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
{
if (!item.(ammotype))