mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
6a25e9365a
* 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 <pabstmirror@gmail.com> * Update addons/weaponselect/functions/fnc_selectWeaponMode.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com>
59 lines
1.3 KiB
Markdown
59 lines
1.3 KiB
Markdown
---
|
|
layout: wiki
|
|
title: Safemode Framework
|
|
description: Explains how to use the weapon safety API.
|
|
group: framework
|
|
order: 5
|
|
parent: wiki
|
|
mod: ace
|
|
version:
|
|
major: 3
|
|
minor: 0
|
|
patch: 0
|
|
---
|
|
|
|
## 1. Scripting
|
|
|
|
### 1.1 Setting weapon safety status
|
|
|
|
`ace_safemode_fnc_setWeaponSafety`
|
|
If you want the state of the currently selected muzzle, either pass the muzzle by name or leave it blank (= `nil`).
|
|
If the unit doesn't have a weapon, its safety can't be locked, but it can be unlocked.
|
|
|
|
```sqf
|
|
* Lock or unlock the given weapon based on weapon state.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: Weapon <STRING>
|
|
* 2: State <BOOL>
|
|
* 3: Show hint <BOOL> (default: true)
|
|
* 4: Muzzle <STRING> (default: current muzzle of weapon)
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [ACE_player, currentWeapon ACE_player, true] call ace_safemode_fnc_setWeaponSafety
|
|
```
|
|
|
|
### 1.2 Getting weapon safety status
|
|
|
|
`ace_safemode_fnc_getWeaponSafety`
|
|
If you want the state of the currently selected muzzle, either pass the muzzle by name or leave it blank (= `nil`).
|
|
|
|
```sqf
|
|
* 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
|
|
```
|