mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Replaced deleting of body by hiding it
This commit is contained in:
parent
55e7e768ca
commit
6eac193825
@ -27,26 +27,6 @@ _group = createGroup _side;
|
|||||||
_position = getPos _oldBody;
|
_position = getPos _oldBody;
|
||||||
|
|
||||||
_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"];
|
_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"];
|
||||||
|
|
||||||
_allVariables = [_oldBody] call EFUNC(common,getAllDefinedSetVariables);
|
|
||||||
// [NAME (STRING), TYPENAME (STRING), VALUE (ANY), DEFAULT GLOBAL (BOOLEAN)]
|
|
||||||
{
|
|
||||||
[_newUnit,_x select 0, _x select 2] call EFUNC(common,setDefinedVariable);
|
|
||||||
}foreach _allVariables;
|
|
||||||
|
|
||||||
_allVars = allVariables _oldBody;
|
|
||||||
_public = !(local _oldBody);
|
|
||||||
{
|
|
||||||
_newUnit setvariable [_x, (_oldBody getvariable _x), false];
|
|
||||||
}foreach _allVars;
|
|
||||||
|
|
||||||
// find the remaining variables?
|
|
||||||
if !(_public) then {
|
|
||||||
// exec on server?
|
|
||||||
} else {
|
|
||||||
// Exec on client
|
|
||||||
};
|
|
||||||
|
|
||||||
_newUnit setVariable ["ACE_name", _name, true];
|
_newUnit setVariable ["ACE_name", _name, true];
|
||||||
|
|
||||||
_newUnit disableAI "TARGET";
|
_newUnit disableAI "TARGET";
|
||||||
@ -54,7 +34,6 @@ _newUnit disableAI "AUTOTARGET";
|
|||||||
_newUnit disableAI "MOVE";
|
_newUnit disableAI "MOVE";
|
||||||
_newUnit disableAI "ANIM";
|
_newUnit disableAI "ANIM";
|
||||||
_newUnit disableAI "FSM";
|
_newUnit disableAI "FSM";
|
||||||
_newUnit setvariable ["ACE_isDead", true, true];
|
|
||||||
|
|
||||||
removeallweapons _newUnit;
|
removeallweapons _newUnit;
|
||||||
removeallassigneditems _newUnit;
|
removeallassigneditems _newUnit;
|
||||||
@ -85,10 +64,16 @@ clearWeaponCargoGlobal (backpackContainer _newUnit);
|
|||||||
|
|
||||||
_newUnit selectWeapon (primaryWeapon _newUnit);
|
_newUnit selectWeapon (primaryWeapon _newUnit);
|
||||||
|
|
||||||
// TODO sometimes the old body does not get cleaned up properly.
|
// We are attaching the old unit and hiding it, so we can keep the original unit until later.
|
||||||
// TODO Maybe it is better to hide the body, attach it as well, and remove the copy once we are done with it instead?
|
_oldBody attachTo [_newUnit, [0,0,0]];
|
||||||
deleteVehicle _oldBody;
|
if (isMultiplayer) then {
|
||||||
|
hideObjectGlobal _oldBody;
|
||||||
|
} else {
|
||||||
|
hideObject _oldBody;
|
||||||
|
};
|
||||||
|
|
||||||
|
_newUnit setvariable [QGVAR(copyOfUnit), _oldBody, true];
|
||||||
|
_newUnit setvariable ["ACE_isDead", true, true];
|
||||||
|
_newUnit setvariable ["ACE_isUnconscious", true, true];
|
||||||
_newUnit setDamage 0.89;
|
_newUnit setDamage 0.89;
|
||||||
|
|
||||||
_newUnit;
|
_newUnit;
|
||||||
|
@ -19,6 +19,17 @@ _target = _caller getvariable [QGVAR(carrying), objNull];
|
|||||||
_carrying = _caller getvariable [QGVAR(isCarrying), -1];
|
_carrying = _caller getvariable [QGVAR(isCarrying), -1];
|
||||||
|
|
||||||
if (_carrying >= 0) then {
|
if (_carrying >= 0) then {
|
||||||
|
if !(isNull (_target getvariable [QGVAR(copyOfUnit), objNull])) then {
|
||||||
|
_copy = _target;
|
||||||
|
_target = _copy getvariable [QGVAR(copyOfUnit), objNull];
|
||||||
|
if (isMultiplayer) then {
|
||||||
|
_target hideObjectGlobal false;
|
||||||
|
} else {
|
||||||
|
_target hideObject false;
|
||||||
|
};
|
||||||
|
detach _copy;
|
||||||
|
deleteVehicle _copy;
|
||||||
|
};
|
||||||
|
|
||||||
_caller setvariable [QGVAR(isCarrying), -1, true];
|
_caller setvariable [QGVAR(isCarrying), -1, true];
|
||||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||||
|
Loading…
Reference in New Issue
Block a user