mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
more common code cleanup
This commit is contained in:
parent
62ec00a251
commit
a98a45e5d1
@ -1,28 +1,38 @@
|
|||||||
/*
|
/*
|
||||||
* Author: bux578, commy2
|
* Author: bux578, commy2
|
||||||
*
|
|
||||||
* Returns an array containing all items of a given unit
|
* Returns an array containing all items of a given unit
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit (Object)
|
* 0: Unit <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Array with all the gear, format:
|
* 0: Headgear <STRING>
|
||||||
* 0: headgear (String)
|
* 1: Goggles <STRING>
|
||||||
* 1: goggles (String)
|
* 2: Uniform <STRING>
|
||||||
* 2,3: uniform (String, Array)
|
* 3: Uniform Items <ARRAY>
|
||||||
* 4,5: vest (String, Array)
|
* 4: Vest <String>
|
||||||
* 6,7: backpack (String, Array)
|
* 5: Vest Items <ARRAY>
|
||||||
* 8-10: rifle (String, Array, Array)
|
* 6: Backback <STRING>
|
||||||
* 11-13: launcher (String, Array, Array)
|
* 7: Backpack Items <ARRAY>
|
||||||
* 14-16: pistol (String, Array, Array)
|
* 8: Rifle <STRING>
|
||||||
* 17: map, compass, watch, etc. (Array)
|
* 9: Rifle Items <ARRAY>
|
||||||
* 18: binocluar (String)
|
* 10: Rifle Magazines <ARRAY>
|
||||||
|
* 11: Launcher <STRING>
|
||||||
|
* 12: Launcher Items <ARRAY>
|
||||||
|
* 13: Launcher Magazines <ARRAY>
|
||||||
|
* 14: Handgun <STRING>
|
||||||
|
* 15: Handgun Items <ARRAY>
|
||||||
|
* 16: Handgun Magazines <ARRAY>
|
||||||
|
* 17: Assigned Items (map, compass, watch, etc.) <ARRAY>
|
||||||
|
* 18: Binoculars <STRING>
|
||||||
*
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*
|
||||||
|
* Note: Element 17 includes the Head Mounted Display (HMD)
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_unit);
|
params ["_unit"];
|
||||||
|
|
||||||
if (isNull _unit) exitWith {[
|
if (isNull _unit) exitWith {[
|
||||||
"",
|
"",
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Return the captivity status of an unit.
|
* Return the captivity status of an unit.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit (Object)
|
* 0: Unit <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Reasons, why the unit is a captive. An empty array is returned if the unit is not a captive (Array of Strings)
|
* Captivity Reasons, empty if not captive <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
|
params ["_unit"];
|
||||||
|
|
||||||
PARAMS_1(_unit);
|
private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
|
||||||
|
|
||||||
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
|
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
|
||||||
|
|
||||||
_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
|
_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
|
||||||
|
|
||||||
_unitCaptivityReasons = [];
|
_unitCaptivityReasons = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_unitCaptivityStatus select _forEachIndex) then {
|
if (_unitCaptivityStatus select _forEachIndex) then {
|
||||||
_unitCaptivityReasons pushBack _x;
|
_unitCaptivityReasons pushBack _x;
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
// by commy2
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
* Obtain children of a config entry
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Parent Entry Class Children <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_classes"];
|
params ["_name", "_cfgClass"];
|
||||||
|
|
||||||
PARAMS_2(_name,_cfgClass);
|
|
||||||
|
|
||||||
|
private "_classes";
|
||||||
_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
|
_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
|
||||||
_classes = [_classes, {configName _this}] call FUNC(map);
|
|
||||||
_classes
|
[_classes, {configName _this}] call FUNC(map) // return
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the commander config of a vehicles turret.
|
* Get the commander config of a vehicles turret.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: vehicle (Object)
|
* 0: vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Commander config (Config)
|
* Commander config <CONFIG>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_config", "_turret"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_config", "_turret"];
|
||||||
|
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
_turret = [_vehicle] call FUNC(getTurretCommander);
|
_turret = [_vehicle] call FUNC(getTurretCommander);
|
||||||
|
|
||||||
[_config, _turret] call FUNC(getTurretConfigPath)
|
[_config, _turret] call FUNC(getTurretConfigPath) // return
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the gunner config of a vehicles turret.
|
* Get the gunner config of a vehicles turret.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: vehicle (Object)
|
* 0: vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Gunner config (Config)
|
* Gunner config <CONFIG>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_config", "_turret"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_config", "_turret"];
|
||||||
|
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
_turret = [_vehicle] call FUNC(getTurretGunner);
|
_turret = [_vehicle] call FUNC(getTurretGunner);
|
||||||
|
|
||||||
[_config, _turret] call FUNC(getTurretConfigPath)
|
[_config, _turret] call FUNC(getTurretConfigPath) // return
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Determins type of item. Can be CfgMagaines, CfgWeapons or CfgGlasses.
|
||||||
*
|
*
|
||||||
* What kind of Cfg is the item. Works for CfgMagaines, CfgWeapons and CfgGlasses
|
* Arguments:
|
||||||
|
* 0: Item Classname <STRING>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: A item's classname. (String)
|
* Config category ("CfgWeapons", "CfgMagazines", "CfgGlasses", "") <STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Public: Yes
|
||||||
* CfgWhatever (String)
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_item);
|
params ["_item"];
|
||||||
|
|
||||||
if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"};
|
if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"};
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Determins type of object. Can be CfgVehicles or CfgAmmo.
|
||||||
*
|
*
|
||||||
* What kind of Cfg is the object. Works for CfgVehicles and CfgAmmo
|
* Arguments:
|
||||||
|
* 0: Object classname <STRING>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: An object's classname. (String)
|
* Config category ("CfgWeapons", "Cfgmagazines", "CfgGlasses", "") <STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Public: Yes
|
||||||
* CfgWhatever (String)
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_object);
|
params ["_object"];
|
||||||
|
|
||||||
if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"};
|
if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"};
|
||||||
|
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Returns gunner using specified weapon type in vehicle. Only works if all turrets have different weapons.
|
||||||
*
|
*
|
||||||
* Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapon.
|
* Arguments:
|
||||||
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Weapon <STRING>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: The vehicle (Object)
|
* Gunner <OBJECT>
|
||||||
* 1: weapon of the vehicle (String)
|
|
||||||
*
|
*
|
||||||
* Return value:
|
* Public: Yes
|
||||||
* The turret gunner with this weapon (Object)
|
|
||||||
*/
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_weapon"];
|
params ["_vehicle", "_weapon"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
|
||||||
_weapon = _this select 1;
|
|
||||||
|
|
||||||
// on foot
|
// on foot
|
||||||
if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle};
|
if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle};
|
||||||
@ -27,7 +26,8 @@ _gunner = objNull;
|
|||||||
if (_weapon in (_vehicle weaponsTurret _x)) exitWith {
|
if (_weapon in (_vehicle weaponsTurret _x)) exitWith {
|
||||||
_gunner = _vehicle turretUnit _x;
|
_gunner = _vehicle turretUnit _x;
|
||||||
};
|
};
|
||||||
} forEach allTurrets [_vehicle, true];
|
false
|
||||||
|
} count allTurrets [_vehicle, true];
|
||||||
|
|
||||||
// ensure that at least the pilot is returned if there is no gunner
|
// ensure that at least the pilot is returned if there is no gunner
|
||||||
if (isManualFire _vehicle && {isNull _gunner}) then {
|
if (isManualFire _vehicle && {isNull _gunner}) then {
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the turret index of a vehicles commander.
|
* Get the turret index of a vehicles commander.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Vehicle (Object)
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Turret index of the vehicles commander. Empty array means no observer position. (Array)
|
* Vehicle commander turrent indecies <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_turrets", "_turret", "_config"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_turrets", "_turret", "_config"];
|
||||||
|
|
||||||
_turrets = allTurrets [_vehicle, true];
|
_turrets = allTurrets [_vehicle, true];
|
||||||
|
|
||||||
_turret = [];
|
_turret = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
|
|
||||||
@ -26,5 +28,7 @@ _turret = [];
|
|||||||
if (getNumber (_config >> "primaryObserver") == 1) exitWith {
|
if (getNumber (_config >> "primaryObserver") == 1) exitWith {
|
||||||
_turret = _x;
|
_turret = _x;
|
||||||
};
|
};
|
||||||
} forEach _turrets;
|
false
|
||||||
|
} count _turrets;
|
||||||
|
|
||||||
_turret
|
_turret
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the turret index of a vehicles copilot.
|
* Get the turret index of a vehicles copilot.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Vehicle (Object)
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Turret index of the vehicles gunner. Empty array means no copilot position. (Array)
|
* Vehicle Copilot Turret indecies <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_turrets", "_turret", "_config"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_turrets", "_turret", "_config"];
|
||||||
|
|
||||||
_turrets = allTurrets [_vehicle, true];
|
_turrets = allTurrets [_vehicle, true];
|
||||||
|
|
||||||
_turret = [];
|
_turret = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ _turret = [];
|
|||||||
if (getNumber (_config >> "isCopilot") == 1 && {getNumber (_config >> "primaryGunner") != 1} && {getNumber (_config >> "primaryObserver") != 1}) exitWith {
|
if (getNumber (_config >> "isCopilot") == 1 && {getNumber (_config >> "primaryGunner") != 1} && {getNumber (_config >> "primaryObserver") != 1}) exitWith {
|
||||||
_turret = _x;
|
_turret = _x;
|
||||||
};
|
};
|
||||||
} forEach _turrets;
|
false
|
||||||
|
} count _turrets;
|
||||||
|
|
||||||
_turret
|
_turret
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the turret index of a vehicles gunner.
|
* Get the turret index of a vehicles gunner.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Vehicle (Object)
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Turret index of the vehicles gunner. Empty array means no gunner position. (Array)
|
* Vehicle Gunner Turret indecies <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_turrets", "_turret", "_config"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_turrets", "_turret", "_config"];
|
||||||
|
|
||||||
_turrets = allTurrets [_vehicle, true];
|
_turrets = allTurrets [_vehicle, true];
|
||||||
|
|
||||||
_turret = [];
|
_turret = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ _turret = [];
|
|||||||
if (getNumber (_config >> "primaryGunner") == 1) exitWith {
|
if (getNumber (_config >> "primaryGunner") == 1) exitWith {
|
||||||
_turret = _x;
|
_turret = _x;
|
||||||
};
|
};
|
||||||
} forEach _turrets;
|
false
|
||||||
|
} count _turrets;
|
||||||
|
|
||||||
_turret
|
_turret
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the turret indices of ffv turrets.
|
* Get the turret indices of ffv turrets.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Vehicle (Object)
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Turret index of the vehicles gunner. Empty array means no ffv turrets. (Array)
|
* Vehicle FFV Turret indecies <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_turrets", "_turret", "_config"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_turrets", "_turret", "_config"];
|
||||||
|
|
||||||
_turrets = allTurrets [_vehicle, true];
|
_turrets = allTurrets [_vehicle, true];
|
||||||
|
|
||||||
_turret = [];
|
_turret = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
|
|
||||||
@ -26,5 +28,7 @@ _turret = [];
|
|||||||
if (getNumber (_config >> "isPersonTurret") == 1) then {
|
if (getNumber (_config >> "isPersonTurret") == 1) then {
|
||||||
_turret pushBack _x;
|
_turret pushBack _x;
|
||||||
};
|
};
|
||||||
} forEach _turrets;
|
false
|
||||||
|
} count _turrets;
|
||||||
|
|
||||||
_turret
|
_turret
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the turret indices of other turrets (not gunner, commander, copilot or ffv).
|
* Get the turret indices of other turrets (not gunner, commander, copilot or ffv).
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Vehicle (Object)
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Turret index of the vehicles gunner. Empty array means no other turrets. (Array)
|
* Vehicle Other Turret indecies <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_turrets", "_turret", "_config"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
PARAMS_1(_vehicle);
|
private ["_turrets", "_turret", "_config"];
|
||||||
|
|
||||||
_turrets = allTurrets [_vehicle, true];
|
_turrets = allTurrets [_vehicle, true];
|
||||||
|
|
||||||
_turret = [];
|
_turret = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||||
|
|
||||||
@ -30,5 +32,7 @@ _turret = [];
|
|||||||
) then {
|
) then {
|
||||||
_turret pushBack _x;
|
_turret pushBack _x;
|
||||||
};
|
};
|
||||||
} forEach _turrets;
|
false
|
||||||
|
} count _turrets;
|
||||||
|
|
||||||
_turret
|
_turret
|
||||||
|
Loading…
Reference in New Issue
Block a user