Skip to content

Commit

Permalink
Code formatting changes from 9234
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Jul 26, 2024
1 parent b85150e commit f922c15
Show file tree
Hide file tree
Showing 28 changed files with 124 additions and 124 deletions.
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;
4 changes: 2 additions & 2 deletions addons/csw/functions/fnc_assemble_deployWeapon.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Deploys the current CSW
* Deploys the current CSW.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Unit <OBJECT>
* 1: Player <OBJECT>
* 2: Args <ANY>
* 3: Action Data <ARRAY>
*
Expand Down
4 changes: 2 additions & 2 deletions addons/csw/functions/fnc_assemble_deployWeaponModifier.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Modifies interaction for deploying weapon
* Modifies interaction for deploying weapon.
*
* Arguments:
* 0: Target <OBJECT>
Expand All @@ -21,7 +21,7 @@
params ["_target", "_player", "", "_actionData"];

private _carryWeaponClassname = secondaryWeapon _player;
private _assembleTo = (getText(configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> (typeOf _target)));
private _assembleTo = getText (configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> typeOf _target);
private _icon = getText (configFile >> "CfgVehicles" >> _assembleTo >> "picture");
TRACE_2("",_assembleTo,_icon);

Expand Down
6 changes: 3 additions & 3 deletions addons/csw/functions/fnc_assemble_pickupTripod.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Picks up the tripod and adds it to the player launcher slot
* Picks up the tripod and adds it to the player launcher slot.
*
* Arguments:
* 0: Tripod <OBJECT>
* 1: Unit <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* None
Expand Down Expand Up @@ -56,7 +56,7 @@
if (isNull _weaponHolder || {_tripodPos distance _weaponHolder > 2}) then {
_weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_weaponHolder setDir random [0, 180, 360];
_weaponHolder setVehiclePosition [_tripodPos, [], 0, "CAN_COLLIDE"]; // places object on surface below
_weaponHolder setVehiclePosition [_tripodPos, [], 0, "CAN_COLLIDE"]; // Places object on surface below
};

_weaponHolder addWeaponCargoGlobal [_tripodClassname, 1];
Expand Down
40 changes: 20 additions & 20 deletions addons/csw/functions/fnc_assemble_pickupWeapon.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Dismounts the weapon from the tripod and drops its backpack beside
* Dismounts the weapon from the tripod and drops its backpack beside.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 1: Unit <OBJECT>
* 0: CSW <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* None
Expand All @@ -17,10 +17,10 @@
*/

[{
params ["_staticWeapon", "_player"];
TRACE_2("assemble_pickupWeapon",_staticWeapon,_player);
params ["_vehicle", "_player"];
TRACE_2("assemble_pickupWeapon",_vehicle,_player);

private _weaponConfig = configOf _staticWeapon >> QUOTE(ADDON);
private _weaponConfig = configOf _vehicle >> QUOTE(ADDON);
private _carryWeaponClassname = getText (_weaponConfig >> "disassembleWeapon");

if (!isClass (configFile >> "CfgWeapons" >> _carryWeaponClassname)) exitWith {
Expand All @@ -37,15 +37,15 @@
private _onDisassembleFunc = getText (_weaponConfig >> "disassembleFunc");

private _pickupTime = getNumber (configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "pickupTime");
TRACE_4("",typeOf _staticWeapon,_carryWeaponClassname,_turretClassname,_pickupTime);
TRACE_4("",typeOf _vehicle,_carryWeaponClassname,_turretClassname,_pickupTime);

private _onFinish = {
params ["_args"];
_args params ["_staticWeapon", "_player", "_carryWeaponClassname", "_turretClassname", "_onDisassembleFunc"];
TRACE_4("disassemble finish",_staticWeapon,_player,_carryWeaponClassname,_turretClassname);
_args params ["_vehicle", "_player", "_carryWeaponClassname", "_turretClassname", "_onDisassembleFunc"];
TRACE_4("disassemble finish",_vehicle,_player,_carryWeaponClassname,_turretClassname);

private _weaponPos = (getPosATL _staticWeapon) vectorAdd [0, 0, 0.1];
private _weaponDir = getDir _staticWeapon;
private _weaponPos = (getPosATL _vehicle) vectorAdd [0, 0, 0.1];
private _weaponDir = getDir _vehicle;

private _carryWeaponMag = [];
private _carryWeaponMags = compatibleMagazines _carryWeaponClassname;
Expand All @@ -64,7 +64,7 @@
TRACE_2("Removing ammo",_xMag,_carryMag);
[_player, _carryMag, _xAmmo] call FUNC(reload_handleReturnAmmo);
};
} forEach (magazinesAllTurrets _staticWeapon);
} forEach (magazinesAllTurrets _vehicle);

if (_turretClassname isNotEqualTo "") then {
private _cswTripod = createVehicle [_turretClassname, [0, 0, 0], [], 0, "NONE"];
Expand All @@ -76,7 +76,7 @@
_cswTripod setVelocity [0, 0, -0.05];
_cswTripod setVectorUp (surfaceNormal _weaponPos);
}, [_cswTripod, _weaponDir, _weaponPos]] call CBA_fnc_execNextFrame;
[_cswTripod, _staticWeapon] call (missionNamespace getVariable _onDisassembleFunc);
[_cswTripod, _vehicle] call (missionNamespace getVariable _onDisassembleFunc);
};

