Skip to content

Commit

Permalink
Merge branch 'master' into pr/9528
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Aug 4, 2024
2 parents 508f8b4 + 2db56cc commit a07e8eb
Show file tree
Hide file tree
Showing 96 changed files with 1,271 additions and 688 deletions.
8 changes: 6 additions & 2 deletions addons/advanced_ballistics/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
[LSTRING(enabled_DisplayName), LSTRING(enabled_Description)],
_category,
false,
1
1,
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

[
Expand Down Expand Up @@ -45,5 +47,7 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
[LSTRING(simulationInterval_DisplayName), LSTRING(simulationInterval_Description)],
_category,
[0, 0.2, 0.05, 2],
1
1,
{[QGVAR(simulationInterval), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
1 change: 1 addition & 0 deletions addons/captives/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
<Japanese>目隠しを外す</Japanese>
<Russian>Снять повязку с глаз</Russian>
<Spanish>Quitar vendas de los ojos</Spanish>
<Portuguese>Remover a venda</Portuguese>
</Key>
<Key ID="STR_ACE_Captives_CableTie">
<English>Cable Tie</English>
Expand Down
1 change: 1 addition & 0 deletions addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ PREP(stopGesture);
PREP(stringCompare);
PREP(stringToColoredText);
PREP(swayLoop);
PREP(switchAttachmentMode);
PREP(switchPersistentLaser);
PREP(switchToGroupSide);
PREP(throttledPublicVariable);
Expand Down
23 changes: 17 additions & 6 deletions addons/common/functions/fnc_getWeaponMuzzles.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: commy2
* Author: commy2, johnb43
* Get the muzzles of a weapon.
*
* Arguments:
Expand All @@ -10,19 +10,30 @@
* All weapon muzzles <ARRAY>
*
* Example:
* ["gun"] call ace_common_fnc_getWeaponMuzzles
* "arifle_AK12_F" call ace_common_fnc_getWeaponMuzzles
*
* Public: Yes
*/

params [["_weapon", "", [""]]];

private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
private _config = configFile >> "CfgWeapons" >> _weapon;

if (!isClass _config) exitWith {
[] // return
};

private _muzzles = [];

// Get config case muzzle names
{
if (_x == "this") then {
_muzzles set [_forEachIndex, configName (configFile >> "CfgWeapons" >> _weapon)];
_muzzles pushBack (configName _config);
} else {
if (isClass (_config >> _x)) then {
_muzzles pushBack (configName (_config >> _x));
};
};
} forEach _muzzles;
} forEach getArray (_config >> "muzzles");

_muzzles
_muzzles // return
61 changes: 61 additions & 0 deletions addons/common/functions/fnc_switchAttachmentMode.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Switch attachment from one mode to another - based on CBA_accessory_fnc_switchAttachment
*
* Arguments:
* 0: Unit <OBJECT>
* 1: From <STRING>
* 2: To <STRING>
*
* Return Value:
* None
*
* Example:
* [player, "ACE_DBAL_A3_Green_VP", "ACE_DBAL_A3_Green"] call ace_common_fnc_switchAttachmentMode
*
* Public: No
*/

params ["_unit", "_currItem", "_switchItem"];
TRACE_3("switchAttachmentMode",_unit,_currItem,_switchItem);

switch (currentWeapon _unit) do {
case (""): {};
case (primaryWeapon _unit): {
private _currWeaponType = 0;
_unit removePrimaryWeaponItem _currItem;
[{
params ["_unit", "", "_switchItem"];
_unit addPrimaryWeaponItem _switchItem;
["CBA_attachmentSwitched", _this] call CBA_fnc_localEvent;
}, [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_execNextFrame;
};
case (handgunWeapon _unit): {
private _currWeaponType = 1;
_unit removeHandgunItem _currItem;
[{
params ["_unit", "", "_switchItem"];
_unit addHandgunItem _switchItem;
["CBA_attachmentSwitched", _this] call CBA_fnc_localEvent;
}, [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_execNextFrame;
};
case (secondaryWeapon _unit): {
private _currWeaponType = 2;
_unit removeSecondaryWeaponItem _currItem;
[{
params ["_unit", "", "_switchItem"];
_unit addSecondaryWeaponItem _switchItem;
["CBA_attachmentSwitched", _this] call CBA_fnc_localEvent;
}, [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_execNextFrame;
};
};
private _configSwitchItem = configfile >> "CfgWeapons" >> _switchItem;
private _switchItemHintText = getText (_configSwitchItem >> "MRT_SwitchItemHintText");
private _switchItemHintImage = getText (_configSwitchItem >> "picture");
if (_switchItemHintText isNotEqualTo "") then {
[[_switchItemHintImage, 2.0], [_switchItemHintText], true] call CBA_fnc_notify;
};
if (_unit == ACE_player) then {
playSound "click";
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<German>[CSW] AGS30 Gurt</German>
<Spanish>[CSW] Cinta de AGS30</Spanish>
<Italian>[CSW] Nastro AGS30</Italian>
<Portuguese>[CSW] Cinto de AGS30</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_MK19_displayName">
<English>[CSW] MK19 Belt</English>
Expand All @@ -18,6 +19,7 @@
<German>[CSW] MK19 Gurt</German>
<Spanish>[CSW] Cinta de MK19</Spanish>
<Italian>[CSW] Nastro MK19</Italian>
<Portuguese>[CSW] Cinto de MK19</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_TOW_displayName">
<English>[CSW] TOW Tube</English>
Expand All @@ -27,6 +29,7 @@
<German>[CSW] TOW Rohr</German>
<Spanish>[CSW] Tubo de TOW</Spanish>
<Italian>[CSW] Tubo TOW</Italian>
<Portuguese>[CSW] Tubo de TOW</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_TOW2_displayName">
<English>[CSW] TOW2 Tube</English>
Expand All @@ -36,6 +39,7 @@
<German>[CSW] TOW2 Rohr</German>
<Spanish>[CSW] Tubo de TOW2</Spanish>
<Italian>[CSW] Tubo TOW2</Italian>
<Portuguese>[CSW] Tubo de TOW2</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_PG9_displayName">
<English>[CSW] PG-9 Round</English>
Expand All @@ -45,6 +49,7 @@
<German>[CSW] PG-9 Rakete</German>
<Spanish>[CSW] Carga de PG-9</Spanish>
<Italian>[CSW] Razzo PG-9</Italian>
<Portuguese>[CSW] Cartucho PG-9</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_OG9_displayName">
<English>[CSW] OG-9 Round</English>
Expand All @@ -54,6 +59,7 @@
<German>[CSW] OG-9 Rakete</German>
<Spanish>[CSW] Carga de OG-9</Spanish>
<Italian>[CSW] Razzo OG-9</Italian>
<Portuguese>[CSW] Cartucho OG-9</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_M1HE_displayName">
<English>[CSW] M1 HE</English>
Expand All @@ -74,6 +80,7 @@
<German>[CSW] M84 Rauch</German>
<Spanish>[CSW] Humo M84</Spanish>
<Italian>[CSW] M84 Fumogeno</Italian>
<Portuguese>[CSW] M84 Fumígeno</Portuguese>
</Key>
<Key ID="STR_ACE_Compat_CUP_Weapons_CSW_mag_M60A2_displayName">
<English>[CSW] M60A2 WP</English>
Expand Down
6 changes: 3 additions & 3 deletions addons/csw/dev/checkStaticWeapons.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private _inherited = [];
private _config = _x;
private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1;
if (_configEnabled) then {
private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1;
private _configExplicit = (count configProperties [_config, toString {configName _x == QUOTE(ADDON)}, false]) == 1;
if (_configExplicit) then {
_explicitBases pushBack (configName _config);
_inherited pushBack [];
Expand All @@ -43,8 +43,8 @@ private _inherited = [];

INFO("------ Logging static magazines with no carry version -------");
private _hash = createHashMap;
// private _logAll = true; // logs all possible weapon magazines (even if not used in a static weapon)
private _logAll = false;
private _logAll = false; // logs all possible weapon magazines (even if not used in a static weapon) when set to true

{
private _vehicleType = configName _x;
private _turretConfig = [_vehicleType, [0]] call CBA_fnc_getTurret;
Expand Down
6 changes: 3 additions & 3 deletions addons/csw/functions/fnc_aceRearmGetCarryMagazines.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Helper function for ace_rearm; Gets magazines that should be loaded by csw
* Helper function for ace_rearm; Gets magazines that should be loaded by csw.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Specific Turret or pass bool to check all turrets <ARRAY><BOOL>(default: true)
* 0: CSW <OBJECT>
* 1: Specific Turret or pass bool to check all turrets <ARRAY|BOOL> (default: true)
*
* Return Value:
* [0: compatible veh mags, 1: carry mags] <ARRAY>
Expand Down
2 changes: 1 addition & 1 deletion addons/csw/functions/fnc_ai_handleFired.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Handles AI Fired EH
* Handles AI Fired EH.
*
* Arguments:
* Fired EH
Expand Down
4 changes: 2 additions & 2 deletions addons/csw/functions/fnc_ai_handleGetIn.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: Grim
* Handles AI GetIn on an empty weapon
* Author: LinkIsGrim
* Handles AI GetIn on an empty CSW.
*
* Arguments:
* GetIn EH
Expand Down
24 changes: 12 additions & 12 deletions addons/csw/functions/fnc_ai_reload.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror, modified by Grim
* Handles AI reloading
* Author: PabstMirror, LinkIsGrim
* Handles AI reloading.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Gunner <OBJECT>
* 2: Weapon <STRING>
* 3: Magazine <STRING> (default: "")
Expand All @@ -15,7 +15,7 @@
* Public: No
*/

params ["_staticWeapon", "_gunner", "_weapon", ["_magazine", ""]];
params ["_vehicle", "_gunner", "_weapon", ["_magazine", ""]];

private _turretPath = [_gunner] call EFUNC(common,getTurretIndex);
private _reloadSource = objNull;
Expand All @@ -24,7 +24,7 @@ private _reloadNeededAmmo = -1;

private _cfgMagGroups = configFile >> QGVAR(groups);

private _nearSupplies = [_gunner] + ((_staticWeapon nearSupplies 10) select {
private _nearSupplies = [_gunner] + ((_vehicle nearSupplies 10) select {
isNull (group _x) ||
{!([_x] call EFUNC(common,isPlayer)) && {[side group _gunner, side group _x] call BIS_fnc_sideIsFriendly}}
});
Expand All @@ -49,7 +49,7 @@ private _nearSupplies = [_gunner] + ((_staticWeapon nearSupplies 10) select {
private _xWeaponMag = _x;
{
if ((getNumber (_cfgMagGroups >> _x >> _xWeaponMag)) == 1) then {
private _loadInfo = [_staticWeapon, _turretPath, _x, _xSource] call FUNC(reload_canLoadMagazine);
private _loadInfo = [_vehicle, _turretPath, _x, _xSource] call FUNC(reload_canLoadMagazine);
if (_loadInfo select 0) then {
_reloadMag = _x;
_reloadSource = _xSource;
Expand Down Expand Up @@ -81,16 +81,16 @@ if (_bestAmmoToSend == -1) exitWith {ERROR("No ammo");};
[_reloadSource, _reloadMag, _bestAmmoToSend] call EFUNC(common,removeSpecificMagazine);

private _timeToLoad = 1;
if (!isNull(configOf _staticWeapon >> QUOTE(ADDON) >> "ammoLoadTime")) then {
_timeToLoad = getNumber(configOf _staticWeapon >> QUOTE(ADDON) >> "ammoLoadTime");
if (!isNull(configOf _vehicle >> QUOTE(ADDON) >> "ammoLoadTime")) then {
_timeToLoad = getNumber(configOf _vehicle >> QUOTE(ADDON) >> "ammoLoadTime");
};

TRACE_1("Reloading in progress",_timeToLoad);
[{
params ["_staticWeapon", "_turretPath", "_gunner", "_reloadMag", "_bestAmmoToSend"];
if ((!alive _staticWeapon) || {!alive _gunner} || {(_staticWeapon distance _gunner) > 10}) exitWith {TRACE_1("invalid state",_this);};
params ["_vehicle", "_turretPath", "_gunner", "_reloadMag", "_bestAmmoToSend"];
if ((!alive _vehicle) || {!alive _gunner} || {(_vehicle distance _gunner) > 10}) exitWith {TRACE_1("invalid state",_this);};

// Reload the static weapon
TRACE_5("calling addTurretMag event",_staticWeapon,_turretPath,_gunner,_reloadMag,_bestAmmoToSend);
TRACE_5("calling addTurretMag event",_vehicle,_turretPath,_gunner,_reloadMag,_bestAmmoToSend);
[QGVAR(addTurretMag), _this] call CBA_fnc_globalEvent;
}, [_staticWeapon, _turretPath, _gunner, _reloadMag, _bestAmmoToSend], _timeToLoad] call CBA_fnc_waitAndExecute;
}, [_vehicle, _turretPath, _gunner, _reloadMag, _bestAmmoToSend], _timeToLoad] call CBA_fnc_waitAndExecute;
6 changes: 3 additions & 3 deletions addons/csw/functions/fnc_assemble_canDeployWeapon.sqf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Checks if you can deploy a weapon on the tripod
* Checks if you can deploy a weapon on the tripod.
*
* Arguments:
* 0: Target Tripod <OBJECT>
* 0: Target <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* Wether or not you can deploy the weapon <BOOL>
* Whether or not you can deploy the weapon <BOOL>
*
* Example:
* [cursorObject, player] call ace_csw_fnc_assemble_canDeployWeapon
Expand Down
14 changes: 7 additions & 7 deletions addons/csw/functions/fnc_assemble_canPickupWeapon.sqf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* If the CSW is mounted or in use this will not allow you to dismount the weapon
* If the CSW is mounted or in use this will not allow you to dismount the weapon.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
*
* Return Value:
* Can Dismount <BOOL>
* Can dismount weapon <BOOL>
*
* Example:
* [cursorObject] call ace_csw_fnc_assemble_canPickupWeapon
* cursorObject call ace_csw_fnc_assemble_canPickupWeapon
*
* Public: No
*/

params ["_staticWeapon"];
params ["_vehicle"];

// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_staticWeapon getVariable [QGVAR(assemblyMode), 3]);
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_vehicle getVariable [QGVAR(assemblyMode), 3]);

_assemblyMode && {alive _staticWeapon} && {((crew _staticWeapon) findIf {alive _x && {!unitIsUAV _x}}) == -1} // return
_assemblyMode && {alive _vehicle} && {((crew _vehicle) findIf {alive _x && {!unitIsUAV _x}}) == -1} // return
8 changes: 4 additions & 4 deletions addons/csw/functions/fnc_assemble_deployTripod.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Deploys the tripod
* Deploys the tripod.
*
* Arguments:
* 0: Unit <OBJECT>
Expand All @@ -10,7 +10,7 @@
* None
*
* Example:
* [player] call ace_csw_fnc_assemble_deployTripod
* player call ace_csw_fnc_assemble_deployTripod
*
* Public: No
*/
Expand All @@ -34,7 +34,7 @@
_args params ["_player", "_secondaryWeaponClassname", "_secondaryWeaponInfo"];
TRACE_3("deployTripod finish",_player,_secondaryWeaponClassname,_secondaryWeaponInfo);

private _tripodClassname = getText(configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deploy");
private _tripodClassname = getText (configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deploy");

// Create a tripod
private _cswTripod = createVehicle [_tripodClassname, [0, 0, 0], [], 0, "NONE"];
Expand Down Expand Up @@ -96,6 +96,6 @@
} forEach _secondaryWeaponInfo;
};

private _deployTime = getNumber(configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deployTime");
private _deployTime = getNumber (configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deployTime");
[TIME_PROGRESSBAR(_deployTime), [_player, _secondaryWeaponClassname, _secondaryWeaponInfo], _onFinish, _onFailure, LLSTRING(PlaceTripod_progressBar)] call EFUNC(common,progressBar);
}, _this] call CBA_fnc_execNextFrame;
Loading

0 comments on commit a07e8eb

Please sign in to comment.