mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Dragging - Additional weight override parameter for setCarryable/setDraggable (#6780)
* Added weight override parameter to ace_dragging_fnc_setCarryable/setDraggable - Additional optional parameter that ignores the `startCarry`/`startDrag` weight checks. - Minor `==` to `isEqualto` replacements * `count crew _target isEqualto -1` to `count crew _target isEqualto 0` * Tab Replacement - remove \t * Reverted UAV check, Params formatting, Lazy Eval * Update addons/dragging/functions/fnc_startCarry.sqf Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com> * Update fnc_startDrag.sqf * Remove beta suggestion extra line additions * Update addons/dragging/functions/fnc_startDrag.sqf Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>
This commit is contained in:
parent
c4655148e0
commit
13193d3e6d
@ -116,6 +116,7 @@ OnkelDisMaster <onkeldismaster@gmail.com>
|
||||
Orbis2358 <mgkid3310@naver.com>
|
||||
oscarmolinadev
|
||||
PaxJaromeMalues <seemax1991@gmail.com>
|
||||
PiZZADOX <509thParachuteInfantry@gmail.com>
|
||||
Phyma <sethramstrom@gmail.com>
|
||||
pokertour
|
||||
Professor <lukas.trneny@wo.cz>
|
||||
|
@ -8,7 +8,7 @@ class CfgPatches {
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_interaction"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
authors[] = {"Garth 'L-H' de Wet", "commy2"};
|
||||
authors[] = {"Garth 'L-H' de Wet", "commy2", "PiZZADOX"};
|
||||
url = ECSTRING(main,URL);
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
|
@ -27,4 +27,4 @@ if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false};
|
||||
// a static weapon has to be empty for dragging (ignore UAV AI)
|
||||
if (((typeOf _target) isKindOf "StaticWeapon") && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}
|
||||
alive _target && {vehicle _target isEqualto _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}
|
||||
|
@ -23,4 +23,4 @@ if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exi
|
||||
// a static weapon has to be empty for dragging (ignore UAV AI)
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})};
|
||||
alive _target && {vehicle _target isEqualto _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Author: commy2, PiZZADOX
|
||||
* Enable the object to be carried.
|
||||
*
|
||||
* Arguments:
|
||||
@ -8,17 +8,19 @@
|
||||
* 1: true to enable carrying, false to disable <BOOL>
|
||||
* 2: Position offset for attachTo command <ARRAY> (default: [0,1,1])
|
||||
* 3: Direction in degree to rotate the object after attachTo <NUMBER> (default: 0)
|
||||
* 4: Override weight limit (optional; default: false) <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [object, true, [0,1,1], 0] call ace_dragging_fnc_setCarryable;
|
||||
* [object, true, [0,1,1], 0, false] call ace_dragging_fnc_setCarryable;
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params ["_object", "_enableCarry", "_position", "_direction"];
|
||||
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
||||
params ["_object", "_enableCarry", "_position", "_direction", ["_ignoreWeightCarry", false, [false]]];
|
||||
|
||||
if (isNil "_position") then {
|
||||
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
|
||||
@ -32,6 +34,7 @@ if (isNil "_direction") then {
|
||||
_object setVariable [QGVAR(canCarry), _enableCarry];
|
||||
_object setVariable [QGVAR(carryPosition), _position];
|
||||
_object setVariable [QGVAR(carryDirection), _direction];
|
||||
_object setVariable [QGVAR(ignoreWeightCarry), _ignoreWeightCarry];
|
||||
|
||||
// add action to class if it is not already present
|
||||
private _type = typeOf _object;
|
||||
|
@ -1,25 +1,26 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Author: commy2, PiZZADOX
|
||||
* Enable the object to be dragged.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Any object <OBJECT>
|
||||
* 1: true to enable dragging, false to disable <BOOL>
|
||||
* 2: Position offset for attachTo command (optinal; default: [0,0,0])<ARRAY>
|
||||
* 2: Position offset for attachTo command (optional; default: [0,0,0])<ARRAY>
|
||||
* 3: Direction in degree to rotate the object after attachTo (optional; default: 0) <NUMBER>
|
||||
* 4: Override weight limit (optional; default: false) <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [object, true, [0,0,0], 0] call ace_dragging_fnc_setDraggable;
|
||||
* [object, true, [0,0,0], 0, false] call ace_dragging_fnc_setDraggable;
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
||||
params ["_object", "_enableDrag", "_position", "_direction"];
|
||||
params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];
|
||||
|
||||
if (isNil "_position") then {
|
||||
_position = _object getVariable [QGVAR(dragPosition), [0,0,0]];
|
||||
@ -33,6 +34,7 @@ if (isNil "_direction") then {
|
||||
_object setVariable [QGVAR(canDrag), _enableDrag];
|
||||
_object setVariable [QGVAR(dragPosition), _position];
|
||||
_object setVariable [QGVAR(dragDirection), _direction];
|
||||
_object setVariable [QGVAR(ignoreWeightDrag), _ignoreWeightDrag];
|
||||
|
||||
// add action to class if it is not already present
|
||||
private _type = typeOf _object;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Author: commy2, PiZZADOX
|
||||
* Start the carrying process.
|
||||
*
|
||||
* Arguments:
|
||||
@ -19,10 +19,12 @@
|
||||
params ["_unit", "_target"];
|
||||
TRACE_2("params",_unit,_target);
|
||||
|
||||
// check weight
|
||||
private _weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWith {
|
||||
// exempt from weight check if object has override variable set
|
||||
if (!GETVAR(_target,GVAR(ignoreWeightCarry),false) && {
|
||||
private _weight = [_target] call FUNC(getWeight);
|
||||
_weight > GETMVAR(ACE_maxWeightCarry,1E11)
|
||||
}) exitWith {
|
||||
// exit if object weight is over global var value
|
||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
@ -32,7 +34,7 @@ private _timer = CBA_missionTime + 5;
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
|
||||
// add a primary weapon if the unit has none.
|
||||
if (primaryWeapon _unit == "") then {
|
||||
if (primaryWeapon _unit isEqualto "") then {
|
||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,7 @@ if (_target isKindOf "CAManBase") then {
|
||||
};
|
||||
|
||||
// wait for the unit to stand up
|
||||
if (stance _unit == "STAND") exitWith {
|
||||
if (stance _unit isEqualto "STAND") exitWith {
|
||||
TRACE_4("Start carry object",_unit,_target,_timeOut,CBA_missionTime);
|
||||
[_unit, _target] call FUNC(carryObject);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Author: commy2, PiZZADOX
|
||||
* Start the dragging process.
|
||||
*
|
||||
* Arguments:
|
||||
@ -19,16 +19,18 @@
|
||||
params ["_unit", "_target"];
|
||||
TRACE_2("params",_unit,_target);
|
||||
|
||||
// check weight
|
||||
private _weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > missionNamespace getVariable ["ACE_maxWeightDrag", 1E11]) exitWith {
|
||||
// exempt from weight check if object has override variable set
|
||||
if (!GETVAR(_target,GVAR(ignoreWeightDrag),false) && {
|
||||
private _weight = [_target] call FUNC(getWeight);
|
||||
_weight > GETMVAR(ACE_maxWeightDrag,1E11)
|
||||
}) exitWith {
|
||||
// exit if object weight is over global var value
|
||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
// add a primary weapon if the unit has none.
|
||||
// @todo prevent opening inventory when equipped with a fake weapon
|
||||
if (primaryWeapon _unit == "") then {
|
||||
if (primaryWeapon _unit isEqualto "") then {
|
||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user