[{
Expand All @@ -99,7 +99,7 @@
// Create a new weapon holder (don't try to get an existing one, as no guarantee where it could be)
private _weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_weaponHolder setDir random [0, 180, 360];
_weaponHolder setVehiclePosition [_weaponPos, [], 0, "CAN_COLLIDE"]; // places object on surface below
_weaponHolder setVehiclePosition [_weaponPos, [], 0, "CAN_COLLIDE"]; // Places object on surface below
_weaponHolder addWeaponWithAttachmentsCargoGlobal [[_carryWeaponClassname, "", "", "", _carryWeaponMag, [], ""], 1];
}, [_player, _weaponPos, _carryWeaponClassname, _carryWeaponMag, _turretClassname]] call CBA_fnc_execNextFrame;

Expand All @@ -108,23 +108,23 @@
// Eject dead units (all crew are dead or UAV at this point, otherwise condition would have failed), but ignore UAV units
{
if (unitIsUAV _x) then {
_staticWeapon deleteVehicleCrew _x;
_vehicle deleteVehicleCrew _x;
} else {
moveOut _x;
};
} forEach (crew _staticWeapon);
} forEach (crew _vehicle);

deleteVehicle _staticWeapon;
deleteVehicle _vehicle;

LOG("end");
};

private _condition = {
params ["_args"];
_args params ["_staticWeapon"];
_args params ["_vehicle"];

_staticWeapon call FUNC(assemble_canPickupWeapon)
_vehicle call FUNC(assemble_canPickupWeapon)
};

[TIME_PROGRESSBAR(_pickupTime), [_staticWeapon, _player, _carryWeaponClassname, _turretClassname, _onDisassembleFunc], _onFinish, {}, LLSTRING(DisassembleCSW_progressBar), _condition] call EFUNC(common,progressBar);
[TIME_PROGRESSBAR(_pickupTime), [_vehicle, _player, _carryWeaponClassname, _turretClassname, _onDisassembleFunc], _onFinish, {}, LLSTRING(DisassembleCSW_progressBar), _condition] call EFUNC(common,progressBar);
}, _this] call CBA_fnc_execNextFrame;
8 changes: 4 additions & 4 deletions addons/csw/functions/fnc_canDeployTripod.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Checks if the unit can deploy a tripod
* Checks if the player can deploy the tripod.
*
* Arguments:
* 0: Unit <OBJECT>
* 0: Player <OBJECT>
*
* Return Value:
* Can deploy <BOOL>
Expand All @@ -15,8 +15,8 @@
* Public: No
*/

params ["_unit"];
params ["_player"];

private _secondaryWeapon = secondaryWeapon _unit;
private _secondaryWeapon = secondaryWeapon _player;

_secondaryWeapon != "" && {getText (configFile >> "CfgWeapons" >> _secondaryWeapon >> QUOTE(ADDON) >> "type") == "mount"} // return
Loading

0 comments on commit f922c15

Please sign in to comment.