This commit is contained in:
Sotirios Pupakis
2024-04-25 23:04:47 +02:00
parent 22925379fa
commit 4cec6e0d6a
7 changed files with 237 additions and 142 deletions

View File

@@ -16,3 +16,5 @@ PREP(unload);
PREP(canBeTowed); PREP(canBeTowed);
PREP(tow); PREP(tow);
PREP(detach); PREP(detach);
PREP(rotateLeft);
PREP(rotateRight);

View File

@@ -21,3 +21,18 @@ ADDON = true;
_arty addMagazineTurret [_shell, [_turret], 1]; _arty addMagazineTurret [_shell, [_turret], 1];
} }
] call CBA_fnc_addEventHandler; ] call CBA_fnc_addEventHandler;
[LLSTRING(name), "RotateRight", [LLSTRING(rotright), LLSTRING(rotright_desc)], {
if (vehicle player == player) exitWith {};
if (typeOf (vehicle player) != QUOTE(TBD_M119)) exitWith {};
call FUNC(rotateRight);
}, {},
[0x20, [false, false, false]], true, 0.1] call CBA_fnc_addKeybind;
[LLSTRING(name), "RotateLeft", [LLSTRING(rotleft), LLSTRING(rotleft_desc)], {
if (vehicle player == player) exitWith {};
if (typeOf (vehicle player) != QUOTE(TBD_M119)) exitWith {};
call FUNC(rotateLeft);
}, {},
[0x1E, [false, false, false]], true, 0.1] call CBA_fnc_addKeybind;

View File

@@ -0,0 +1,42 @@
/*
FILE: fnc_rotateLeft.sqf
Name: tbd_m119_m119_fnc_rotateLeft
Author(s):
ilbinek
Description:
Rotate the M119 to the left
Parameters:
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_rotateLeft;
Public:
No
*/
#include "..\script_component.hpp"
if (vehicle player == player) exitWith {};
if (typeOf (vehicle player) != QUOTE(TBD_M119)) exitWith {};
private _arty = vehicle player;
// Get the current animation source phase
private _currentPhase = _arty animationSourcePhase "howitzer_rotation_source";
// Edit it
_currentPhase = _currentPhase - 4;
if (_currentPhase < -1440) then {
_currentPhase = 1440;
};
// Set the new animation source phase
_arty animateSource ["howitzer_rotation_source", _currentPhase, 30];

View File

@@ -0,0 +1,42 @@
/*
FILE: fnc_rotateRight.sqf
Name: tbd_m119_m119_fnc_rotateRight
Author(s):
ilbinek
Description:
Rotate the M119 to the right
Parameters:
Nothing
Returns:
Nothing
Examples:
> [_arty] call tbd_m119_m119_fnc_rotateRight;
Public:
No
*/
#include "..\script_component.hpp"
if (vehicle player == player) exitWith {};
if (typeOf (vehicle player) != QUOTE(TBD_M119)) exitWith {};
private _arty = vehicle player;
// Get the current animation source phase
private _currentPhase = _arty animationSourcePhase "howitzer_rotation_source";
// Edit it
_currentPhase = _currentPhase + 4;
if (_currentPhase > 1440) then {
_currentPhase = 1440;
};
// Set the new animation source phase
_arty animateSource ["howitzer_rotation_source", _currentPhase, 30];

View File

@@ -46,5 +46,25 @@
<Czech>Odpojit</Czech> <Czech>Odpojit</Czech>
<Russian>Отсоединить</Russian> <Russian>Отсоединить</Russian>
</Key> </Key>
<Key ID="STR_TBD_M119_M119_ROTLEFT">
<English>Rotate left</English>
<Czech>Otočit vlevo</Czech>
<Russian>Повернуть орудие влево</Russian>
</Key>
<Key ID="STR_TBD_M119_M119_ROTRIGHT">
<English>Rotate right</English>
<Czech>Otočit vprevo</Czech>
<Russian>Повернуть орудие вправо</Russian>
</Key>
<Key ID="STR_TBD_M119_M119_ROTLEFT_DESC">
<English>Rotate the gun to the left</English>
<Czech>Otočit celou houfnici vlevo</Czech>
<Russian>Повернуть орудие влево</Russian>
</Key>
<Key ID="STR_TBD_M119_M119_ROTRIGHT_DESC">
<English>Rotate the gun to the right</English>
<Czech>Otočit celou houfnici vpravo</Czech>
<Russian>Повернуть орудие вправо</Russian>
</Key>
</Package> </Package>
</Project> </Project>

View File

