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 (_var isEqualTo []) then {
|
||||
diag_log text format["%1[],", _pad];
|
||||
diag_log text format ["%1[],", _pad];
|
||||
} else {
|
||||
diag_log text format["%1[", _pad];
|
||||
diag_log text format ["%1[", _pad];
|
||||
|
||||
{
|
||||
[_x, _depth] call FUNC(dumpArray);
|
||||
false
|
||||
} count _var;
|
||||
|
||||
diag_log text format["%1],", _pad];
|
||||
diag_log text format ["%1],", _pad];
|
||||
};
|
||||
} 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"
|
||||
|
||||
diag_log text format["REGISTERED ACE PFH HANDLERS"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
diag_log text format ["REGISTERED ACE PFH HANDLERS"];
|
||||
diag_log text format ["-------------------------------------------"];
|
||||
|
||||
if (!isNil "ACE_PFH_COUNTER") then {
|
||||
{
|
||||
|
@ -1,25 +1,23 @@
|
||||
/*
|
||||
Name: FUNC(getForceWalkStatus)
|
||||
|
||||
Author: Pabst Mirror (from captivity by commy2)
|
||||
|
||||
Description:
|
||||
Returns reasons why the unit is forceWalk-ing, empty if not forced.
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - Unit
|
||||
|
||||
Returns:
|
||||
ARRAY(of strings) - Reason why the unit is force walking
|
||||
|
||||
Example:
|
||||
[ACE_Player] call FUNC(getForceWalkStatus)
|
||||
*/
|
||||
* Author: PabstMirror, commy2
|
||||
* Returns reasons why the unit is forceWalk-ing.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Force Walk reasons <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [ACE_Player] call ace_common_fnc_getForceWalkStatus
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
|
||||
params ["_unit"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
|
||||
|
||||
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
|
||||
|
||||
@ -28,6 +26,7 @@ _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
|
||||
_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
|
||||
|
||||
_unitForceWalkReasons = [];
|
||||
|
||||
{
|
||||
if (_unitForceWalkStatus select _forEachIndex) then {
|
||||
_unitForceWalkReasons pushBack _x;
|
||||
|
@ -1,31 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#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}
|
||||
|
||||
private ["_position", "_index"];
|
||||
params ["_unit", "_vehicle", "_position", ["_index", -1]];
|
||||
|
||||
PARAMS_2(_unit,_vehicle);
|
||||
|
||||
_position = toLower (_this select 2);
|
||||
_index = _this select 3; // optional, please don't use
|
||||
|
||||
if (isNil "_index") then {_index = -1};
|
||||
_position = toLower _position;
|
||||
|
||||
// general
|
||||
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
|
||||
@ -39,27 +34,29 @@ _isInside = vehicle _unit == _vehicle;
|
||||
|
||||
_script = {};
|
||||
_enemiesInVehicle = false; //Possible Side Restriction
|
||||
|
||||
{
|
||||
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
|
||||
} forEach crew _vehicle;
|
||||
false
|
||||
} count crew _vehicle;
|
||||
|
||||
switch (_position) do {
|
||||
case "driver" : {
|
||||
if (CANGETINDRIVER) then {
|
||||
_script = [
|
||||
{_unit action [["GetInDriver", "MoveToDriver"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_script = [
|
||||
{_unit action [["GetInDriver", "MoveToDriver"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
};
|
||||
};
|
||||
|
||||
case "pilot" : {
|
||||
if (CANGETINDRIVER) then {
|
||||
_script = [
|
||||
{_unit action [["GetInPilot", "MoveToPilot"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_position = "driver";
|
||||
_script = [
|
||||
{_unit action [["GetInPilot", "MoveToPilot"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_position = "driver";
|
||||
};
|
||||
};
|
||||
|
||||
@ -67,10 +64,10 @@ switch (_position) do {
|
||||
_turret = [_vehicle] call FUNC(getTurretGunner);
|
||||
|
||||
if (CANGETINTURRETINDEX) then {
|
||||
_script = [
|
||||
{_unit action [["GetInGunner", "MoveToGunner"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInGunner _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_script = [
|
||||
{_unit action [["GetInGunner", "MoveToGunner"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInGunner _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
};
|
||||
};
|
||||
|
||||
@ -78,10 +75,10 @@ switch (_position) do {
|
||||
_turret = [_vehicle] call FUNC(getTurretCommander);
|
||||
|
||||
if (CANGETINTURRETINDEX) then {
|
||||
_script = [
|
||||
{_unit action [["GetInCommander", "MoveToCommander"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCommander _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_script = [
|
||||
{_unit action [["GetInCommander", "MoveToCommander"] select _isInside, _vehicle];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCommander _vehicle; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
};
|
||||
};
|
||||
|
||||
@ -89,12 +86,12 @@ switch (_position) do {
|
||||
_turret = [_vehicle] call FUNC(getTurretCopilot);
|
||||
|
||||
if (CANGETINTURRETINDEX) then {
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] 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 {
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "gunner";
|
||||
@ -114,13 +111,13 @@ switch (_position) do {
|
||||
_turret = _turrets select _index;
|
||||
if (CANGETINTURRETINDEX) exitWith {
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "gunner";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -130,22 +127,22 @@ switch (_position) do {
|
||||
|
||||
if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then {
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner"
|
||||
} else {
|
||||
for "_index" from 0 to (count _turrets - 1) do {
|
||||
_turret = _turrets select _index;
|
||||
if (CANGETINTURRETINDEX) exitWith {
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
_turret = _turrets select _index;
|
||||
if (CANGETINTURRETINDEX) exitWith {
|
||||
_script = [
|
||||
{_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;}
|
||||
] 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 {
|
||||
_script = [
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "cargo";
|
||||
@ -169,8 +166,8 @@ switch (_position) do {
|
||||
_index = _positions select 0;
|
||||
if (!isNil "_index") then {
|
||||
_script = [
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "cargo";
|
||||
@ -188,8 +185,8 @@ switch (_position) do {
|
||||
|
||||
if (_index != -1 && {_index in _positions}) then {
|
||||
_script = [
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "cargo";
|
||||
@ -197,8 +194,8 @@ switch (_position) do {
|
||||
_index = _positions select 0;
|
||||
if (!isNil "_index") then {
|
||||
_script = [
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
{_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];},
|
||||
{if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;}
|
||||
] select _enemiesInVehicle;
|
||||
|
||||
_position = "cargo";
|
||||
|
@ -1,83 +1,78 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Returns item type of given classname.
|
||||
*
|
||||
* What kind of item is given classname
|
||||
* Arguments:
|
||||
* 0: Item <STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Classname of a item. (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)
|
||||
* Return Value:
|
||||
* 0: Type ("weapon", "item", "magazine", "") <STRING>
|
||||
* 1: Item Description <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_item);
|
||||
params ["_item"];
|
||||
|
||||
private ["_cfgType"];
|
||||
private ["_cfgType", "_config", "_type", "_default"];
|
||||
|
||||
_cfgType = [_item] call FUNC(getConfigType);
|
||||
|
||||
if (_cfgType == "") exitWith {["",""]};
|
||||
if (_cfgType == "") exitWith {["", ""]};
|
||||
|
||||
if (_cfgType == "CfgGlasses") exitWith {["item","glasses"]};
|
||||
|
||||
private ["_config", "_type"];
|
||||
if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]};
|
||||
|
||||
_config = configFile >> _cfgType >> _item;
|
||||
|
||||
_type = getNumber (_config >> "type");
|
||||
|
||||
if (isNumber (_config >> "ItemInfo" >> "type")) then {
|
||||
_type = getNumber (_config >> "ItemInfo" >> "type");
|
||||
};
|
||||
|
||||
private "_default";
|
||||
_default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
|
||||
|
||||
switch (true) do {
|
||||
case (_type == 0): {[_default,"unknown"]};
|
||||
case (_type == 2^0): {["weapon","primary"]};
|
||||
case (_type == 2^1): {["weapon","handgun"]};
|
||||
case (_type == 2^2): {["weapon","secondary"]};
|
||||
case (_type < 2^4): {["weapon","unknown"]};
|
||||
case (_type == 2^4): {["magazine","handgun"]}; // handgun
|
||||
case (_type == 2^8): {["magazine","primary"]}; // rifle
|
||||
case (_type == 2^9): {["magazine","secondary"]}; // rpg, mg, mines
|
||||
//case (_type < 2^11): {["magazine","unknown"]};
|
||||
case (_type == 2^0): {["weapon", "primary"]};
|
||||
case (_type == 2^1): {["weapon", "handgun"]};
|
||||
case (_type == 2^2): {["weapon", "secondary"]};
|
||||
case (_type < 2^4): {["weapon", "unknown"]};
|
||||
case (_type == 2^4): {["magazine", "handgun"]}; // handgun
|
||||
case (_type == 2^8): {["magazine", "primary"]}; // rifle
|
||||
case (_type == 2^9): {["magazine", "secondary"]}; // rpg, mg, mines
|
||||
//case (_type < 2^11): {["magazine", "unknown"]};
|
||||
|
||||
case (_type == 101): {["item","muzzle"]};
|
||||
case (_type == 201): {["item","optics"]};
|
||||
case (_type == 301): {["item","flashlight"]};
|
||||
case (_type == 302): {["item","under"]}; // czech for bipod item
|
||||
case (_type == 401): {["item","first_aid_kit"]};
|
||||
case (_type == 501): {["item","fins"]}; // not implemented
|
||||
case (_type == 601): {["item","breathing_bomb"]}; // not implemented
|
||||
case (_type == 603): {["item","goggles"]};
|
||||
case (_type == 604): {["item","scuba"]}; // not implemented
|
||||
case (_type == 605): {["item","headgear"]};
|
||||
case (_type == 611): {["item","radio"]};
|
||||
case (_type == 616): {["item","hmd"]};
|
||||
case (_type == 617): {["item","binocular"]};
|
||||
case (_type == 619): {["item","medikit"]};
|
||||
case (_type == 620): {["item","toolkit"]};
|
||||
case (_type == 621): {["item","uav_terminal"]};
|
||||
case (_type == 701): {["item","vest"]};
|
||||
case (_type == 801): {["item","uniform"]};
|
||||
case (_type == 101): {["item", "muzzle"]};
|
||||
case (_type == 201): {["item", "optics"]};
|
||||
case (_type == 301): {["item", "flashlight"]};
|
||||
case (_type == 302): {["item", "under"]}; // czech for bipod item
|
||||
case (_type == 401): {["item", "first_aid_kit"]};
|
||||
case (_type == 501): {["item", "fins"]}; // not implemented
|
||||
case (_type == 601): {["item", "breathing_bomb"]}; // not implemented
|
||||
case (_type == 603): {["item", "goggles"]};
|
||||
case (_type == 604): {["item", "scuba"]}; // not implemented
|
||||
case (_type == 605): {["item", "headgear"]};
|
||||
case (_type == 611): {["item", "radio"]};
|
||||
case (_type == 616): {["item", "hmd"]};
|
||||
case (_type == 617): {["item", "binocular"]};
|
||||
case (_type == 619): {["item", "medikit"]};
|
||||
case (_type == 620): {["item", "toolkit"]};
|
||||
case (_type == 621): {["item", "uav_terminal"]};
|
||||
case (_type == 701): {["item", "vest"]};
|
||||
case (_type == 801): {["item", "uniform"]};
|
||||
|
||||
case (_type == 2^12): {
|
||||
switch (toLower getText (_config >> "simulation")) do {
|
||||
case ("weapon"): {["weapon","binocular"]};
|
||||
case ("binocular"): {["weapon","binocular"]};
|
||||
case ("nvgoggles"): {["item","nvgoggles"]};
|
||||
case ("itemminedetector"): {["item","minedetector"]};
|
||||
default {[_default,"unknown"]};
|
||||
case ("weapon"): {["weapon", "binocular"]};
|
||||
case ("binocular"): {["weapon", "binocular"]};
|
||||
case ("nvgoggles"): {["item", "nvgoggles"]};
|
||||
case ("itemminedetector"): {["item", "minedetector"]};
|
||||
default {[_default, "unknown"]};
|
||||
};
|
||||
};
|
||||
|
||||
case (_type == 2^16): {["weapon","vehicle"]};
|
||||
case (_type == 2^17): {[_default,"unknown"]}; // ???
|
||||
default {[_default,"unknown"]};
|
||||
case (_type == 2^16): {["weapon", "vehicle"]};
|
||||
case (_type == 2^17): {[_default, "unknown"]}; // ???
|
||||
default {[_default, "unknown"]};
|
||||
};
|
||||
|
@ -3,22 +3,26 @@
|
||||
* Read properties of given vehicles light.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object with lights (Object)
|
||||
* 1: Light classname (String)
|
||||
* 0: Object with lights <OBJECT>
|
||||
* 1: Light classname <STRING>
|
||||
*
|
||||
* 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"
|
||||
|
||||
PARAMS_2(_vehicle,_light);
|
||||
params ["_vehicle", "_light"];
|
||||
|
||||
private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light;
|
||||
|
||||
private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
_intensity = getNumber (_config >> "intensity");
|
||||
_position = getText (_config >> "position");
|
||||
_direction = getText (_config >> "direction");
|
||||
@ -26,35 +30,3 @@ _innerAngle = getNumber (_config >> "innerAngle");
|
||||
_outerAngle = getNumber (_config >> "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
|
||||
* Read properties of given flashlight. @todo, Can weapons themselves still have flashlights (no attachment)?
|
||||
* Read properties of given flashlight.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: A flashlight (String)
|
||||
* 0: Flashlight <STRING>
|
||||
*
|
||||
* 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"
|
||||
|
||||
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";
|
||||
|
||||
private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
_intensity = getNumber (_config >> "intensity");
|
||||
_position = getText (_config >> "position");
|
||||
_direction = getText (_config >> "direction");
|
||||
@ -25,32 +31,3 @@ _innerAngle = getNumber (_config >> "innerAngle");
|
||||
_outerAngle = getNumber (_config >> "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
|
||||
*
|
||||
* Returns the name of the object. Used to prevent issues with the name command.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Object (Object)
|
||||
* 1: Show effective commander name? (Bool, optinal default: false)
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 1: Use effective commander name when used on vehicles (default: false) <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* The name.
|
||||
* Return Value:
|
||||
* Object Name <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_name"];
|
||||
|
||||
PARAMS_2(_unit,_showEffective);
|
||||
|
||||
if (isNil "_showEffective") then {
|
||||
_showEffective = false;
|
||||
};
|
||||
params ["_unit", ["_showEffective", false]];
|
||||
|
||||
private "_name";
|
||||
_name = "";
|
||||
|
||||
if (_unit isKindOf "CAManBase") then {
|
||||
|
@ -1,14 +1,19 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
*
|
||||
* Returns [pitch, bank, yaw] for given vehicle in degrees.
|
||||
* Returns pitch, bank, yaw for given vehicle in degrees.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit/Vehicle
|
||||
* 0: Unit/Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* [pitch, bank, yaw]
|
||||
* 0: pitch <NUMBER>
|
||||
* 1: bank <NUMBER>
|
||||
* 2: yaw <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#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
|
||||
*
|
||||
* Get the compass direction the wind is blowing from.
|
||||
*
|
||||
* Argument:
|
||||
* None.
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Wind direction. (String)
|
||||
* Return Value:
|
||||
* Wind cardinal direction <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
switch (round (windDir / 360 * 16)) do {
|
||||
case 1 : {localize QUOTE(DOUBLES(STR,GVAR(SSW)))};
|
||||
case 2 : {localize QUOTE(DOUBLES(STR,GVAR(SW)))};
|
||||
case 3 : {localize QUOTE(DOUBLES(STR,GVAR(WSW)))};
|
||||
case 4 : {localize QUOTE(DOUBLES(STR,GVAR(W)))};
|
||||
case 5 : {localize QUOTE(DOUBLES(STR,GVAR(WNW)))};
|
||||
case 6 : {localize QUOTE(DOUBLES(STR,GVAR(NW)))};
|
||||
case 7 : {localize QUOTE(DOUBLES(STR,GVAR(NNW)))};
|
||||
case 8 : {localize QUOTE(DOUBLES(STR,GVAR(N)))};
|
||||
case 9 : {localize QUOTE(DOUBLES(STR,GVAR(NNE)))};
|
||||
case 10 : {localize QUOTE(DOUBLES(STR,GVAR(NE)))};
|
||||
case 11 : {localize QUOTE(DOUBLES(STR,GVAR(ENE)))};
|
||||
case 12 : {localize QUOTE(DOUBLES(STR,GVAR(E)))};
|
||||
case 13 : {localize QUOTE(DOUBLES(STR,GVAR(ESE)))};
|
||||
case 14 : {localize QUOTE(DOUBLES(STR,GVAR(SE)))};
|
||||
case 15 : {localize QUOTE(DOUBLES(STR,GVAR(SSE)))};
|
||||
default {localize QUOTE(DOUBLES(STR,GVAR(S)))};
|
||||
};
|
||||
localize ([
|
||||
LSTRING(S),
|
||||
LSTRING(SSW),
|
||||
LSTRING(SW),
|
||||
LSTRING(WSW),
|
||||
LSTRING(W),
|
||||
LSTRING(WNW),
|
||||
LSTRING(NW),
|
||||
LSTRING(NNW),
|
||||
LSTRING(N),
|
||||
LSTRING(NNE),
|
||||
LSTRING(NE),
|
||||
LSTRING(ENE),
|
||||
LSTRING(E),
|
||||
LSTRING(ESE),
|
||||
LSTRING(SE),
|
||||
LSTRING(SSE),
|
||||
LSTRING(S)
|
||||
] select (round (windDir / 360 * 16))) // return
|
||||
|
@ -1,14 +1,17 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Returns a value depending on current zoom level.
|
||||
*
|
||||
* Argument:
|
||||
* None.
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Zoom. (Number)
|
||||
* Return Value:
|
||||
* Zoom <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#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