This commit is contained in:
Tklama
2024-04-22 15:59:33 +02:00
11 changed files with 200 additions and 45 deletions

View File

@@ -0,0 +1,5 @@
PREP(init);
PREP(canOpenBreech);
PREP(canCloseBreech);
PREP(openBreech);
PREP(closeBreech);

View File

@@ -2,4 +2,6 @@
#include "XEH_PREP.hpp"
[QUOTE(TBD_M119), "init", {_this call FUNC(init)}] call CBA_fnc_addClassEventHandler;
ADDON = true;

View File

@@ -0,0 +1,31 @@
/*
FILE: fnc_canCloseBreech.sqf
Name: tbd_m119_m119_fnc_canCloseBreech
Author(s):
ilbinek
Description:
Checks if the M119 can close the breech
Parameters:
_arty - object - M119 to be canCloseBreeched
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_canCloseBreech;
Public:
No
*/
#include "..\script_component.hpp"
params ["_arty"];
private _ret = _arty getVariable [QGVAR(breech), false] && _arty animationSourcePhase "open_breech_source" == 1;
_ret

View File

@@ -0,0 +1,32 @@
/*
FILE: fnc_canOpenBreech.sqf
Name: tbd_m119_m119_fnc_canOpenBreech
Author(s):
ilbinek
Description:
Checks if the M119 can open the breech
Parameters:
_arty - object - M119 to be canCloseBreeched
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_canOpenBreech;
Public:
Yes
*/
#include "..\script_component.hpp"
params ["_arty"];
private _ret = (!(_arty getVariable [QGVAR(breech), false]) && _arty animationSourcePhase "open_breech_source" == 0);
_ret

View File

@@ -0,0 +1,34 @@
/*
FILE: fnc_closeBreech.sqf
Name: tbd_m119_m119_fnc_closeBreech
Author(s):
ilbinek
Description:
Close the M119 breech
Parameters:
_arty - object - M119 to be canCloseBreeched
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_closeBreech;
Public:
No
*/
#include "..\script_component.hpp"
params ["_arty"];
if !([_arty] call FUNC(canCloseBrach)) exitWith {};
_arty animateSource ["open_breech_source", 0];
_arty animateSource ["handle_breech_source", 0];
_arty setVariable [QGVAR(breech), false, true];

View File

@@ -0,0 +1,33 @@
/*
FILE: fnc_init.sqf
Name: tbd_m119_m119_fnc_init
Author(s):
ilbinek
Description:
Init all variables for the M119
Parameters:
_arty - object - M119 to be inited
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_init;
Public:
No
*/
#include "..\script_component.hpp"
params ["_arty"];
// Set the state variables
_arty setVariable [QGVAR(folded), false, true];
_arty setVariable [QGVAR(breech), false, true];
_arty setVariable [QGVAR(loaded), false, true];
_arty setVariable [QGVAR(fired), false, true];

View File

@@ -0,0 +1,34 @@
/*
FILE: fnc_openBreech.sqf
Name: tbd_m119_m119_fnc_openBreech
Author(s):
ilbinek
Description:
Open the M119 breech
Parameters:
_arty - object - M119 to be canCloseBreeched
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_openBreech;
Public:
No
*/
#include "..\script_component.hpp"
params ["_arty"];
if !([_arty] call FUNC(canOpenBrach)) exitWith {};
_arty animateSource ["open_breech_source", 1];
_arty animateSource ["handle_breech_source", 1];
_arty setVariable [QGVAR(breech), true, true];

View File

@@ -1,9 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="tbd_mortar">
<Package name="Translation">
<Key ID="STR_TBD_M119_NAME">
<Key ID="STR_TBD_M119_M119_NAME">
<English>M119</English>
<Czech>M119</Czech>
</Key>
<Key ID="STR_TBD_M119_M119_OPEN_BREECH">
<English>Open breech</English>
<Czech>Otevřít zadovku</Czech>
</Key>
<Key ID="STR_TBD_M119_M119_CLOSE_BREECH">
<English>Close breech</English>
<Czech>Zavřít zadovku</Czech>
</Key>
<Key ID="STR_TBD_M119_M119_FOLD">
<English>Fold</English>
<Czech>Složit</Czech>
</Key>
<Key ID="STR_TBD_M119_M119_UNFOLD">
<English>Unfold</English>
<Czech>Rozložit</Czech>
</Key>
</Package>
</Project>

View File

@@ -168,7 +168,6 @@ class CfgVehicles {
soundPosition = "konec_hlavne";
};
class handle_breech_source {
source = "user";
initPhase = 0;
@@ -202,56 +201,25 @@ class CfgVehicles {
initPhase = 1;
animPeriod = 0;
};
};
class ACE_Actions: ACE_Actions {
class VASIL_LoadMag {
selection = "load_magazine";
distance = 1;
condition = QUOTE([ARR_2(_target,QUOTE(QUOTE(TBD_2B9_VASILEK_MAGAZINE)))] call FUNC(canLoadWeapon));
class TBD_OpenBreech {
selection = "int_handle_breech";
distance = 1.5;
condition = QUOTE([ARR_1(_target)] call FUNC(canOpenBreech));
showDisabled = 0;
displayName = CSTRING(LOAD_MAGAZINE);
icon = "x\tbd_mortars\addons\main\data\load.paa";
statement = QUOTE([ARR_2(_target,QUOTE(QUOTE(TBD_2B9_VASILEK_MAGAZINE)))] call FUNC(loadWeapon));
displayName = CSTRING(open_breech);
statement = QUOTE([ARR_1(_target)] call FUNC(openBreech));
};
class ACE_MainActions: ACE_MainActions {
selection = "interact";
class VASIL_Fold {
distance = 2.5;
condition = QUOTE([ARR_1(_target)] call FUNC(canFold));
showDisabled = 0;
displayName = CSTRING(FOLD);
statement = QUOTE([ARR_1(_target)] call FUNC(fold));
};
class VASIL_Unfold {
distance = 2.5;
condition = QUOTE([ARR_1(_target)] call FUNC(canUnfold));
showDisabled = 0;
displayName = CSTRING(UNFOLD);
statement = QUOTE([ARR_1(_target)] call FUNC(unfold));
};
};
class VASIL_Tow {
selection = "towing_point";
distance = 2.5;
condition = QUOTE([ARR_1(_target)] call FUNC(canBeTowed));
class TBD_CloseBreech {
selection = "int_handle_breech";
distance = 1.5;
condition = QUOTE([ARR_1(_target)] call FUNC(canCloseBreech));
showDisabled = 0;
displayName = CSTRING(TOW);
statement = QUOTE([ARR_1(_target)] call FUNC(tow));
};
class VASIL_Detach {
selection = "towing_point";
distance = 2.5;
condition = QUOTE(_target getVariable [ARR_2(QUOTE(QGVAR(towed)),false)]);
showDisabled = 0;
displayName = CSTRING(DETACH);
statement = QUOTE([ARR_1(_target)] call FUNC(detach));
displayName = CSTRING(close_breech);
statement = QUOTE([ARR_1(_target)] call FUNC(closeBreech));
};
};
};