mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Another attempt
This commit is contained in:
parent
85f138fbc1
commit
824a9f6afe
@ -67,6 +67,21 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
_clone setMimic "unconscious";
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(moveCorpse), {
|
||||
params ["_corpse", "_dir", "_pos"];
|
||||
|
||||
// Set direction before position
|
||||
_corpse setDir _dir;
|
||||
|
||||
// Bring corpse back to clone's position
|
||||
_corpse setPosATL _pos;
|
||||
|
||||
// Sync the corpse
|
||||
[QEGVAR(common,awake), [_corpse, true]] call CBA_fnc_globalEvent;
|
||||
[QEGVAR(common,awake), [_corpse, false]] call CBA_fnc_globalEvent;
|
||||
[QEGVAR(common,awake), [_corpse, true]] call CBA_fnc_globalEvent;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// Display event handler
|
||||
["MouseZChanged", {(_this select 1) call FUNC(handleScrollWheel)}] call CBA_fnc_addDisplayHandler;
|
||||
|
||||
|
@ -29,6 +29,9 @@ private _clone = createVehicle [QGVAR(clone), ASLToAGL _posATL, [], 0, "CAN_COLL
|
||||
// Move unit -10 m below terrain in order to hide it and remove its inventory access
|
||||
_posATL set [2, -10];
|
||||
|
||||
// Corpse is desynced, but it doesn't matter here
|
||||
_target setPosATL _posATL;
|
||||
|
||||
// Hide unit until it can be moved below terrain
|
||||
private _isObjectHidden = isObjectHidden _target;
|
||||
|
||||
@ -66,9 +69,6 @@ private _relevantHitpoints = ["HitHead", "HitBody", "HitHands", "HitLegs"];
|
||||
_clone allowDamage false;
|
||||
_clone setVariable [QGVAR(original), [_target, _isInRemainsCollector, _isObjectHidden, _simulationEnabled], true];
|
||||
|
||||
// Turn on PhysX so that the corpse doesn't desync when moved
|
||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||
|
||||
[{
|
||||
params ["_clone", "_target", "_posATL"];
|
||||
|
||||
@ -77,18 +77,12 @@ _clone setVariable [QGVAR(original), [_target, _isInRemainsCollector, _isObjectH
|
||||
[QEGVAR(zeus,removeObjects), [[_clone]]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
||||
// Make sure PhysX is on
|
||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||
|
||||
// Clone loadout (sometimes default loadouts are randomised, so overwrite those)
|
||||
[_clone, _target call CBA_fnc_getLoadout] call CBA_fnc_setLoadout;
|
||||
|
||||
// Sets the facial expression
|
||||
[[QGVAR(cloneCreated), [_target, _clone]] call CBA_fnc_globalEventJIP, _clone] call CBA_fnc_removeGlobalEventJIP;
|
||||
|
||||
// Corpse is desynced, but it doesn't matter here
|
||||
_target setPosATL _posATL;
|
||||
|
||||
// Release claim on corpse
|
||||
[objNull, _target] call EFUNC(common,claim);
|
||||
}, [_clone, _target, _posATL], 0.25] call CBA_fnc_waitAndExecute;
|
||||
|
@ -28,41 +28,33 @@ params ["_unit", "_clone", "_inBuilding"];
|
||||
|
||||
// Check if unit was deleted
|
||||
if (!isNull _target) then {
|
||||
// Turn on PhysX so that the corpse doesn't desync when moved
|
||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||
|
||||
private _posASL = getPosASL _clone;
|
||||
private _pos = getPosATL _clone;
|
||||
|
||||
if (_inBuilding) then {
|
||||
_posASL = _posASL vectorAdd [0, 0, 0.05];
|
||||
_pos = _pos vectorAdd [0, 0, 0.05];
|
||||
};
|
||||
|
||||
// Set the unit's direction
|
||||
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
||||
// Make sure position is not underground
|
||||
if (_pos select 2 < 0.05) then {
|
||||
_pos set [2, 0.05];
|
||||
};
|
||||
|
||||
[{
|
||||
params ["_target", "_clone", "_isObjectHidden", "_simulationEnabled", "_posASL"];
|
||||
// Move the unit where it is local
|
||||
[QGVAR(moveCorpse), [_target, getDir _unit + 180, ], _target] call CBA_fnc_targetEvent;
|
||||
|
||||
// Make sure PhysX is on
|
||||
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
||||
// Unhide unit
|
||||
if (!_isObjectHidden) then {
|
||||
[QEGVAR(common,hideObjectGlobal), [_target, false]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
||||
// Bring unit back to clone's position
|
||||
_target setPosASL _posASL;
|
||||
// Enable simulation again
|
||||
if (_simulationEnabled) then {
|
||||
[QEGVAR(common,enableSimulationGlobal), [_target, true]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
||||
// Unhide unit
|
||||
if (!_isObjectHidden) then {
|
||||
[QEGVAR(common,hideObjectGlobal), [_target, false]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
||||
// Enable simulation again
|
||||
if (_simulationEnabled) then {
|
||||
[QEGVAR(common,enableSimulationGlobal), [_target, true]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
||||
// Detach first to prevent objNull in attachedObjects
|
||||
detach _clone;
|
||||
deleteVehicle _clone;
|
||||
}, [_target, _clone, _isObjectHidden, _simulationEnabled, _posASL], 0.25] call CBA_fnc_waitAndExecute;
|
||||
// Detach first to prevent objNull in attachedObjects
|
||||
detach _clone;
|
||||
deleteVehicle _clone;
|
||||
|
||||
// Get which curators had this object as editable
|
||||
if (["ace_zeus"] call EFUNC(common,isModLoaded)) then {
|
||||
|
@ -80,6 +80,20 @@ GVAR(inheritedClassesAll) = [];
|
||||
GVAR(inheritedActionsMan) = [];
|
||||
GVAR(inheritedClassesMan) = [];
|
||||
|
||||
// Extended EH doesn't fire for dead units, so add interactions manually
|
||||
{
|
||||
private _type = typeOf _x;
|
||||
|
||||
if (GVAR(inheritedClassesMan) pushBackUnique _type == -1) then {
|
||||
continue;
|
||||
};
|
||||
|
||||
{
|
||||
_x params ["_typeNum", "_parentPath", "_action"];
|
||||
[_type, _typeNum, _parentPath, _action] call FUNC(addActionToClass);
|
||||
} forEach GVAR(inheritedActionsMan);
|
||||
} forEach allDeadMen;
|
||||
|
||||
["All", "InitPost", {
|
||||
BEGIN_COUNTER(InitPost);
|
||||
params ["_object"];
|
||||
|
Loading…
Reference in New Issue
Block a user