mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Remove body moving under terrain
This commit is contained in:
parent
3387898441
commit
d1755af35b
@ -14,6 +14,7 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_target"];
|
params ["_target"];
|
||||||
|
|
||||||
// Get current position of unit, -10 m below surface
|
// Get current position of unit, -10 m below surface
|
||||||
@ -25,19 +26,13 @@ private _clone = createVehicle [QGVAR(clone), _posATL];
|
|||||||
// Clone loadout
|
// Clone loadout
|
||||||
[_clone, _target call CBA_fnc_getLoadout] call CBA_fnc_setLoadout;
|
[_clone, _target call CBA_fnc_getLoadout] call CBA_fnc_setLoadout;
|
||||||
|
|
||||||
// Hide unit until it can be moved below terrain
|
// Hide unit
|
||||||
private _isObjectHidden = isObjectHidden _target;
|
private _isObjectHidden = isObjectHidden _target;
|
||||||
|
|
||||||
if (!_isObjectHidden) then {
|
if (!_isObjectHidden) then {
|
||||||
[QEGVAR(common,hideObjectGlobal), [_target, true]] call CBA_fnc_serverEvent;
|
[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;
|
private _isInRemainsCollector = isInRemainsCollector _target;
|
||||||
|
|
||||||
// Make sure corpse isn't deleted by engine's garbage collector
|
// Make sure corpse isn't deleted by engine's garbage collector
|
||||||
@ -47,17 +42,7 @@ if (_isInRemainsCollector) then {
|
|||||||
|
|
||||||
// Disable all damage
|
// Disable all damage
|
||||||
_clone allowDamage false;
|
_clone allowDamage false;
|
||||||
_clone setVariable [QGVAR(original), [_target, _isInRemainsCollector, _isObjectHidden, _simulationEnabled], true];
|
_clone setVariable [QGVAR(original), [_target, _isInRemainsCollector, _isObjectHidden], true];
|
||||||
|
|
||||||
// Turn on PhysX so that unit is not desync when moving with 'setPos' commands
|
|
||||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
|
||||||
|
|
||||||
[{
|
|
||||||
params ["_target", "_posATL"];
|
|
||||||
|
|
||||||
// Move unit below terrain in order to hide it
|
|
||||||
_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;
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_unit", "_clone", "_inBuilding"];
|
params ["_unit", "_clone", "_inBuilding"];
|
||||||
|
|
||||||
(_clone getVariable [QGVAR(original), []]) params [["_target", objNull], ["_isInRemainsCollector", true], ["_isObjectHidden", false], ["_simulationEnabled", true]];
|
(_clone getVariable [QGVAR(original), []]) params [["_target", objNull], ["_isInRemainsCollector", true], ["_isObjectHidden", false]];
|
||||||
|
|
||||||
// Check if unit was deleted
|
// Check if unit was deleted
|
||||||
if (!isNull _target) then {
|
if (!isNull _target) then {
|
||||||
// Turn on PhysX so that unit is not desync when moving
|
// Turn on PhysX so that unit doesn't desync when moving
|
||||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
private _posASL = getPosASL _clone;
|
private _posASL = getPosASL _clone;
|
||||||
@ -31,29 +32,28 @@ if (!isNull _target) then {
|
|||||||
_posASL = _posASL vectorAdd [0, 0, 0.05];
|
_posASL = _posASL vectorAdd [0, 0, 0.05];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the unit's direction
|
|
||||||
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
|
||||||
|
|
||||||
[{
|
[{
|
||||||
params ["_target", "_clone", "_isObjectHidden", "_simulationEnabled", "_posASL"];
|
params ["_target", "_clone", "_isObjectHidden", "_posASL"];
|
||||||
|
|
||||||
|
// Make sure PhysX is on
|
||||||
|
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
|
// Set the unit's direction
|
||||||
|
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
||||||
|
|
||||||
// Bring unit back to clone's position
|
// Bring unit back to clone's position
|
||||||
_target setPosASL _posASL;
|
_target setPosASL _posASL;
|
||||||
|
|
||||||
[{
|
[{
|
||||||
params ["_target", "_clone", "_isObjectHidden", "_simulationEnabled"];
|
params ["_target", "_clone", "_isObjectHidden"];
|
||||||
|
|
||||||
if (!_isObjectHidden) then {
|
if (!_isObjectHidden) then {
|
||||||
[QEGVAR(common,hideObjectGlobal), [_target, false]] call CBA_fnc_serverEvent;
|
[QEGVAR(common,hideObjectGlobal), [_target, false]] call CBA_fnc_serverEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_simulationEnabled) then {
|
|
||||||
[QEGVAR(common,enableSimulationGlobal), [_target, true]] call CBA_fnc_serverEvent;
|
|
||||||
};
|
|
||||||
|
|
||||||
deleteVehicle _clone;
|
deleteVehicle _clone;
|
||||||
}, _this, 0.1] call CBA_fnc_waitAndExecute;
|
}, _this, 0.1] call CBA_fnc_waitAndExecute;
|
||||||
}, [_target, _clone, _isObjectHidden, _simulationEnabled, _posASL], 0.1] call CBA_fnc_waitAndExecute;
|
}, [_target, _clone, _isObjectHidden, _posASL], 0.1] call CBA_fnc_waitAndExecute;
|
||||||
|
|
||||||
if (_isInRemainsCollector) then {
|
if (_isInRemainsCollector) then {
|
||||||
addToRemainsCollector [_target];
|
addToRemainsCollector [_target];
|
||||||
|
Loading…
Reference in New Issue
Block a user