ACE3/addons/common/functions/fnc_claim.sqf
Grim 3f61a41be3
Common/CSW - Use status effect for enableWeaponDisassembly (#9413)
* uuse weaponDisassemblyEnabled

* convert to status effect

* fix edge conditions

* Update addons/common/functions/fnc_claim.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/common/XEH_postInit.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/common/XEH_postInit.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update XEH_postInit.sqf

* Update addons/common/functions/fnc_claimSafeServer.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update fnc_claimSafeServer.sqf

* change status effect key

* status effect key

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2023-11-22 21:16:42 -03:00

44 lines
1.2 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: commy2
* Unit claims the ownership over an object. This is used to prevent multiple players from draging the same ammo box or using up the same wheel when repairing etc.
*
* Arguments:
* 0: Unit that claims another object. ObjNull to remove claim. <OBJECT>
* 1: The object that gets claimed. <OBJECT>
* 2: Lock the claimed object aswell? (optional: false) <BOOL>
*
* Return Value:
* None
*
* Example:
* [bob, flag, true] call ace_common_fnc_claim
*
* Public: No
*/
params ["_unit", "_target", ["_lockTarget", false]];
private _owner = _target getVariable [QGVAR(owner), objNull];
if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then {
ERROR("Claiming already owned object.");
};
// transfer this immediately
_target setVariable [QGVAR(owner), _unit, true];
// lock target object
if (_lockTarget) then {
if (!isNull _unit) then {
[QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent;
} else {
[QGVAR(unlockVehicle), _target, _target] call CBA_fnc_targetEvent;
};
};
/*
systemChat str locked _target;
systemChat str (_target getVariable [QGVAR(lockStatus), locked _target]);
*/