Merge pull request #3043 from acemod/Mortar_interact

Mortar interaction and ammunition handling
This commit is contained in:
Thomas Kooi 2016-02-20 16:57:55 +01:00
commit 1e3596b92a
29 changed files with 587 additions and 15 deletions

View File

@ -15,4 +15,9 @@ class ACE_Settings {
typeName = "BOOL";
isClientSetable = 0;
};
class GVAR(useAmmoHandling) {
value = 0;
typeName = "BOOL";
isClientSetable = 0;
};
};

View File

@ -5,7 +5,7 @@ class Extended_PreInit_EventHandlers {
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {

View File

@ -25,6 +25,7 @@ class CfgVehicles {
class Turrets: Turrets {
class MainTurret: MainTurret {};
};
class ACE_Actions;
};
class Mortar_01_base_F: StaticMortar {
class Turrets: Turrets {
@ -34,6 +35,54 @@ class CfgVehicles {
discreteDistanceInitIndex = 0;
};
};
class ACE_Actions: ACE_Actions {
class GVAR(unloadMagazine) {
displayName = CSTRING(unloadMortar);
distance = 2;
condition = QUOTE(_this call FUNC(canUnloadMagazine));
statement = QUOTE([ARR_3(_target,_player,5)] call FUNC(unloadMagazineTimer));
icon = "";
selection = "usti hlavne";
};
class GVAR(LoadActions) {
displayName = CSTRING(loadMortar);
distance = 2;
condition = QUOTE([ARR_2(_target,_player)] call FUNC(canLoadMagazine));
statement = "";
icon = "";
selection = "usti hlavne";
class GVAR(loadMagazine_HE_Guided) {
displayName = CSTRING(loadMagazine_HE_Guided);
condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_HE_Guided')] call FUNC(canLoadMagazine));
statement = QUOTE([ARR_4(_target,_player,8,'ACE_1Rnd_82mm_Mo_HE_Guided')] call FUNC(loadMagazineTimer));
icon = "";
};
class GVAR(loadMagazine_HE_LaserGuided) {
displayName = CSTRING(loadMagazine_HE_LaserGuided);
condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_HE_LaserGuided')] call FUNC(canLoadMagazine));
statement = QUOTE([ARR_4(_target,_player,8,'ACE_1Rnd_82mm_Mo_HE_LaserGuided')] call FUNC(loadMagazineTimer));
icon = "";
};
class GVAR(loadMagazine_Illum) {
displayName = CSTRING(loadMagazine_Illum);
condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_Illum')] call FUNC(canLoadMagazine));
statement = QUOTE([ARR_4(_target,_player,5,'ACE_1Rnd_82mm_Mo_Illum')] call FUNC(loadMagazineTimer));
icon = "";
};
class GVAR(loadMagazine_Smoke) {
displayName = CSTRING(loadMagazine_Smoke);
condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_Smoke')] call FUNC(canLoadMagazine));
statement = QUOTE([ARR_4(_target,_player,2.5,'ACE_1Rnd_82mm_Mo_Smoke')] call FUNC(loadMagazineTimer));
icon = "";
};
class GVAR(loadMagazine_HE) {
displayName = CSTRING(loadMagazine_HE);
condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_HE')] call FUNC(canLoadMagazine));
statement = QUOTE([ARR_4(_target,_player,2.5,'ACE_1Rnd_82mm_Mo_HE')] call FUNC(loadMagazineTimer));
icon = "";
};
};
};
class ACE_SelfActions {
class GVAR(toggleMils) {
displayName = "Toggle MILS";
@ -74,9 +123,49 @@ class CfgVehicles {
typeName = "BOOL";
defaultValue = 1;
};
class useAmmoHandling {
displayName = CSTRING(useAmmoHandling_DisplayName);
description = CSTRING(useAmmoHandling_Description);
typeName = "BOOL";
defaultValue = 0;
};
};
class ModuleDescription {
description = CSTRING(Module_Description);
};
};
class Box_NATO_AmmoOrd_F;
class ACE_Box_82mm_Mo_HE: Box_NATO_AmmoOrd_F {
displayName = CSTRING(HEBox_DisplayName);
author = ECSTRING(common,ACETeam);
transportMaxWeapons = 4;
transportMaxMagazines = 8;
class TransportMagazines {
MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_HE,8);
};
class TransportItems {};
class TransportWeapons {};
};
class ACE_Box_82mm_Mo_Smoke: ACE_Box_82mm_Mo_HE {
displayName = CSTRING(SmokeBox_DisplayName);
class TransportMagazines {
MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Smoke,8);
};
};
class ACE_Box_82mm_Mo_Illum: ACE_Box_82mm_Mo_HE {
displayName = CSTRING(IllumBox_DisplayName);
class TransportMagazines {
MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Illum,8);
};
};
class ACE_Box_82mm_Mo_Combo: ACE_Box_82mm_Mo_HE {
displayName = CSTRING(ComboBox_DisplayName);
transportMaxMagazines = 48;
class TransportMagazines {
MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_HE,32);
MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Smoke,8);
MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Illum,8);
};
};
};