@@ -1,19 +1,16 @@
class CfgSkeletons class CfgSkeletons {
{ class Default {
class Default
{
isDiscrete = 0; isDiscrete = 0;
skeletonInherit = ""; skeletonInherit = "";
skeletonBones[] = {}; skeletonBones[] = {};
}; };
class tbd_M119_skeleton: Default class tbd_M119_skeleton : Default {
{
pivotsModel = ""; pivotsModel = "";
isDiscrete = 0; isDiscrete = 0;
skeletonInherit = ""; skeletonInherit = "";
skeletonBones[] = skeletonBones[] = {
{ "plate_front", "", "plate_front", "",
"rest", "", "rest", "",
"plate_back", "rest", "plate_back", "rest",
"rightwheel", "rest", "rightwheel", "rest",
@@ -29,34 +26,24 @@ class CfgSkeletons
"magazine", "magazine_translation_bone", "magazine", "magazine_translation_bone",
"hydraulics", "otocvez", "hydraulics", "otocvez",
"breech", "barrel", "breech", "barrel",
"handle_breech", "barrel" "handle_breech", "barrel"};
};
}; };
}; };
class CfgModels class CfgModels {
{ class Default {
class Default
{
sectionsInherit = ""; sectionsInherit = "";
sections[] = {}; sections[] = {};
skeletonName = ""; skeletonName = "";
}; };
class tbd_M119: Default class tbd_M119 : Default {
{
sectionsInherit = ""; sectionsInherit = "";
sections[] = sections[] = {};
{
};
skeletonName = "tbd_M119_skeleton"; skeletonName = "tbd_M119_skeleton";
class Animations class Animations {
{ class leftwheel {
class leftwheel
{
type = "rotation"; type = "rotation";
source = "recoil_rest_source"; source = "recoil_rest_source";
selection = "leftwheel"; selection = "leftwheel";
@@ -66,8 +53,8 @@ class Animations
angle0 = "rad +360"; angle0 = "rad +360";
angle1 = "rad -360"; angle1 = "rad -360";
}; };
class rightwheel
{ class rightwheel {
type = "rotation"; type = "rotation";
source = "recoil_rest_source"; source = "recoil_rest_source";
selection = "rightwheel"; selection = "rightwheel";
@@ -77,20 +64,19 @@ class Animations
angle0 = "rad +360"; angle0 = "rad +360";
angle1 = "rad -360"; angle1 = "rad -360";
}; };
class howitzer_rotation
{ class howitzer_rotation {
type = "rotationY"; type = "rotationY";
source = "howitzer_rotation_source"; source = "howitzer_rotation_source";
selection = "rest"; selection = "rest";
axis = "axis_howitzer"; axis = "axis_howitzer";
minValue = "rad -360"; minValue = -1440;
maxValue = "rad +360"; maxValue = 1440;
angle0 = "rad +360"; angle0 = "rad +1440";
angle1 = "rad -360"; angle1 = "rad -1440";
}; };
class rest class rest {
{
type = "rotation"; type = "rotation";
source = "rest_rotation_source"; source = "rest_rotation_source";
selection = "rest"; selection = "rest";
@@ -170,8 +156,7 @@ class Animations
source = "mainGunT_source"; source = "mainGunT_source";
}; };
class recoil_rest class recoil_rest {
{
type = "translation"; type = "translation";
source = "recoil_rest_source"; source = "recoil_rest_source";
selection = "rest"; selection = "rest";
@@ -183,8 +168,7 @@ class Animations
animPeriod = 10; animPeriod = 10;
}; };
class recoil_barrel class recoil_barrel {
{
type = "translation"; type = "translation";
source = "recoil_barrel_source"; source = "recoil_barrel_source";
selection = "barrel"; selection = "barrel";
@@ -196,8 +180,7 @@ class Animations
animPeriod = 10; animPeriod = 10;
}; };
class open_breech class open_breech {
{
type = "translation"; type = "translation";
source = "open_breech_source"; source = "open_breech_source";
selection = "breech"; selection = "breech";
@@ -209,9 +192,7 @@ class Animations
animPeriod = 10; animPeriod = 10;
}; };
class handle_breech {
class handle_breech
{
type = "rotation"; type = "rotation";
source = "handle_breech_source"; source = "handle_breech_source";
selection = "handle_breech"; selection = "handle_breech";
@@ -223,8 +204,8 @@ class Animations
animPeriod = 10; animPeriod = 10;
memory = 1; memory = 1;
}; };
class hydraulics
{ class hydraulics {
type = "rotation"; type = "rotation";
source = "mainGun"; source = "mainGun";
sourceAddress = "loop"; sourceAddress = "loop";
@@ -254,16 +235,12 @@ class Animations
memory = 1; memory = 1;
}; };
class MainGunOptics : MainGun { class MainGunOptics : MainGun {
selection = "gunnerview"; selection = "gunnerview";
axis = "gunnerview"; axis = "gunnerview";
}; };
class magazine_load class magazine_load {
{
type = "translation"; type = "translation";
source = "magazine_load_source"; source = "magazine_load_source";
selection = "magazine_translation_bone"; selection = "magazine_translation_bone";
@@ -275,29 +252,26 @@ class Animations
animPeriod = 10; animPeriod = 10;
}; };
class magazine_hide class magazine_hide {
{
type = "hide"; type = "hide";
source = "magazine_hide_source"; source = "magazine_hide_source";
selection = "magazine"; selection = "magazine";
hideValue = 1; hideValue = 1;
}; };
class plate_front_hide
{ class plate_front_hide {
type = "hide"; type = "hide";
source = "plate_front_source"; source = "plate_front_source";
selection = "plate_front"; selection = "plate_front";
hideValue = 1; hideValue = 1;
}; };
class plate_back_hide
{ class plate_back_hide {
type = "hide"; type = "hide";
source = "plate_back_source"; source = "plate_back_source";
selection = "plate_back"; selection = "plate_back";
hideValue = 1; hideValue = 1;
}; };
}; };
}; };
}; };