function is_valid_wpn(wpn) local section = wpn:section() local has_tristate_reload = ini_sys:r_string_ex(section,"tri_state_reload") -- Ignore weapons that are not jammed / at max ammo capacity local casted_wpn = wpn:cast_Weapon() if not casted_wpn:IsMisfire() and casted_wpn:GetAmmoElapsed() == casted_wpn:GetAmmoMagSize() then return false end if has_tristate_reload then if animation_common.has_animation(section, "anm_open_aim") then return true else return false end else if animation_common.has_animation(section, "anm_reload_aim") then return true else return false end end end function on_before_key_press(key, bind, dis, flags) if bind ~= key_bindings.kWPN_RELOAD then return end local wpn = db.actor:item_in_slot(db.actor:active_slot()) if not wpn then return end if not is_valid_wpn(wpn) then return end wpn:switch_state(7) flags.ret_value = false end function on_game_start() if magazines then return end RegisterScriptCallback("on_before_key_press", on_before_key_press) end