forked from acemod/ACE3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor safemode * Further improvements and fixes * Update XEH_postInit.sqf * Don't allow binoculars to be set to safe * Add API for getting weapon safety status * Update fnc_jamWeapon.sqf * Added doc * Update fnc_playChangeFiremodeSound.sqf * Update addons/overheating/functions/fnc_jamWeapon.sqf Co-authored-by: PabstMirror <[email protected]> * Update addons/weaponselect/functions/fnc_selectWeaponMode.sqf Co-authored-by: PabstMirror <[email protected]> --------- Co-authored-by: PabstMirror <[email protected]>
- Loading branch information
Showing
13 changed files
with
254 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
class Extended_PreStart_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
PREP(getWeaponSafety); | ||
PREP(lockSafety); | ||
PREP(playChangeFiremodeSound); | ||
PREP(setSafeModeVisual); | ||
PREP(unlockSafety); | ||
PREP(setWeaponSafety); | ||
PREP(unlockSafety); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: johnb43 | ||
* Getter for weapon safety state. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Weapon <STRING> | ||
* 2: Muzzle <STRING> (default: current muzzle of weapon) | ||
* | ||
* Return Value: | ||
* Safety status <BOOL> | ||
* | ||
* Example: | ||
* [ACE_player, currentWeapon ACE_player] call ace_safemode_fnc_getWeaponSafety | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [ | ||
["_unit", objNull, [objNull]], | ||
["_weapon", "", [""]], | ||
["_muzzle", nil, [""]] | ||
]; | ||
|
||
if (_weapon == "" || {!(_unit hasWeapon _weapon)}) exitWith {false}; | ||
|
||
// Check if weapon is a binocular | ||
if ((_weapon call EFUNC(common,getItemType)) select 1 == "binocular") exitWith {false}; | ||
|
||
// Check for invalid muzzles | ||
_muzzle = if (isNil "_muzzle") then { | ||
// Get current weapon muzzle if not defined | ||
(_unit weaponState _weapon) select 1 | ||
} else { | ||
// Get config case muzzle names | ||
private _muzzles = _weapon call EFUNC(common,getWeaponMuzzles); | ||
|
||
_muzzles param [_muzzles findIf {_x == _muzzle}, ""] | ||
}; | ||
|
||
// Weapon is not available | ||
if (_muzzle == "") exitWith {false}; | ||
|
||
_muzzle in ((_unit getVariable [QGVAR(safedWeapons), createHashMap]) getOrDefault [_weapon, createHashMap]) // return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.