mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
First working iteration.
Todo: Implement in module (Choose new or old/don't break old missions) Magazine UI+model Add preparing delay Fix function readmes Cleanup in functions? Credits MP Testing
This commit is contained in:
parent
170095ae35
commit
3e6fc52733
@ -20,11 +20,15 @@ class CfgVehicles {
|
|||||||
class Turrets {
|
class Turrets {
|
||||||
class MainTurret;
|
class MainTurret;
|
||||||
};
|
};
|
||||||
|
class ACE_Actions;
|
||||||
};
|
};
|
||||||
class StaticMortar: StaticWeapon {
|
class StaticMortar: StaticWeapon {
|
||||||
class Turrets: Turrets {
|
class Turrets: Turrets {
|
||||||
class MainTurret: MainTurret {};
|
class MainTurret: MainTurret {};
|
||||||
};
|
};
|
||||||
|
class ACE_Actions: ACE_Actions {
|
||||||
|
class ACE_MainActions;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class Mortar_01_base_F: StaticMortar {
|
class Mortar_01_base_F: StaticMortar {
|
||||||
class Turrets: Turrets {
|
class Turrets: Turrets {
|
||||||
@ -34,35 +38,57 @@ class CfgVehicles {
|
|||||||
discreteDistanceInitIndex = 0;
|
discreteDistanceInitIndex = 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_Actions {
|
class ACE_Actions: ACE_Actions {
|
||||||
class ACE_MainACtions {
|
|
||||||
class GVAR(loadMagazine_HE) {
|
|
||||||
displayName = CSTRING(loadMagazine_HE);
|
|
||||||
distance = 4;
|
|
||||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canLoadMagazine));
|
|
||||||
statement = QUOTE([ARR_3(_player,_target,'HE')] call FUNC(loadMagazine));
|
|
||||||
icon = "";
|
|
||||||
class GVAR(loadMagazine_Smoke) {
|
|
||||||
displayName = CSTRING(loadMagazine_Smoke);
|
|
||||||
distance = 4;
|
|
||||||
condition = QUOTE([ARR_3(_player,_target,'Smoke')] call FUNC(canLoadMagazine));
|
|
||||||
statement = QUOTE([ARR_3(_player,_target,'Smoke')] call FUNC(loadMagazine));
|
|
||||||
icon = "";
|
|
||||||
};
|
|
||||||
class GVAR(loadMagazine_Illum) {
|
|
||||||
displayName = CSTRING(loadMagazine_Illum);
|
|
||||||
distance = 4;
|
|
||||||
condition = QUOTE([ARR_3(_player,_target,'Illum')] call FUNC(canLoadMagazine));
|
|
||||||
statement = QUOTE([ARR_3(_player,_target,'Illum')] call FUNC(loadMagazine));
|
|
||||||
icon = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
class GVAR(unloadMagazine) {
|
class GVAR(unloadMagazine) {
|
||||||
displayName = CSTRING(unloadMagazine);
|
displayName = CSTRING(unloadMagazine);
|
||||||
distance = 4;
|
distance = 4;
|
||||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canUnloadMagazine));
|
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canUnloadMagazine));
|
||||||
statement = QUOTE([ARR_2(_player,_target)] call FUNC(unloadMagazine));
|
statement = QUOTE([ARR_2(_player,_target)] call FUNC(unloadMagazine));
|
||||||
icon = "";
|
icon = "";
|
||||||
|
selection = "usti hlavne";
|
||||||
|
};
|
||||||
|
class GVAR(LoadActions) {
|
||||||
|
displayName = CSTRING(loadMortar);
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canLoadMagazine));
|
||||||
|
statement = "";
|
||||||
|
icon = "";
|
||||||
|
selection = "usti hlavne";
|
||||||
|
class GVAR(loadMagazine_HE_Guided) {
|
||||||
|
displayName = CSTRING(loadMagazine_HE_Guided);
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_HE_Guided')] call FUNC(canLoadMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_HE_Guided')] call FUNC(loadMagazine));
|
||||||
|
icon = "";
|
||||||
|
};
|
||||||
|
class GVAR(loadMagazine_HE_LaserGuided) {
|
||||||
|
displayName = CSTRING(loadMagazine_HE_LaserGuided);
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_HE_LaserGuided')] call FUNC(canLoadMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_HE_LaserGuided')] call FUNC(loadMagazine));
|
||||||
|
icon = "";
|
||||||
|
};
|
||||||
|
class GVAR(loadMagazine_Illum) {
|
||||||
|
displayName = CSTRING(loadMagazine_Illum);
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_Illum')] call FUNC(canLoadMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_Illum')] call FUNC(loadMagazine));
|
||||||
|
icon = "";
|
||||||
|
};
|
||||||
|
class GVAR(loadMagazine_Smoke) {
|
||||||
|
displayName = CSTRING(loadMagazine_Smoke);
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_Smoke')] call FUNC(canLoadMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_Smoke')] call FUNC(loadMagazine));
|
||||||
|
icon = "";
|
||||||
|
};
|
||||||
|
class GVAR(loadMagazine_HE) {
|
||||||
|
displayName = CSTRING(loadMagazine_HE);
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_HE')] call FUNC(canLoadMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,'ACE_1Rnd_82mm_Mo_HE')] call FUNC(loadMagazine));
|
||||||
|
icon = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
|
@ -18,6 +18,7 @@ class CfgWeapons {
|
|||||||
class Single1;
|
class Single1;
|
||||||
};
|
};
|
||||||
class ACE_mortar_82mm: mortar_82mm {
|
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",
|
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"};
|
"ACE_1Rnd_82mm_Mo_HE_Guided","ACE_1Rnd_82mm_Mo_HE_LaserGuided"};
|
||||||
modes[] = {"Single1","Single2","Single3"};
|
modes[] = {"Single1","Single2","Single3"};
|
||||||
|
@ -4,3 +4,24 @@ if (!hasInterface) exitWith {};
|
|||||||
|
|
||||||
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
|
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
|
||||||
["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler);
|
["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
[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);
|
||||||
|
@ -8,8 +8,11 @@ PREP(dev_simulateCalcRangeTableLine);
|
|||||||
PREP(dev_simulateFindSolution);
|
PREP(dev_simulateFindSolution);
|
||||||
PREP(dev_simulateShot);
|
PREP(dev_simulateShot);
|
||||||
|
|
||||||
|
PREP(canLoadMagazine);
|
||||||
|
PREP(canUnloadMagazine);
|
||||||
PREP(handleFired);
|
PREP(handleFired);
|
||||||
PREP(handlePlayerVehicleChanged);
|
PREP(handlePlayerVehicleChanged);
|
||||||
|
PREP(loadMagazine);
|
||||||
PREP(moduleInit);
|
PREP(moduleInit);
|
||||||
PREP(rangeTableCanUse);
|
PREP(rangeTableCanUse);
|
||||||
PREP(rangeTableOpen);
|
PREP(rangeTableOpen);
|
||||||
@ -17,5 +20,6 @@ PREP(rangeTablePageChange);
|
|||||||
PREP(rangeTablePreCalculatedValues);
|
PREP(rangeTablePreCalculatedValues);
|
||||||
PREP(toggleMils);
|
PREP(toggleMils);
|
||||||
PREP(turretDisplayLoaded);
|
PREP(turretDisplayLoaded);
|
||||||
|
PREP(unloadMagazine);
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -1,32 +1,65 @@
|
|||||||
|
// Artificially low for testing
|
||||||
|
#DEFINE __MASS = 10
|
||||||
|
|
||||||
class cfgMagazines {
|
class cfgMagazines {
|
||||||
class 8Rnd_82mm_Mo_shells;
|
class 8Rnd_82mm_Mo_shells;
|
||||||
class ACE_1Rnd_82mm_Mo_HE: 8Rnd_82mm_Mo_shells {
|
class ACE_1Rnd_82mm_Mo_HE: 8Rnd_82mm_Mo_shells {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
scope = 2;
|
||||||
|
scopeCurator = 2;
|
||||||
|
author = ECSTRING(common,ACETeam);
|
||||||
displayName = CSTRING(magazine_HE_displayName);
|
displayName = CSTRING(magazine_HE_displayName);
|
||||||
// Infantry-carry stuff here
|
descriptionShort = CSTRING(magazine_HE_descriptionShort);
|
||||||
|
model = "";
|
||||||
|
picture = "";
|
||||||
|
mass = __MASS;
|
||||||
};
|
};
|
||||||
class 8Rnd_82mm_Mo_Smoke_white;
|
class 8Rnd_82mm_Mo_Smoke_white;
|
||||||
class ACE_1Rnd_82mm_Mo_Smoke: 8Rnd_82mm_Mo_Smoke_white {
|
class ACE_1Rnd_82mm_Mo_Smoke: 8Rnd_82mm_Mo_Smoke_white {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
scope = 2;
|
||||||
|
scopeCurator = 2;
|
||||||
|
author = ECSTRING(common,ACETeam);
|
||||||
displayName = CSTRING(magazine_Smoke_displayName);
|
displayName = CSTRING(magazine_Smoke_displayName);
|
||||||
|
descriptionShort = CSTRING(magazine_Smoke_descriptionShort);
|
||||||
|
model = "";
|
||||||
|
picture = "";
|
||||||
|
mass = __MASS;
|
||||||
};
|
};
|
||||||
class 8Rnd_82mm_Mo_Flare_white;
|
class 8Rnd_82mm_Mo_Flare_white;
|
||||||
class ACE_1Rnd_82mm_Mo_Illum: 8Rnd_82mm_Mo_Flare_white {
|
class ACE_1Rnd_82mm_Mo_Illum: 8Rnd_82mm_Mo_Flare_white {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
scope = 2;
|
||||||
|
scopeCurator = 2;
|
||||||
|
author = ECSTRING(common,ACETeam);
|
||||||
displayName = CSTRING(magazine_Illum_displayName);
|
displayName = CSTRING(magazine_Illum_displayName);
|
||||||
|
descriptionShort = CSTRING(magazine_Illum_descriptionShort);
|
||||||
|
model = "";
|
||||||
|
picture = "";
|
||||||
|
mass = __MASS;
|
||||||
};
|
};
|
||||||
class 8Rnd_82mm_Mo_guided;
|
class 8Rnd_82mm_Mo_guided;
|
||||||
class ACE_1Rnd_82mm_Mo_HE_Guided: 8Rnd_82mm_Mo_guided {
|
class ACE_1Rnd_82mm_Mo_HE_Guided: 8Rnd_82mm_Mo_guided {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
scope = 2;
|
||||||
|
scopeCurator = 2;
|
||||||
|
author = ECSTRING(common,ACETeam);
|
||||||
displayName = CSTRING(magazine_HE_Guided_displayName);
|
displayName = CSTRING(magazine_HE_Guided_displayName);
|
||||||
|
descriptionShort = CSTRING(magazine_HE_Guided_descriptionShort);
|
||||||
|
model = "";
|
||||||
|
picture = "";
|
||||||
|
mass = __MASS;
|
||||||
};
|
};
|
||||||
class 8Rnd_82mm_Mo_LG;
|
class 8Rnd_82mm_Mo_LG;
|
||||||
class ACE_1Rnd_82mm_Mo_HE_LaserGuided: 8Rnd_82mm_Mo_LG {
|
class ACE_1Rnd_82mm_Mo_HE_LaserGuided: 8Rnd_82mm_Mo_LG {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
scope = 2;
|
||||||
|
scopeCurator = 2;
|
||||||
|
author = ECSTRING(common,ACETeam);
|
||||||
displayName = CSTRING(magazine_HE_LaserGuided_displayName);
|
displayName = CSTRING(magazine_HE_LaserGuided_displayName);
|
||||||
|
descriptionShort = CSTRING(magazine_HE_LaserGuided_descriptionShort);
|
||||||
|
model = "";
|
||||||
|
picture = "";
|
||||||
|
mass = __MASS;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
class CfgPatches {
|
class CfgPatches {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
units[] = {};
|
units[] = {};
|
||||||
weapons[] = {"ACE_RangeTable_82mm"};
|
weapons[] = {"ACE_RangeTable_82mm","ace_mortar_82mm"};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_interaction"};
|
requiredAddons[] = {"ace_interaction"};
|
||||||
author[] = {"PabstMirror"};
|
author[] = {"PabstMirror"};
|
||||||
@ -16,6 +16,7 @@ class CfgPatches {
|
|||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgVehicles.hpp"
|
#include "CfgVehicles.hpp"
|
||||||
#include "CfgWeapons.hpp"
|
#include "CfgWeapons.hpp"
|
||||||
|
#include "CfgMagazines.hpp"
|
||||||
|
|
||||||
|
|
||||||
//UI Stuff:
|
//UI Stuff:
|
||||||
|
55
addons/mk6mortar/functions/fnc_canLoadMagazine.sqf
Normal file
55
addons/mk6mortar/functions/fnc_canLoadMagazine.sqf
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Author: Grey
|
||||||
|
* Checks whether magazine can be loaded into static weapon
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: static <OBJECT>
|
||||||
|
* 1: unit <OBJECT>
|
||||||
|
* 2: magazineClassOptional <OPTIONAL><STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* canLoadMagazine <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_target,_player,'16aa_static_magazine_1Rnd_105mm_HE'] call lsr_staticweapons_canLoadMagazine
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit","_static",["_magazineClassOptional","",[""]]];
|
||||||
|
private ["_canLoadMagazine","_currentMagazine","_weapon","_magazines","_listOfMagNames",
|
||||||
|
"_hasCompatibleMagazine","_count"];
|
||||||
|
|
||||||
|
if !(alive _static) exitWith {false};
|
||||||
|
|
||||||
|
_canLoadMagazine = false;
|
||||||
|
|
||||||
|
_currentMagazine = (magazinesAllTurrets _static) select 1;
|
||||||
|
_weapon = (_static weaponsTurret [0]) select 0;
|
||||||
|
|
||||||
|
_magazines = magazines _unit;
|
||||||
|
_listOfMagNames = getArray(configFile >> "cfgWeapons" >> _weapon >> "magazines");
|
||||||
|
_hasCompatibleMagazine = false;
|
||||||
|
_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
|
29
addons/mk6mortar/functions/fnc_canUnloadMagazine.sqf
Normal file
29
addons/mk6mortar/functions/fnc_canUnloadMagazine.sqf
Normal 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 lsr_staticweapons_canUnloadMagazine
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit","_static"];
|
||||||
|
private ["_canUnloadMagazine","_ammoCount"];
|
||||||
|
|
||||||
|
if !(alive _static) exitWith {false};
|
||||||
|
_canUnloadMagazine = false;
|
||||||
|
|
||||||
|
_ammoCount = ((magazinesAllTurrets _static) select 1) select 2;
|
||||||
|
if (_ammoCount > 0) then {
|
||||||
|
_canUnloadMagazine = true;
|
||||||
|
};
|
||||||
|
_canUnloadMagazine
|
66
addons/mk6mortar/functions/fnc_loadMagazine.sqf
Normal file
66
addons/mk6mortar/functions/fnc_loadMagazine.sqf
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Author: Grey
|
||||||
|
* Loads Magazine into static weapon
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: static <OBJECT>
|
||||||
|
* 1: unit <OBJECT>
|
||||||
|
* 2: magazineClassOptional <OPTIONAL><STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_target,_player,'16aa_static_magazine_l16_illum'] call lsr_staticweapons_loadMagazine
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit","_static",["_magazineClassOptional","",[""]]];
|
||||||
|
private ["_weapon","_currentMagazine","_count","_magazines","_magazineDetails","_listOfMagNames",
|
||||||
|
"_magazineClass","_magazineClassDetails","_parsed","_roundsLeft","_configMortar"];
|
||||||
|
|
||||||
|
//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
|
||||||
|
_magazines = magazines _unit;
|
||||||
|
_magazineDetails = magazinesDetail _unit;
|
||||||
|
_listOfMagNames = getArray(configFile >> "cfgWeapons" >> _weapon >> "magazines");
|
||||||
|
_magazineClass = "";
|
||||||
|
_magazineClassDetails = "";
|
||||||
|
_parsed ="";
|
||||||
|
_roundsLeft = 0;
|
||||||
|
{
|
||||||
|
if (_x in _listOfMagNames) exitWith {
|
||||||
|
_magazineClass = _magazines select _forEachIndex;
|
||||||
|
_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;
|
||||||
|
_roundsMax = parseNumber _maxRoundsText;
|
||||||
|
_magType = _type;
|
||||||
|
};
|
||||||
|
|
||||||
|
//_configMortar = getNumber (configFile >> "CfgMagazines" >> _magazineClass >> QGVAR(isMortarRound));
|
||||||
|
//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{
|
||||||
|
_unit removeMagazine _magazineClass;
|
||||||
|
[QGVAR(addMagazine), [_static, _magazineClass]] call EFUNC(common,globalEvent);
|
||||||
|
[QGVAR(setAmmo), _static, [_static, _magazineClass,_roundsLeft]] call EFUNC(common,targetEvent);
|
||||||
|
};
|
38
addons/mk6mortar/functions/fnc_unloadMagazine.sqf
Normal file
38
addons/mk6mortar/functions/fnc_unloadMagazine.sqf
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Author: Grey
|
||||||
|
*
|
||||||
|
* Unload current magazine from static weapon
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: static <OBJECT>
|
||||||
|
* 1: unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_target, _player] call lsr_staticweapons_unloadMagazine
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit","_static"];
|
||||||
|
private ["_weapon","_currentMagazine","_currentMagazineClass","_ammoCount"];
|
||||||
|
|
||||||
|
//Get weapon & magazine information about static weapon
|
||||||
|
_weapon = (_static weaponsTurret [0]) select 0;
|
||||||
|
_currentMagazine = (magazinesAllTurrets _static) select 1;
|
||||||
|
_currentMagazineClass = _currentMagazine select 0;
|
||||||
|
_ammoCount = _currentMagazine select 2;
|
||||||
|
|
||||||
|
//If current magazine is empty then remove it otherwise remove it and add it to the players inventory
|
||||||
|
if (_ammoCount == 0) then {
|
||||||
|
[QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent);
|
||||||
|
}else {
|
||||||
|
_pos = _unit modelToWorldVisual [0,1,0];
|
||||||
|
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
|
||||||
|
_unit addMagazineAmmoCargo [_currentMagazineClass, 1, _ammoCount];
|
||||||
|
_unit setPosATL _pos;
|
||||||
|
[QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent);
|
||||||
|
};
|
@ -135,20 +135,23 @@
|
|||||||
<Russian>Модуль настройки миномета MK6.</Russian>
|
<Russian>Модуль настройки миномета MK6.</Russian>
|
||||||
<French>Ce module permet de régler les options du mortier MK6</French>
|
<French>Ce module permet de régler les options du mortier MK6</French>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Mk6Mortar_loadMortar">
|
||||||
|
<English>Load Mortar</English>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE">
|
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE">
|
||||||
<English>Load HE Round</English>
|
<English>Load HE</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_Smoke">
|
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_Smoke">
|
||||||
<English>Load Smoke Round</English>
|
<English>Load Smoke</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_Illum">
|
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_Illum">
|
||||||
<English>Load Illumination Round</English>
|
<English>Load Illumination</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE_Guided">
|
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE_Guided">
|
||||||
<English>Load Guided HE Round</English>
|
<English>Load Guided HE</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE_LaserGuided">
|
<Key ID="STR_ACE_Mk6Mortar_loadMagazine_HE_LaserGuided">
|
||||||
<English>Load Laser Guided HE Round</English>
|
<English>Load Laser Guided HE</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Mk6Mortar_unloadMagazine">
|
<Key ID="STR_ACE_Mk6Mortar_unloadMagazine">
|
||||||
<English>Unload Round</English>
|
<English>Unload Round</English>
|
||||||
@ -168,5 +171,20 @@
|
|||||||
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_LaserGuided_displayName">
|
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_LaserGuided_displayName">
|
||||||
<English>82mm Laser Guided HE Round</English>
|
<English>82mm Laser Guided HE Round</English>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_descriptionShort">
|
||||||
|
<English>Used in Mk6 mortar</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Mk6Mortar_magazine_Smoke_descriptionShort">
|
||||||
|
<English>Used in Mk6 mortar</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Mk6Mortar_magazine_Illum_descriptionShort">
|
||||||
|
<English>Used in Mk6 mortar</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_Guided_descriptionShort">
|
||||||
|
<English>Used in Mk6 mortar</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Mk6Mortar_magazine_HE_LaserGuided_descriptionShort">
|
||||||
|
<English>Used in Mk6 mortar</English>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user