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
5f7d8c0095
commit
d449e4bd83
@ -26,17 +26,17 @@ _depth = _depth + 1;
|
|||||||
|
|
||||||
if (IS_ARRAY(_var)) then {
|
if (IS_ARRAY(_var)) then {
|
||||||
if (_var isEqualTo []) then {
|
if (_var isEqualTo []) then {
|
||||||
diag_log text format["%1[],", _pad];
|
diag_log text format ["%1[],", _pad];
|
||||||
} else {
|
} else {
|
||||||
diag_log text format["%1[", _pad];
|
diag_log text format ["%1[", _pad];
|
||||||
|
|
||||||
{
|
{
|
||||||
[_x, _depth] call FUNC(dumpArray);
|
[_x, _depth] call FUNC(dumpArray);
|
||||||
false
|
false
|
||||||
} count _var;
|
} count _var;
|
||||||
|
|
||||||
diag_log text format["%1],", _pad];
|
diag_log text format ["%1],", _pad];
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)];
|
diag_log text format ["%1%2", _pad, [_var] call FUNC(formatVar)];
|
||||||
};
|
};
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
diag_log text format["REGISTERED ACE PFH HANDLERS"];
|
diag_log text format ["REGISTERED ACE PFH HANDLERS"];
|
||||||
diag_log text format["-------------------------------------------"];
|
diag_log text format ["-------------------------------------------"];
|
||||||
|
|
||||||
if (!isNil "ACE_PFH_COUNTER") then {
|
if (!isNil "ACE_PFH_COUNTER") then {
|
||||||
{
|
{
|
||||||
|
@ -1,25 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
Name: FUNC(getForceWalkStatus)
|
* Author: PabstMirror, commy2
|
||||||
|
* Returns reasons why the unit is forceWalk-ing.
|
||||||
Author: Pabst Mirror (from captivity by commy2)
|
*
|
||||||
|
* Arguments:
|
||||||
Description:
|
* 0: unit <OBJECT>
|
||||||
Returns reasons why the unit is forceWalk-ing, empty if not forced.
|
*
|
||||||
|
* Return Value:
|
||||||
Parameters:
|
* Force Walk reasons <ARRAY>
|
||||||
0: OBJECT - Unit
|
*
|
||||||
|
* Example:
|
||||||
Returns:
|
* [ACE_Player] call ace_common_fnc_getForceWalkStatus
|
||||||
ARRAY(of strings) - Reason why the unit is force walking
|
*
|
||||||
|
* Public: Yes
|
||||||
Example:
|
*/
|
||||||
[ACE_Player] call FUNC(getForceWalkStatus)
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
|
params ["_unit"];
|
||||||
|
|
||||||
PARAMS_1(_unit);
|
private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
|
||||||
|
|
||||||
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
|
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
|
||||||
|
|
||||||
@ -28,6 +26,7 @@ _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
|
|||||||
_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
|
_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
|
||||||
|
|
||||||
_unitForceWalkReasons = [];
|
_unitForceWalkReasons = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_unitForceWalkStatus select _forEachIndex) then {
|
if (_unitForceWalkStatus select _forEachIndex) then {
|
||||||
_unitForceWalkReasons pushBack _x;
|
_unitForceWalkReasons pushBack _x;
|
||||||
|
@ -1,31 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Move unit into given vehicle position or switch to that position if the unit is already inside the vehicle.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Vehicle <OBJECT>
|
||||||
|
* 2: Position ("Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver", "Cargo") <STRING>
|
||||||
|
* 3: Index (only applies to "Turret", "FFV", "Codriver", "Cargo") (default: next free index) <NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
*
|
*
|
||||||
* Move unit into given vehicle position. Or switch to that position if the unit is already inside the vehicle.
|
* Public: Yes
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Unit to enter the vehicle (Object)
|
|
||||||
* 1: The vehicle to be entered (Object)
|
|
||||||
* 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" (String)
|
|
||||||
* 3: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken.
|
|
||||||
* Note: This index is diffrent from Armas "cargoIndex". (Number, optional default: next free index)
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* Nothing
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1}
|
#define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1}
|
||||||
#define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1}
|
#define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1}
|
||||||
|
|
||||||
private ["_position", "_index"];
|
params ["_unit", "_vehicle", "_position", ["_index", -1]];
|
||||||
|
|
||||||
PARAMS_2(_unit,_vehicle);
|
_position = toLower _position;
|
||||||
|
|
||||||
_position = toLower (_this select 2);
|
|
||||||
_index = _this select 3; // optional, please don't use
|
|
||||||
|
|
||||||
if (isNil "_index") then {_index = -1};
|
|
||||||
|
|
||||||
// general
|
// general
|
||||||
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
|
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
|
||||||
@ -39,27 +34,29 @@ _isInside = vehicle _unit == _vehicle;
|
|||||||
|
|
||||||
_script = {};
|
_script = {};
|
||||||
_enemiesInVehicle = false; //Possible Side Restriction
|
_enemiesInVehicle = false; //Possible Side Restriction
|
||||||
|
|
||||||
{
|
{
|
||||||
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
|
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
|
||||||
} forEach crew _vehicle;
|
false
|
||||||
|
} count crew _vehicle;
|
||||||
|
|
||||||
switch (_position) do {
|
switch (_position) do {
|
||||||
case "driver" : {
|
case "driver" : {
|
||||||
if (CANGETINDRIVER) then {
|
if (CANGETINDRIVER) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInDriver", "MoveToDriver"] select _isInside, _vehicle];},
|
{_unit action [["GetInDriver", "MoveToDriver"] select _isInside, _vehicle];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case "pilot" : {
|
case "pilot" : {
|
||||||
if (CANGETINDRIVER) then {
|
if (CANGETINDRIVER) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInPilot", "MoveToPilot"] select _isInside, _vehicle];},
|
{_unit action [["GetInPilot", "MoveToPilot"] select _isInside, _vehicle];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
_position = "driver";
|
_position = "driver";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,10 +64,10 @@ switch (_position) do {
|
|||||||
_turret = [_vehicle] call FUNC(getTurretGunner);
|
_turret = [_vehicle] call FUNC(getTurretGunner);
|
||||||
|
|
||||||
if (CANGETINTURRETINDEX) then {
|
if (CANGETINTURRETINDEX) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInGunner", "MoveToGunner"] select _isInside, _vehicle];},
|
{_unit action [["GetInGunner", "MoveToGunner"] select _isInside, _vehicle];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInGunner _vehicle; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInGunner _vehicle; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,10 +75,10 @@ switch (_position) do {
|
|||||||
_turret = [_vehicle] call FUNC(getTurretCommander);
|
_turret = [_vehicle] call FUNC(getTurretCommander);
|
||||||
|
|
||||||
if (CANGETINTURRETINDEX) then {
|
if (CANGETINTURRETINDEX) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInCommander", "MoveToCommander"] select _isInside, _vehicle];},
|
{_unit action [["GetInCommander", "MoveToCommander"] select _isInside, _vehicle];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInCommander _vehicle; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInCommander _vehicle; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,12 +86,12 @@ switch (_position) do {
|
|||||||
_turret = [_vehicle] call FUNC(getTurretCopilot);
|
_turret = [_vehicle] call FUNC(getTurretCopilot);
|
||||||
|
|
||||||
if (CANGETINTURRETINDEX) then {
|
if (CANGETINTURRETINDEX) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,8 +101,8 @@ switch (_position) do {
|
|||||||
|
|
||||||
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
|
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "gunner";
|
_position = "gunner";
|
||||||
@ -114,13 +111,13 @@ switch (_position) do {
|
|||||||
_turret = _turrets select _index;
|
_turret = _turrets select _index;
|
||||||
if (CANGETINTURRETINDEX) exitWith {
|
if (CANGETINTURRETINDEX) exitWith {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "gunner";
|
_position = "gunner";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -130,22 +127,22 @@ switch (_position) do {
|
|||||||
|
|
||||||
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
|
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
||||||
} else {
|
} else {
|
||||||
for "_index" from 0 to (count _turrets - 1) do {
|
for "_index" from 0 to (count _turrets - 1) do {
|
||||||
_turret = _turrets select _index;
|
_turret = _turrets select _index;
|
||||||
if (CANGETINTURRETINDEX) exitWith {
|
if (CANGETINTURRETINDEX) exitWith {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -160,8 +157,8 @@ switch (_position) do {
|
|||||||
|
|
||||||
if (_index != -1 && {_index in _positions}) then {
|
if (_index != -1 && {_index in _positions}) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "cargo";
|
_position = "cargo";
|
||||||
@ -169,8 +166,8 @@ switch (_position) do {
|
|||||||
_index = _positions select 0;
|
_index = _positions select 0;
|
||||||
if (!isNil "_index") then {
|
if (!isNil "_index") then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "cargo";
|
_position = "cargo";
|
||||||
@ -188,8 +185,8 @@ switch (_position) do {
|
|||||||
|
|
||||||
if (_index != -1 && {_index in _positions}) then {
|
if (_index != -1 && {_index in _positions}) then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "cargo";
|
_position = "cargo";
|
||||||
@ -197,8 +194,8 @@ switch (_position) do {
|
|||||||
_index = _positions select 0;
|
_index = _positions select 0;
|
||||||
if (!isNil "_index") then {
|
if (!isNil "_index") then {
|
||||||
_script = [
|
_script = [
|
||||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||||
] select _enemiesInVehicle;
|
] select _enemiesInVehicle;
|
||||||
|
|
||||||
_position = "cargo";
|
_position = "cargo";
|
||||||
|
@ -1,83 +1,78 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Returns item type of given classname.
|
||||||
*
|
*
|
||||||
* What kind of item is given classname
|
* Arguments:
|
||||||
|
* 0: Item <STRING>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: Classname of a item. (String)
|
* 0: Type ("weapon", "item", "magazine", "") <STRING>
|
||||||
*
|
* 1: Item Description <STRING>
|
||||||
* Return value:
|
|
||||||
* Item type. (Array)
|
|
||||||
* 0: "weapon", "item", "magazine" or "" (String)
|
|
||||||
* 1: A description of the item (e.g. "primary" for a weapon or "vest" for a vest item)
|
|
||||||
*
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_item);
|
params ["_item"];
|
||||||
|
|
||||||
private ["_cfgType"];
|
private ["_cfgType", "_config", "_type", "_default"];
|
||||||
|
|
||||||
_cfgType = [_item] call FUNC(getConfigType);
|
_cfgType = [_item] call FUNC(getConfigType);
|
||||||
|
|
||||||
if (_cfgType == "") exitWith {["",""]};
|
if (_cfgType == "") exitWith {["", ""]};
|
||||||
|
|
||||||
if (_cfgType == "CfgGlasses") exitWith {["item","glasses"]};
|
if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]};
|
||||||
|
|
||||||
private ["_config", "_type"];
|
|
||||||
|
|
||||||
_config = configFile >> _cfgType >> _item;
|
_config = configFile >> _cfgType >> _item;
|
||||||
|
|
||||||
_type = getNumber (_config >> "type");
|
_type = getNumber (_config >> "type");
|
||||||
|
|
||||||
if (isNumber (_config >> "ItemInfo" >> "type")) then {
|
if (isNumber (_config >> "ItemInfo" >> "type")) then {
|
||||||
_type = getNumber (_config >> "ItemInfo" >> "type");
|
_type = getNumber (_config >> "ItemInfo" >> "type");
|
||||||
};
|
};
|
||||||
|
|
||||||
private "_default";
|
|
||||||
_default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
|
_default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
|
||||||
|
|
||||||
switch (true) do {
|
switch (true) do {
|
||||||
case (_type == 0): {[_default,"unknown"]};
|
case (_type == 0): {[_default,"unknown"]};
|
||||||
case (_type == 2^0): {["weapon","primary"]};
|
case (_type == 2^0): {["weapon", "primary"]};
|
||||||
case (_type == 2^1): {["weapon","handgun"]};
|
case (_type == 2^1): {["weapon", "handgun"]};
|
||||||
case (_type == 2^2): {["weapon","secondary"]};
|
case (_type == 2^2): {["weapon", "secondary"]};
|
||||||
case (_type < 2^4): {["weapon","unknown"]};
|
case (_type < 2^4): {["weapon", "unknown"]};
|
||||||
case (_type == 2^4): {["magazine","handgun"]}; // handgun
|
case (_type == 2^4): {["magazine", "handgun"]}; // handgun
|
||||||
case (_type == 2^8): {["magazine","primary"]}; // rifle
|
case (_type == 2^8): {["magazine", "primary"]}; // rifle
|
||||||
case (_type == 2^9): {["magazine","secondary"]}; // rpg, mg, mines
|
case (_type == 2^9): {["magazine", "secondary"]}; // rpg, mg, mines
|
||||||
//case (_type < 2^11): {["magazine","unknown"]};
|
//case (_type < 2^11): {["magazine", "unknown"]};
|
||||||
|
|
||||||
case (_type == 101): {["item","muzzle"]};
|
case (_type == 101): {["item", "muzzle"]};
|
||||||
case (_type == 201): {["item","optics"]};
|
case (_type == 201): {["item", "optics"]};
|
||||||
case (_type == 301): {["item","flashlight"]};
|
case (_type == 301): {["item", "flashlight"]};
|
||||||
case (_type == 302): {["item","under"]}; // czech for bipod item
|
case (_type == 302): {["item", "under"]}; // czech for bipod item
|
||||||
case (_type == 401): {["item","first_aid_kit"]};
|
case (_type == 401): {["item", "first_aid_kit"]};
|
||||||
case (_type == 501): {["item","fins"]}; // not implemented
|
case (_type == 501): {["item", "fins"]}; // not implemented
|
||||||
case (_type == 601): {["item","breathing_bomb"]}; // not implemented
|
case (_type == 601): {["item", "breathing_bomb"]}; // not implemented
|
||||||
case (_type == 603): {["item","goggles"]};
|
case (_type == 603): {["item", "goggles"]};
|
||||||
case (_type == 604): {["item","scuba"]}; // not implemented
|
case (_type == 604): {["item", "scuba"]}; // not implemented
|
||||||
case (_type == 605): {["item","headgear"]};
|
case (_type == 605): {["item", "headgear"]};
|
||||||
case (_type == 611): {["item","radio"]};
|
case (_type == 611): {["item", "radio"]};
|
||||||
case (_type == 616): {["item","hmd"]};
|
case (_type == 616): {["item", "hmd"]};
|
||||||
case (_type == 617): {["item","binocular"]};
|
case (_type == 617): {["item", "binocular"]};
|
||||||
case (_type == 619): {["item","medikit"]};
|
case (_type == 619): {["item", "medikit"]};
|
||||||
case (_type == 620): {["item","toolkit"]};
|
case (_type == 620): {["item", "toolkit"]};
|
||||||
case (_type == 621): {["item","uav_terminal"]};
|
case (_type == 621): {["item", "uav_terminal"]};
|
||||||
case (_type == 701): {["item","vest"]};
|
case (_type == 701): {["item", "vest"]};
|
||||||
case (_type == 801): {["item","uniform"]};
|
case (_type == 801): {["item", "uniform"]};
|
||||||
|
|
||||||
case (_type == 2^12): {
|
case (_type == 2^12): {
|
||||||
switch (toLower getText (_config >> "simulation")) do {
|
switch (toLower getText (_config >> "simulation")) do {
|
||||||
case ("weapon"): {["weapon","binocular"]};
|
case ("weapon"): {["weapon", "binocular"]};
|
||||||
case ("binocular"): {["weapon","binocular"]};
|
case ("binocular"): {["weapon", "binocular"]};
|
||||||
case ("nvgoggles"): {["item","nvgoggles"]};
|
case ("nvgoggles"): {["item", "nvgoggles"]};
|
||||||
case ("itemminedetector"): {["item","minedetector"]};
|
case ("itemminedetector"): {["item", "minedetector"]};
|
||||||
default {[_default,"unknown"]};
|
default {[_default, "unknown"]};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case (_type == 2^16): {["weapon","vehicle"]};
|
case (_type == 2^16): {["weapon", "vehicle"]};
|
||||||
case (_type == 2^17): {[_default,"unknown"]}; // ???
|
case (_type == 2^17): {[_default, "unknown"]}; // ???
|
||||||
default {[_default,"unknown"]};
|
default {[_default, "unknown"]};
|
||||||
};
|
};
|
||||||
|
@ -3,22 +3,26 @@
|
|||||||
* Read properties of given vehicles light.
|
* Read properties of given vehicles light.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Object with lights (Object)
|
* 0: Object with lights <OBJECT>
|
||||||
* 1: Light classname (String)
|
* 1: Light classname <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Stuff from config (Array)
|
* 0: Light intensity <NUMBER>
|
||||||
|
* 1: Light position <STRING>
|
||||||
|
* 2: Light direction <STRING>
|
||||||
|
* 3: Light inner angle <NUMBER>
|
||||||
|
* 4: Light outer angle <NUMBER>
|
||||||
*
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_2(_vehicle,_light);
|
params ["_vehicle", "_light"];
|
||||||
|
|
||||||
|
private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||||
|
|
||||||
private "_config";
|
|
||||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light;
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light;
|
||||||
|
|
||||||
private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
|
||||||
|
|
||||||
_intensity = getNumber (_config >> "intensity");
|
_intensity = getNumber (_config >> "intensity");
|
||||||
_position = getText (_config >> "position");
|
_position = getText (_config >> "position");
|
||||||
_direction = getText (_config >> "direction");
|
_direction = getText (_config >> "direction");
|
||||||
@ -26,35 +30,3 @@ _innerAngle = getNumber (_config >> "innerAngle");
|
|||||||
_outerAngle = getNumber (_config >> "outerAngle");
|
_outerAngle = getNumber (_config >> "outerAngle");
|
||||||
|
|
||||||
[_intensity, _position, _direction, _innerAngle, _outerAngle]
|
[_intensity, _position, _direction, _innerAngle, _outerAngle]
|
||||||
|
|
||||||
/*
|
|
||||||
class Reflectors
|
|
||||||
{
|
|
||||||
class Light_1
|
|
||||||
{
|
|
||||||
color[] = {1000,1000,1100};
|
|
||||||
ambient[] = {10,10,11};
|
|
||||||
intensity = 5;
|
|
||||||
size = 1;
|
|
||||||
innerAngle = 90;
|
|
||||||
outerAngle = 130;
|
|
||||||
coneFadeCoef = 2;
|
|
||||||
position = "Light_1_pos";
|
|
||||||
direction = "Light_1_dir";
|
|
||||||
hitpoint = "Light_1_hitpoint";
|
|
||||||
selection = "Light_1_hide";
|
|
||||||
useFlare = 1;
|
|
||||||
flareSize = 0.9;
|
|
||||||
flareMaxDistance = 85;
|
|
||||||
class Attenuation
|
|
||||||
{
|
|
||||||
start = 0;
|
|
||||||
constant = 0;
|
|
||||||
linear = 0;
|
|
||||||
quadratic = 0.9;
|
|
||||||
hardLimitStart = 40;
|
|
||||||
hardLimitEnd = 60;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
@ -1,23 +1,29 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Read properties of given flashlight. @todo, Can weapons themselves still have flashlights (no attachment)?
|
* Read properties of given flashlight.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: A flashlight (String)
|
* 0: Flashlight <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Stuff from config (Array)
|
* 0: Light intensity <NUMBER>
|
||||||
|
* 1: Light position <STRING>
|
||||||
|
* 2: Light direction <STRING>
|
||||||
|
* 3: Light inner angle <NUMBER>
|
||||||
|
* 4: Light outer angle <NUMBER>
|
||||||
*
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_weapon);
|
params ["_weapon"];
|
||||||
|
|
||||||
|
// @todo: Can weapons themselves still have flashlights (no attachment)?
|
||||||
|
|
||||||
|
private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||||
|
|
||||||
private "_config";
|
|
||||||
_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight";
|
_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight";
|
||||||
|
|
||||||
private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
|
||||||
|
|
||||||
_intensity = getNumber (_config >> "intensity");
|
_intensity = getNumber (_config >> "intensity");
|
||||||
_position = getText (_config >> "position");
|
_position = getText (_config >> "position");
|
||||||
_direction = getText (_config >> "direction");
|
_direction = getText (_config >> "direction");
|
||||||
@ -25,32 +31,3 @@ _innerAngle = getNumber (_config >> "innerAngle");
|
|||||||
_outerAngle = getNumber (_config >> "outerAngle");
|
_outerAngle = getNumber (_config >> "outerAngle");
|
||||||
|
|
||||||
[_intensity, _position, _direction, _innerAngle, _outerAngle]
|
[_intensity, _position, _direction, _innerAngle, _outerAngle]
|
||||||
|
|
||||||
/*
|
|
||||||
class FlashLight
|
|
||||||
{
|
|
||||||
color[] = {180,156,120};
|
|
||||||
ambient[] = {0.9,0.78,0.6};
|
|
||||||
intensity = 20;
|
|
||||||
size = 1;
|
|
||||||
innerAngle = 20;
|
|
||||||
outerAngle = 80;
|
|
||||||
coneFadeCoef = 5;
|
|
||||||
position = "flash dir";
|
|
||||||
direction = "flash";
|
|
||||||
useFlare = 1;
|
|
||||||
flareSize = 1.4;
|
|
||||||
flareMaxDistance = "100.0f";
|
|
||||||
dayLight = 0;
|
|
||||||
class Attenuation
|
|
||||||
{
|
|
||||||
start = 0.5;
|
|
||||||
constant = 0;
|
|
||||||
linear = 0;
|
|
||||||
quadratic = 1.1;
|
|
||||||
hardLimitStart = 20;
|
|
||||||
hardLimitEnd = 30;
|
|
||||||
};
|
|
||||||
scale[] = {0};
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Returns the name of the object. Used to prevent issues with the name command.
|
* Returns the name of the object. Used to prevent issues with the name command.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Object (Object)
|
* 0: Object <OBJECT>
|
||||||
* 1: Show effective commander name? (Bool, optinal default: false)
|
* 1: Use effective commander name when used on vehicles (default: false) <BOOL>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* The name.
|
* Object Name <STRING>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_name"];
|
params ["_unit", ["_showEffective", false]];
|
||||||
|
|
||||||
PARAMS_2(_unit,_showEffective);
|
|
||||||
|
|
||||||
if (isNil "_showEffective") then {
|
|
||||||
_showEffective = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
private "_name";
|
||||||
_name = "";
|
_name = "";
|
||||||
|
|
||||||
if (_unit isKindOf "CAManBase") then {
|
if (_unit isKindOf "CAManBase") then {
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
* Returns pitch, bank, yaw for given vehicle in degrees.
|
||||||
* Returns [pitch, bank, yaw] for given vehicle in degrees.
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit/Vehicle
|
* 0: Unit/Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* [pitch, bank, yaw]
|
* 0: pitch <NUMBER>
|
||||||
|
* 1: bank <NUMBER>
|
||||||
|
* 2: yaw <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
((_this select 0) call BIS_fnc_getPitchBank) + [getDir (_this select 0)]
|
private ["_vehicle"];
|
||||||
|
|
||||||
|
(_vehicle call BIS_fnc_getPitchBank) + [getDir _vehicle]
|
||||||
|
@ -1,31 +1,33 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get the compass direction the wind is blowing from.
|
* Get the compass direction the wind is blowing from.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* None.
|
* None
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Wind direction. (String)
|
* Wind cardinal direction <STRING>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
switch (round (windDir / 360 * 16)) do {
|
localize ([
|
||||||
case 1 : {localize QUOTE(DOUBLES(STR,GVAR(SSW)))};
|
LSTRING(S),
|
||||||
case 2 : {localize QUOTE(DOUBLES(STR,GVAR(SW)))};
|
LSTRING(SSW),
|
||||||
case 3 : {localize QUOTE(DOUBLES(STR,GVAR(WSW)))};
|
LSTRING(SW),
|
||||||
case 4 : {localize QUOTE(DOUBLES(STR,GVAR(W)))};
|
LSTRING(WSW),
|
||||||
case 5 : {localize QUOTE(DOUBLES(STR,GVAR(WNW)))};
|
LSTRING(W),
|
||||||
case 6 : {localize QUOTE(DOUBLES(STR,GVAR(NW)))};
|
LSTRING(WNW),
|
||||||
case 7 : {localize QUOTE(DOUBLES(STR,GVAR(NNW)))};
|
LSTRING(NW),
|
||||||
case 8 : {localize QUOTE(DOUBLES(STR,GVAR(N)))};
|
LSTRING(NNW),
|
||||||
case 9 : {localize QUOTE(DOUBLES(STR,GVAR(NNE)))};
|
LSTRING(N),
|
||||||
case 10 : {localize QUOTE(DOUBLES(STR,GVAR(NE)))};
|
LSTRING(NNE),
|
||||||
case 11 : {localize QUOTE(DOUBLES(STR,GVAR(ENE)))};
|
LSTRING(NE),
|
||||||
case 12 : {localize QUOTE(DOUBLES(STR,GVAR(E)))};
|
LSTRING(ENE),
|
||||||
case 13 : {localize QUOTE(DOUBLES(STR,GVAR(ESE)))};
|
LSTRING(E),
|
||||||
case 14 : {localize QUOTE(DOUBLES(STR,GVAR(SE)))};
|
LSTRING(ESE),
|
||||||
case 15 : {localize QUOTE(DOUBLES(STR,GVAR(SSE)))};
|
LSTRING(SE),
|
||||||
default {localize QUOTE(DOUBLES(STR,GVAR(S)))};
|
LSTRING(SSE),
|
||||||
};
|
LSTRING(S)
|
||||||
|
] select (round (windDir / 360 * 16))) // return
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Returns a value depending on current zoom level.
|
* Returns a value depending on current zoom level.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* None.
|
* None
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Zoom. (Number)
|
* Zoom <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
(0.5 - ((worldToScreen positionCameraToWorld [0,1,1]) select 1)) * (getResolution select 5)
|
if (!hasInterface) exitWith {0};
|
||||||
|
|
||||||
|
(0.5 - ((worldToScreen positionCameraToWorld [0, 1, 1]) select 1)) * (getResolution select 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user