mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix error, Set disabled collision objects to object variable
This commit is contained in:
parent
8bfcb5a1b1
commit
c08d15151e
@ -67,7 +67,7 @@ if (_target isKindOf "CAManBase") then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// check everything
|
// check everything
|
||||||
[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime, []]] call CBA_fnc_addPerFrameHandler;
|
[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// reset current dragging height.
|
// reset current dragging height.
|
||||||
GVAR(currentHeightChange) = 0;
|
GVAR(currentHeightChange) = 0;
|
||||||
|
@ -7,14 +7,13 @@
|
|||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: Target <OBJECT>
|
* 1: Target <OBJECT>
|
||||||
* 2: Start time <NUMBER>
|
* 2: Start time <NUMBER>
|
||||||
* 3: Disabled Collision Objects <ARRAY> (empty for in-PFH changes)
|
|
||||||
* 1: PFEH Id <NUMBER>
|
* 1: PFEH Id <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[player, target, []], 20] call ace_dragging_fnc_carryObjectPFH;
|
* [[player, target], 20] call ace_dragging_fnc_carryObjectPFH;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -25,7 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
params ["_args", "_idPFH"];
|
params ["_args", "_idPFH"];
|
||||||
_args params ["_unit","_target", "_startTime", "_disabledCollisionObjects"];
|
_args params ["_unit","_target", "_startTime"];
|
||||||
|
|
||||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||||
TRACE_2("carry false",_unit,_target);
|
TRACE_2("carry false",_unit,_target);
|
||||||
@ -40,13 +39,15 @@ if (!alive _target || {_unit distance _target > 10}) then {
|
|||||||
//so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos)
|
//so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos)
|
||||||
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
||||||
};
|
};
|
||||||
[_unit, _target, _disabledCollisionObjects] call FUNC(dropObject_carry);
|
[_unit, _target] call FUNC(dropObject_carry);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Disable collision with nearby players
|
// Disable collision with nearby players
|
||||||
|
private _disabledCollisionObjects = _target getVariable [QGVAR(disabledCollisionObjects), []];
|
||||||
TRACE_1("Disable collision objects",_disabledCollisionObjects);
|
TRACE_1("Disable collision objects",_disabledCollisionObjects);
|
||||||
|
|
||||||
private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANCE];
|
private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANCE];
|
||||||
{
|
{
|
||||||
if !(_x in _disabledCollisionObjects) then {
|
if !(_x in _disabledCollisionObjects) then {
|
||||||
@ -54,6 +55,7 @@ private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANC
|
|||||||
_target disableCollisionWith _x;
|
_target disableCollisionWith _x;
|
||||||
_disabledCollisionObjects pushBack _x;
|
_disabledCollisionObjects pushBack _x;
|
||||||
};
|
};
|
||||||
|
false
|
||||||
} count _nearUnits;
|
} count _nearUnits;
|
||||||
|
|
||||||
_disabledCollisionObjects = _disabledCollisionObjects select {
|
_disabledCollisionObjects = _disabledCollisionObjects select {
|
||||||
@ -66,4 +68,4 @@ _disabledCollisionObjects = _disabledCollisionObjects select {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_args set [3, _disabledCollisionObjects];
|
_target setVariable [QGVAR(disabledCollisionObjects), _disabledCollisionObjects];
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that carries the other object <OBJECT>
|
* 0: Unit that carries the other object <OBJECT>
|
||||||
* 1: Carried object to drop <OBJECT>
|
* 1: Carried object to drop <OBJECT>
|
||||||
* 2: Disabled Collision Objects <ARRAY>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -17,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_target", "_disabledCollisionObjects"];
|
params ["_unit", "_target"];
|
||||||
TRACE_1("params",_this);
|
TRACE_1("params",_this);
|
||||||
|
|
||||||
// remove drop action
|
// remove drop action
|
||||||
@ -80,4 +79,4 @@ if (_target getVariable [QGVAR(isUAV), false]) then {
|
|||||||
// Reenable collision with nearby objects
|
// Reenable collision with nearby objects
|
||||||
{
|
{
|
||||||
_target enableCollisionWith _x;
|
_target enableCollisionWith _x;
|
||||||
} forEach _disabledCollisionObjects;
|
} forEach (_target getVariable [QGVAR(disabledCollisionObjects), []]);
|
||||||
|
Loading…
Reference in New Issue
Block a user