Fixed towing wrong orientation and locked even after unfold

This commit is contained in:
Sotirios Pupakis
2024-08-06 01:32:51 +02:00
parent f9951e664a
commit 8187be6782
5 changed files with 43 additions and 34 deletions

View File

@@ -54,3 +54,42 @@ GVAR(towingList) = [
_arty setPosWorld getPosWorld _arty; _arty setPosWorld getPosWorld _arty;
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
[QGVAR(fold), {
params ["_arty"];
if !([_arty] call FUNC(canFold)) exitWith {};
_arty lock true;
// animate
private _curTur = _arty animationPhase "mainTurret";
private _curGun = _arty animationPhase "mainGun";
_arty animateSource ["plate_back_source", 0, true];
_arty animateSource ["plate_front_source", 1, true];
_arty animateSource ["mainTurretT_source", -_curTur];
_arty animateSource ["mainGunT_source", -_curGun + 0.1];
_arty animateSource ["hydraulicsT_source", -_curGun + 0.1];
_arty animateSource ["howitzer_rotation_source", 0, true];
_arty setVariable [QGVAR(folded), true, true];
_arty enableRopeAttach true;
}] call CBA_fnc_addEventHandler;;
[QGVAR(unfold), {
params ["_arty"];
if !([_arty] call FUNC(canUnfold)) exitWith {};
_arty lock false;
// animate
_arty animateSource ["plate_back_source", 1, true];
_arty animateSource ["plate_front_source", 0, true];
_arty animateSource ["mainTurretT_source", 0];
_arty animateSource ["mainGunT_source", 0];
_arty animateSource ["hydraulicsT_source", 0];
_arty setVariable [QGVAR(folded), false, true];
_arty enableRopeAttach true;
}] call CBA_fnc_addEventHandler;

View File

@@ -26,7 +26,7 @@
params ["_arty"]; params ["_arty"];
_arty setVariable [QGVAR(towed), false, false]; _arty setVariable [QGVAR(towed), false, true];
[QGVAR(detached), [_arty], QGVAR(towJIP)] call CBA_fnc_globalEventJIP; [QGVAR(detached), [_arty], QGVAR(towJIP)] call CBA_fnc_globalEventJIP;
_arty animateSource ["rest_rotation_source", 0, 10]; _arty animateSource ["rest_rotation_source", 0, 10];

View File

@@ -25,21 +25,4 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
params ["_arty"]; params ["_arty"];
[QGVAR(fold), [_arty], _arty] call CBA_fnc_targetEvent;
if !([_arty] call FUNC(canFold)) exitWith {};
_arty lock true;
// animate
private _curTur = _arty animationPhase "mainTurret";
private _curGun = _arty animationPhase "mainGun";
_arty animateSource ["plate_back_source", 0, true];
_arty animateSource ["plate_front_source", 1, true];
_arty animateSource ["mainTurretT_source", -_curTur];
_arty animateSource ["mainGunT_source", -_curGun + 0.1];
_arty animateSource ["hydraulicsT_source", -_curGun + 0.1];
_arty animateSource ["howitzer_rotation_source", 0, true];
_arty setVariable [QGVAR(folded), true, true];
_arty enableRopeAttach true;

View File

@@ -43,7 +43,7 @@ private _canBeTowed = false;
private _p = _veh modelToWorldVisual [_x#1#0, _x#1#1, _x#1#2]; private _p = _veh modelToWorldVisual [_x#1#0, _x#1#1, _x#1#2];
if (_p distance _pos < ATTACH_RADIUS) exitWith { if (_p distance _pos < ATTACH_RADIUS) exitWith {
_canBeTowed = true; _canBeTowed = true;
[QGVAR(tow), [_arty, _veh, _x#1#0, _x#1#1, _x#1#2, _x#2]] call CBA_fnc_serverEvent; [QGVAR(tow), [_arty, _veh, _x#1#0, _x#1#1, _x#1#2, _x#2], _arty] call CBA_fnc_targetEvent;
}; };
}; };
} forEach GVAR(towingList); } forEach GVAR(towingList);

View File

@@ -25,17 +25,4 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
params ["_arty"]; params ["_arty"];
[QGVAR(unfold), [_arty], _arty] call CBA_fnc_targetEvent;
if !([_arty] call FUNC(canUnfold)) exitWith {};
_arty lock false;
// animate
_arty animateSource ["plate_back_source", 1, true];
_arty animateSource ["plate_front_source", 0, true];
_arty animateSource ["mainTurretT_source", 0];
_arty animateSource ["mainGunT_source", 0];
_arty animateSource ["hydraulicsT_source", 0];
_arty setVariable [QGVAR(folded), false, true];
_arty enableRopeAttach true;