Replaced deleting of body by hiding it

This commit is contained in:
Glowbal 2015-03-22 20:37:55 +01:00
parent 55e7e768ca
commit 6eac193825
2 changed files with 21 additions and 25 deletions

View File

@ -27,26 +27,6 @@ _group = createGroup _side;
_position = getPos _oldBody;
_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 disableAI "TARGET";
@ -54,7 +34,6 @@ _newUnit disableAI "AUTOTARGET";
_newUnit disableAI "MOVE";
_newUnit disableAI "ANIM";
_newUnit disableAI "FSM";
_newUnit setvariable ["ACE_isDead", true, true];
removeallweapons _newUnit;
removeallassigneditems _newUnit;
@ -85,10 +64,16 @@ clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit selectWeapon (primaryWeapon _newUnit);
// TODO sometimes the old body does not get cleaned up properly.
// TODO Maybe it is better to hide the body, attach it as well, and remove the copy once we are done with it instead?
deleteVehicle _oldBody;
// We are attaching the old unit and hiding it, so we can keep the original unit until later.
_oldBody attachTo [_newUnit, [0,0,0]];
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;

View File

@ -19,6 +19,17 @@ _target = _caller getvariable [QGVAR(carrying), objNull];
_carrying = _caller getvariable [QGVAR(isCarrying), -1];
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];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {