mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
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>
This commit is contained in:
parent
3f6a93195a
commit
3f61a41be3
@ -28,6 +28,7 @@
|
||||
["setHidden", true, ["ace_unconscious"]] call FUNC(statusEffect_addType);
|
||||
["blockRadio", false, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType);
|
||||
["blockSpeaking", false, ["ace_unconscious"]] call FUNC(statusEffect_addType);
|
||||
["disableWeaponAssembly", false, ["ace_common", "ace_common_lockVehicle", "ace_csw"]] call FUNC(statusEffect_addType);
|
||||
["lockInventory", true, []] call FUNC(statusEffect_addType);
|
||||
|
||||
[QGVAR(forceWalk), {
|
||||
@ -121,6 +122,11 @@
|
||||
_object setMass _mass;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(disableWeaponAssembly), {
|
||||
params ["_object", "_set"];
|
||||
_object enableWeaponDisassembly (_set < 1);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(lockInventory), {
|
||||
params ["_object", "_set"];
|
||||
TRACE_2("lockInventory EH",_object,_set);
|
||||
@ -161,10 +167,16 @@ if (isServer) then {
|
||||
[QGVAR(lockVehicle), {
|
||||
_this setVariable [QGVAR(lockStatus), locked _this];
|
||||
_this lock 2;
|
||||
if ([] isNotEqualTo getArray (configOf _this >> "assembleInfo" >> "dissasembleTo")) then {
|
||||
[_this, "disableWeaponAssembly", QGVAR(lockVehicle), true] call FUNC(statusEffect_set);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(unlockVehicle), {
|
||||
_this lock (_this getVariable [QGVAR(lockStatus), locked _this]);
|
||||
if ([] isNotEqualTo getArray (configOf _target >> "assembleInfo" >> "dissasembleTo")) then {
|
||||
[_this, "disableWeaponAssembly", QGVAR(lockVehicle), false] call FUNC(statusEffect_set);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(setDir), {(_this select 0) setDir (_this select 1)}] call CBA_fnc_addEventHandler;
|
||||
|
@ -30,17 +30,10 @@ _target setVariable [QGVAR(owner), _unit, true];
|
||||
|
||||
// lock target object
|
||||
if (_lockTarget) then {
|
||||
private _canBeDisassembled = ([] isNotEqualTo getArray (configOf _target >> "assembleInfo" >> "dissasembleTo")) && { !([false, true] select (_target getVariable [QEGVAR(csw,assemblyMode), 0])) };
|
||||
if (!isNull _unit) then {
|
||||
[QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent;
|
||||
if (_canBeDisassembled) then {
|
||||
_target enableWeaponDisassembly false;
|
||||
};
|
||||
} else {
|
||||
[QGVAR(unlockVehicle), _target, _target] call CBA_fnc_targetEvent;
|
||||
if (_canBeDisassembled) then {
|
||||
_target enableWeaponDisassembly true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -36,17 +36,10 @@ _target setVariable [QGVAR(owner), _unit, true];
|
||||
|
||||
// lock target object
|
||||
if (_lockTarget) then {
|
||||
private _canBeDisassembled = ([] isNotEqualTo getArray (configOf _target >> "assembleInfo" >> "dissasembleTo")) && { !([false, true] select (_target getVariable [QEGVAR(csw,assemblyMode), 0])) };
|
||||
if (!isNull _unit) then {
|
||||
[QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent;
|
||||
if (_canBeDisassembled) then {
|
||||
_target enableWeaponDisassembly false;
|
||||
};
|
||||
} else {
|
||||
[QGVAR(unlockVehicle), _target, _target] call CBA_fnc_targetEvent;
|
||||
if (_canBeDisassembled) then {
|
||||
_target enableWeaponDisassembly true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -12,12 +12,6 @@ GVAR(vehicleMagCache) = createHashMap;
|
||||
|
||||
|
||||
// Event handlers:
|
||||
[QGVAR(disableVanillaAssembly), {
|
||||
params ["_staticWeapon"];
|
||||
TRACE_1("disableVanillaAssembly eh",_staticWeapon);
|
||||
_staticWeapon enableWeaponDisassembly false;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(addTurretMag), LINKFUNC(reload_handleAddTurretMag)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(removeTurretMag), LINKFUNC(reload_handleRemoveTurretMag)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(returnAmmo), LINKFUNC(reload_handleReturnAmmo)] call CBA_fnc_addEventHandler;
|
||||
|
@ -40,8 +40,7 @@
|
||||
_cswTripod setVariable [QGVAR(secondaryWeaponMagazine), _secondaryWeaponMagazine];
|
||||
};
|
||||
if (!GVAR(defaultAssemblyMode)) then {
|
||||
TRACE_1("global disableVanillaAssembly event",_cswTripod); // handles it being assembled when setting is disabled
|
||||
[QGVAR(disableVanillaAssembly), [_cswTripod]] call CBA_fnc_globalEvent;
|
||||
[_cswTripod, "disableWeaponAssembly", "ace_csw", true] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
|
||||
private _posATL = _player getRelPos [2, 0];
|
||||
|
@ -46,8 +46,7 @@
|
||||
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
|
||||
_csw setVariable [QGVAR(assemblyMode), 2, true]; // Explicitly set advanced assembly mode + unload, and broadcast
|
||||
if (!GVAR(defaultAssemblyMode)) then {
|
||||
TRACE_1("global disableVanillaAssembly event",_csw); // handles it being assembled when setting is disabled
|
||||
[QGVAR(disableVanillaAssembly), [_csw]] call CBA_fnc_globalEvent;
|
||||
[_csw, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
_csw setDir _tripodDir;
|
||||
_csw setPosATL _tripodPos;
|
||||
@ -75,4 +74,3 @@
|
||||
|
||||
[TIME_PROGRESSBAR(_deployTime), [_tripod, _player, _assembledClassname, _carryWeaponClassname], _onFinish, _onFailure, localize LSTRING(AssembleCSW_progressBar), _codeCheck] call EFUNC(common,progressBar);
|
||||
}, _this] call CBA_fnc_execNextFrame;
|
||||
|
||||
|
@ -50,8 +50,8 @@ if (_assemblyConfig) then {
|
||||
if (!alive _staticWeapon) exitWith { TRACE_1("dead/deleted",_staticWeapon); };
|
||||
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_staticWeapon getVariable [QGVAR(assemblyMode), 3]);
|
||||
TRACE_2("assemblyConfig present",_staticWeapon,_assemblyMode);
|
||||
if (_assemblyMode) then { // Disable vanilla assembly if assemblyMode eanbled
|
||||
[QGVAR(disableVanillaAssembly), [_staticWeapon]] call CBA_fnc_localEvent;
|
||||
if (_assemblyMode) then { // Disable vanilla assembly if assemblyMode enabled
|
||||
[_staticWeapon, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
}, [_staticWeapon]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user