mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Block adv. throwing when player is busy (#5534)
* Add throw blocking status effect * Add concertina_wire and tripod support * Add launcher in hands support * Disable effect sending more than once * Fix EFUNC using, add trace * Disable vanilla throw blocking * Improve status handling * Fix rearm status key
This commit is contained in:
parent
235315e4ef
commit
36b61fdb6e
@ -33,4 +33,6 @@ GVAR(enabled) &&
|
||||
|
||||
{!(call EFUNC(common,isFeatureCameraActive))} &&
|
||||
{[_unit, objNull, ["isNotInside", "isNotSwimming", "isNotSitting"/*, "isNotOnLadder"*/]] call EFUNC(common,canInteractWith)} && // Ladder needs positioning fixes on throw
|
||||
{_unit call CBA_fnc_canUseWeapon} // Disable in non-FFV seats due to surface detection issues
|
||||
{_unit call CBA_fnc_canUseWeapon} && // Disable in non-FFV seats due to surface detection issues
|
||||
{"" == currentWeapon _unit || {currentWeapon _unit != secondaryWeapon _unit}} &&
|
||||
{0 >= _unit getVariable [QEGVAR(common,effect_blockThrow), 0]}
|
||||
|
@ -48,6 +48,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
GVAR(placeAction) = PLACE_WAITING;
|
||||
|
||||
[_unit, "forceWalk", "ACE_Attach", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Attach", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
[{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call CBA_fnc_execNextFrame;
|
||||
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
|
||||
@ -85,6 +86,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
[_unit, "forceWalk", "ACE_Attach", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Attach", false] call EFUNC(common,statusEffect_set);
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
_unit removeAction _actionID;
|
||||
|
@ -19,11 +19,12 @@
|
||||
|
||||
//Status Effect EHs:
|
||||
[QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler;
|
||||
["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType);
|
||||
["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches"]] call FUNC(statusEffect_addType);
|
||||
["blockSprint", false, []] call FUNC(statusEffect_addType);
|
||||
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType);
|
||||
["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType);
|
||||
["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType);
|
||||
["blockThrow", false, ["ACE_Attach", "ACE_concertina_wire", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_rearm", "ACE_refuel", "ACE_Sandbag", "ACE_Trenches", "ACE_tripod"]] call FUNC(statusEffect_addType);
|
||||
|
||||
[QGVAR(forceWalk), {
|
||||
params ["_object", "_set"];
|
||||
@ -44,7 +45,7 @@
|
||||
params ["_object", "_set"];
|
||||
if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then {
|
||||
TRACE_2("blockDamage EH (using medical)",_object,_set);
|
||||
_object setvariable [QEGVAR(medical,allowDamage), (_set == 0), true];
|
||||
_object setVariable [QEGVAR(medical,allowDamage), (_set == 0), true];
|
||||
} else {
|
||||
TRACE_2("blockDamage EH (using allowDamage)",_object,_set);
|
||||
_object allowDamage (_set == 0);
|
||||
|
@ -16,7 +16,6 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
// #define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_object", objNull, [objNull]], ["_effectName", "", [""]], ["_ID", "", [""]], ["_set", true, [false]]];
|
||||
@ -32,7 +31,7 @@ if (isNull _object) exitWith {TRACE_1("null",_object);};
|
||||
|
||||
[_object, true] call FUNC(statusEffect_resetVariables); //Check for mismatch, and set object ref
|
||||
|
||||
//check ID case and set globaly if not already set:
|
||||
//check ID case and set globally if not already set:
|
||||
_ID = toLower _ID;
|
||||
private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []];
|
||||
private _statusIndex = _statusReasons find _ID;
|
||||
@ -62,9 +61,13 @@ if (_set isEqualTo (_effectBoolArray select _statusIndex)) exitWith {
|
||||
|
||||
TRACE_2("Setting to new value",_set,_effectBoolArray select _statusIndex);
|
||||
_effectBoolArray set [_statusIndex, _set];
|
||||
_effectNumber = _effectBoolArray call FUNC(toBitmask); //Convert array back to number
|
||||
private _newEffectNumber = _effectBoolArray call FUNC(toBitmask); //Convert array back to number
|
||||
|
||||
TRACE_2("Saving globaly",_effectVarName,_effectNumber);
|
||||
_object setVariable [_effectVarName, _effectNumber, true];
|
||||
TRACE_2("Saving globally",_effectVarName,_newEffectNumber);
|
||||
_object setVariable [_effectVarName, _newEffectNumber, true];
|
||||
|
||||
if (_effectNumber == 0 || {_newEffectNumber == 0}) then {
|
||||
[_object, _effectName] call FUNC(statusEffect_sendEffects);
|
||||
} else {
|
||||
LOG("not sending more than once");
|
||||
};
|
||||
|
@ -65,6 +65,7 @@ GVAR(deployPFH) = [{
|
||||
}, 0, [_wireNoGeo, _wire, _anim, _dir, _wireNoGeoPos]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler);
|
||||
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
@ -78,6 +79,8 @@ GVAR(deployPFH) = [{
|
||||
|
||||
[localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
GVAR(placer) setVariable [QGVAR(Deploy),
|
||||
[GVAR(placer), "DefaultAction",
|
||||
{GVAR(deployPFH) != -1},
|
||||
|
@ -46,6 +46,8 @@ if (_target isKindOf "CAManBase") then {
|
||||
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
|
||||
[_unit, "blockThrow", "ACE_dragging", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// prevent object from flipping inside buildings
|
||||
if (_inBuilding) then {
|
||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||
|
@ -51,6 +51,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
|
||||
[_unit, "forceWalk", "ACE_dragging", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_dragging", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// prevent object from flipping inside buildings
|
||||
if (_inBuilding) then {
|
||||
|
@ -58,6 +58,8 @@ if (_target isKindOf "CAManBase") then {
|
||||
|
||||
};
|
||||
|
||||
[_unit, "blockThrow", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// prevent multiple players from accessing the same object
|
||||
[_unit, _target, true] call EFUNC(common,claim);
|
||||
|
||||
|
@ -35,6 +35,8 @@ if (primaryWeapon _unit == "") then {
|
||||
// select primary, otherwise the drag animation actions don't work.
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
|
||||
[_unit, "blockThrow", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// prevent multiple players from accessing the same object
|
||||
[_unit, _target, true] call EFUNC(common,claim);
|
||||
|
||||
|
@ -31,6 +31,7 @@ private _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >>
|
||||
if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game!
|
||||
|
||||
[_unit, "forceWalk", "ACE_Explosives", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Explosives", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
//Show mouse buttons:
|
||||
[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
|
||||
@ -149,6 +150,7 @@ GVAR(TweakedAngle) = 0;
|
||||
GVAR(pfeh_running) = false;
|
||||
|
||||
[_unit, "forceWalk", "ACE_Explosives", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Explosives", false] call EFUNC(common,statusEffect_set);
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
[_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
|
@ -38,7 +38,8 @@ if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
_unit setVariable [QGVAR(ReleaseActionID), nil];
|
||||
};
|
||||
[_unit, "forceWalk", QGVAR(vehRearm), false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "forceWalk", "ACE_rearm", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_rearm", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
if (_unholster) then {
|
||||
REARM_UNHOLSTER_WEAPON
|
||||
|
@ -19,7 +19,8 @@
|
||||
params ["_dummy", "_unit"];
|
||||
|
||||
REARM_HOLSTER_WEAPON;
|
||||
[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "forceWalk", "ACE_rearm", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_rearm", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
[
|
||||
TIME_PROGRESSBAR(5),
|
||||
|
@ -28,7 +28,8 @@ if (GVAR(supply) > 0) then {
|
||||
};
|
||||
if !(_success) exitWith {WARNING_2("takeSuccess failed to take [%1] from [%2]",_magazineClass,_truck);};
|
||||
|
||||
[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "forceWalk", "ACE_rearm", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_rearm", true] call EFUNC(common,statusEffect_set);
|
||||
private _dummy = [_unit, _magazineClass] call FUNC(createDummy);
|
||||
[_dummy, _unit] call FUNC(pickUpAmmo);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
_unit setVariable [QGVAR(hint), nil]; \
|
||||
call EFUNC(interaction,hideMouseHint); \
|
||||
[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); \
|
||||
[_unit, "blockThrow", "ACE_refuel", false] call EFUNC(common,statusEffect_set); \
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
params ["_unit", "_nozzle"];
|
||||
|
@ -88,6 +88,7 @@ params [
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 299];
|
||||
|
||||
[_unit, "forceWalk", "ACE_refuel", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_refuel", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
[_unit, _nozzle] call FUNC(startNozzleInHandsPFH);
|
||||
},
|
||||
|
@ -19,6 +19,7 @@ params ["_unit"];
|
||||
|
||||
// prevent the placing unit from running
|
||||
[_unit, "forceWalk", "ACE_Sandbag", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Sandbag", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// create the sandbag
|
||||
private _sandBag = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"];
|
||||
|
@ -22,6 +22,7 @@ if (_key != 1 || {GVAR(deployPFH) == -1}) exitWith {};
|
||||
|
||||
// enable running again
|
||||
[_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// delete placement dummy
|
||||
deleteVehicle GVAR(sandBag);
|
||||
|
@ -19,6 +19,7 @@ params ["_unit"];
|
||||
|
||||
// enable running again
|
||||
[_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// remove sandbag from inventory
|
||||
_unit removeItem "ACE_Sandbag_empty";
|
||||
|
@ -24,6 +24,7 @@ if (_key != 1 || {isNull GVAR(ladder)}) exitWith {};
|
||||
|
||||
// enable running again
|
||||
[_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Ladder", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
detach GVAR(ladder);
|
||||
|
||||
|
@ -20,6 +20,7 @@ params ["_unit", "_ladder"];
|
||||
|
||||
// enable running again
|
||||
[_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Ladder", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
private _pos1 = getPosASL _ladder;
|
||||
private _pos2 = AGLToASL (_ladder modelToWorld (_ladder selectionPosition "check2"));
|
||||
|
@ -22,6 +22,7 @@ params ["_unit", "_ladder"];
|
||||
|
||||
// prevent the placing unit from running
|
||||
[_unit, "forceWalk", "ACE_Ladder", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Ladder", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
{
|
||||
_ladder animate [_x, 0];
|
||||
|
@ -22,6 +22,7 @@ if (_key != 1 || {GVAR(digPFH) == -1}) exitWith {};
|
||||
|
||||
// enable running again
|
||||
[_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Trenches", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// delete placement dummy
|
||||
deleteVehicle GVAR(trench);
|
||||
|
@ -19,6 +19,7 @@ params ["_unit"];
|
||||
|
||||
// enable running again
|
||||
[_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Trenches", false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// remove dig pfh
|
||||
[GVAR(digPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
|
@ -28,6 +28,7 @@ TRACE_1("",GVAR(trenchPlacementData));
|
||||
|
||||
// prevent the placing unit from running
|
||||
[_unit, "forceWalk", "ACE_Trenches", true] call EFUNC(common,statusEffect_set);
|
||||
[_unit, "blockThrow", "ACE_Trenches", true] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// create the trench
|
||||
private _trench = createVehicle [_noGeoModel, [0, 0, 0], [], 0, "NONE"];
|
||||
|
@ -25,6 +25,7 @@ GVAR(adjustPFH) = [{
|
||||
|
||||
if (!(_unit getVariable [QGVAR(adjusting), false]) || {isNull _tripod} || {_unit distance _tripod > 5}) exitWith {
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(Adjust), -1]] call EFUNC(common,removeActionEventHandler);
|
||||
|
||||
@ -37,6 +38,7 @@ GVAR(adjustPFH) = [{
|
||||
|
||||
}, 0, [_unit, _tripod]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||
// add mouse button action and hint
|
||||
[localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user