Dragging - Fix unintended Cargo dependency and improve ragdoll/disconnection handling (#9272)

* Improvements

* fix unintended cargo dependency

* stringtable

---------

Co-authored-by: Salluci <salluci.lovi@gmail.com>
This commit is contained in:
johnb432 2023-07-22 06:01:30 +02:00 committed by GitHub
parent 9d1b696480
commit 9505d4c47e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 12 deletions

View File

@ -1661,5 +1661,21 @@
<Russian>Разрядить оружие</Russian>
<Spanish>Descargar arma</Spanish>
</Key>
<Key ID="STR_ACE_Common_loadObject">
<English>Load</English>
<German>Beladen</German>
<Polish>Załaduj</Polish>
<Portuguese>Carregar</Portuguese>
<Russian>Загрузить</Russian>
<Czech>Naložit</Czech>
<Spanish>Cargar</Spanish>
<Italian>Carica</Italian>
<French>Charger</French>
<Japanese>積み込む</Japanese>
<Korean>싣기</Korean>
<Chinese>裝載</Chinese>
<Chinesesimp>装载</Chinesesimp>
<Turkish>Yükle</Turkish>
</Key>
</Package>
</Project>

View File

@ -2,8 +2,12 @@
#include "script_component.hpp"
if (isServer) then {
// release object on hard disconnection. Function is identical to killed
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}];
// 'HandleDisconnect' EH triggers too late
addMissionEventHandler ["PlayerDisconnected", {
private _unit = (getUserInfo (_this select 5)) select 10;
_unit call FUNC(handleKilled);
}];
};
if (!hasInterface) exitWith {};

View File

@ -31,10 +31,11 @@ if (_target isKindOf "StaticWeapon") exitWith {
crew _target findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
};
// Units need to be unconscious or limping
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues
if (_target isKindOf "CAManBase") exitWith {
lifeState _target isEqualTo "INCAPACITATED"
|| {_target getHitPointDamage "HitLegs" >= 0.5}
!(alive _target != isAwake _target) &&
{lifeState _target isEqualTo "INCAPACITATED" ||
{_target getHitPointDamage "HitLegs" >= 0.5}}
};
// Check max items for WeaponHolders

View File

@ -27,10 +27,11 @@ if (_target isKindOf "StaticWeapon") exitWith {
crew _target findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
};
// Units need to be unconscious or limping
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues
if (_target isKindOf "CAManBase") exitWith {
lifeState _target isEqualTo "INCAPACITATED"
|| {_target getHitPointDamage "HitLegs" >= 0.5}
!(alive _target != isAwake _target) &&
{lifeState _target isEqualTo "INCAPACITATED" ||
{_target getHitPointDamage "HitLegs" >= 0.5}}
};
// Check max items for WeaponHolders

View File

@ -58,11 +58,12 @@ if (
if (_target isKindOf "CAManBase") then {
[_cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat) isNotEqualTo []
} else {
[_target, _cursorObject] call EFUNC(cargo,canLoadItemIn)
["ace_cargo"] call EFUNC(common,isModLoaded) &&
{[_target, _cursorObject] call EFUNC(cargo,canLoadItemIn)}
}
}
) then {
_hintLMB = localize ELSTRING(Cargo,loadObject);
_hintLMB = localize ELSTRING(common,loadObject);
};
private _hintMMB = localize LSTRING(RaiseLowerRotate);

View File

@ -91,7 +91,7 @@ if (_mass != 0) then {
_target setVariable [QGVAR(carryDirection_temp), nil];
// try loading into vehicle
if (_tryLoad && {!isNull cursorObject} && {([ACE_player, cursorObject, []] call EFUNC(common,canInteractWith))}) then {
if (_tryLoad && {!isNull cursorObject} && {([ACE_player, cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith))}) then {
if (_target isKindOf "CAManBase") then {
private _vehicles = [cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat);
if ([cursorObject] isEqualTo _vehicles) then {
@ -102,7 +102,10 @@ if (_tryLoad && {!isNull cursorObject} && {([ACE_player, cursorObject, []] call
};
};
} else {
if ([_target, cursorObject] call EFUNC(cargo,canLoadItemIn)) then {
if (
["ace_cargo"] call EFUNC(common,isModLoaded) &&
{[_target, cursorObject] call EFUNC(cargo,canLoadItemIn)}
) then {
[player, _target, cursorObject] call EFUNC(cargo,startLoadIn);
};
};