mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Potential fix for duplicating
This commit is contained in:
parent
cbc7748eef
commit
b32ad48f82
@ -19,6 +19,11 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
|||||||
GVAR(maxWeightCarryRun) = 50;
|
GVAR(maxWeightCarryRun) = 50;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Extended EH doesn't fire for dead units, so add interactions manually
|
||||||
|
{
|
||||||
|
_x call FUNC(initPerson);
|
||||||
|
} forEach allDeadMen;
|
||||||
|
|
||||||
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
|
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||||
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
|
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||||
|
|
||||||
|
@ -16,24 +16,49 @@
|
|||||||
*/
|
*/
|
||||||
params ["_target"];
|
params ["_target"];
|
||||||
|
|
||||||
private _clone = QGVAR(clone) createVehicle [0, 0, 0];
|
// Get current position of unit, -10 m below surface
|
||||||
|
private _posATL = getPosATL _target;
|
||||||
|
_posATL set [2, -10];
|
||||||
|
|
||||||
|
private _clone = createVehicle [QGVAR(clone), _posATL];
|
||||||
|
|
||||||
// Clone loadout
|
// Clone loadout
|
||||||
_clone setUnitLoadout getUnitLoadout _target;
|
[_clone, _target call CBA_fnc_getLoadout] call CBA_fnc_setLoadout;
|
||||||
[_clone, _target call BIS_fnc_getUnitInsignia] call BIS_fnc_setUnitInsignia;
|
[_clone, _target call BIS_fnc_getUnitInsignia] call BIS_fnc_setUnitInsignia;
|
||||||
|
|
||||||
|
// Hide unit until it can be moved below terrain
|
||||||
|
private _isObjectHidden = isObjectHidden _target;
|
||||||
|
|
||||||
|
if (_isObjectHidden) then {
|
||||||
|
[QEGVAR(common,hideObjectGlobal), [_target, true]] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _simulationEnabled = simulationEnabled _target;
|
||||||
|
|
||||||
|
if (_simulationEnabled) then {
|
||||||
|
[QEGVAR(common,enableSimulationGlobal), [_target, false]] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _isInRemainsCollector = isInRemainsCollector _target;
|
||||||
|
|
||||||
|
// Make sure corpse isn't deleted by engine's garbage collector
|
||||||
|
if (_isInRemainsCollector) then {
|
||||||
|
removeFromRemainsCollector [_target];
|
||||||
|
};
|
||||||
|
|
||||||
// Disable all damage
|
// Disable all damage
|
||||||
_clone allowDamage false;
|
_clone allowDamage false;
|
||||||
_clone setVariable [QGVAR(original), _target, true];
|
_clone setVariable [QGVAR(original), [_target, _isInRemainsCollector, _isObjectHidden, _simulationEnabled], true];
|
||||||
|
|
||||||
// Turn on PhysX so that unit is not desync when moving with 'setPos' commands
|
// Turn on PhysX so that unit is not desync when moving with 'setPos' commands
|
||||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
// Move unit below terrain in order to hide it
|
[{
|
||||||
_target setPosATL [0, 0, -10];
|
params ["_target", "_posATL"];
|
||||||
|
|
||||||
// Turn off PhysX
|
// Move unit below terrain in order to hide it
|
||||||
[QEGVAR(common,awake), [_target, false]] call CBA_fnc_globalEvent;
|
_target setPosATL _posATL;
|
||||||
|
}, [_target, _posATL], 0.1] call CBA_fnc_waitAndExecute;
|
||||||
|
|
||||||
// Sets the facial expression
|
// Sets the facial expression
|
||||||
[[QGVAR(cloneCreated), [_target, _clone]] call CBA_fnc_globalEventJIP, _clone] call CBA_fnc_removeGlobalEventJIP;
|
[[QGVAR(cloneCreated), [_target, _clone]] call CBA_fnc_globalEventJIP, _clone] call CBA_fnc_removeGlobalEventJIP;
|
||||||
|
@ -18,28 +18,48 @@
|
|||||||
*/
|
*/
|
||||||
params ["_unit", "_clone", "_inBuilding"];
|
params ["_unit", "_clone", "_inBuilding"];
|
||||||
|
|
||||||
private _target = _clone getVariable [QGVAR(original), objNull];
|
(_clone getVariable [QGVAR(original), []]) params [["_target", objNull], ["_isInRemainsCollector", true], ["_isObjectHidden", false], ["_simulationEnabled", true]];
|
||||||
|
|
||||||
if (isNull _target) exitWith {objNull};
|
// Check if unit was deleted
|
||||||
|
if (!isNull _target) then {
|
||||||
|
// Turn on PhysX so that unit is not desync when moving
|
||||||
|
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
// Turn on PhysX so that unit is not desync when moving
|
private _posASL = getPosASL _clone;
|
||||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
|
||||||
|
|
||||||
private _posASL = getPosASL _clone;
|
if (_inBuilding) then {
|
||||||
|
_posASL = _posASL vectorAdd [0, 0, 0.05];
|
||||||
|
};
|
||||||
|
|
||||||
if (_inBuilding) then {
|
// Set the unit's direction
|
||||||
_posASL = _posASL vectorAdd [0, 0, 0.05];
|
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
||||||
|
|
||||||
|
[{
|
||||||
|
params ["_target", "_clone", "_isObjectHidden", "_simulationEnabled", "_posASL"];
|
||||||
|
|
||||||
|
// Bring unit back to clone's position
|
||||||
|
_target setPosASL _posASL;
|
||||||
|
|
||||||
|
[{
|
||||||
|
params ["_target", "_clone", "_isObjectHidden", "_simulationEnabled"];
|
||||||
|
|
||||||
|
if (_isObjectHidden) then {
|
||||||
|
[QEGVAR(common,hideObjectGlobal), [_target, false]] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_simulationEnabled) then {
|
||||||
|
[QEGVAR(common,enableSimulationGlobal), [_target, true]] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
deleteVehicle _clone;
|
||||||
|
}, _this, 0.1] call CBA_fnc_waitAndExecute;
|
||||||
|
}, [_target, _clone, _isObjectHidden, _simulationEnabled, _posASL], 0.1] call CBA_fnc_waitAndExecute;
|
||||||
|
|
||||||
|
if (_isInRemainsCollector) then {
|
||||||
|
addToRemainsCollector [_target];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the unit's direction
|
|
||||||
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
|
||||||
|
|
||||||
// Bring unit back to clone's position
|
|
||||||
_target setPosASL _posASL;
|
|
||||||
|
|
||||||
// Turn off PhysX
|
|
||||||
[QEGVAR(common,awake), [_target, false]] call CBA_fnc_globalEvent;
|
|
||||||
|
|
||||||
// Detach first to prevent objNull in attachedObjects
|
// Detach first to prevent objNull in attachedObjects
|
||||||
detach _clone;
|
detach _clone;
|
||||||
deleteVehicle _clone;
|
deleteVehicle _clone;
|
||||||
|
Loading…
Reference in New Issue
Block a user