Try syncing individually on each client

This commit is contained in:
johnb432 2024-04-01 16:33:08 +02:00
parent 1a20df808e
commit fdbaeabc47
3 changed files with 16 additions and 17 deletions

View File

@ -122,11 +122,6 @@
_object setMass _mass;
}] call CBA_fnc_addEventHandler;
[QGVAR(awake), {
params ["_object", "_awake"];
_object awake _awake;
}] call CBA_fnc_addEventHandler;
[QGVAR(disableWeaponAssembly), {
params ["_object", "_set"];
_object enableWeaponDisassembly (_set < 1);

View File

@ -67,6 +67,18 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
_clone setMimic "unconscious";
}] call CBA_fnc_addEventHandler;
[QGVAR(syncCorpse),{
params ["_corpse"];
[{
_this awake true;
[{
_this awake false;
}, _this] call CBA_fnc_execNextFrame;
}, _corpse] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addEventHandler;
[QGVAR(moveCorpse), {
params ["_corpse", "_dir", "_pos"];
@ -76,10 +88,8 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
// 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;
// Sync the corpse with its position
[QGVAR(syncCorpse), _corpse] call CBA_fnc_globalEvent;
}] call CBA_fnc_addEventHandler;
// Display event handler

View File

@ -54,17 +54,11 @@ if (_isInRemainsCollector) then {
};
// Make sure clone has the same wound textures as the corpse
private _targetDamage = damage _target;
if (_targetDamage != 0) then {
_clone setDamage (_targetDamage min 0.99); // don't kill the clone
};
private _relevantHitpoints = ["HitHead", "HitBody", "HitHands", "HitLegs"];
_clone setDamage ((damage _target) min 0.99); // don't kill the clone
{
_clone setHitPointDamage [_x, (_target getHitPointDamage _x) min 0.99];
} forEach _relevantHitpoints;
} forEach ["HitHead", "HitBody", "HitHands", "HitLegs"]; // relevant hitpoints
// Disable all damage
_clone allowDamage false;