View File

@ -12,4 +12,20 @@ class CfgWeapons {
mass = 0.5;
};
};
class CannonCore;
class mortar_82mm: CannonCore {
class Single1;
};
class ACE_mortar_82mm: mortar_82mm {
author = ECSTRING(common,ACETeam);
magazines[] = {"ACE_1Rnd_82mm_Mo_HE","ACE_1Rnd_82mm_Mo_Smoke","ACE_1Rnd_82mm_Mo_Illum",
"ACE_1Rnd_82mm_Mo_HE_Guided","ACE_1Rnd_82mm_Mo_HE_LaserGuided"};
modes[] = {"Single1","Single2","Single3"};
reloadTime = 0.5;
magazineReloadTime = 0.5;
class Single1: Single1 {
reloadTime = 0.5;
};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +0,0 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,21 @@
#include "script_component.hpp"
[QGVAR(addMagazine), {
params ["_static", "_magazine"];
_static addMagazineTurret [_magazine,[0]];
}] call EFUNC(common,addEventHandler);
[QGVAR(removeMagazine), {
params ["_static", "_magazine"];
_static removeMagazineTurret [_magazine,[0]];
}] call EFUNC(common,addEventHandler);
[QGVAR(setAmmo), {
params ["_static", "_magazine","_ammoCount"];
_static setMagazineTurretAmmo [_magazine, _ammoCount, [0]];
}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {};
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler);

View File

@ -8,14 +8,21 @@ PREP(dev_simulateCalcRangeTableLine);
PREP(dev_simulateFindSolution);
PREP(dev_simulateShot);
PREP(canLoadMagazine);
PREP(canUnloadMagazine);
PREP(handleFired);
PREP(handlePlayerVehicleChanged);
PREP(loadMagazine);
PREP(loadMagazineTimer);
PREP(moduleInit);
PREP(mortarInit);
PREP(rangeTableCanUse);
PREP(rangeTableOpen);
PREP(rangeTablePageChange);
PREP(rangeTablePreCalculatedValues);
PREP(toggleMils);
PREP(turretDisplayLoaded);
PREP(unloadMagazine);
PREP(unloadMagazineTimer);
ADDON = true;

View File

@ -0,0 +1,67 @@
class cfgMagazines {
class 8Rnd_82mm_Mo_shells;
class ACE_1Rnd_82mm_Mo_HE: 8Rnd_82mm_Mo_shells {
count = 1;
scope = 2;
scopeCurator = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(magazine_HE_displayName);
displayNameShort = "";
descriptionShort = CSTRING(magazine_descriptionShort);
model = PATHTOF(data\l16_ammo_he.p3d);
picture = PATHTOF(UI\w_l16_ammo_he_ca.paa);
mass = 50;
};
class 8Rnd_82mm_Mo_Smoke_white;
class ACE_1Rnd_82mm_Mo_Smoke: 8Rnd_82mm_Mo_Smoke_white {
count = 1;
scope = 2;
scopeCurator = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(magazine_Smoke_displayName);
displayNameShort = "";
descriptionShort = CSTRING(magazine_descriptionShort);
model = PATHTOF(data\l16_ammo_smk_white.p3d);
picture = PATHTOF(UI\w_l16_ammo_smk_white_ca.paa);
mass = 50;
};
class 8Rnd_82mm_Mo_Flare_white;
class ACE_1Rnd_82mm_Mo_Illum: 8Rnd_82mm_Mo_Flare_white {
count = 1;
scope = 2;
scopeCurator = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(magazine_Illum_displayName);
displayNameShort = "";
descriptionShort = CSTRING(magazine_descriptionShort);
model = PATHTOF(data\l16_ammo_illum.p3d);
picture = PATHTOF(UI\w_l16_ammo_illum_ca.paa);
mass = 50;
};
class 8Rnd_82mm_Mo_guided;
class ACE_1Rnd_82mm_Mo_HE_Guided: 8Rnd_82mm_Mo_guided {
count = 1;
scope = 2;
scopeCurator = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(magazine_HE_Guided_displayName);
displayNameShort = "";
descriptionShort = CSTRING(magazine_descriptionShort);
model = PATHTOF(data\l16_ammo_he.p3d);
picture = PATHTOF(UI\w_l16_ammo_he_ca.paa);
mass = 50;
};
class 8Rnd_82mm_Mo_LG;
class ACE_1Rnd_82mm_Mo_HE_LaserGuided: 8Rnd_82mm_Mo_LG {
count = 1;
scope = 2;
scopeCurator = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(magazine_HE_LaserGuided_displayName);
displayNameShort = "";
descriptionShort = CSTRING(magazine_descriptionShort);
model = PATHTOF(data\l16_ammo_he.p3d);
picture = PATHTOF(UI\w_l16_ammo_he_ca.paa);
mass = 50;
};
};

View File

@ -2,11 +2,12 @@
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {"ACE_RangeTable_82mm"};
units[] = {"ACE_Box_82mm_Mo_HE","ACE_Box_82mm_Mo_Smoke",
"ACE_Box_82mm_Mo_Illum","ACE_Box_82mm_Mo_Combo"};
weapons[] = {"ACE_RangeTable_82mm","ace_mortar_82mm"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author[] = {"PabstMirror"};
author[] = {"PabstMirror","Grey","VKing"};
authorUrl = "https://github.com/acemod";
VERSION_CONFIG;
};
@ -16,6 +17,7 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgMagazines.hpp"
//UI Stuff:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,53 @@
/*
* Author: Grey
* Checks whether magazine can be loaded into static weapon
*
* Arguments:
* 0: static <OBJECT>
* 1: unit <OBJECT>
* 2: magazine class to check; if not given having any compatible magazine returns true <STRING> (default: "")
*
* Return Value:
* canLoadMagazine <BOOL>
*
* Example:
* [_target,_player,"ACE_1Rnd_82mm_Mo_HE"] call ace_mk6mortar_fnc_canLoadMagazine
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_static","_unit",["_magazineClassOptional","",[""]]];
private ["_canLoadMagazine","_currentMagazine","_weapon","_listOfMagNames",
"_hasCompatibleMagazine","_count"];
if !(alive _static && GVAR(useAmmoHandling)) exitWith {false};
_canLoadMagazine = false;
_hasCompatibleMagazine = false;
_currentMagazine = (magazinesAllTurrets _static) select 1;
_weapon = (_static weaponsTurret [0]) select 0;
_listOfMagNames = getArray(configFile >> "cfgWeapons" >> _weapon >> "magazines");
_count = 0;
//If function is called with an optional string then check if player has that magzine otherwise check all magazines of the player to see if they are compatible with the static weapon
if (_magazineClassOptional != "") then {
if ([_unit,_magazineClassOptional] call EFUNC(common,hasMagazine)) then {
_hasCompatibleMagazine = true;
};
} else {
{
if ([_unit,_x] call EFUNC(common,hasMagazine)) exitWith {_hasCompatibleMagazine = true};
} forEach _listOfMagNames;
};
//If static weapon has a magazine then find the ammo count
if (count (_static magazinesTurret [0]) > 0) then {
_count = _currentMagazine select 2;
};
//If the static weapon doesn't have a magzine or a magazine with no bullets, the player has a compatible magazine and the static weapon has a barrel then you can load a magazine
if ((count (_static magazinesTurret [0]) == 0 || _count == 0 ) && _hasCompatibleMagazine) then {
_canLoadMagazine = true;
};
_canLoadMagazine

View File

@ -0,0 +1,29 @@
/*
* Author: Grey
* Checks whether magazine can be unloaded from static weapon
*
* Arguments:
* 0: static <OBJECT>
* 1: unit <OBJECT>
*
* Return Value:
* canUnloadMagazine <BOOL>
*
* Example:
* [_target,_player] call ace_mk6mortar_fnc_canUnloadMagazine
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_static","_unit"];
private ["_canUnloadMagazine","_ammoCount"];
if !(alive _static && GVAR(useAmmoHandling) && _static getVariable [QGVAR(initialized),false]) exitWith {false};
_canUnloadMagazine = false;
_ammoCount = ((magazinesAllTurrets _static) select 1) select 2;
if (_ammoCount > 0) then {
_canUnloadMagazine = true;
};
_canUnloadMagazine

View File

@ -21,10 +21,17 @@
*/
#include "script_component.hpp"
if (!GVAR(airResistanceEnabled)) exitWith {};
PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
if (GVAR(useAmmoHandling) && {_vehicle getVariable [QGVAR(initialized),false] && !(_vehicle getVariable [QGVAR(exclude),false])}) then {
// if !(_vehicle getVariable [QGVAR(exclude),false]) then {
_vehicle removeMagazineGlobal (_vehicle magazinesTurret [0] select 0);
TRACE_1("",_vehicle magazinesTurret [0]);
// };
};
if (!GVAR(airResistanceEnabled)) exitWith {};
private ["_shooterMan", "_temperature", "_newMuzzleVelocityCoefficent", "_bulletVelocity", "_bulletSpeed"];
// Large enough distance to not simulate any wind deflection

View File

@ -3,7 +3,7 @@
* Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar.
*
* Arguments:
* 0:Player <OBJECT>
* 0: Player <OBJECT>
* 1: New Vehicle <OBJECT>
*
* Return Value:
@ -23,6 +23,19 @@ private["_tubeWeaponName" ,"_fireModes", "_lastFireMode"];
if (isNull _newVehicle) exitWith {};
if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {};
// Run magazine handling initialization if enabled
if (!EGVAR(common,settingsInitFinished)) then {
EGVAR(common,runAtSettingsInitialized) pushBack [{
if (GVAR(useAmmoHandling) && {!(_this getVariable [QGVAR(initialized),false]) && !(_this getVariable [QGVAR(exclude),false])}) then {
_this call FUNC(mortarInit);
};
}, _newVehicle];
} else {
if (GVAR(useAmmoHandling) && {!(_newVehicle getVariable [QGVAR(initialized),false]) && !(_newVehicle getVariable [QGVAR(exclude),false])}) then {
_newVehicle call FUNC(mortarInit);
};
};
_tubeWeaponName = (weapons _newVehicle) select 0;
_fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes");
@ -49,7 +62,7 @@ if (_lastFireMode != -1) then {
//Save firemode on vehicle:
_mortarVeh setVariable [QGVAR(lastFireMode), _currentChargeMode];
if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then {
//Don't like this solution, but it works
closeDialog 0;

View File

@ -0,0 +1,65 @@
/*
* Author: Grey
* Loads Magazine into static weapon
*
* Arguments:
* 0: static <OBJECT>
* 1: unit <OBJECT>
* 2: magazine class to load; if not given the first compatible magazine is loaded <STRING> (default: "")
*
* Return Value:
* None
*
* Example:
* [_target,_player,"ACE_1Rnd_82mm_Mo_HE"] call ace_mk6mortar_fnc_loadMagazine
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_static","_unit",["_magazineClassOptional","",[""]]];
private ["_weapon","_currentMagazine","_count","_magazines","_magazineDetails","_listOfMagNames",
"_magazineClass","_magazineClassDetails","_parsed","_roundsLeft"];
//If function has been called with an optional classname hten add that magazine to the static weapon. Otherwise add the compatible magazine
if(_magazineClassOptional != "") then {
_unit removeMagazine _magazineClassOptional;
[QGVAR(addMagazine), [_static, _magazineClassOptional]] call EFUNC(common,globalEvent);
} else {
//Get weapon & magazine information of static weapon
_weapon = (_static weaponsTurret [0]) select 0;
_currentMagazine = (magazinesAllTurrets _static) select 1;
_currentMagazineClass = _currentMagazine select 0;
_count = _currentMagazine select 2;
//Check all of the players magazines to see if they are compatible with the static weapon. First magazine that is compatible is chosen
//VKing: This section ought to be double checked.
_magazines = magazines _unit;
_magazineDetails = magazinesDetail _unit;
_listOfMagNames = getArray(configFile >> "cfgWeapons" >> _weapon >> "magazines");
_magazineClass = "";
_magazineClassDetails = "";
_parsed ="";
_roundsLeft = 0;
{
if (_x in _listOfMagNames) exitWith {
_magazineClass = _x;
_magazineClassDetails = _magazineDetails select _forEachIndex;
};
} forEach _magazines;
//If the static weapon already has an empty magazine then remove it
if (_count == 0) then {
[QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent);
};
//Find out the ammo count of the compatible magazine found
if (_magazineClassDetails != "") then{
_parsed = _magazineClassDetails splitString "([]/: )";
_parsed params ["_type", "", "", "_roundsLeftText", "_maxRoundsText"];
_roundsLeft = parseNumber _roundsLeftText;
_magType = _type;
};
_unit removeMagazine _magazineClass;
[QGVAR(addMagazine), [_static, _magazineClass]] call EFUNC(common,globalEvent);
[QGVAR(setAmmo), _static, [_static, _magazineClass,_roundsLeft]] call EFUNC(common,targetEvent);
};

View File

@ -0,0 +1,28 @@
/*
* Author: Grey
* Loads Magazine into static weapon using a timer
*
* Arguments:
* 0: static <OBJECT>
* 1: unit <OBJECT>
* 2: time to load <NUMBER>
* 3: magazineClassOptional <OPTIONAL><STRING>
*
* Return Value:
* None
*
* Example:
* [_target,_player,"ACE_1Rnd_82mm_Mo_HE"] call ace_mk6mortar_fnc_loadMagazineTimer
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_static","_unit","_timeToLoad",["_magazineClassOptional","",[""]]];
//Move player into animation if player is standing
if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then {
[_unit, "AmovPercMstpSrasWrflDnon_diary", 1] call EFUNC(common,doAnimation);
};
[_timeToLoad, [_static,_unit,_magazineClassOptional], {(_this select 0) call FUNC(loadMagazine)}, {}, localize LSTRING(loadingMortar)] call EFUNC(common,progressBar);

View File

@ -25,3 +25,4 @@ if (!isServer) exitWith {};
[_logic, QGVAR(airResistanceEnabled), "airResistanceEnabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(allowComputerRangefinder), "allowComputerRangefinder"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(allowCompass), "allowCompass"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(useAmmoHandling), "useAmmoHandling"] call EFUNC(common,readSettingFromModule);

View File

@ -0,0 +1,45 @@
/*
* Author: VKing
* Initializes mortar for use with ammunition handling magazines.
*
* Arguments:
* 0: Mortar <OBJECT>
*
* Return Value:
* None
*
* Example:
* [mortar1] call ace_mk6mortar_fnc_mortarInit
*
* Public: No
*/
#include "script_component.hpp"
params ["_mortar"];
if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {TRACE_1("Exit",_mortar)};
// Remove all magazines
if (count magazines _mortar > 0) then {
{
[QGVAR(removeMagazine), [_mortar, _x]] call EFUNC(common,globalEvent);
} forEach magazines _mortar;
};
// Replace current weapon with ammo handling weapon
private _currentWeapon = _mortar weaponsTurret [0] select 0;
private _newWeapon = "";
if (_currentWeapon == "mortar_82mm") then {
_newWeapon = "ace_mortar_82mm";
} else {
_newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith));
};
if (_newWeapon != "") then {
_mortar removeWeaponGlobal _currentWeapon;
_mortar addWeaponGlobal _newWeapon;
};
_mortar setVariable [QGVAR(initialized),true,true];
TRACE_1("Init complete",_mortar);

View File

@ -0,0 +1,39 @@
/*
* Author: Grey
*
* Unload current magazine from static weapon
*
* Arguments:
* 0: static <OBJECT>
* 1: unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_target, _player] call ace_mk6mortar_fnc_unloadMagazine
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_static","_unit"];
private ["_currentMagazine","_currentMagazineClass","_ammoCount"];
//Get weapon & magazine information about static weapon
_currentMagazine = (magazinesAllTurrets _static) select 1;
_currentMagazineClass = _currentMagazine select 0;
_ammoCount = _currentMagazine select 2;
// Try to add the round to player inventory, otherwise place it on the ground near the player
if (_ammoCount > 0) then {
if (_unit canAdd _currentMagazineClass) then {
_unit addMagazineGlobal _currentMagazineClass;
} else {
_pos = _unit modelToWorldVisual [0.5,0.5,0]; // Front right of player
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addMagazineAmmoCargo [_currentMagazineClass, 1, _ammoCount];
_unit setPosATL _pos;
};
[QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent);
};

View File

@ -0,0 +1,28 @@
/*
* Author: Grey
*
* Unload current magazine from static weapon using a timer
*
* Arguments:
* 0: static <OBJECT>
* 1: unit <OBJECT>
* 2: time to unload <NUMBER>
*
* Return Value:
* None
*
* Example:
* [_target, _player, 5] call ace_mk6mortar_fnc_unloadMagazineTimer
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_static","_unit","_timeToUnload"];
//Move player into animation if player is standing
if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then {
[_unit, "AmovPercMstpSrasWrflDnon_diary", 1] call EFUNC(common,doAnimation);
};
[_timeToUnload, [_static,_unit], {(_this select 0) call FUNC(unloadMagazine)}, {}, localize LSTRING(unloadingMortar)] call EFUNC(common,progressBar);

View File

@ -135,5 +135,68 @@
<Russian>Модуль настройки миномета MK6.</Russian>
<French>Ce module permet de régler les options du mortier MK6</French>
</Key>
<Key ID="STR_ACE_Mk6Mortar_useAmmoHandling_DisplayName">
<English>Use Ammunition handling</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_useAmmoHandling_Description">
<English>Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars.</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_unloadMortar">
<English>Remove Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadMortar">
<English>Load Mortar</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_unloadingMortar">
<English>Unloading Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadingMortar">
<English>Preparing Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE">
<English>Load HE</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_Smoke">
<English>Load Smoke</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_Illum">
<English>Load Illumination</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE_Guided">
<English>Load Guided HE</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE_LaserGuided">
<English>Load Laser Guided HE</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_displayName">
<English>82mm HE Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_magazine_Smoke_displayName">
<English>82mm Smoke Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_magazine_Illum_displayName">
<English>82mm Illumination Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_Guided_displayName">
<English>82mm Guided HE Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_LaserGuided_displayName">
<English>82mm Laser Guided HE Round</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_magazine_descriptionShort">
<English>Used in Mk6 mortar</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_HEBox_DisplayName">
<English>[ACE] 82mm HE Rounds Box</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_SmokeBox_DisplayName">
<English>[ACE] 82mm Smoke Rounds Box</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_IllumBox_DisplayName">
<English>[ACE] 82mm Illumination Rounds Box</English>
</Key>
<Key ID="STR_ACE_Mk6Mortar_ComboBox_DisplayName">
<English>[ACE] 82mm Default Loadout Box</English>
</Key>
</Package>
</Project>
</Project>