#include "selection.qh"
#include "../command/common.qh"
-#include "../mutators/_mod.qh"
+#include <server/mutators/_mod.qh>
#include "../round_handler.qh"
-#include "../resources.qh"
+#include <server/resources.qh>
#include <common/t_items.qh>
#include <common/animdecide.qh>
#include <common/constants.qh>
return false;
}
-void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim);
-
/**
* @param t defer thinking until time + t
* @param func next think function
bool forbidWeaponUse(entity player)
{
- if (time < game_starttime && !autocvar_sv_ready_restart_after_countdown) return true;
+ if (time < game_starttime && !sv_ready_restart_after_countdown) return true;
if (player.player_blocked) return true;
if (game_stopped) return true;
if (STAT(FROZEN, player)) return true;
entity this = actor.(weaponentity);
if (frametime) this.weapon_frametime = frametime;
- if (!this || actor.health < 1) return; // Dead player can't use weapons and injure impulse commands
+ if (!this || GetResourceAmount(actor, RESOURCE_HEALTH) < 1) return; // Dead player can't use weapons and injure impulse commands
int button_atck = PHYS_INPUT_BUTTON_ATCK(actor);
int button_atck2 = PHYS_INPUT_BUTTON_ATCK2(actor);
// server framerate is very low and the weapon fire rate very high
for (int c = 0; c < W_TICSPERFRAME; ++c)
{
- if (w != WEP_Null && !(actor.weapons & WepSet_FromWeapon(w)))
+ if (w != WEP_Null && !(STAT(WEAPONS, actor) & WepSet_FromWeapon(w)))
{
if (this.m_weapon == this.m_switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
w = WEP_Null;
key_pressed = false;
Weapon off = actor.offhand;
- if (off && !(actor.weapons & WEPSET(HOOK)))
+ if (off && (!(STAT(WEAPONS, actor) & WEPSET(HOOK)) || off != OFFHAND_HOOK))
{
if (off.offhand_think) off.offhand_think(off, actor, key_pressed);
}
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponentity)
{
- if (MUTATOR_CALLHOOK(W_DecreaseAmmo, actor, actor.(weaponentity))) return;
+ if (MUTATOR_CALLHOOK(W_DecreaseAmmo, actor, actor.(weaponentity), ammo_use)) return;
if ((actor.items & IT_UNLIMITED_WEAPON_AMMO) && !wep.reloading_ammo) return;
+ ammo_use = M_ARGV(2, float);
+
entity w_ent = actor.(weaponentity);
// if this weapon is reloadable, decrease its load. Else decrease the player's ammo
this.reload_ammo_min = sent_ammo_min;
this.reload_ammo_amount = e.reloading_ammo;
this.reload_time = e.reloading_time;
- if (actor.reload_sound) strunzone(actor.reload_sound);
- actor.reload_sound = strzone(Sound_fixpath(sent_sound));
+ strcpy(actor.reload_sound, Sound_fixpath(sent_sound));
// don't reload weapons that don't have the RELOADABLE flag
if (!(e.spawnflags & WEP_FLAG_RELOADABLE))