diff --git a/addons/rearm/CfgAmmo.hpp b/addons/rearm/CfgAmmo.hpp index 8acd8bc82f..174d4ccfb3 100644 --- a/addons/rearm/CfgAmmo.hpp +++ b/addons/rearm/CfgAmmo.hpp @@ -1,3 +1,13 @@ +#define DUMMY_PROPERTIES \ + effectsSmoke = ""; \ + explosive = 0; \ + fuseDistance = 10000; \ + hit = 0; \ + indirectHit = 0; \ + muzzleEffect = ""; \ + simulation = "shotMine"; \ + timeToLive = 3600; + class CfgAmmo { class BombCore; @@ -11,29 +21,57 @@ class CfgAmmo { class MissileBase : MissileCore { GVAR(caliber) = 250; // Default caliber for missiles }; + class Missile_AA_04_F : MissileBase { + GVAR(dummy) = QGVAR(Missile_AA_04_F); + }; + class Missile_AA_03_F : Missile_AA_04_F { + GVAR(dummy) = QGVAR(Missile_AA_03_F); + }; + class Rocket_04_HE_F : MissileBase { GVAR(caliber) = 70; + GVAR(dummy) = QGVAR(Rocket_04_HE_F); + }; + class Rocket_03_HE_F : Rocket_04_HE_F { + GVAR(dummy) = QGVAR(Rocket_03_HE_F); + }; + class Rocket_04_AP_F : Rocket_04_HE_F { + GVAR(dummy) = QGVAR(Rocket_04_AP_F); + }; + class Rocket_03_AP_F : Rocket_04_AP_F { + GVAR(dummy) = QGVAR(Rocket_03_AP_F); }; class M_PG_AT : MissileBase { GVAR(caliber) = 100; + GVAR(dummy) = QGVAR(M_PG_AT); }; class ACE_Hydra70_DAGR : M_PG_AT { GVAR(caliber) = 70; }; - + class Missile_AGM_02_F : MissileBase { + GVAR(dummy) = QGVAR(Missile_AGM_02_F); + }; + class Missile_AGM_01_F : Missile_AGM_02_F { + GVAR(dummy) = QGVAR(Missile_AGM_01_F); + }; + class RocketCore; class RocketBase : RocketCore { GVAR(caliber) = 70; // Default caliber for rockets }; class R_80mm_HE : RocketBase { GVAR(caliber) = 80; + GVAR(dummy) = QGVAR(R_80mm_HE); }; class R_60mm_HE : R_80mm_HE { GVAR(caliber) = 60; + GVAR(dummy) = QGVAR(R_60mm_HE); + }; + class R_Hydra_HE : RocketBase { + GVAR(dummy) = QGVAR(R_Hydra_HE); }; class BulletBase; - class B_19mm_HE : BulletBase { GVAR(caliber) = 19; }; @@ -79,6 +117,10 @@ class CfgAmmo { }; class ShellBase; + class R_230mm_fly : ShellBase { + GVAR(dummy) = QGVAR(R_230mm_fly); + }; + class Sh_120mm_APFSDS : Shellbase { GVAR(caliber) = 120; }; @@ -174,16 +216,120 @@ class CfgAmmo { GVAR(caliber) = 70; }; - class Bomb_04_F : LaserBombCore { - GVAR(caliber) = 250; // Default caliber for bombs + class Bo_Mk82 : BombCore { + GVAR(dummy) = QGVAR(Bo_Mk82); }; + class Bo_GBU12_LGB : LaserBombCore { GVAR(caliber) = 250; // Default caliber for bombs + GVAR(dummy) = QGVAR(Bo_GBU12_LGB); }; + + class Bomb_04_F : LaserBombCore { + GVAR(caliber) = 250; // Default caliber for bombs + GVAR(dummy) = QGVAR(Bomb_04_F); + }; + + class Bomb_03_F : Bomb_04_F { + GVAR(dummy) = QGVAR(Bomb_03_F); + }; + + // Dummy Ammo + class GVAR(Bo_GBU12_LGB) : Bo_GBU12_LGB { + DUMMY_PROPERTIES + model = "\A3\Weapons_F\Ammo\Bomb_01_F.p3d"; + }; + + class GVAR(Bo_Mk82) : Bo_Mk82 { + DUMMY_PROPERTIES + model = "\A3\Weapons_F\Ammo\Bomb_02_F"; + }; + + class GVAR(Bomb_04_F) : Bomb_04_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Bomb_04_F.p3d"; + }; + + class GVAR(Bomb_03_F) : Bomb_04_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Bomb_03_F.p3d"; + }; + + class GVAR(Missile_AA_04_F) : Missile_AA_04_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Missile_AA_04_F.p3d"; + }; + + class GVAR(Missile_AA_03_F) : Missile_AA_03_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Missile_AA_03_F.p3d"; + }; + + class GVAR(Missile_AGM_02_F) : Missile_AGM_02_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_02_F.p3d"; + }; + + class GVAR(Missile_AGM_01_F) : Missile_AGM_01_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_01_F.p3d"; + }; + + class GVAR(R_230mm_fly) : R_230mm_fly { + DUMMY_PROPERTIES + model = "\A3\Weapons_F\Ammo\Missile_AT_02_F"; + }; + + class GVAR(R_230mm_HE) : R_230mm_HE { + DUMMY_PROPERTIES + model = "\A3\Weapons_F\Ammo\Missile_AT_02_F"; + }; + + class GVAR(M_PG_AT) : M_PG_AT { + DUMMY_PROPERTIES + model = "\A3\Weapons_F\Ammo\Rocket_01_F"; + }; + + class GVAR(Rocket_04_HE_F) : Rocket_04_HE_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_HE_F.p3d"; + }; + + class GVAR(Rocket_03_HE_F) : Rocket_03_HE_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + + class GVAR(Rocket_04_AP_F) : Rocket_04_HE_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_AP_F.p3d"; + }; + + class GVAR(Rocket_03_AP_F) : Rocket_03_AP_F { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_AP_F.p3d"; + }; + + // Using wrong model + class GVAR(R_80mm_HE) : R_80mm_HE { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + + class GVAR(R_60mm_HE) : R_60mm_HE { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + + class GVAR(R_Hydra_HE) : R_Hydra_HE { + DUMMY_PROPERTIES + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + + // F18 Mod class js_a_fa18_wing_tank : LaserBombCore { GVAR(caliber) = 250; // Default caliber for bombs }; - class js_a_fa18x_MK82 : BombCore {}; class js_a_fa18x_GBU39_SDB : js_a_fa18x_MK82 { GVAR(caliber) = 250; // Default caliber for bombs diff --git a/addons/rearm/CfgMagazines.hpp b/addons/rearm/CfgMagazines.hpp new file mode 100644 index 0000000000..2f2d16db93 --- /dev/null +++ b/addons/rearm/CfgMagazines.hpp @@ -0,0 +1,56 @@ +class CfgMagazines { + class CA_Magazine; + class 60Rnd_CMFlareMagazine : CA_Magazine { + displayName = CSTRING(flarelauncher); + }; + + class VehicleMagazine; + class SmokeLauncherMag : VehicleMagazine { + displayName = CSTRING(smokelauncher); + }; + class SmokeLauncherMag_boat : VehicleMagazine { + displayName = CSTRING(smokelauncher); + }; + + class 1000Rnd_Gatling_30mm_Plane_CAS_01_F : VehicleMagazine { + displayName = "30mm HEI"; + }; + class 500Rnd_Cannon_30mm_Plane_CAS_02_F : 1000Rnd_Gatling_30mm_Plane_CAS_01_F { + displayName = "30mm HEI-T"; + }; + + class 2Rnd_Missile_AA_04_F : VehicleMagazine { + displayName = "AIM-9 Sidewinder"; + }; + class 2Rnd_Missile_AA_03_F : 2Rnd_Missile_AA_04_F { + displayName = "Wympel R-73"; + }; + + class 6Rnd_Missile_AGM_02_F : VehicleMagazine { + displayName = "AGM-65 Maverick"; + }; + class 4Rnd_Missile_AGM_01_F : 6Rnd_Missile_AGM_02_F { + displayName = "Kh-25MTP"; + }; + + class 7Rnd_Rocket_04_HE_F : VehicleMagazine { + displayName = "Hydra 70 HE"; + }; + class 20Rnd_Rocket_03_HE_F : 7Rnd_Rocket_04_HE_F { + displayName = "S-8 HE"; + }; + + class 7Rnd_Rocket_04_AP_F : 7Rnd_Rocket_04_HE_F { + displayName = "Hydra 70 AP"; + }; + class 20Rnd_Rocket_03_AP_F : 7Rnd_Rocket_04_AP_F { + displayName = "S-8 AP"; + }; + + class 4Rnd_Bomb_04_F : VehicleMagazine { + displayName = "GBU-12" + }; + class 2Rnd_Bomb_03_F : 4Rnd_Bomb_04_F { + displayName = "FAB-250M-54" + }; +}; \ No newline at end of file diff --git a/addons/rearm/config.cpp b/addons/rearm/config.cpp index 1d7083b2a4..975f35b2e3 100644 --- a/addons/rearm/config.cpp +++ b/addons/rearm/config.cpp @@ -14,5 +14,6 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" +#include "CfgMagazines.hpp" #include "CfgAmmo.hpp" #include "ACE_Settings.hpp" \ No newline at end of file diff --git a/addons/rearm/functions/fnc_pickUpAmmo.sqf b/addons/rearm/functions/fnc_pickUpAmmo.sqf index 2d35b13f18..f9c0786359 100644 --- a/addons/rearm/functions/fnc_pickUpAmmo.sqf +++ b/addons/rearm/functions/fnc_pickUpAmmo.sqf @@ -47,6 +47,9 @@ if (_idx == -1 ) then { _idx = 2; }; +_unit setVariable [QGVAR(selectedWeaponOnRearm), currentWeapon _unit]; +_unit action ["SwitchWeapon", _unit, _unit, 99]; + [ (DURATION_PICKUP select _idx), [_unit, _magazine], diff --git a/addons/rearm/functions/fnc_pickUpSuccess.sqf b/addons/rearm/functions/fnc_pickUpSuccess.sqf index 114cb99047..da5483874b 100644 --- a/addons/rearm/functions/fnc_pickUpSuccess.sqf +++ b/addons/rearm/functions/fnc_pickUpSuccess.sqf @@ -17,7 +17,25 @@ */ #include "script_component.hpp" +private ["_dummy"]; params ["_args"]; _args params ["_unit", "_magazine"]; -_unit setVariable [QGVAR(carriedMagazine), _magazine]; // TODO replace by item +_unit setVariable [QGVAR(carriedMagazine), _magazine]; +[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); + +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if !(isNull _dummy) then { + detach _dummy; + deleteVehicle _dummy; + _unit setVariable [QGVAR(dummy), objNull]; +}; +_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); +_dummy = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy)); +if !(_dummy == "") then { + _dummy = _dummy createVehicle (position _unit); + _dummy attachTo [_unit, [0,0.5,0], "pelvis"]; + _dummy setDir 90; + _dummy allowDamage false; + _unit setVariable [QGVAR(dummy), _dummy]; +}; \ No newline at end of file diff --git a/addons/rearm/functions/fnc_rearmSuccess.sqf b/addons/rearm/functions/fnc_rearmSuccess.sqf index 76047c583b..2e628311eb 100644 --- a/addons/rearm/functions/fnc_rearmSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmSuccess.sqf @@ -21,7 +21,19 @@ */ #include "script_component.hpp" -private ["_rounds", "_currentRounds", "_maxMagazines"]; +#define REARM_SUCCESS \ + [_unit, QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus); \ + _dummy = _unit getVariable [QGVAR(dummy), objNull]; \ + if !(isNull _dummy) then { \ + detach _dummy; \ + deleteVehicle _dummy; \ + }; \ + _unit setVariable [QGVAR(carriedMagazine), nil, true]; \ + _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \ + _unit selectWeapon _weaponSelect; \ + _unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; + +private ["_rounds", "_currentRounds", "_maxMagazines", "_dummy"]; params ["_args"]; _args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazine", "_numRounds"]; @@ -43,7 +55,11 @@ if (_maxMagazines == 1) then { // Fill only at most _numRounds _target setMagazineTurretAmmo [_magazine, ((_target magazineTurretAmmo [_magazine, _turretPath]) + _numRounds) min _rounds, _turretPath]; }; - _unit setVariable [QGVAR(carriedMagazine), nil]; // TODO replace by item + [[LSTRING(Hint_RearmedTriple), _numRounds, + getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit] call EFUNC(common,displayTextStructured); + + REARM_SUCCESS } else { for "_idx" from 1 to _maxMagazines do { _currentRounds = _target magazineTurretAmmo [_magazine, _turretPath]; @@ -68,7 +84,11 @@ if (_maxMagazines == 1) then { _target setMagazineTurretAmmo [_magazine, _currentRounds, _turretPath]; }; }; - _unit setVariable [QGVAR(carriedMagazine), nil]; // TODO replace by item + [[LSTRING(Hint_RearmedTriple), _rounds, + getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit] call EFUNC(common,displayTextStructured); + + REARM_SUCCESS }; _target removeMagazineTurret [_magazine, _turretPath]; _numMagazines = _numMagazines - 1; diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml index 85523c0e30..954ad1c071 100644 --- a/addons/rearm/stringtable.xml +++ b/addons/rearm/stringtable.xml @@ -45,5 +45,33 @@ Pick up ammo Munition nehmen + + Rearmed %1 rounds of %2 on %3 + %1 Schuss %2 an %3 aufmunitioniert + + + Smoke Screen + Smoke Screen + Kouřová clona + Écran de fumée + Rauchwand + Cortina fumogena + Zasłona dymna + Cortina de fumaça + Дым. завеса + Pantalla de humo + + + Flares + Flares + Světlice + Fusées + Leuchtkörper + Razzi luminosi + Flary + Sinalizadores + ЛТЦ + Bengalas +