diff --git a/AUTHORS.txt b/AUTHORS.txt index f4ebd317eb..8cdf9a99a9 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,4 +1,4 @@ -# ACE3 CONTRIBUTOR LIST +# ACE3 CONTRIBUTOR LIST # If you contributed, but are not listed here, contact me: # koffeinflummi@gmail.com # @@ -37,6 +37,7 @@ alef Aleksey EpMAK Yermakov Alganthe Anthariel +Arkhir Asgar Serran Bamse Bla1337 @@ -108,6 +109,7 @@ Toaster Tonic Tourorist Valentin Torikian +voiper VyMajoris(W-Cephei) Winter zGuba diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 9debec1dc8..1f7e2ecde7 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -36,7 +36,7 @@ GVAR(Protractor) = true; if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith { GVAR(Protractor) = false; 1 cutText ["", "PLAIN"]; - [_idPFH] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; 1 cutRsc ["RscProtractor", "PLAIN", 1, false]; diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf index 7a432831ad..5874de96c4 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf @@ -26,19 +26,19 @@ _aceTimeSecond = floor ACE_time; _bulletSpeed = vectorMagnitude _bulletVelocity; - if (!alive _bullet || _bulletSpeed < 100) exitWith { - GVAR(allBullets) deleteAt (_forEachIndex - _deleted); - _deleted = _deleted + 1; + if (!alive _bullet || _bulletSpeed < 100) then { + GVAR(allBullets) deleteAt (GVAR(allBullets) find _x); + } else { + _bulletPosition = getPosASL _bullet; + + if (_bulletTraceVisible && _bulletSpeed > 500) then { + drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; + }; + + call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); }; - - _bulletPosition = getPosASL _bullet; - - if (_bulletTraceVisible && _bulletSpeed > 500) then { - drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; - }; - - call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); -} forEach GVAR(allBullets); + nil +} count +GVAR(allBullets); if (GVAR(allBullets) isEqualTo []) then { [_this select 1] call CBA_fnc_removePerFrameHandler; diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 8d9cb73509..90eacf2928 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -54,7 +54,7 @@ if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _wea if (_abort || !(GVAR(extensionAvailable))) exitWith { if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then { - EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")]; + EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; }; }; diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 53ac6aa874..02468d0349 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -40,7 +40,7 @@ GVAR(currentGrid) = 0; #ifdef DEBUG_MODE_FULL systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; #endif - [_idPFH] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; for "_i" from 1 to 50 do { diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index 8e13dc04dc..ec6f3a6212 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -20,9 +20,11 @@ _weaponConfig = (configFile >> "CfgWeapons" >> _this); _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist"); _twistDirection = 1; -_twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection"); -if !(_twistDirection in [-1, 0, 1]) then { - _twistDirection = 1; +if (isNumber (_weaponConfig >> "ACE_twistDirection")) then { + _twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection"); + if !(_twistDirection in [-1, 0, 1]) then { + _twistDirection = 1; + }; }; _barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength"); diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index aad591581a..07b93eb2da 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -54,7 +54,7 @@ GVAR(active) = true; GVAR(DialogPFH) = [{ if (!GVAR(active)) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; + [_this select 1] call CBA_fnc_removePerFrameHandler; }; __ctrlBackground ctrlSetText format [QUOTE(PATHTOF(UI\ATRAG_%1.paa)), ["N", "D"] select (call EFUNC(common,ambientBrightness))]; }, 60, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/atragmx/functions/fnc_on_close_dialog.sqf b/addons/atragmx/functions/fnc_on_close_dialog.sqf index 46cbbfc146..1f254c646a 100644 --- a/addons/atragmx/functions/fnc_on_close_dialog.sqf +++ b/addons/atragmx/functions/fnc_on_close_dialog.sqf @@ -2,4 +2,4 @@ uiNamespace setVariable ['ATragMX_Display', nil]; GVAR(active) = false; -[GVAR(DialogPFH)] call cba_fnc_removePerFrameHandler; \ No newline at end of file +[GVAR(DialogPFH)] call CBA_fnc_removePerFrameHandler; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf b/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf index 9bc5b7e34f..0f42f9637c 100644 --- a/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf +++ b/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf @@ -37,7 +37,7 @@ if !(ctrlVisible 9000) then { false call FUNC(show_target_speed_assist_timer); true call FUNC(show_target_speed_assist); - [_this select 1] call cba_fnc_removePerFrameHandler; + [_this select 1] call CBA_fnc_removePerFrameHandler; }; ctrlSetText [9001, Str(Round((ACE_time - _startTime) * 10) / 10)]; diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index b8e2cc17fb..922136107e 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -10,7 +10,7 @@ * Arguments: * 0: Unit (player) * 1: attachToVehicle - * 2: Item Classname (cfgWeapon/cfgMagazine) + * 2: Item Classname (CfgWeapon/CfgMagazine) * 3: Light Vehicle Classname * 4: On Attach Text * 5: Starting Pos of dummy item diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index fab82c505f..68b59f803e 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -14,7 +14,7 @@ params ["_backpack"]; -if (typeName _backpack == "OBJECT") then { +if (_backpack isEqualType objNull) then { _backpack = typeOf _backpack; }; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index eff1cf4c52..0cfda46128 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -192,6 +192,7 @@ class CfgVehicles { scope = 2; icon = QUOTE(PATHTOF(UI\Icon_Module_settings_ca.paa)); isGlobal = 1; + isSingular = 1; class Arguments { class allowHandcuffOwnSide { displayName = CSTRING(ModuleSettings_handcuffSide_name); diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index 08b64195f3..484151853b 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -45,7 +45,7 @@ if (_state) then { }; if (!(_unit getVariable [QGVAR(isEscorting), false])) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; [objNull, _target, false] call EFUNC(common,claim); detach _target; _unit removeAction _actionID; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index aea91b5e11..3ff0e00752 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -21,10 +21,10 @@ params ["_newUnit","_oldUnit"]; //set showHUD based on new unit status: if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { TRACE_1("Player Change (showHUD false)",_newUnit); - showHUD false; + ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); } else { TRACE_1("Player Change (showHUD true)",_newUnit); - showHUD true; + ["captive", []] call EFUNC(common,showHud); //same as showHud true; }; //If old player was escorting, stop diff --git a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf index 7b30199caf..ef8aedbbe1 100644 --- a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf +++ b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf @@ -23,9 +23,9 @@ params ["_unit","_zeusIsOpen"]; if (!_zeusIsOpen) then { if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { TRACE_1("Player Change (showHUD false)",_unit); - showHUD false; + ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); } else { TRACE_1("Player Change (showHUD true)",_unit); - showHUD true; + ["captive", []] call EFUNC(common,showHud); //same as showHud true; }; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index a4788db057..1e686ea849 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -19,7 +19,7 @@ params ["_unit","_state"]; TRACE_2("params",_unit,_state); -if (!local _unit) exitwith { +if (!local _unit) exitWith { ERROR("running setHandcuffed on remote unit"); }; if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith { @@ -38,7 +38,7 @@ if (_state) then { _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; if (_unit == ACE_player) then { - showHUD false; + ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); }; // fix anim on mission start (should work on dedicated servers) @@ -107,7 +107,7 @@ if (_state) then { }; if (_unit == ACE_player) then { - showHUD true; + ["captive", []] call EFUNC(common,showHud); //same as showHud true; }; }; diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index 5af4454472..aa65c1273d 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -19,7 +19,7 @@ params ["_unit","_state"]; TRACE_2("params",_unit,_state); -if (!local _unit) exitwith { +if (!local _unit) exitWith { ERROR("running surrender on remote unit"); }; @@ -36,7 +36,7 @@ if (_state) then { [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); if (_unit == ACE_player) then { - showHUD false; + ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); }; [_unit] call EFUNC(common,fixLoweredRifleAnimation); @@ -75,7 +75,7 @@ if (_state) then { if (_unit == ACE_player) then { //only re-enable HUD if not handcuffed if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { - showHUD true; + ["captive", []] call EFUNC(common,showHud); //same as showHud true; }; }; diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 8465588fb5..2d202ed852 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -181,11 +181,13 @@ Make Unit Handcuffed + Skuj jednostkę Fazer unidade algemada Связать юнита Sync a unit to make them handcuffed.<br />Source: ace_captives + Zsynchronizuj z jednostką, aby została skuta.<br />Źródło: ace_captives Sincronizar uma unidade para deixá-la algemada.<br/>Source: ace_captives Синхронизируйте с юнитами, чтобы сделать их связанными.<br />Источник: ace_captives @@ -288,4 +290,4 @@ Rendición o desarme - \ No newline at end of file + diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp index 689ba5f19e..5dadfb322c 100644 --- a/addons/cargo/CfgEventHandlers.hpp +++ b/addons/cargo/CfgEventHandlers.hpp @@ -48,6 +48,11 @@ class Extended_InitPost_EventHandlers { init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); }; }; + class RoadCone_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; class Car { class ADDON { init = QUOTE(_this call DFUNC(initVehicle)); diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 56e3aee2c2..6565b7f4c5 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QFUNC(moduleSettings); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); @@ -236,7 +237,15 @@ class CfgVehicles { GVAR(size) = 6; }; - + // objects + class RoadCone_F: ThingX { + GVAR(size) = 1; + GVAR(canLoad) = 1; + }; + class RoadBarrier_F: RoadCone_F { + GVAR(size) = 2; + }; + class Scrapyard_base_F; class Land_PaperBox_closed_F: Scrapyard_base_F { diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index 2aeb3ab630..064c941d37 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -27,7 +27,7 @@ _unloaded = [_item, _vehicle] call FUNC(unloadItem); - _itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; + _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; // Show hint as feedback _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded; diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf index a790087b7f..a44cd0ebcf 100644 --- a/addons/cargo/functions/fnc_addCargoItem.sqf +++ b/addons/cargo/functions/fnc_addCargoItem.sqf @@ -18,12 +18,11 @@ */ #include "script_component.hpp" -private ["_position", "_item", "_i"]; params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ]; TRACE_3("params",_itemClass,_vehicle,_amount); for "_i" from 1 to _amount do { - [_item, _vehicle] call FUNC(loadItem); + [_itemClass, _vehicle] call FUNC(loadItem); }; // Invoke listenable event diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf index fda60aaf65..b446c4b589 100644 --- a/addons/cargo/functions/fnc_canLoadItemIn.sqf +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -23,7 +23,7 @@ if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false}; private ["_itemSize", "_validItem"]; _itemSize = [_item] call FUNC(getSizeItem); -if (typeName _item == "STRING") then { +if (_item isEqualType "") then { _validItem = isClass (configFile >> "CfgVehicles" >> _item) && {getNumber (configFile >> "CfgVehicles" >> _item >> QGVAR(canLoad)) == 1}; diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf index 8c741a5448..5c6acc44cc 100644 --- a/addons/cargo/functions/fnc_canUnloadItem.sqf +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -22,7 +22,7 @@ private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"]; _loaded = _vehicle getVariable [QGVAR(loaded), []]; if !(_item in _loaded) exitWith {false}; -_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; +_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; _validVehiclestate = true; _emptyPos = []; diff --git a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf index cae27a2d58..b858ebfddc 100644 --- a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf +++ b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf @@ -17,4 +17,4 @@ params ["_object"]; -_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _object >> QGVAR(space))] +_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(space))] diff --git a/addons/cargo/functions/fnc_getSizeItem.sqf b/addons/cargo/functions/fnc_getSizeItem.sqf index 807251365c..bf5e76dcdb 100644 --- a/addons/cargo/functions/fnc_getSizeItem.sqf +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -19,7 +19,7 @@ params ["_item"]; private ["_isVirtual","_itemClass","_config"]; scopeName "return"; -_isVirtual = (typeName _item == "STRING"); +_isVirtual = (_item isEqualType ""); _itemClass = if (_isVirtual) then {_item} else {typeOf _item}; _config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size)); diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf index 1022497719..8ddf59b21b 100644 --- a/addons/cargo/functions/fnc_handleDestroyed.sqf +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -24,7 +24,7 @@ if (_loaded isEqualTo []) exitWith {}; { // TODO Do we want to be able to recover destroyed equipment? - if (typeName _x == "OBJECT") then { + if (_x isEqualType objNull) then { deleteVehicle _x; }; } count _loaded; diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index 45746a93fd..22c78c4304 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -24,7 +24,7 @@ private ["_loaded", "_space", "_itemSize"]; if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false}; _loaded = _vehicle getVariable [QGVAR(loaded), []]; -_loaded pushback _item; +_loaded pushBack _item; _vehicle setVariable [QGVAR(loaded), _loaded, true]; TRACE_1("added to loaded array",_loaded); @@ -33,7 +33,7 @@ _space = [_vehicle] call FUNC(getCargoSpaceLeft); _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), _space - _itemSize, true]; -if (typeName _item == "OBJECT") then { +if (_item isEqualType objNull) then { detach _item; _item attachTo [_vehicle,[0,0,-100]]; ["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent); diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf index 85557835bf..f2abf79100 100644 --- a/addons/cargo/functions/fnc_onMenuOpen.sqf +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -40,7 +40,7 @@ uiNamespace setVariable [QGVAR(menuDisplay), _display]; lbClear _ctrl; { - _class = if (typeName _x == "STRING") then {_x} else {typeOf _x}; + _class = if (_x isEqualType "") then {_x} else {typeOf _x}; _ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName")); true } count _loaded; diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index 1ce5d62407..091c817f1e 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -23,7 +23,7 @@ _vehicle = [_player] call FUNC(findNearestVehicle); if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then { { if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x}; - } foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); + } forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); }; if (isNull _vehicle) exitWith {false}; diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index 013de1dc64..dc49e9d34b 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -41,7 +41,7 @@ if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then { [5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar); } else { - _itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; + _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); ["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index 81cca7154b..d9e8bf34be 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -23,7 +23,7 @@ if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith { false }; -_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item}; +_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; _validVehiclestate = true; _emptyPos = []; @@ -57,7 +57,7 @@ _space = [_vehicle] call FUNC(getCargoSpaceLeft); _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; -if (typeName _item == "OBJECT") then { +if (_item isEqualType objNull) then { detach _item; _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); ["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent); diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf index 7634b131e6..d5781067d1 100644 --- a/addons/cargo/functions/fnc_validateCargoSpace.sqf +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -24,7 +24,7 @@ _loaded = _vehicle getVariable [QGVAR(loaded), []]; _newLoaded = []; _totalSpaceOccupied = 0; { - if ((typeName _x == "STRING") || {!isNull _x}) then { + if ((_x isEqualType "") || {!isNull _x}) then { _newLoaded pushback _x; _totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem)); }; diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml index 4b33f9826b..2e3ffd648b 100644 --- a/addons/cargo/stringtable.xml +++ b/addons/cargo/stringtable.xml @@ -98,18 +98,22 @@ Loading Cargo Carregando carga + Ładowanie cargo Unloading Cargo Descarregando carga + Rozładowywanie cargo %1<br/>could not be loaded %1<br/>não pode ser carregado + %1<br/>nie mógł zostać załadowany %1<br/>could not be unloaded %1<br/>não pode ser descarregado + %1<br/>nie mógł zostać rozładowany \ No newline at end of file diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp index 7c5c9295f9..de1f7f7cf4 100644 --- a/addons/common/CfgVehicles.hpp +++ b/addons/common/CfgVehicles.hpp @@ -35,6 +35,7 @@ class CfgVehicles { function = QFUNC(moduleCheckPBOs); scope = 2; isGlobal = 1; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_CheckPBO_ca.paa)); class Arguments { class Action { diff --git a/addons/common/ProgressScreen.hpp b/addons/common/ProgressScreen.hpp index ab624669cf..57454dec78 100644 --- a/addons/common/ProgressScreen.hpp +++ b/addons/common/ProgressScreen.hpp @@ -41,7 +41,7 @@ class GVAR(ProgressBar_Dialog) { w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; colorFrame[] = {1,1,1,0.5}; - colorBar[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + colorBar[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.08])","(profilenamespace getVariable ['GUI_BCG_RGB_A',0.8])"}; texture = "#(argb,8,8,3)color(1,1,1,0.7)"; }; class TitleText: TitleBackground { diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index bad8a2b427..258bf51ec9 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -115,18 +115,18 @@ class RscDisplayInventory { // map class RscDisplayMainMap { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent);); }; class RscDisplayGetReady: RscDisplayMainMap { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Briefing')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Briefing')])] call FUNC(localEvent);); }; class RscDisplayServerGetReady: RscDisplayGetReady { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ServerBriefing')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ServerBriefing')])] call FUNC(localEvent);); }; class RscDisplayClientGetReady: RscDisplayGetReady { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ClientBriefing')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ClientBriefing')])] call FUNC(localEvent);); }; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 2c4a78254a..0ca9f51329 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -29,17 +29,16 @@ GVAR(nextFrameNo) = diag_frameno + 1; //Handle the waitUntilAndExec array: - private _deleted = 0; { // if condition is satisifed call statement if ((_x select 2) call (_x select 0)) then { // make sure to delete the correct handle when multiple conditions are met in one frame - GVAR(waitUntilAndExecArray) deleteAt (_forEachIndex - _deleted); - _deleted = _deleted + 1; + GVAR(waitUntilAndExecArray) deleteAt (GVAR(waitUntilAndExecArray) find _x); (_x select 2) call (_x select 1); }; - } forEach GVAR(waitUntilAndExecArray); - + nil + } count +GVAR(waitUntilAndExecArray); + END_COUNTER(waitAndExec); }, 0, []] call CBA_fnc_addPerFrameHandler; @@ -98,7 +97,6 @@ ["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler); ["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler); ["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler); -["assignTeam", {(_this select 0) assignTeam (_this select 1)}] call FUNC(addEventHandler); ["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler); if (isServer) then { @@ -194,9 +192,17 @@ call FUNC(checkFiles); ACE_LOGINFO("Settings received from server."); + if (isServer) then { //read settings from paramsArray + [] call FUNC(readSettingsFromParamsArray); + }; // Event so that ACE_Modules have their settings loaded: ["InitSettingsFromModules", []] call FUNC(localEvent); + if (isServer) then { + // Publish all settings data after all configs and modules are read + publicVariable QGVAR(settings); + }; + // Load user settings from profile if (hasInterface) then { call FUNC(loadSettingsFromProfile); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index a9b10c4896..3180eacb86 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -115,6 +115,7 @@ PREP(isInBuilding); PREP(isModLoaded); PREP(isPlayer); PREP(isTurnedOut); +PREP(isUnderwater); PREP(letterToCode); PREP(lightIntensityFromObject); PREP(loadPerson); @@ -139,6 +140,7 @@ PREP(playerSide); PREP(positionToASL); PREP(progressBar); PREP(readSettingFromModule); +PREP(readSettingsFromParamsArray); PREP(receiveRequest); PREP(removeCanInteractWithCondition); PREP(removeSpecificMagazine); @@ -166,6 +168,7 @@ PREP(setVariableJIP); PREP(setVariablePublic); PREP(setVolume); PREP(sortAlphabeticallyBy); +PREP(showHud); PREP(stringCompare); PREP(stringToColoredText); PREP(stringRemoveWhiteSpace); @@ -290,6 +293,7 @@ PREP(hashListSet); PREP(hashListPush); GVAR(syncedEvents) = HASH_CREATE; +GVAR(showHudHash) = [] call FUNC(hashCreate); //GVARS for execNextFrame and waitAndExec and waitUntilAndExecute GVAR(waitAndExecArray) = []; diff --git a/addons/common/config.cpp b/addons/common/config.cpp index f1bca395f8..c38c3fd3e7 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -88,7 +88,7 @@ class CfgUIGrids { // check dll class RscStandardDisplay; class RscDisplayMain: RscStandardDisplay { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayMain"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_5('header','tail',{0},{},_this select 0)] call COMPILE_FILE(functions\fnc_errorMessage)); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayMain"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); [ARR_5('header','tail',{0},{},_this select 0)] call COMPILE_FILE(functions\fnc_errorMessage)); }; */ diff --git a/addons/common/define.hpp b/addons/common/define.hpp index f1cc009864..98367e72ae 100644 --- a/addons/common/define.hpp +++ b/addons/common/define.hpp @@ -116,9 +116,9 @@ class ACE_gui_editBase }; colorSelection[] = { - "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", - "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", - "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", + "(profilenamespace getVariable ['GUI_BCG_RGB_R',0.3843])", + "(profilenamespace getVariable ['GUI_BCG_RGB_G',0.7019])", + "(profilenamespace getVariable ['GUI_BCG_RGB_B',0.8862])", 1 }; autocomplete = ""; @@ -249,7 +249,7 @@ class ACE_gui_listBoxBase : RscListBox{ colorSelect2[] = {0.95, 0.95, 0.95, 1}; colorSelectBackground[] = {0, 0, 0, 1}; colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1.0}; - colorDisabled[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.25}; + colorDisabled[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", 0.25}; period = 1.2; rowHeight = 0.03; colorBackground[] = {0, 0, 0, 1}; @@ -505,7 +505,7 @@ onMouseButtonDblClick = ""; iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa"; iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa"; iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa"; - color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"}; + color[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_A',0.8])"}; colorCreated[] = {1,1,1,1}; colorCanceled[] = {0.7,0.7,0.7,1}; colorDone[] = {0.7,1,0.3,1}; diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index 3ea516513f..a14ee2680e 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -32,7 +32,7 @@ if (isServer) then { private "_eventLog"; _eventLog = _internalData select 1; - _eventLog pushback [ACE_diagTime, _args, _ttl]; + _eventLog pushBack [ACE_diagTime, _args, _ttl]; }; }; diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf index 4d7d96bd44..ae04933cdd 100644 --- a/addons/common/functions/fnc_addActionEventHandler.sqf +++ b/addons/common/functions/fnc_addActionEventHandler.sqf @@ -17,11 +17,11 @@ params ["_unit", "_action", "_condition", "_statement"]; -if (typeName _condition == "STRING") then { +if (_condition isEqualType "") then { _condition = compile _condition; }; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf index 279842ae5c..d9beb977f7 100644 --- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf @@ -21,19 +21,19 @@ params ["_unit", "_displayName", "_action", "_condition", "_statement", "_condition2", "_statement2", ["_priority", 0]]; -if (typeName _condition == "STRING") then { +if (_condition isEqualType "") then { _condition = compile _condition; }; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; -if (typeName _condition2 == "STRING") then { +if (_condition2 isEqualType "") then { _condition2 = compile _condition2; }; -if (typeName _statement2 == "STRING") then { +if (_statement2 isEqualType "") then { _statement2 = compile _statement2; }; diff --git a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf index 95cce02e41..c739177288 100644 --- a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf +++ b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf @@ -18,6 +18,6 @@ _dlg = ctrlParent _this; _dlg displayAddEventHandler ["unload", { if (_this select 1 == 1) then { - [missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target", objNull]] call FUNC(fixCrateContent); + [missionnamespace getVariable ["BIS_fnc_initCuratorAttributes_target", objNull]] call FUNC(fixCrateContent); }; }]; diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf index 1e060f056a..05e23cf099 100644 --- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf @@ -14,7 +14,7 @@ params ["_statement"]; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf index df1601c95a..45f935812f 100644 --- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf @@ -15,7 +15,7 @@ params ["_statement"]; -if (typeName _statement == "STRING") then { +if (_statement isEqualType "") then { _statement = compile _statement; }; diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf index a09447a43a..edfeb1b709 100644 --- a/addons/common/functions/fnc_assignObjectsInList.sqf +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -22,14 +22,14 @@ params ["_list", "_variable", "_setting", "_global", ["_vehicle", false]]; -if (typeName _list == "STRING") then { +if (_list isEqualType "") then { _list = [_list, true, true] call FUNC(parseList); TRACE_1("Parsed",_list) }; { if (!isNil "_x") then { - if (typeName _x == typeName objNull) then { + if (_x isEqualType objNull) then { if (local _x) then { if (_vehicle) then { (vehicle _x) setVariable [_variable, _setting, _global]; diff --git a/addons/common/functions/fnc_blurScreen.sqf b/addons/common/functions/fnc_blurScreen.sqf index a3394a1fbf..2c6a17cbe3 100644 --- a/addons/common/functions/fnc_blurScreen.sqf +++ b/addons/common/functions/fnc_blurScreen.sqf @@ -16,7 +16,7 @@ if (!hasInterface) exitWith {}; params ["_id", ["_show", false]]; -if (typeName _show == "SCALAR") then { +if (_show isEqualType 0) then { _show = _show == 1; }; @@ -28,7 +28,7 @@ if (_show) then { GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushBack _id; // show blur - if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { + if (isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102]; GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectAdjust [0.9]; GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectEnable true; diff --git a/addons/common/functions/fnc_codeToString.sqf b/addons/common/functions/fnc_codeToString.sqf index 4a1b158f21..b2817cd2b8 100644 --- a/addons/common/functions/fnc_codeToString.sqf +++ b/addons/common/functions/fnc_codeToString.sqf @@ -14,7 +14,7 @@ params ["_function"]; -if (typeName _function == "STRING") exitWith {_function}; +if (_function isEqualType "") exitWith {_function}; _function = toArray str _function; _function deleteAt 0; diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf index 6430a7bb11..6dd1f04163 100644 --- a/addons/common/functions/fnc_debug.sqf +++ b/addons/common/functions/fnc_debug.sqf @@ -22,7 +22,7 @@ private ["_defaultLoglevel", "_defaultLogDisplayLevel"]; _defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL); -if (_defaultLoglevel < 0) exitwith {false}; +if (_defaultLoglevel < 0) exitWith {false}; _defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL); diff --git a/addons/common/functions/fnc_debugModule.sqf b/addons/common/functions/fnc_debugModule.sqf index 4f3da4d7cb..125887183e 100644 --- a/addons/common/functions/fnc_debugModule.sqf +++ b/addons/common/functions/fnc_debugModule.sqf @@ -14,5 +14,5 @@ params ["_entity"]; -GVAR(LOGDISPLAY_LEVEL) = call compile (_entity getvariable ["logDisplayLevel","4"]); -GVAR(LOGLEVEL) = call compile (_entity getvariable ["logLevel","4"]); +GVAR(LOGDISPLAY_LEVEL) = call compile (_entity getVariable ["logDisplayLevel","4"]); +GVAR(LOGLEVEL) = call compile (_entity getVariable ["logLevel","4"]); diff --git a/addons/common/functions/fnc_defineVariable.sqf b/addons/common/functions/fnc_defineVariable.sqf index 6ea15adc43..35a1e96d31 100644 --- a/addons/common/functions/fnc_defineVariable.sqf +++ b/addons/common/functions/fnc_defineVariable.sqf @@ -21,7 +21,7 @@ params ["_name", "_value", "_defaultGlobal", "_category", ["_code", 0], ["_persi if (isNil "_defaultGlobal") exitWith {}; -if (typeName _name != "STRING") exitwith { +if (!(_name isEqualType "")) exitwith { [format ["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug); }; diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf index 681ab946e0..16a80d6e3f 100644 --- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf +++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf @@ -22,7 +22,7 @@ private ["_validIndex", "_realIndex"]; _validIndex = -1; -if (typeName _searchOffsetOrName == "STRING") then { +if (_searchOffsetOrName isEqualType "") then { { if (_x select 0 == _searchOffsetOrName) exitWith { _validIndex = _forEachIndex; diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf index 8421f5be7e..23c5631fa6 100644 --- a/addons/common/functions/fnc_displayIcon.sqf +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -73,11 +73,11 @@ _refresh = { _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000]; _position = switch (_setting) do { - case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; - case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]}; - case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; - case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]}; - default {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]}; + case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]}; + default {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; }; _ctrl ctrlSetPosition _position; @@ -97,7 +97,7 @@ if (_show) then { _list pushBack [_iconId, _icon, _color, ACE_time]; } else { { - if (_x select 0 == _iconId) exitwith { + if (_x select 0 == _iconId) exitWith { _list set [_forEachIndex, [_iconId, _icon, _color, ACE_time]]; }; } forEach _list; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 3bdf908d16..a0bcb47e11 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -20,10 +20,10 @@ params ["_text", "_image", ["_imageColor", [1,1,1]], ["_target", ACE_player]]; if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - if (typeName _text == "ARRAY") then { + if (_text isEqualType []) then { if (count _text > 0) then { { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _text set [_forEachIndex, localize _x]; }; } forEach _text; @@ -32,7 +32,7 @@ if (typeName _text != "TEXT") then { }; }; - if (typeName _text == "STRING" && {isLocalized _text}) then { + if (_text isEqualType "" && {isLocalized _text}) then { _text = localize _text; }; diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 255a014b6f..ce088163a6 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -19,17 +19,17 @@ params ["_text", ["_size", 1.5], ["_target", ACE_player]]; if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - if (typeName _text == "ARRAY") then { + if (_text isEqualType []) then { if (count _text > 0) then { { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _text set [_foreachIndex, localize _x]; }; }foreach _text; _text = format _text; }; }; - if (typeName _text == "STRING" && {isLocalized _text}) then { + if (_text isEqualType "" && {isLocalized _text}) then { _text = localize _text; }; _text = composeText [lineBreak, parseText format ["%1", _text]]; @@ -48,10 +48,10 @@ _ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor); _ctrlHint ctrlSetTextColor GVAR(displayTextFontColor); /* // This does not function at the moment. Has been disabled until it fixed. -_xPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))]; -_yPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; -_wPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; -_hPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]; +_xPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))]; +_yPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; +_wPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; +_hPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]; */ _xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)); diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf index f06aa2d30d..aa2b872d47 100644 --- a/addons/common/functions/fnc_errorMessage.sqf +++ b/addons/common/functions/fnc_errorMessage.sqf @@ -31,7 +31,7 @@ if (isNull (call BIS_fnc_displayMission)) exitWith { params ["_textHeader", "_textMessage", ["_onOK", {}], ["_onCancel", {}]]; -if (typeName _textMessage == "STRING") then { +if (_textMessage isEqualType "") then { _textMessage = parseText _textMessage; }; @@ -92,7 +92,7 @@ _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _b _xPos set [1, _bottomPosY]; _x ctrlSetPosition _xPos; _x ctrlCommit 0; -} foreach [ +} forEach [ _ctrlBackgroundButtonOK, _ctrlBackgroundButtonMiddle, _ctrlBackgroundButtonCancel, diff --git a/addons/common/functions/fnc_execRemoteFnc.sqf b/addons/common/functions/fnc_execRemoteFnc.sqf index 0dd0653a33..02f957b501 100644 --- a/addons/common/functions/fnc_execRemoteFnc.sqf +++ b/addons/common/functions/fnc_execRemoteFnc.sqf @@ -27,7 +27,7 @@ TRACE_3("params", _arguments, _function, _unit); _function = call compile _function; -if (typeName _unit == "SCALAR") exitWith { +if (_unit isEqualType 0) exitWith { switch (_unit) do { case 0 : { _arguments call _function; diff --git a/addons/common/functions/fnc_executePersistent.sqf b/addons/common/functions/fnc_executePersistent.sqf index 3763d1bb58..d8f54995bd 100644 --- a/addons/common/functions/fnc_executePersistent.sqf +++ b/addons/common/functions/fnc_executePersistent.sqf @@ -18,7 +18,7 @@ params ["_target"]; if (isNil "_x") then { ACE_LOGERROR_1("No arguments and function for remote function. ID: %1",_forEachIndex); } else { - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { [_x select 0, _target] call (_x select 1); }; }; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 9b28786e43..2a4890c49c 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -41,8 +41,8 @@ _fnc_logEntries = { case (isClass _e1): {[_e1, _d + 1] call _fnc_logEntries; false}; }; - if (typeName _e2 != "BOOL") then { - if (typeName _e2 == "ARRAY") then { + if (!(_e2 isEqualType false)) then { + if (_e2 isEqualType []) then { _e2 = toArray str _e2; { if (_x == toArray "[" select 0) then { diff --git a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf index 18c8a18c72..7205a943d9 100644 --- a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf +++ b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf @@ -20,14 +20,14 @@ params ["_object", ["_category", ""]]; -if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {[]}; +if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitWith {[]}; private ["_return", "_val"]; _return = []; { - _val = _object getvariable (_x select 0); + _val = _object getVariable (_x select 0); if (!isNil "_val") then { if (_category == "" || _category == _x select 3) then { diff --git a/addons/common/functions/fnc_getDefinedVariable.sqf b/addons/common/functions/fnc_getDefinedVariable.sqf index c0d7ce8d83..ea22163622 100644 --- a/addons/common/functions/fnc_getDefinedVariable.sqf +++ b/addons/common/functions/fnc_getDefinedVariable.sqf @@ -16,7 +16,7 @@ params ["_unit", "_variable", "_defaultValue"]; private "_value"; -_value = _unit getvariable _variable; +_value = _unit getVariable _variable; if (isNil "_value") then { if (!isNil "_defaultValue") then { diff --git a/addons/common/functions/fnc_getDefinedVariableDefault.sqf b/addons/common/functions/fnc_getDefinedVariableDefault.sqf index 4bb4b12253..ba9ff20e23 100644 --- a/addons/common/functions/fnc_getDefinedVariableDefault.sqf +++ b/addons/common/functions/fnc_getDefinedVariableDefault.sqf @@ -17,7 +17,7 @@ params ["_varName"]; private "_variableDefinition"; _variableDefinition = [_varName] call FUNC(getDefinedVariableInfo); -if !(_variableDefinition isEqualTo []) exitwith { +if !(_variableDefinition isEqualTo []) exitWith { _variableDefinition select 1; }; diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index b0b9867cf7..aef415a54f 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -24,7 +24,7 @@ _hitPointsWithSelections = getAllHitPointsDamage _vehicle; // get correct format on vehicles without any hitpoints if (_hitPointsWithSelections isEqualTo []) then { - _hitPointsWithSelections = [[],[],[]]; + _hitPointsWithSelections = [[],[],[]]; }; _hitPointsWithSelections resize 2; diff --git a/addons/common/functions/fnc_inWater.sqf b/addons/common/functions/fnc_inWater.sqf index 7c8e2eee21..3b323469fc 100644 --- a/addons/common/functions/fnc_inWater.sqf +++ b/addons/common/functions/fnc_inWater.sqf @@ -1,29 +1,19 @@ /* * Author: Glowbal - * Check if unit is underwater + * Check if unit's head is underwater * * Arguments: * 0: Unit * * Return Value: - * if unit is in the water (BOOLEAN) + * If unit's head is underwater * * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -params ["_unit"]; +ACE_DEPRECATED("ace_common_fnc_inWater","3.5.0","ace_common_fnc_isUnderwater"); -private "_return"; -_return = false; - -if (surfaceIsWater getPosASL _unit) then { - private "_pos"; - _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); - - if (_pos select 2 < 0) then { - _return = true; - }; -}; - -_return +_this call FUNC(isUnderwater) diff --git a/addons/common/functions/fnc_isAwake.sqf b/addons/common/functions/fnc_isAwake.sqf index 8a123cfec9..1179ced02f 100644 --- a/addons/common/functions/fnc_isAwake.sqf +++ b/addons/common/functions/fnc_isAwake.sqf @@ -14,4 +14,4 @@ params ["_unit"]; -!(_unit getvariable ["ACE_isUnconscious", false]) && alive _unit && !(_unit getvariable ["ACE_isDead", false]) // return +!(_unit getVariable ["ACE_isUnconscious", false]) && alive _unit && !(_unit getVariable ["ACE_isDead", false]) // return diff --git a/addons/common/functions/fnc_isEngineer.sqf b/addons/common/functions/fnc_isEngineer.sqf index 9018149c27..01eabfc0b3 100644 --- a/addons/common/functions/fnc_isEngineer.sqf +++ b/addons/common/functions/fnc_isEngineer.sqf @@ -8,10 +8,17 @@ * Return Value: * is the unit an engineer * + * Example: + * [player] call ace_common_fnc_isEngineer + * * Public: Yes */ #include "script_component.hpp" params ["_unit"]; -_unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1] // return +private _isEngineer = _unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1]; +//Handle ace_repair modules setting this to a number +if (_isEngineer isEqualType 0) then {_isEngineer = _isEngineer > 0}; + +_isEngineer diff --git a/addons/common/functions/fnc_isModLoaded.sqf b/addons/common/functions/fnc_isModLoaded.sqf index e5f94b202d..cb62a90440 100644 --- a/addons/common/functions/fnc_isModLoaded.sqf +++ b/addons/common/functions/fnc_isModLoaded.sqf @@ -14,4 +14,4 @@ params ["_modName"]; -isClass (configFile >> "cfgPatches" >> _modName) // return +isClass (configFile >> "CfgPatches" >> _modName) // return diff --git a/addons/common/functions/fnc_isUnderwater.sqf b/addons/common/functions/fnc_isUnderwater.sqf new file mode 100644 index 0000000000..d2f399b770 --- /dev/null +++ b/addons/common/functions/fnc_isUnderwater.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Check if unit's head is underwater + * + * Arguments: + * 0: Unit + * + * Return Value: + * If unit's head is underwater + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit"]; + +private "_return"; +_return = false; + +if (surfaceIsWater getPosASL _unit) then { + private "_pos"; + _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); + + if (_pos select 2 < 0) then { + _return = true; + }; +}; + +_return diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index da729ed0d7..659d63224a 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -21,7 +21,7 @@ private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"]; _vehicle = objNull; -if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitwith {_vehicle}; +if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle}; _loadcar = nearestObject [_unit, "Car"]; diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index d4806d0c54..a596583a5c 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -27,7 +27,7 @@ // If the setting is stored on the profile if !(isNil "_profileValue") then { // If the profile variable has the correct type - if (typeName _profileValue == typeName (missionNamespace getVariable _name)) then { + if (_profileValue isEqualType (missionNamespace getVariable _name)) then { // Load the setting from the profile missionNamespace setVariable [_name, _profileValue]; }; diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf index 1e43359379..225c2d9675 100644 --- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf +++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf @@ -16,7 +16,7 @@ private "_fnc_parseConfigForDisplayNames"; _fnc_parseConfigForDisplayNames = { params ["_optionEntry"]; - if !(isClass _optionEntry) exitwith {false}; + if !(isClass _optionEntry) exitWith {false}; private "_values"; _values = getArray (_optionEntry >> "values"); @@ -30,17 +30,28 @@ _fnc_parseConfigForDisplayNames = { private "_text"; _text = _x; - if (typeName _text == "STRING" && {count _text > 1} && {_text select [0, 1] == "$"}) then { + if (_text isEqualType "" && {count _text > 1} && {_text select [0, 1] == "$"}) then { _text = localize (_text select [1]); //chop off the leading $ _values set [_forEachIndex, _text]; }; } forEach _values; + + if (!(_values isEqualTo [])) then { + if (_typeOf != "SCALAR") then { + ACE_LOGWARNING_2("Setting [%1] has values[] but is not SCALAR (%2)", _name, _typeOf); + } else { + private _value = missionNamespace getVariable [_name, -1]; + if ((_value < 0) || {_value >= (count _values)}) then { + ACE_LOGWARNING_3("Setting [%1] out of bounds %2 (values[] count is %3)(", _name, _value, count _values); + }; + }; + }; true }; // Iterate through settings { - _x params ["_name"]; + _x params ["_name", "_typeOf"]; if !([configFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then { if !([configFile >> "ACE_ServerSettings" >> _name] call _fnc_parseConfigForDisplayNames) then { diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index ea8257ec23..cdf8b48041 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -51,8 +51,6 @@ _fnc_parseConfigForSettings = { // mission side settings [missionConfigFile >> "ACE_Settings"] call _fnc_parseConfigForSettings; -// Publish all settings data -publicVariable QGVAR(settings); // Publish all setting values { publicVariable (_x select 0); diff --git a/addons/common/functions/fnc_onAnswerRequest.sqf b/addons/common/functions/fnc_onAnswerRequest.sqf index b1639eb970..2f7aef43a5 100644 --- a/addons/common/functions/fnc_onAnswerRequest.sqf +++ b/addons/common/functions/fnc_onAnswerRequest.sqf @@ -16,9 +16,9 @@ params ["_unit", "_id", "_accepted"]; private ["_requestID", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"]; -_info = _unit getvariable _id; +_info = _unit getVariable _id; -if (!isnil "_info") then { +if (!isNil "_info") then { _caller = _info select 0; _target = _info select 1; _requestID = _info select 2; @@ -26,16 +26,16 @@ if (!isnil "_info") then { _callBack = _info select 4; _replyParams = [_info, _accepted]; [_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc); - _unit setvariable [_id, nil]; + _unit setVariable [_id, nil]; }; GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil; -if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { +if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { _unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT); GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil; }; -if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { +if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { _unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE); GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil; }; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index d93273a0c3..170d0060c0 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -85,13 +85,13 @@ _fnc_perFrameFunction = { [_this select 1] call CBA_fnc_removePerFrameHandler; if (_errorCode == 0) then { - if (typeName _onFinish == "STRING") then { + if (_onFinish isEqualType "") then { [_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFinish; }; } else { - if (typeName _onFail == "STRING") then { + if (_onFail isEqualType "") then { [_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFail; diff --git a/addons/common/functions/fnc_readSettingsFromParamsArray.sqf b/addons/common/functions/fnc_readSettingsFromParamsArray.sqf new file mode 100644 index 0000000000..e158ae5c81 --- /dev/null +++ b/addons/common/functions/fnc_readSettingsFromParamsArray.sqf @@ -0,0 +1,63 @@ +/* + * Author: PabstMirror + * Read settins from paramsArray that have a ACE_setting = 1. + * Happens before modules but after all other configs (for force priority) + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_common_fnc_readSettingsFromParamsArray + * + * Public: No + */ +#include "script_component.hpp" + +//paramsArray is a normal variable not a command +private _paramsArray = missionnamespace getVariable ["paramsArray", []]; + +TRACE_1("Reading missionConfigFile params",_paramsArray); + +{ + private _config = (missionConfigFile >> "params") select _forEachIndex; + if ((getNumber (_config >> "ACE_setting")) > 0) then { + private _settingName = configName _config; + private _settingValue = _x; + private _title = getText (_config >> "title"); + + TRACE_3("ace_setting",_title,_settingName,_settingValue); + + // Check if the variable is already defined + if (isNil _settingName) exitWith { + ACE_LOGERROR_1("readSettingsFromParamsArray - param [%1] is not an ace_setting", _settingName); + }; + + private _settingData = [_settingName] call FUNC(getSettingData); + _settingData params ["", "_typeName", "", "", "", "", "_isForced"]; + + // Check if it's already forced and quit + if (_isForced) exitWith {ACE_LOGWARNING_1("readSettingsFromParamsArray - param [%1] is already set and forced", _settingName);}; + + // The setting is not forced, so update the value + // Read entry and cast it to the correct type from the existing variable + private _validValue = false; + switch (true) do { + case (_typeName == "SCALAR"): {_validValue = true;}; + case (_typeName == "BOOL"): { + _settingValue = _settingValue > 0; + _validValue = true; + }; + //TODO: Handle ARRAY,COLOR,STRING??? (bool/scalar covers most important settings) + }; + + if (!_validValue) exitWith { + ACE_LOGWARNING_3("readSettingsFromParamsArray - param [%1] type not valid [%2] - expected type [%3]", _settingName,_settingValue,_typeName); + }; + + // Update the variable globaly and Force + [_settingName, _settingValue, true, true] call FUNC(setSetting); + }; +} forEach _paramsArray; diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index 1377f4ec35..e5885d70ce 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -53,7 +53,7 @@ GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { private "_id"; _id = _target getVariable _requestID; - waituntil { + waitUntil { _id = _target getVariable _requestID; (ACE_time > _time || isNil "_id") diff --git a/addons/common/functions/fnc_resetAllDefaults.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf index c2ba1bee18..d9850ffd5b 100644 --- a/addons/common/functions/fnc_resetAllDefaults.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -14,8 +14,8 @@ params ["_unit"]; -_unit setvariable ["ACE_isDead", nil, true]; -_unit setvariable ["ACE_isUnconscious", nil, true]; +_unit setVariable ["ACE_isDead", nil, true]; +_unit setVariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { [true] call FUNC(setVolume); @@ -36,7 +36,7 @@ if (isPlayer _unit) then { { if !(_x select 4) then { - _unit setvariable [_x select 0, nil, _x select 3]; + _unit setVariable [_x select 0, nil, _x select 3]; }; false } count ([_unit] call FUNC(getAllDefinedSetVariables)); diff --git a/addons/common/functions/fnc_setDefinedVariable.sqf b/addons/common/functions/fnc_setDefinedVariable.sqf index 480632394c..9b7812ee82 100644 --- a/addons/common/functions/fnc_setDefinedVariable.sqf +++ b/addons/common/functions/fnc_setDefinedVariable.sqf @@ -1,6 +1,6 @@ /* * Author: Glowbal - * Setvariable value + * setVariable value * * Arguments: * 0: Unit @@ -23,7 +23,7 @@ if (isNil "_global") then { _definedVariable params ["", "", ["_global", false]]; }; -if (!isNil "_value") exitwith { +if (!isNil "_value") exitWith { _unit setVariable [_variable, _value, _global]; }; diff --git a/addons/common/functions/fnc_setParameter.sqf b/addons/common/functions/fnc_setParameter.sqf index dd946f7bc5..b24e2506b5 100644 --- a/addons/common/functions/fnc_setParameter.sqf +++ b/addons/common/functions/fnc_setParameter.sqf @@ -19,7 +19,7 @@ params ["_name", "_value"]; // Hack to keep backward compatibility for the moment if (typeName (missionNamespace getVariable _name) == "BOOL") then { - if (typeName _value == "SCALAR") then { + if (_value isEqualType 0) then { _value = _value > 0; }; }; diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 60b64e31d4..a2bd9e700e 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -13,27 +13,39 @@ * Return Value: * None * + * Example: + * ["ace_map_gestures_enabled", true, false, true] call ace_common_fnc_setSetting + * * Public: No */ #include "script_component.hpp" params ["_name", "_value", ["_force", false], ["_broadcastChanges", false]]; -private ["_settingData", "_failed"]; - -_settingData = [_name] call FUNC(getSettingData); +private _settingData = [_name] call FUNC(getSettingData); // Exit if the setting does not exist -if (count _settingData == 0) exitWith {}; +if (_settingData isEqualTo []) exitWith { + ACE_LOGERROR_1("SetSetting [%1] setting does not exist", _name); +}; + +_settingData params ["", "_typeName", "_isClientSetable", "", "", "", "_isForced"]; // Exit if the setting is already forced -if (_settingData select 6) exitWith {}; +if (_isForced) exitWith { + ACE_LOGINFO_1("SetSetting [%1] Trying to set forced setting", _name); +}; + +//This does NOT broadcast changes to GVAR(settings), so clients would not get updated force status +if ((missionNamespace getVariable [QEGVAR(modules,serverModulesRead), false]) && {!(_isForced isEqualTo _force)}) then { + ACE_LOGWARNING_3("SetSetting [%1] attempting to broadcast a change to force (%2 to %3)", _name, _isForced, _force); +}; // If the type is not equal, try to cast it -_failed = false; +private _failed = false; if (typeName _value != _settingData select 1) then { _failed = true; - if (_settingData select 1 == "BOOL" && typeName _value == "SCALAR") then { + if ((_typeName == "BOOL") && {_value isEqualType 0}) then { // If value is not 0 or 1 consider it invalid and don't set anything if (_value isEqualTo 0) then { _value = false; @@ -44,12 +56,12 @@ if (typeName _value != _settingData select 1) then { _failed = false; }; }; - if (_settingData select 1 == "COLOR" && typeName _value == "ARRAY") then { + if ((_typeName == "COLOR") && {_value isEqualType []}) then { _failed = false; }; }; -if (_failed) exitWith {}; +if (_failed) exitWith {ACE_LOGERROR_3("SetSetting [%1] bad data type expected %2 got %3", _name, _typeName, typeName _value);}; // Force it if it was required _settingData set [6, _force]; diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index 67dbd5fd2f..8dbaeffbd6 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -38,19 +38,16 @@ GVAR(setVariablePublicArray) pushBack [_object, _varName, _syncTime, _idName]; if (isNil QGVAR(setVariablePublicPFH)) exitWith {}; GVAR(setVariablePublicPFH) = [{ - private "_delete"; - _delete = 0; - { _x params ["_object", "_varName", "_syncTime", "_idName"]; if (ACE_diagTime > _syncTime) then { // set value public _object setVariable [_varName, _object getVariable _varName, true]; - GVAR(setVariablePublicArray) deleteAt _forEachIndex - _delete; - GVAR(setVariableNames) deleteAt _forEachIndex - _delete; - _delete = _delete + 1; + GVAR(setVariablePublicArray) deleteAt (GVAR(setVariablePublicArray) find _x); + GVAR(setVariableNames) deleteAt (GVAR(setVariableNames) find _x); }; - } forEach GVAR(setVariablePublicArray); + nil + } count +GVAR(setVariablePublicArray); if (GVAR(setVariablePublicArray) isEqualTo []) then { [GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/common/functions/fnc_showHud.sqf b/addons/common/functions/fnc_showHud.sqf new file mode 100644 index 0000000000..723c2436ed --- /dev/null +++ b/addons/common/functions/fnc_showHud.sqf @@ -0,0 +1,66 @@ +/* + * Author: PabstMirror + * Allows multiple sources to not overwrite showHud command + * Bitwise AND Logic (a single false in a mask will make it false) + * + * Arguments: + * 0: Source ID + * 1: Show Hud Bool Array (8 to set, empty to remove) + * - [hud, info, radar, compass, direction, menu, group, cursors] + * - hud: Boolean - show scripted HUD (same as normal showHUD true/false) + * - info: Boolean - show vehicle + soldier info (hides weapon info from the HUD as well) + * - radar: Boolean - show vehicle radar + * - compass: Boolean - show vehicle compass + * - direction: Boolean - show tank direction indicator (not present in vanilla Arma 3) + * - menu: Boolean - show commanding menu (hides HC related menus) + * - group: Boolean - show group info bar (hides squad leader info bar) + * - cursors: Boolean - show HUD weapon cursors (connected with scripted HUD) + * + * Return Value: + * Resulting ShowHud Array + * + * Example: + * ["hideHud", [false, true, true, true, true, true, true, false]] call ace_common_fnc_showHud; //This is equivalent to the old showHud false + * [] call ace_common_fnc_showHud; //sets `showHud` and returns the result array used + * + * Public: Yes + */ +#include "script_component.hpp" + +if (!hasInterface) exitWith {[-1]}; + +params [["_reason", "", [""]], ["_mask", [], [[]], [0,8]]]; + +if (isArray (missionConfigFile >> "showHUD")) then { + //(showHud = 0;) is fine - the array is the problem + ACE_LOGWARNING("showHUD[] in Description.ext breaks the showHud command"); +}; + +if (_reason != "") then { + _reason = toLower _reason; + if (_mask isEqualTo []) then { + TRACE_2("Setting", _reason, _mask); + [GVAR(showHudHash), _reason] call FUNC(hashRem); + } else { + TRACE_2("Removing", _reason, _mask); + [GVAR(showHudHash), _reason, _mask] call FUNC(hashSet); + }; +}; + +GVAR(showHudHash) params ["_reasons", "_masks"]; +private _resultMask = []; + +for "_index" from 0 to 7 do { + private _set = true; //Default to true + { + if (!(_x select _index)) exitWith { + _set = false; //Any false will make it false + }; + } forEach _masks; + _resultMask pushBack _set; +}; + +TRACE_2("showHud", _resultMask, _reasons); +showHud _resultMask; + +_resultMask diff --git a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf index 287c4566d5..9bbec92d40 100644 --- a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf +++ b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf @@ -25,8 +25,8 @@ _elements = []; { _theElement = toArray (_x select _elementN); - _indexes pushback _foreachIndex; - _elements pushback _theElement; + _indexes pushBack _forEachIndex; + _elements pushBack _theElement; } forEach _array; for "_i" from 1 to (count _elements) - 1 do { @@ -45,7 +45,7 @@ for "_i" from 1 to (count _elements) - 1 do { _returnArray = []; { - _returnArray pushback (_array select _x); + _returnArray pushBack (_array select _x); } forEach _indexes; _returnArray diff --git a/addons/common/functions/fnc_switchToGroupSide.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf index 95f17a9c7b..7d23e6442a 100644 --- a/addons/common/functions/fnc_switchToGroupSide.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -18,7 +18,7 @@ params [["_unit", objNull], ["_switch", false], ["_id", ""], ["_side", side _unit]]; private "_previousGroupsList"; -_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo), []]; +_previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []]; if (_switch) then { // go forward @@ -27,7 +27,7 @@ if (_switch) then { _previousGroup = group _unit; _originalSide = side group _unit; - if (count units _previousGroup == 1 && _originalSide == _side) exitwith { + if (count units _previousGroup == 1 && _originalSide == _side) exitWith { [format ["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug); }; @@ -41,7 +41,7 @@ if (_switch) then { private ["_currentGroup", "_newGroup"]; { - if (_id == (_x select 2)) exitwith { + if (_id == (_x select 2)) exitWith { _x set [ 3, false]; _previousGroupsList set [_forEachIndex, _x]; [format["found group with ID: %1", _id]] call FUNC(debug); @@ -51,7 +51,7 @@ if (_switch) then { reverse _previousGroupsList; { - if (_x select 3) exitwith {}; // stop at first id set to true + if (_x select 3) exitWith {}; // stop at first id set to true if !(_x select 3) then { _currentGroup = group _unit; if (!isNull (_x select 0)) then { diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf index 923e445839..1b2f634ace 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -35,7 +35,7 @@ if (!isServer) exitWith {false}; _eventEntry = _x; _ttlReturn = true; - if (typeName _globalEventTTL == "CODE") then { + if (_globalEventTTL isEqualType {}) then { _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; } else { _ttlReturn = call {_globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL}}; @@ -45,7 +45,7 @@ if (!isServer) exitWith {false}; // Do event based TTL check _eventEntry params ["_time", "", "_eventTTL"]; - if (typeName _eventTTL == "CODE") then { + if (_eventTTL isEqualType {}) then { _ttlReturn = [_eventTime, _eventEntry] call _eventTTL; } else { _ttlReturn = call {_eventTTL < 1 || {ACE_diagTime < _time + _eventTTL}}; diff --git a/addons/common/functions/fnc_toNumber.sqf b/addons/common/functions/fnc_toNumber.sqf index 6b1aacde1e..c375dfb02e 100644 --- a/addons/common/functions/fnc_toNumber.sqf +++ b/addons/common/functions/fnc_toNumber.sqf @@ -17,6 +17,6 @@ params ["_value"]; -if (typeName _value == "SCALAR") exitWith {_value}; +if (_value isEqualType 0) exitWith {_value}; parseNumber _value // return diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf index 0ab65a5983..73e02cd7ce 100644 --- a/addons/common/functions/fnc_unloadPerson.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -24,7 +24,7 @@ if (_vehicle == _unit) exitWith {false}; if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false}; private "_emptyPos"; -_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]; // @todo to small? +_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeOf _unit]; // @todo to small? if (count _emptyPos == 0) exitWith {false}; diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index 67d104a9e4..6a42d8ea11 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -27,7 +27,7 @@ if (_vehicle isKindOf "Ship") then { TRACE_1("SHIP Ground Check",getPos _vehicle); - _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeof _unit]; // TODO: if spot is underwater pick another spot. + _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeOf _unit]; // TODO: if spot is underwater pick another spot. } else { if (_vehicle isKindOf "Air") then { if (speed _vehicle > 1 || {isTouchingGround _vehicle}) then { @@ -45,18 +45,18 @@ if (_vehicle isKindOf "Ship") then { TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeof _unit]; + _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeOf _unit]; }; }; TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); -if !(_validVehiclestate) exitwith { +if !(_validVehiclestate) exitWith { ACE_LOGWARNING_4("Unable to unload patient because invalid (%1) vehicle state. Either moving or Not close enough on the ground. position: %2 isTouchingGround: %3 Speed: %4",_vehicle,getPos _vehicle,isTouchingGround _vehicle,speed _vehicle); false }; -if (count _emptyPos == 0) exitwith { +if (count _emptyPos == 0) exitWith { ACE_LOGWARNING_1("No safe empty spots to unload patient. %1",_emptyPos); false }; //consider displaying text saying there are no safe places to exit the vehicle @@ -95,9 +95,9 @@ _unit action ["Eject", vehicle _unit]; [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); -_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; +_loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; _loaded deleteAt (_loaded find _unit); -_vehicle setvariable [QGVAR(loaded_persons), _loaded, true]; +_vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; true diff --git a/addons/concertina_wire/functions/fnc_dismount.sqf b/addons/concertina_wire/functions/fnc_dismount.sqf index c7ba3f50b1..6e8ae8f4f5 100644 --- a/addons/concertina_wire/functions/fnc_dismount.sqf +++ b/addons/concertina_wire/functions/fnc_dismount.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" // If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine -if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith { +if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitWith { [{ _this call FUNC(dismount); }, _this] call EFUNC(common,execNextFrame); diff --git a/addons/concertina_wire/functions/fnc_vehicleDamage.sqf b/addons/concertina_wire/functions/fnc_vehicleDamage.sqf index 41050eb9b9..5d04e3dc5d 100644 --- a/addons/concertina_wire/functions/fnc_vehicleDamage.sqf +++ b/addons/concertina_wire/functions/fnc_vehicleDamage.sqf @@ -57,7 +57,7 @@ if (_mode == 0) then { if (count _no > 0) exitWith { _found = true; //diag_log "found"; }; - } foreach _wireCheckPosAr; + } forEach _wireCheckPosAr; // Double coil found! if (_found) then { _mode = 1; diff --git a/addons/dagr/functions/fnc_outputVector.sqf b/addons/dagr/functions/fnc_outputVector.sqf index 7f36facae8..ef93a53d8a 100644 --- a/addons/dagr/functions/fnc_outputVector.sqf +++ b/addons/dagr/functions/fnc_outputVector.sqf @@ -29,7 +29,7 @@ private ["_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevati __background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa)); -if (GVAR(noVectorData)) exitwith {}; +if (GVAR(noVectorData)) exitWith {}; GVAR(LAZPOS) params ["_lazPosX", "_lazPosY", "_lazPosZ"]; // Incase grids go neg due to 99-00 boundry diff --git a/addons/dagr/initKeybinds.sqf b/addons/dagr/initKeybinds.sqf index 4575401feb..66bd08190e 100644 --- a/addons/dagr/initKeybinds.sqf +++ b/addons/dagr/initKeybinds.sqf @@ -14,7 +14,7 @@ true }, {false}, -[0, [false, true, false]], false] call cba_fnc_addKeybind; // (empty default key) +[0, [false, true, false]], false] call CBA_fnc_addKeybind; // (empty default key) ["ACE3 Equipment", QGVAR(ToggleKey), "Toggle DAGR", { @@ -27,7 +27,7 @@ true }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; // (empty default key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; // (empty default key) //Add deviceKey entry: private ["_conditonCode", "_toggleCode", "_closeCode"]; diff --git a/addons/disarming/functions/fnc_openDisarmDialog.sqf b/addons/disarming/functions/fnc_openDisarmDialog.sqf index c2a3a6396e..c18b3ab7ac 100644 --- a/addons/disarming/functions/fnc_openDisarmDialog.sqf +++ b/addons/disarming/functions/fnc_openDisarmDialog.sqf @@ -20,7 +20,7 @@ params ["_caller", "_target"]; private "_display"; #define DEFUALTPATH "\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa" //Sanity Checks -if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");}; +if (_caller != ACE_player) exitWith {ERROR("Player isn't caller?");}; if (!([_player, _target] call FUNC(canPlayerDisarmUnit))) exitWith {ERROR("Can't Disarm Unit");}; if (dialog) then {ERROR("Dialog open when trying to open disarm dialog"); closeDialog 0;}; diff --git a/addons/disarming/gui_disarm.hpp b/addons/disarming/gui_disarm.hpp index 0961b809ed..1863eb9b0b 100644 --- a/addons/disarming/gui_disarm.hpp +++ b/addons/disarming/gui_disarm.hpp @@ -33,13 +33,13 @@ class GVAR(remoteInventory) { fadeout = 0; class Colors { - dragValidBgr[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",0.5}; - dragInvalidBgr[] = {"(profilenamespace getvariable ['IGUI_ERROR_RGB_R',0.8])","(profilenamespace getvariable ['IGUI_ERROR_RGB_G',0.0])","(profilenamespace getvariable ['IGUI_ERROR_RGB_B',0.0])",0.5}; - dragValidBar[] = {"(profilenamespace getvariable ['IGUI_WARNING_RGB_R',0.8])","(profilenamespace getvariable ['IGUI_WARNING_RGB_G',0.5])","(profilenamespace getvariable ['IGUI_WARNING_RGB_B',0.0])",0.5}; - dragInvalidBar[] = {"(profilenamespace getvariable ['IGUI_ERROR_RGB_R',0.8])","(profilenamespace getvariable ['IGUI_ERROR_RGB_G',0.0])","(profilenamespace getvariable ['IGUI_ERROR_RGB_B',0.0])",0.5}; - progressBar[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",1}; - progressBarBgr[] = {"(profilenamespace getvariable ['IGUI_BCG_RGB_R',0])","(profilenamespace getvariable ['IGUI_BCG_RGB_G',1])","(profilenamespace getvariable ['IGUI_BCG_RGB_B',1])",0.75}; - highlight[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",0.5}; + dragValidBgr[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])",0.5}; + dragInvalidBgr[] = {"(profilenamespace getVariable ['IGUI_ERROR_RGB_R',0.8])","(profilenamespace getVariable ['IGUI_ERROR_RGB_G',0.0])","(profilenamespace getVariable ['IGUI_ERROR_RGB_B',0.0])",0.5}; + dragValidBar[] = {"(profilenamespace getVariable ['IGUI_WARNING_RGB_R',0.8])","(profilenamespace getVariable ['IGUI_WARNING_RGB_G',0.5])","(profilenamespace getVariable ['IGUI_WARNING_RGB_B',0.0])",0.5}; + dragInvalidBar[] = {"(profilenamespace getVariable ['IGUI_ERROR_RGB_R',0.8])","(profilenamespace getVariable ['IGUI_ERROR_RGB_G',0.0])","(profilenamespace getVariable ['IGUI_ERROR_RGB_B',0.0])",0.5}; + progressBar[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])",1}; + progressBarBgr[] = {"(profilenamespace getVariable ['IGUI_BCG_RGB_R',0])","(profilenamespace getVariable ['IGUI_BCG_RGB_G',1])","(profilenamespace getVariable ['IGUI_BCG_RGB_B',1])",0.75}; + highlight[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])",0.5}; }; class controlsBackground {}; diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index ec56f42ff4..f0cee0a048 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -52,7 +52,7 @@ if !([_unit] call EFUNC(common,isPlayer)) then { //don't do anything until projectile is null (exploded/max range) if (isNull _projectile) then { //Remove PFEH: - [_idPFH] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; //If (tube is dropped) OR (is dead) OR (is player) just exit if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {}; diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index d4d791724b..b7128341bb 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -84,6 +84,22 @@ class CfgVehicles { GVAR(canDrag) = 0; }; + // Barrier + class RoadCone_F: thingX { + XEH_ENABLED; + GVAR(canCarry) = 1; + GVAR(carryPosition[]) = {0,1,1}; + GVAR(carryDirection) = 0; + + GVAR(canDrag) = 1; + GVAR(dragPosition[]) = {0,1.2,0}; + GVAR(dragDirection) = 0; + }; + + class RoadBarrier_F: RoadCone_F { + GVAR(carryPosition[]) = {0,1,0.300671}; + }; + class ACE_RepairItem_Base: ThingX {}; class ACE_Track: ACE_RepairItem_Base { diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 6ee28edff3..1f5e9f68aa 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -21,4 +21,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; // a static weapon has to be empty for dragging (ignore UAV AI) if (((typeOf _target) isKindOf "StaticWeapon") && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; -alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})} +alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})} diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index 58c4718407..d96c0dd5da 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -24,4 +24,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; // a static weapon has to be empty for dragging (ignore UAV AI) if ((typeOf _target) isKindOf "StaticWeapon" && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; -alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; +alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 9da1656b8b..aad30ec234 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -22,7 +22,7 @@ params ["_unit", "_target"]; private "_inBuilding"; _inBuilding = [_unit] call FUNC(isObjectOnObject); -if !(_unit getvariable ["ACE_isUnconscious", false]) then { +if !(_unit getVariable ["ACE_isUnconscious", false]) then { // play release animation _unit playAction "released"; }; @@ -63,7 +63,7 @@ if !(_target isKindOf "CAManBase") then { ["fixFloating", _target, _target] call EFUNC(common,targetEvent); }; -if (_unit getvariable ["ACE_isUnconscious", false]) then { +if (_unit getVariable ["ACE_isUnconscious", false]) then { [_unit, "unconscious", 2, true] call EFUNC(common,doAnimation); }; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 300846bc6c..c9c34c82a0 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -31,7 +31,7 @@ detach _target; // fix anim when aborting carrying persons if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then { - if (vehicle _unit == _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { + if (vehicle _unit == _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { [_unit, "", 2, true] call EFUNC(common,doAnimation); }; diff --git a/addons/dragging/functions/fnc_getWeight.sqf b/addons/dragging/functions/fnc_getWeight.sqf index dcdcbbf3fe..0fbee19d41 100644 --- a/addons/dragging/functions/fnc_getWeight.sqf +++ b/addons/dragging/functions/fnc_getWeight.sqf @@ -39,7 +39,7 @@ _totalWeight = 0; ]; // add Weight of create to totalWeight -_totalWeight = _totalWeight + (getNumber (configFile >> "CfgVehicles" >> typeof _object >> "mass")); +_totalWeight = _totalWeight + (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> "mass")); // Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of). _totalWeight * 0.5 diff --git a/addons/explosives/CfgModule.hpp b/addons/explosives/CfgModule.hpp index a27efae704..b651903f59 100644 --- a/addons/explosives/CfgModule.hpp +++ b/addons/explosives/CfgModule.hpp @@ -6,6 +6,7 @@ class ACE_ModuleExplosive: ACE_Module { function = QUOTE(FUNC(module)); scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Explosives_ca.paa); class Arguments { class RequireSpecialist { diff --git a/addons/explosives/ExplosivesUI.hpp b/addons/explosives/ExplosivesUI.hpp index 6e6374af12..45582a8564 100644 --- a/addons/explosives/ExplosivesUI.hpp +++ b/addons/explosives/ExplosivesUI.hpp @@ -19,9 +19,9 @@ class Rsc_ACE_CallScreen_Edit:RscEdit { colorText[] = {0,0,0,1}; colorDisabled[] = {1,1,1,0.25}; colorSelection[] = { - "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])", - "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])", - "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", + "(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])", + "(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])", + "(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", 1 }; text = ""; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index b6dc5049d9..af105b5879 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -43,7 +43,7 @@ GVAR(CurrentSpeedDial) = 0; GVAR(placeAction) = PLACE_CANCEL; }; - //Show defuse actions on cfgAmmos (allMines): + //Show defuse actions on CfgAmmos (allMines): _this call FUNC(interactEH); }] call EFUNC(common,addEventHandler); diff --git a/addons/explosives/functions/fnc_addToSpeedDial.sqf b/addons/explosives/functions/fnc_addToSpeedDial.sqf index bf409d5462..7ad0fe76da 100644 --- a/addons/explosives/functions/fnc_addToSpeedDial.sqf +++ b/addons/explosives/functions/fnc_addToSpeedDial.sqf @@ -29,7 +29,7 @@ if ((_code) == "") exitWith { }; { if ((_x select 0) == _name) exitWith { - _speedDial set [_foreachindex, _this]; + _speedDial set [_forEachIndex, _this]; _found = true; }; } forEach _speedDial; diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index 74e4dfca11..d204ad7bad 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -30,10 +30,10 @@ _result = true; if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false}; -if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then { +if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then { private ["_exp", "_previousExp"]; _previousExp = _item select 0; - _exp = getText (ConfigFile >> "CfgAmmo" >> typeof (_previousExp) >> "ACE_Explosive"); + _exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> "ACE_Explosive"); if (_exp != "") then { _exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"]; _exp setDir (getDir _previousExp); diff --git a/addons/explosives/functions/fnc_dialingPhone.sqf b/addons/explosives/functions/fnc_dialingPhone.sqf index cb9d7f5450..bc57ddd4b2 100644 --- a/addons/explosives/functions/fnc_dialingPhone.sqf +++ b/addons/explosives/functions/fnc_dialingPhone.sqf @@ -30,7 +30,7 @@ private "_explosive"; _explosive = [_code] call FUNC(getSpeedDialExplosive); if (_i >= (count _arr + 2)) then { - [_pfID] call CALLSTACK(cba_fnc_removePerFrameHandler); + [_pfID] call CALLSTACK(CBA_fnc_removePerFrameHandler); if ((count _explosive) > 0) then { [_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive); }; diff --git a/addons/explosives/functions/fnc_getPlacedExplosives.sqf b/addons/explosives/functions/fnc_getPlacedExplosives.sqf index 56334af65b..e2e56824ec 100644 --- a/addons/explosives/functions/fnc_getPlacedExplosives.sqf +++ b/addons/explosives/functions/fnc_getPlacedExplosives.sqf @@ -44,9 +44,9 @@ _list = []; if (_adjustedList) then { _clackerList = _clackerList - ["X"]; if (count _clackerList == 0) then { - _unit SetVariable [QGVAR(Clackers), nil, true]; + _unit setVariable [QGVAR(Clackers), nil, true]; } else { - _unit SetVariable [QGVAR(Clackers), _clackerList, true]; + _unit setVariable [QGVAR(Clackers), _clackerList, true]; }; }; diff --git a/addons/explosives/functions/fnc_onInventoryChanged.sqf b/addons/explosives/functions/fnc_onInventoryChanged.sqf index 3e3e1b96d3..127cd8c105 100644 --- a/addons/explosives/functions/fnc_onInventoryChanged.sqf +++ b/addons/explosives/functions/fnc_onInventoryChanged.sqf @@ -29,7 +29,7 @@ _config = ConfigFile >> "CfgWeapons" >> _item; if (isClass _config && {getNumber(_config >> "ACE_Detonator") == 1}) then { private ["_clackerItems"]; _clackerItems = _giver getVariable [QGVAR(Clackers), []]; - _receiver SetVariable [QGVAR(Clackers), (_receiver getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; + _receiver setVariable [QGVAR(Clackers), (_receiver getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; _detonators = [_giver] call FUNC(getDetonators); if (count _detonators == 0) then { diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index 5e4999b1f4..e1cdbcd80c 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -62,8 +62,8 @@ if (isNumber (_magazineTrigger >> "digDistance")) then { _canDigDown = true; _surfaceType = surfaceType _pos; if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];}; - if ((_surfaceType != "") || {isClass (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then { - _soundEnviron = getText (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron"); + if ((_surfaceType != "") || {isClass (configFile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then { + _soundEnviron = getText (configFile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron"); TRACE_2("Dig Down Surface",_surfaceType,_soundEnviron); _canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]); }; diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 1b2443b44a..37390c0b47 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -210,3 +210,11 @@ if(_playSound) then { if(_showHint) then { [format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured); }; + +//Update the hud's distance display to the new value or "----" if out of range +//(10m fudge because of EFUNC(common,getTargetDistance)) +if ((_distance + 10) >= (getNumber (_turretConfig >> QGVAR(MaxDistance)))) then { + ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----"; +} else { + ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber); +}; diff --git a/addons/fcs/functions/script_component.hpp b/addons/fcs/functions/script_component.hpp index 8ada0f7a71..179c66c15e 100644 --- a/addons/fcs/functions/script_component.hpp +++ b/addons/fcs/functions/script_component.hpp @@ -1,12 +1 @@ -#define COMPONENT fcs -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_FCS - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_FCS - #define DEBUG_SETTINGS DEBUG_SETTINGS_FCS -#endif - -#include "\z\ace\addons\main\script_macros.hpp" +#include "\z\ace\addons\fcs\script_component.hpp" \ No newline at end of file diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index 3b22cb2262..a302776741 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -28,7 +28,7 @@ [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp); false }, -[15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key +[15, [false, false, false]], false] call CBA_fnc_addKeybind; //Tab Key ["ACE3 Vehicles", QGVAR(adjustRangeUp), localize LSTRING(AdjustRangeUp), { @@ -42,7 +42,7 @@ true }, {false}, -[201, [false, false, false]], false] call cba_fnc_addKeybind; //PageUp Key +[201, [false, false, false]], false] call CBA_fnc_addKeybind; //PageUp Key ["ACE3 Vehicles", QGVAR(adjustRangDown), localize LSTRING(AdjustRangeDown), { @@ -56,4 +56,4 @@ true }, {false}, -[209, [false, false, false]], false] call cba_fnc_addKeybind; //PageDown Key +[209, [false, false, false]], false] call CBA_fnc_addKeybind; //PageDown Key diff --git a/addons/finger/CfgVehicles.hpp b/addons/finger/CfgVehicles.hpp index 99d9713f00..e78ef50123 100644 --- a/addons/finger/CfgVehicles.hpp +++ b/addons/finger/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { icon = QUOTE(PATHTOF(UI\Icon_Module_finger_ca.paa)); function = QFUNC(moduleSettings); isGlobal = 0; + isSingular = 1; author = ECSTRING(common,ACETeam); class Arguments { class enabled { diff --git a/addons/finger/XEH_postInit.sqf b/addons/finger/XEH_postInit.sqf index 5d2fa5a261..394c0cfd3b 100644 --- a/addons/finger/XEH_postInit.sqf +++ b/addons/finger/XEH_postInit.sqf @@ -19,5 +19,5 @@ GVAR(pfeh_id) = -1; _this call FUNC(keyPress); }, {false}, - [41, [true, false, false]], true] call cba_fnc_addKeybind; // Shift + Tilda (hold) + [41, [true, false, false]], true] call CBA_fnc_addKeybind; // Shift + Tilda (hold) }] call EFUNC(common,addEventHandler); diff --git a/addons/frag/CfgAmmoReflections.hpp b/addons/frag/CfgAmmoReflections.hpp index f59d67f89a..0331dd41dd 100644 --- a/addons/frag/CfgAmmoReflections.hpp +++ b/addons/frag/CfgAmmoReflections.hpp @@ -1,6 +1,65 @@ //CfgAmmoReflections.hpp -#define ACE_EXPLOSION_REFLECTION(range, hit) class ace_explosion_reflection_##range##_##hit : ace_explosion_reflection_base { indirectHitRange = range; indirectHit = hit; dangerRadiusHit = range*3; suppressionRadiusHit = range*2; }; +#define ACE_EXPLOSION_REFLECTION(range, hit)\ +class ace_explosion_reflection_##range##_##hit : ace_explosion_reflection_base {\ + indirectHitRange = range;\ + indirectHit = hit;\ + dangerRadiusHit = range*3;\ + suppressionRadiusHit = range*2;\ +} + +#define ACE_EXPLOSION_RANGE(range)\ + ACE_EXPLOSION_REFLECTION(range,10);\ + ACE_EXPLOSION_REFLECTION(range,20);\ + ACE_EXPLOSION_REFLECTION(range,30);\ + ACE_EXPLOSION_REFLECTION(range,40);\ + ACE_EXPLOSION_REFLECTION(range,50);\ + ACE_EXPLOSION_REFLECTION(range,60);\ + ACE_EXPLOSION_REFLECTION(range,70);\ + ACE_EXPLOSION_REFLECTION(range,80);\ + ACE_EXPLOSION_REFLECTION(range,90);\ + ACE_EXPLOSION_REFLECTION(range,100);\ + ACE_EXPLOSION_REFLECTION(range,110);\ + ACE_EXPLOSION_REFLECTION(range,120);\ + ACE_EXPLOSION_REFLECTION(range,130);\ + ACE_EXPLOSION_REFLECTION(range,140);\ + ACE_EXPLOSION_REFLECTION(range,150);\ + ACE_EXPLOSION_REFLECTION(range,160);\ + ACE_EXPLOSION_REFLECTION(range,170);\ + ACE_EXPLOSION_REFLECTION(range,180);\ + ACE_EXPLOSION_REFLECTION(range,190);\ + ACE_EXPLOSION_REFLECTION(range,200);\ + ACE_EXPLOSION_REFLECTION(range,210);\ + ACE_EXPLOSION_REFLECTION(range,220);\ + ACE_EXPLOSION_REFLECTION(range,230);\ + ACE_EXPLOSION_REFLECTION(range,240);\ + ACE_EXPLOSION_REFLECTION(range,250);\ + ACE_EXPLOSION_REFLECTION(range,260);\ + ACE_EXPLOSION_REFLECTION(range,270);\ + ACE_EXPLOSION_REFLECTION(range,280);\ + ACE_EXPLOSION_REFLECTION(range,290);\ + ACE_EXPLOSION_REFLECTION(range,300);\ + ACE_EXPLOSION_REFLECTION(range,310);\ + ACE_EXPLOSION_REFLECTION(range,320);\ + ACE_EXPLOSION_REFLECTION(range,330);\ + ACE_EXPLOSION_REFLECTION(range,340);\ + ACE_EXPLOSION_REFLECTION(range,350);\ + ACE_EXPLOSION_REFLECTION(range,360);\ + ACE_EXPLOSION_REFLECTION(range,370);\ + ACE_EXPLOSION_REFLECTION(range,380);\ + ACE_EXPLOSION_REFLECTION(range,390);\ + ACE_EXPLOSION_REFLECTION(range,400);\ + ACE_EXPLOSION_REFLECTION(range,410);\ + ACE_EXPLOSION_REFLECTION(range,420);\ + ACE_EXPLOSION_REFLECTION(range,430);\ + ACE_EXPLOSION_REFLECTION(range,440);\ + ACE_EXPLOSION_REFLECTION(range,450);\ + ACE_EXPLOSION_REFLECTION(range,460);\ + ACE_EXPLOSION_REFLECTION(range,470);\ + ACE_EXPLOSION_REFLECTION(range,480);\ + ACE_EXPLOSION_REFLECTION(range,490);\ + ACE_EXPLOSION_REFLECTION(range,500) + class ace_explosion_reflection_base : Sh_120mm_HE { CraterWaterEffects = ""; CraterEffects = ""; @@ -19,2504 +78,53 @@ class ace_explosion_reflection_base : Sh_120mm_HE { craterShape = "\A3\weapons_f\empty.p3d"; }; -ACE_EXPLOSION_REFLECTION(2,10); -ACE_EXPLOSION_REFLECTION(2,20); -ACE_EXPLOSION_REFLECTION(2,30); -ACE_EXPLOSION_REFLECTION(2,40); -ACE_EXPLOSION_REFLECTION(2,50); -ACE_EXPLOSION_REFLECTION(2,60); -ACE_EXPLOSION_REFLECTION(2,70); -ACE_EXPLOSION_REFLECTION(2,80); -ACE_EXPLOSION_REFLECTION(2,90); -ACE_EXPLOSION_REFLECTION(2,100); -ACE_EXPLOSION_REFLECTION(2,110); -ACE_EXPLOSION_REFLECTION(2,120); -ACE_EXPLOSION_REFLECTION(2,130); -ACE_EXPLOSION_REFLECTION(2,140); -ACE_EXPLOSION_REFLECTION(2,150); -ACE_EXPLOSION_REFLECTION(2,160); -ACE_EXPLOSION_REFLECTION(2,170); -ACE_EXPLOSION_REFLECTION(2,180); -ACE_EXPLOSION_REFLECTION(2,190); -ACE_EXPLOSION_REFLECTION(2,200); -ACE_EXPLOSION_REFLECTION(2,210); -ACE_EXPLOSION_REFLECTION(2,220); -ACE_EXPLOSION_REFLECTION(2,230); -ACE_EXPLOSION_REFLECTION(2,240); -ACE_EXPLOSION_REFLECTION(2,250); -ACE_EXPLOSION_REFLECTION(2,260); -ACE_EXPLOSION_REFLECTION(2,270); -ACE_EXPLOSION_REFLECTION(2,280); -ACE_EXPLOSION_REFLECTION(2,290); -ACE_EXPLOSION_REFLECTION(2,300); -ACE_EXPLOSION_REFLECTION(2,310); -ACE_EXPLOSION_REFLECTION(2,320); -ACE_EXPLOSION_REFLECTION(2,330); -ACE_EXPLOSION_REFLECTION(2,340); -ACE_EXPLOSION_REFLECTION(2,350); -ACE_EXPLOSION_REFLECTION(2,360); -ACE_EXPLOSION_REFLECTION(2,370); -ACE_EXPLOSION_REFLECTION(2,380); -ACE_EXPLOSION_REFLECTION(2,390); -ACE_EXPLOSION_REFLECTION(2,400); -ACE_EXPLOSION_REFLECTION(2,410); -ACE_EXPLOSION_REFLECTION(2,420); -ACE_EXPLOSION_REFLECTION(2,430); -ACE_EXPLOSION_REFLECTION(2,440); -ACE_EXPLOSION_REFLECTION(2,450); -ACE_EXPLOSION_REFLECTION(2,460); -ACE_EXPLOSION_REFLECTION(2,470); -ACE_EXPLOSION_REFLECTION(2,480); -ACE_EXPLOSION_REFLECTION(2,490); -ACE_EXPLOSION_REFLECTION(2,500); -ACE_EXPLOSION_REFLECTION(4,10); -ACE_EXPLOSION_REFLECTION(4,20); -ACE_EXPLOSION_REFLECTION(4,30); -ACE_EXPLOSION_REFLECTION(4,40); -ACE_EXPLOSION_REFLECTION(4,50); -ACE_EXPLOSION_REFLECTION(4,60); -ACE_EXPLOSION_REFLECTION(4,70); -ACE_EXPLOSION_REFLECTION(4,80); -ACE_EXPLOSION_REFLECTION(4,90); -ACE_EXPLOSION_REFLECTION(4,100); -ACE_EXPLOSION_REFLECTION(4,110); -ACE_EXPLOSION_REFLECTION(4,120); -ACE_EXPLOSION_REFLECTION(4,130); -ACE_EXPLOSION_REFLECTION(4,140); -ACE_EXPLOSION_REFLECTION(4,150); -ACE_EXPLOSION_REFLECTION(4,160); -ACE_EXPLOSION_REFLECTION(4,170); -ACE_EXPLOSION_REFLECTION(4,180); -ACE_EXPLOSION_REFLECTION(4,190); -ACE_EXPLOSION_REFLECTION(4,200); -ACE_EXPLOSION_REFLECTION(4,210); -ACE_EXPLOSION_REFLECTION(4,220); -ACE_EXPLOSION_REFLECTION(4,230); -ACE_EXPLOSION_REFLECTION(4,240); -ACE_EXPLOSION_REFLECTION(4,250); -ACE_EXPLOSION_REFLECTION(4,260); -ACE_EXPLOSION_REFLECTION(4,270); -ACE_EXPLOSION_REFLECTION(4,280); -ACE_EXPLOSION_REFLECTION(4,290); -ACE_EXPLOSION_REFLECTION(4,300); -ACE_EXPLOSION_REFLECTION(4,310); -ACE_EXPLOSION_REFLECTION(4,320); -ACE_EXPLOSION_REFLECTION(4,330); -ACE_EXPLOSION_REFLECTION(4,340); -ACE_EXPLOSION_REFLECTION(4,350); -ACE_EXPLOSION_REFLECTION(4,360); -ACE_EXPLOSION_REFLECTION(4,370); -ACE_EXPLOSION_REFLECTION(4,380); -ACE_EXPLOSION_REFLECTION(4,390); -ACE_EXPLOSION_REFLECTION(4,400); -ACE_EXPLOSION_REFLECTION(4,410); -ACE_EXPLOSION_REFLECTION(4,420); -ACE_EXPLOSION_REFLECTION(4,430); -ACE_EXPLOSION_REFLECTION(4,440); -ACE_EXPLOSION_REFLECTION(4,450); -ACE_EXPLOSION_REFLECTION(4,460); -ACE_EXPLOSION_REFLECTION(4,470); -ACE_EXPLOSION_REFLECTION(4,480); -ACE_EXPLOSION_REFLECTION(4,490); -ACE_EXPLOSION_REFLECTION(4,500); -ACE_EXPLOSION_REFLECTION(6,10); -ACE_EXPLOSION_REFLECTION(6,20); -ACE_EXPLOSION_REFLECTION(6,30); -ACE_EXPLOSION_REFLECTION(6,40); -ACE_EXPLOSION_REFLECTION(6,50); -ACE_EXPLOSION_REFLECTION(6,60); -ACE_EXPLOSION_REFLECTION(6,70); -ACE_EXPLOSION_REFLECTION(6,80); -ACE_EXPLOSION_REFLECTION(6,90); -ACE_EXPLOSION_REFLECTION(6,100); -ACE_EXPLOSION_REFLECTION(6,110); -ACE_EXPLOSION_REFLECTION(6,120); -ACE_EXPLOSION_REFLECTION(6,130); -ACE_EXPLOSION_REFLECTION(6,140); -ACE_EXPLOSION_REFLECTION(6,150); -ACE_EXPLOSION_REFLECTION(6,160); -ACE_EXPLOSION_REFLECTION(6,170); -ACE_EXPLOSION_REFLECTION(6,180); -ACE_EXPLOSION_REFLECTION(6,190); -ACE_EXPLOSION_REFLECTION(6,200); -ACE_EXPLOSION_REFLECTION(6,210); -ACE_EXPLOSION_REFLECTION(6,220); -ACE_EXPLOSION_REFLECTION(6,230); -ACE_EXPLOSION_REFLECTION(6,240); -ACE_EXPLOSION_REFLECTION(6,250); -ACE_EXPLOSION_REFLECTION(6,260); -ACE_EXPLOSION_REFLECTION(6,270); -ACE_EXPLOSION_REFLECTION(6,280); -ACE_EXPLOSION_REFLECTION(6,290); -ACE_EXPLOSION_REFLECTION(6,300); -ACE_EXPLOSION_REFLECTION(6,310); -ACE_EXPLOSION_REFLECTION(6,320); -ACE_EXPLOSION_REFLECTION(6,330); -ACE_EXPLOSION_REFLECTION(6,340); -ACE_EXPLOSION_REFLECTION(6,350); -ACE_EXPLOSION_REFLECTION(6,360); -ACE_EXPLOSION_REFLECTION(6,370); -ACE_EXPLOSION_REFLECTION(6,380); -ACE_EXPLOSION_REFLECTION(6,390); -ACE_EXPLOSION_REFLECTION(6,400); -ACE_EXPLOSION_REFLECTION(6,410); -ACE_EXPLOSION_REFLECTION(6,420); -ACE_EXPLOSION_REFLECTION(6,430); -ACE_EXPLOSION_REFLECTION(6,440); -ACE_EXPLOSION_REFLECTION(6,450); -ACE_EXPLOSION_REFLECTION(6,460); -ACE_EXPLOSION_REFLECTION(6,470); -ACE_EXPLOSION_REFLECTION(6,480); -ACE_EXPLOSION_REFLECTION(6,490); -ACE_EXPLOSION_REFLECTION(6,500); -ACE_EXPLOSION_REFLECTION(8,10); -ACE_EXPLOSION_REFLECTION(8,20); -ACE_EXPLOSION_REFLECTION(8,30); -ACE_EXPLOSION_REFLECTION(8,40); -ACE_EXPLOSION_REFLECTION(8,50); -ACE_EXPLOSION_REFLECTION(8,60); -ACE_EXPLOSION_REFLECTION(8,70); -ACE_EXPLOSION_REFLECTION(8,80); -ACE_EXPLOSION_REFLECTION(8,90); -ACE_EXPLOSION_REFLECTION(8,100); -ACE_EXPLOSION_REFLECTION(8,110); -ACE_EXPLOSION_REFLECTION(8,120); -ACE_EXPLOSION_REFLECTION(8,130); -ACE_EXPLOSION_REFLECTION(8,140); -ACE_EXPLOSION_REFLECTION(8,150); -ACE_EXPLOSION_REFLECTION(8,160); -ACE_EXPLOSION_REFLECTION(8,170); -ACE_EXPLOSION_REFLECTION(8,180); -ACE_EXPLOSION_REFLECTION(8,190); -ACE_EXPLOSION_REFLECTION(8,200); -ACE_EXPLOSION_REFLECTION(8,210); -ACE_EXPLOSION_REFLECTION(8,220); -ACE_EXPLOSION_REFLECTION(8,230); -ACE_EXPLOSION_REFLECTION(8,240); -ACE_EXPLOSION_REFLECTION(8,250); -ACE_EXPLOSION_REFLECTION(8,260); -ACE_EXPLOSION_REFLECTION(8,270); -ACE_EXPLOSION_REFLECTION(8,280); -ACE_EXPLOSION_REFLECTION(8,290); -ACE_EXPLOSION_REFLECTION(8,300); -ACE_EXPLOSION_REFLECTION(8,310); -ACE_EXPLOSION_REFLECTION(8,320); -ACE_EXPLOSION_REFLECTION(8,330); -ACE_EXPLOSION_REFLECTION(8,340); -ACE_EXPLOSION_REFLECTION(8,350); -ACE_EXPLOSION_REFLECTION(8,360); -ACE_EXPLOSION_REFLECTION(8,370); -ACE_EXPLOSION_REFLECTION(8,380); -ACE_EXPLOSION_REFLECTION(8,390); -ACE_EXPLOSION_REFLECTION(8,400); -ACE_EXPLOSION_REFLECTION(8,410); -ACE_EXPLOSION_REFLECTION(8,420); -ACE_EXPLOSION_REFLECTION(8,430); -ACE_EXPLOSION_REFLECTION(8,440); -ACE_EXPLOSION_REFLECTION(8,450); -ACE_EXPLOSION_REFLECTION(8,460); -ACE_EXPLOSION_REFLECTION(8,470); -ACE_EXPLOSION_REFLECTION(8,480); -ACE_EXPLOSION_REFLECTION(8,490); -ACE_EXPLOSION_REFLECTION(8,500); -ACE_EXPLOSION_REFLECTION(10,10); -ACE_EXPLOSION_REFLECTION(10,20); -ACE_EXPLOSION_REFLECTION(10,30); -ACE_EXPLOSION_REFLECTION(10,40); -ACE_EXPLOSION_REFLECTION(10,50); -ACE_EXPLOSION_REFLECTION(10,60); -ACE_EXPLOSION_REFLECTION(10,70); -ACE_EXPLOSION_REFLECTION(10,80); -ACE_EXPLOSION_REFLECTION(10,90); -ACE_EXPLOSION_REFLECTION(10,100); -ACE_EXPLOSION_REFLECTION(10,110); -ACE_EXPLOSION_REFLECTION(10,120); -ACE_EXPLOSION_REFLECTION(10,130); -ACE_EXPLOSION_REFLECTION(10,140); -ACE_EXPLOSION_REFLECTION(10,150); -ACE_EXPLOSION_REFLECTION(10,160); -ACE_EXPLOSION_REFLECTION(10,170); -ACE_EXPLOSION_REFLECTION(10,180); -ACE_EXPLOSION_REFLECTION(10,190); -ACE_EXPLOSION_REFLECTION(10,200); -ACE_EXPLOSION_REFLECTION(10,210); -ACE_EXPLOSION_REFLECTION(10,220); -ACE_EXPLOSION_REFLECTION(10,230); -ACE_EXPLOSION_REFLECTION(10,240); -ACE_EXPLOSION_REFLECTION(10,250); -ACE_EXPLOSION_REFLECTION(10,260); -ACE_EXPLOSION_REFLECTION(10,270); -ACE_EXPLOSION_REFLECTION(10,280); -ACE_EXPLOSION_REFLECTION(10,290); -ACE_EXPLOSION_REFLECTION(10,300); -ACE_EXPLOSION_REFLECTION(10,310); -ACE_EXPLOSION_REFLECTION(10,320); -ACE_EXPLOSION_REFLECTION(10,330); -ACE_EXPLOSION_REFLECTION(10,340); -ACE_EXPLOSION_REFLECTION(10,350); -ACE_EXPLOSION_REFLECTION(10,360); -ACE_EXPLOSION_REFLECTION(10,370); -ACE_EXPLOSION_REFLECTION(10,380); -ACE_EXPLOSION_REFLECTION(10,390); -ACE_EXPLOSION_REFLECTION(10,400); -ACE_EXPLOSION_REFLECTION(10,410); -ACE_EXPLOSION_REFLECTION(10,420); -ACE_EXPLOSION_REFLECTION(10,430); -ACE_EXPLOSION_REFLECTION(10,440); -ACE_EXPLOSION_REFLECTION(10,450); -ACE_EXPLOSION_REFLECTION(10,460); -ACE_EXPLOSION_REFLECTION(10,470); -ACE_EXPLOSION_REFLECTION(10,480); -ACE_EXPLOSION_REFLECTION(10,490); -ACE_EXPLOSION_REFLECTION(10,500); -ACE_EXPLOSION_REFLECTION(12,10); -ACE_EXPLOSION_REFLECTION(12,20); -ACE_EXPLOSION_REFLECTION(12,30); -ACE_EXPLOSION_REFLECTION(12,40); -ACE_EXPLOSION_REFLECTION(12,50); -ACE_EXPLOSION_REFLECTION(12,60); -ACE_EXPLOSION_REFLECTION(12,70); -ACE_EXPLOSION_REFLECTION(12,80); -ACE_EXPLOSION_REFLECTION(12,90); -ACE_EXPLOSION_REFLECTION(12,100); -ACE_EXPLOSION_REFLECTION(12,110); -ACE_EXPLOSION_REFLECTION(12,120); -ACE_EXPLOSION_REFLECTION(12,130); -ACE_EXPLOSION_REFLECTION(12,140); -ACE_EXPLOSION_REFLECTION(12,150); -ACE_EXPLOSION_REFLECTION(12,160); -ACE_EXPLOSION_REFLECTION(12,170); -ACE_EXPLOSION_REFLECTION(12,180); -ACE_EXPLOSION_REFLECTION(12,190); -ACE_EXPLOSION_REFLECTION(12,200); -ACE_EXPLOSION_REFLECTION(12,210); -ACE_EXPLOSION_REFLECTION(12,220); -ACE_EXPLOSION_REFLECTION(12,230); -ACE_EXPLOSION_REFLECTION(12,240); -ACE_EXPLOSION_REFLECTION(12,250); -ACE_EXPLOSION_REFLECTION(12,260); -ACE_EXPLOSION_REFLECTION(12,270); -ACE_EXPLOSION_REFLECTION(12,280); -ACE_EXPLOSION_REFLECTION(12,290); -ACE_EXPLOSION_REFLECTION(12,300); -ACE_EXPLOSION_REFLECTION(12,310); -ACE_EXPLOSION_REFLECTION(12,320); -ACE_EXPLOSION_REFLECTION(12,330); -ACE_EXPLOSION_REFLECTION(12,340); -ACE_EXPLOSION_REFLECTION(12,350); -ACE_EXPLOSION_REFLECTION(12,360); -ACE_EXPLOSION_REFLECTION(12,370); -ACE_EXPLOSION_REFLECTION(12,380); -ACE_EXPLOSION_REFLECTION(12,390); -ACE_EXPLOSION_REFLECTION(12,400); -ACE_EXPLOSION_REFLECTION(12,410); -ACE_EXPLOSION_REFLECTION(12,420); -ACE_EXPLOSION_REFLECTION(12,430); -ACE_EXPLOSION_REFLECTION(12,440); -ACE_EXPLOSION_REFLECTION(12,450); -ACE_EXPLOSION_REFLECTION(12,460); -ACE_EXPLOSION_REFLECTION(12,470); -ACE_EXPLOSION_REFLECTION(12,480); -ACE_EXPLOSION_REFLECTION(12,490); -ACE_EXPLOSION_REFLECTION(12,500); -ACE_EXPLOSION_REFLECTION(14,10); -ACE_EXPLOSION_REFLECTION(14,20); -ACE_EXPLOSION_REFLECTION(14,30); -ACE_EXPLOSION_REFLECTION(14,40); -ACE_EXPLOSION_REFLECTION(14,50); -ACE_EXPLOSION_REFLECTION(14,60); -ACE_EXPLOSION_REFLECTION(14,70); -ACE_EXPLOSION_REFLECTION(14,80); -ACE_EXPLOSION_REFLECTION(14,90); -ACE_EXPLOSION_REFLECTION(14,100); -ACE_EXPLOSION_REFLECTION(14,110); -ACE_EXPLOSION_REFLECTION(14,120); -ACE_EXPLOSION_REFLECTION(14,130); -ACE_EXPLOSION_REFLECTION(14,140); -ACE_EXPLOSION_REFLECTION(14,150); -ACE_EXPLOSION_REFLECTION(14,160); -ACE_EXPLOSION_REFLECTION(14,170); -ACE_EXPLOSION_REFLECTION(14,180); -ACE_EXPLOSION_REFLECTION(14,190); -ACE_EXPLOSION_REFLECTION(14,200); -ACE_EXPLOSION_REFLECTION(14,210); -ACE_EXPLOSION_REFLECTION(14,220); -ACE_EXPLOSION_REFLECTION(14,230); -ACE_EXPLOSION_REFLECTION(14,240); -ACE_EXPLOSION_REFLECTION(14,250); -ACE_EXPLOSION_REFLECTION(14,260); -ACE_EXPLOSION_REFLECTION(14,270); -ACE_EXPLOSION_REFLECTION(14,280); -ACE_EXPLOSION_REFLECTION(14,290); -ACE_EXPLOSION_REFLECTION(14,300); -ACE_EXPLOSION_REFLECTION(14,310); -ACE_EXPLOSION_REFLECTION(14,320); -ACE_EXPLOSION_REFLECTION(14,330); -ACE_EXPLOSION_REFLECTION(14,340); -ACE_EXPLOSION_REFLECTION(14,350); -ACE_EXPLOSION_REFLECTION(14,360); -ACE_EXPLOSION_REFLECTION(14,370); -ACE_EXPLOSION_REFLECTION(14,380); -ACE_EXPLOSION_REFLECTION(14,390); -ACE_EXPLOSION_REFLECTION(14,400); -ACE_EXPLOSION_REFLECTION(14,410); -ACE_EXPLOSION_REFLECTION(14,420); -ACE_EXPLOSION_REFLECTION(14,430); -ACE_EXPLOSION_REFLECTION(14,440); -ACE_EXPLOSION_REFLECTION(14,450); -ACE_EXPLOSION_REFLECTION(14,460); -ACE_EXPLOSION_REFLECTION(14,470); -ACE_EXPLOSION_REFLECTION(14,480); -ACE_EXPLOSION_REFLECTION(14,490); -ACE_EXPLOSION_REFLECTION(14,500); -ACE_EXPLOSION_REFLECTION(16,10); -ACE_EXPLOSION_REFLECTION(16,20); -ACE_EXPLOSION_REFLECTION(16,30); -ACE_EXPLOSION_REFLECTION(16,40); -ACE_EXPLOSION_REFLECTION(16,50); -ACE_EXPLOSION_REFLECTION(16,60); -ACE_EXPLOSION_REFLECTION(16,70); -ACE_EXPLOSION_REFLECTION(16,80); -ACE_EXPLOSION_REFLECTION(16,90); -ACE_EXPLOSION_REFLECTION(16,100); -ACE_EXPLOSION_REFLECTION(16,110); -ACE_EXPLOSION_REFLECTION(16,120); -ACE_EXPLOSION_REFLECTION(16,130); -ACE_EXPLOSION_REFLECTION(16,140); -ACE_EXPLOSION_REFLECTION(16,150); -ACE_EXPLOSION_REFLECTION(16,160); -ACE_EXPLOSION_REFLECTION(16,170); -ACE_EXPLOSION_REFLECTION(16,180); -ACE_EXPLOSION_REFLECTION(16,190); -ACE_EXPLOSION_REFLECTION(16,200); -ACE_EXPLOSION_REFLECTION(16,210); -ACE_EXPLOSION_REFLECTION(16,220); -ACE_EXPLOSION_REFLECTION(16,230); -ACE_EXPLOSION_REFLECTION(16,240); -ACE_EXPLOSION_REFLECTION(16,250); -ACE_EXPLOSION_REFLECTION(16,260); -ACE_EXPLOSION_REFLECTION(16,270); -ACE_EXPLOSION_REFLECTION(16,280); -ACE_EXPLOSION_REFLECTION(16,290); -ACE_EXPLOSION_REFLECTION(16,300); -ACE_EXPLOSION_REFLECTION(16,310); -ACE_EXPLOSION_REFLECTION(16,320); -ACE_EXPLOSION_REFLECTION(16,330); -ACE_EXPLOSION_REFLECTION(16,340); -ACE_EXPLOSION_REFLECTION(16,350); -ACE_EXPLOSION_REFLECTION(16,360); -ACE_EXPLOSION_REFLECTION(16,370); -ACE_EXPLOSION_REFLECTION(16,380); -ACE_EXPLOSION_REFLECTION(16,390); -ACE_EXPLOSION_REFLECTION(16,400); -ACE_EXPLOSION_REFLECTION(16,410); -ACE_EXPLOSION_REFLECTION(16,420); -ACE_EXPLOSION_REFLECTION(16,430); -ACE_EXPLOSION_REFLECTION(16,440); -ACE_EXPLOSION_REFLECTION(16,450); -ACE_EXPLOSION_REFLECTION(16,460); -ACE_EXPLOSION_REFLECTION(16,470); -ACE_EXPLOSION_REFLECTION(16,480); -ACE_EXPLOSION_REFLECTION(16,490); -ACE_EXPLOSION_REFLECTION(16,500); -ACE_EXPLOSION_REFLECTION(18,10); -ACE_EXPLOSION_REFLECTION(18,20); -ACE_EXPLOSION_REFLECTION(18,30); -ACE_EXPLOSION_REFLECTION(18,40); -ACE_EXPLOSION_REFLECTION(18,50); -ACE_EXPLOSION_REFLECTION(18,60); -ACE_EXPLOSION_REFLECTION(18,70); -ACE_EXPLOSION_REFLECTION(18,80); -ACE_EXPLOSION_REFLECTION(18,90); -ACE_EXPLOSION_REFLECTION(18,100); -ACE_EXPLOSION_REFLECTION(18,110); -ACE_EXPLOSION_REFLECTION(18,120); -ACE_EXPLOSION_REFLECTION(18,130); -ACE_EXPLOSION_REFLECTION(18,140); -ACE_EXPLOSION_REFLECTION(18,150); -ACE_EXPLOSION_REFLECTION(18,160); -ACE_EXPLOSION_REFLECTION(18,170); -ACE_EXPLOSION_REFLECTION(18,180); -ACE_EXPLOSION_REFLECTION(18,190); -ACE_EXPLOSION_REFLECTION(18,200); -ACE_EXPLOSION_REFLECTION(18,210); -ACE_EXPLOSION_REFLECTION(18,220); -ACE_EXPLOSION_REFLECTION(18,230); -ACE_EXPLOSION_REFLECTION(18,240); -ACE_EXPLOSION_REFLECTION(18,250); -ACE_EXPLOSION_REFLECTION(18,260); -ACE_EXPLOSION_REFLECTION(18,270); -ACE_EXPLOSION_REFLECTION(18,280); -ACE_EXPLOSION_REFLECTION(18,290); -ACE_EXPLOSION_REFLECTION(18,300); -ACE_EXPLOSION_REFLECTION(18,310); -ACE_EXPLOSION_REFLECTION(18,320); -ACE_EXPLOSION_REFLECTION(18,330); -ACE_EXPLOSION_REFLECTION(18,340); -ACE_EXPLOSION_REFLECTION(18,350); -ACE_EXPLOSION_REFLECTION(18,360); -ACE_EXPLOSION_REFLECTION(18,370); -ACE_EXPLOSION_REFLECTION(18,380); -ACE_EXPLOSION_REFLECTION(18,390); -ACE_EXPLOSION_REFLECTION(18,400); -ACE_EXPLOSION_REFLECTION(18,410); -ACE_EXPLOSION_REFLECTION(18,420); -ACE_EXPLOSION_REFLECTION(18,430); -ACE_EXPLOSION_REFLECTION(18,440); -ACE_EXPLOSION_REFLECTION(18,450); -ACE_EXPLOSION_REFLECTION(18,460); -ACE_EXPLOSION_REFLECTION(18,470); -ACE_EXPLOSION_REFLECTION(18,480); -ACE_EXPLOSION_REFLECTION(18,490); -ACE_EXPLOSION_REFLECTION(18,500); -ACE_EXPLOSION_REFLECTION(20,10); -ACE_EXPLOSION_REFLECTION(20,20); -ACE_EXPLOSION_REFLECTION(20,30); -ACE_EXPLOSION_REFLECTION(20,40); -ACE_EXPLOSION_REFLECTION(20,50); -ACE_EXPLOSION_REFLECTION(20,60); -ACE_EXPLOSION_REFLECTION(20,70); -ACE_EXPLOSION_REFLECTION(20,80); -ACE_EXPLOSION_REFLECTION(20,90); -ACE_EXPLOSION_REFLECTION(20,100); -ACE_EXPLOSION_REFLECTION(20,110); -ACE_EXPLOSION_REFLECTION(20,120); -ACE_EXPLOSION_REFLECTION(20,130); -ACE_EXPLOSION_REFLECTION(20,140); -ACE_EXPLOSION_REFLECTION(20,150); -ACE_EXPLOSION_REFLECTION(20,160); -ACE_EXPLOSION_REFLECTION(20,170); -ACE_EXPLOSION_REFLECTION(20,180); -ACE_EXPLOSION_REFLECTION(20,190); -ACE_EXPLOSION_REFLECTION(20,200); -ACE_EXPLOSION_REFLECTION(20,210); -ACE_EXPLOSION_REFLECTION(20,220); -ACE_EXPLOSION_REFLECTION(20,230); -ACE_EXPLOSION_REFLECTION(20,240); -ACE_EXPLOSION_REFLECTION(20,250); -ACE_EXPLOSION_REFLECTION(20,260); -ACE_EXPLOSION_REFLECTION(20,270); -ACE_EXPLOSION_REFLECTION(20,280); -ACE_EXPLOSION_REFLECTION(20,290); -ACE_EXPLOSION_REFLECTION(20,300); -ACE_EXPLOSION_REFLECTION(20,310); -ACE_EXPLOSION_REFLECTION(20,320); -ACE_EXPLOSION_REFLECTION(20,330); -ACE_EXPLOSION_REFLECTION(20,340); -ACE_EXPLOSION_REFLECTION(20,350); -ACE_EXPLOSION_REFLECTION(20,360); -ACE_EXPLOSION_REFLECTION(20,370); -ACE_EXPLOSION_REFLECTION(20,380); -ACE_EXPLOSION_REFLECTION(20,390); -ACE_EXPLOSION_REFLECTION(20,400); -ACE_EXPLOSION_REFLECTION(20,410); -ACE_EXPLOSION_REFLECTION(20,420); -ACE_EXPLOSION_REFLECTION(20,430); -ACE_EXPLOSION_REFLECTION(20,440); -ACE_EXPLOSION_REFLECTION(20,450); -ACE_EXPLOSION_REFLECTION(20,460); -ACE_EXPLOSION_REFLECTION(20,470); -ACE_EXPLOSION_REFLECTION(20,480); -ACE_EXPLOSION_REFLECTION(20,490); -ACE_EXPLOSION_REFLECTION(20,500); -ACE_EXPLOSION_REFLECTION(22,10); -ACE_EXPLOSION_REFLECTION(22,20); -ACE_EXPLOSION_REFLECTION(22,30); -ACE_EXPLOSION_REFLECTION(22,40); -ACE_EXPLOSION_REFLECTION(22,50); -ACE_EXPLOSION_REFLECTION(22,60); -ACE_EXPLOSION_REFLECTION(22,70); -ACE_EXPLOSION_REFLECTION(22,80); -ACE_EXPLOSION_REFLECTION(22,90); -ACE_EXPLOSION_REFLECTION(22,100); -ACE_EXPLOSION_REFLECTION(22,110); -ACE_EXPLOSION_REFLECTION(22,120); -ACE_EXPLOSION_REFLECTION(22,130); -ACE_EXPLOSION_REFLECTION(22,140); -ACE_EXPLOSION_REFLECTION(22,150); -ACE_EXPLOSION_REFLECTION(22,160); -ACE_EXPLOSION_REFLECTION(22,170); -ACE_EXPLOSION_REFLECTION(22,180); -ACE_EXPLOSION_REFLECTION(22,190); -ACE_EXPLOSION_REFLECTION(22,200); -ACE_EXPLOSION_REFLECTION(22,210); -ACE_EXPLOSION_REFLECTION(22,220); -ACE_EXPLOSION_REFLECTION(22,230); -ACE_EXPLOSION_REFLECTION(22,240); -ACE_EXPLOSION_REFLECTION(22,250); -ACE_EXPLOSION_REFLECTION(22,260); -ACE_EXPLOSION_REFLECTION(22,270); -ACE_EXPLOSION_REFLECTION(22,280); -ACE_EXPLOSION_REFLECTION(22,290); -ACE_EXPLOSION_REFLECTION(22,300); -ACE_EXPLOSION_REFLECTION(22,310); -ACE_EXPLOSION_REFLECTION(22,320); -ACE_EXPLOSION_REFLECTION(22,330); -ACE_EXPLOSION_REFLECTION(22,340); -ACE_EXPLOSION_REFLECTION(22,350); -ACE_EXPLOSION_REFLECTION(22,360); -ACE_EXPLOSION_REFLECTION(22,370); -ACE_EXPLOSION_REFLECTION(22,380); -ACE_EXPLOSION_REFLECTION(22,390); -ACE_EXPLOSION_REFLECTION(22,400); -ACE_EXPLOSION_REFLECTION(22,410); -ACE_EXPLOSION_REFLECTION(22,420); -ACE_EXPLOSION_REFLECTION(22,430); -ACE_EXPLOSION_REFLECTION(22,440); -ACE_EXPLOSION_REFLECTION(22,450); -ACE_EXPLOSION_REFLECTION(22,460); -ACE_EXPLOSION_REFLECTION(22,470); -ACE_EXPLOSION_REFLECTION(22,480); -ACE_EXPLOSION_REFLECTION(22,490); -ACE_EXPLOSION_REFLECTION(22,500); -ACE_EXPLOSION_REFLECTION(24,10); -ACE_EXPLOSION_REFLECTION(24,20); -ACE_EXPLOSION_REFLECTION(24,30); -ACE_EXPLOSION_REFLECTION(24,40); -ACE_EXPLOSION_REFLECTION(24,50); -ACE_EXPLOSION_REFLECTION(24,60); -ACE_EXPLOSION_REFLECTION(24,70); -ACE_EXPLOSION_REFLECTION(24,80); -ACE_EXPLOSION_REFLECTION(24,90); -ACE_EXPLOSION_REFLECTION(24,100); -ACE_EXPLOSION_REFLECTION(24,110); -ACE_EXPLOSION_REFLECTION(24,120); -ACE_EXPLOSION_REFLECTION(24,130); -ACE_EXPLOSION_REFLECTION(24,140); -ACE_EXPLOSION_REFLECTION(24,150); -ACE_EXPLOSION_REFLECTION(24,160); -ACE_EXPLOSION_REFLECTION(24,170); -ACE_EXPLOSION_REFLECTION(24,180); -ACE_EXPLOSION_REFLECTION(24,190); -ACE_EXPLOSION_REFLECTION(24,200); -ACE_EXPLOSION_REFLECTION(24,210); -ACE_EXPLOSION_REFLECTION(24,220); -ACE_EXPLOSION_REFLECTION(24,230); -ACE_EXPLOSION_REFLECTION(24,240); -ACE_EXPLOSION_REFLECTION(24,250); -ACE_EXPLOSION_REFLECTION(24,260); -ACE_EXPLOSION_REFLECTION(24,270); -ACE_EXPLOSION_REFLECTION(24,280); -ACE_EXPLOSION_REFLECTION(24,290); -ACE_EXPLOSION_REFLECTION(24,300); -ACE_EXPLOSION_REFLECTION(24,310); -ACE_EXPLOSION_REFLECTION(24,320); -ACE_EXPLOSION_REFLECTION(24,330); -ACE_EXPLOSION_REFLECTION(24,340); -ACE_EXPLOSION_REFLECTION(24,350); -ACE_EXPLOSION_REFLECTION(24,360); -ACE_EXPLOSION_REFLECTION(24,370); -ACE_EXPLOSION_REFLECTION(24,380); -ACE_EXPLOSION_REFLECTION(24,390); -ACE_EXPLOSION_REFLECTION(24,400); -ACE_EXPLOSION_REFLECTION(24,410); -ACE_EXPLOSION_REFLECTION(24,420); -ACE_EXPLOSION_REFLECTION(24,430); -ACE_EXPLOSION_REFLECTION(24,440); -ACE_EXPLOSION_REFLECTION(24,450); -ACE_EXPLOSION_REFLECTION(24,460); -ACE_EXPLOSION_REFLECTION(24,470); -ACE_EXPLOSION_REFLECTION(24,480); -ACE_EXPLOSION_REFLECTION(24,490); -ACE_EXPLOSION_REFLECTION(24,500); -ACE_EXPLOSION_REFLECTION(26,10); -ACE_EXPLOSION_REFLECTION(26,20); -ACE_EXPLOSION_REFLECTION(26,30); -ACE_EXPLOSION_REFLECTION(26,40); -ACE_EXPLOSION_REFLECTION(26,50); -ACE_EXPLOSION_REFLECTION(26,60); -ACE_EXPLOSION_REFLECTION(26,70); -ACE_EXPLOSION_REFLECTION(26,80); -ACE_EXPLOSION_REFLECTION(26,90); -ACE_EXPLOSION_REFLECTION(26,100); -ACE_EXPLOSION_REFLECTION(26,110); -ACE_EXPLOSION_REFLECTION(26,120); -ACE_EXPLOSION_REFLECTION(26,130); -ACE_EXPLOSION_REFLECTION(26,140); -ACE_EXPLOSION_REFLECTION(26,150); -ACE_EXPLOSION_REFLECTION(26,160); -ACE_EXPLOSION_REFLECTION(26,170); -ACE_EXPLOSION_REFLECTION(26,180); -ACE_EXPLOSION_REFLECTION(26,190); -ACE_EXPLOSION_REFLECTION(26,200); -ACE_EXPLOSION_REFLECTION(26,210); -ACE_EXPLOSION_REFLECTION(26,220); -ACE_EXPLOSION_REFLECTION(26,230); -ACE_EXPLOSION_REFLECTION(26,240); -ACE_EXPLOSION_REFLECTION(26,250); -ACE_EXPLOSION_REFLECTION(26,260); -ACE_EXPLOSION_REFLECTION(26,270); -ACE_EXPLOSION_REFLECTION(26,280); -ACE_EXPLOSION_REFLECTION(26,290); -ACE_EXPLOSION_REFLECTION(26,300); -ACE_EXPLOSION_REFLECTION(26,310); -ACE_EXPLOSION_REFLECTION(26,320); -ACE_EXPLOSION_REFLECTION(26,330); -ACE_EXPLOSION_REFLECTION(26,340); -ACE_EXPLOSION_REFLECTION(26,350); -ACE_EXPLOSION_REFLECTION(26,360); -ACE_EXPLOSION_REFLECTION(26,370); -ACE_EXPLOSION_REFLECTION(26,380); -ACE_EXPLOSION_REFLECTION(26,390); -ACE_EXPLOSION_REFLECTION(26,400); -ACE_EXPLOSION_REFLECTION(26,410); -ACE_EXPLOSION_REFLECTION(26,420); -ACE_EXPLOSION_REFLECTION(26,430); -ACE_EXPLOSION_REFLECTION(26,440); -ACE_EXPLOSION_REFLECTION(26,450); -ACE_EXPLOSION_REFLECTION(26,460); -ACE_EXPLOSION_REFLECTION(26,470); -ACE_EXPLOSION_REFLECTION(26,480); -ACE_EXPLOSION_REFLECTION(26,490); -ACE_EXPLOSION_REFLECTION(26,500); -ACE_EXPLOSION_REFLECTION(28,10); -ACE_EXPLOSION_REFLECTION(28,20); -ACE_EXPLOSION_REFLECTION(28,30); -ACE_EXPLOSION_REFLECTION(28,40); -ACE_EXPLOSION_REFLECTION(28,50); -ACE_EXPLOSION_REFLECTION(28,60); -ACE_EXPLOSION_REFLECTION(28,70); -ACE_EXPLOSION_REFLECTION(28,80); -ACE_EXPLOSION_REFLECTION(28,90); -ACE_EXPLOSION_REFLECTION(28,100); -ACE_EXPLOSION_REFLECTION(28,110); -ACE_EXPLOSION_REFLECTION(28,120); -ACE_EXPLOSION_REFLECTION(28,130); -ACE_EXPLOSION_REFLECTION(28,140); -ACE_EXPLOSION_REFLECTION(28,150); -ACE_EXPLOSION_REFLECTION(28,160); -ACE_EXPLOSION_REFLECTION(28,170); -ACE_EXPLOSION_REFLECTION(28,180); -ACE_EXPLOSION_REFLECTION(28,190); -ACE_EXPLOSION_REFLECTION(28,200); -ACE_EXPLOSION_REFLECTION(28,210); -ACE_EXPLOSION_REFLECTION(28,220); -ACE_EXPLOSION_REFLECTION(28,230); -ACE_EXPLOSION_REFLECTION(28,240); -ACE_EXPLOSION_REFLECTION(28,250); -ACE_EXPLOSION_REFLECTION(28,260); -ACE_EXPLOSION_REFLECTION(28,270); -ACE_EXPLOSION_REFLECTION(28,280); -ACE_EXPLOSION_REFLECTION(28,290); -ACE_EXPLOSION_REFLECTION(28,300); -ACE_EXPLOSION_REFLECTION(28,310); -ACE_EXPLOSION_REFLECTION(28,320); -ACE_EXPLOSION_REFLECTION(28,330); -ACE_EXPLOSION_REFLECTION(28,340); -ACE_EXPLOSION_REFLECTION(28,350); -ACE_EXPLOSION_REFLECTION(28,360); -ACE_EXPLOSION_REFLECTION(28,370); -ACE_EXPLOSION_REFLECTION(28,380); -ACE_EXPLOSION_REFLECTION(28,390); -ACE_EXPLOSION_REFLECTION(28,400); -ACE_EXPLOSION_REFLECTION(28,410); -ACE_EXPLOSION_REFLECTION(28,420); -ACE_EXPLOSION_REFLECTION(28,430); -ACE_EXPLOSION_REFLECTION(28,440); -ACE_EXPLOSION_REFLECTION(28,450); -ACE_EXPLOSION_REFLECTION(28,460); -ACE_EXPLOSION_REFLECTION(28,470); -ACE_EXPLOSION_REFLECTION(28,480); -ACE_EXPLOSION_REFLECTION(28,490); -ACE_EXPLOSION_REFLECTION(28,500); -ACE_EXPLOSION_REFLECTION(30,10); -ACE_EXPLOSION_REFLECTION(30,20); -ACE_EXPLOSION_REFLECTION(30,30); -ACE_EXPLOSION_REFLECTION(30,40); -ACE_EXPLOSION_REFLECTION(30,50); -ACE_EXPLOSION_REFLECTION(30,60); -ACE_EXPLOSION_REFLECTION(30,70); -ACE_EXPLOSION_REFLECTION(30,80); -ACE_EXPLOSION_REFLECTION(30,90); -ACE_EXPLOSION_REFLECTION(30,100); -ACE_EXPLOSION_REFLECTION(30,110); -ACE_EXPLOSION_REFLECTION(30,120); -ACE_EXPLOSION_REFLECTION(30,130); -ACE_EXPLOSION_REFLECTION(30,140); -ACE_EXPLOSION_REFLECTION(30,150); -ACE_EXPLOSION_REFLECTION(30,160); -ACE_EXPLOSION_REFLECTION(30,170); -ACE_EXPLOSION_REFLECTION(30,180); -ACE_EXPLOSION_REFLECTION(30,190); -ACE_EXPLOSION_REFLECTION(30,200); -ACE_EXPLOSION_REFLECTION(30,210); -ACE_EXPLOSION_REFLECTION(30,220); -ACE_EXPLOSION_REFLECTION(30,230); -ACE_EXPLOSION_REFLECTION(30,240); -ACE_EXPLOSION_REFLECTION(30,250); -ACE_EXPLOSION_REFLECTION(30,260); -ACE_EXPLOSION_REFLECTION(30,270); -ACE_EXPLOSION_REFLECTION(30,280); -ACE_EXPLOSION_REFLECTION(30,290); -ACE_EXPLOSION_REFLECTION(30,300); -ACE_EXPLOSION_REFLECTION(30,310); -ACE_EXPLOSION_REFLECTION(30,320); -ACE_EXPLOSION_REFLECTION(30,330); -ACE_EXPLOSION_REFLECTION(30,340); -ACE_EXPLOSION_REFLECTION(30,350); -ACE_EXPLOSION_REFLECTION(30,360); -ACE_EXPLOSION_REFLECTION(30,370); -ACE_EXPLOSION_REFLECTION(30,380); -ACE_EXPLOSION_REFLECTION(30,390); -ACE_EXPLOSION_REFLECTION(30,400); -ACE_EXPLOSION_REFLECTION(30,410); -ACE_EXPLOSION_REFLECTION(30,420); -ACE_EXPLOSION_REFLECTION(30,430); -ACE_EXPLOSION_REFLECTION(30,440); -ACE_EXPLOSION_REFLECTION(30,450); -ACE_EXPLOSION_REFLECTION(30,460); -ACE_EXPLOSION_REFLECTION(30,470); -ACE_EXPLOSION_REFLECTION(30,480); -ACE_EXPLOSION_REFLECTION(30,490); -ACE_EXPLOSION_REFLECTION(30,500); -ACE_EXPLOSION_REFLECTION(32,10); -ACE_EXPLOSION_REFLECTION(32,20); -ACE_EXPLOSION_REFLECTION(32,30); -ACE_EXPLOSION_REFLECTION(32,40); -ACE_EXPLOSION_REFLECTION(32,50); -ACE_EXPLOSION_REFLECTION(32,60); -ACE_EXPLOSION_REFLECTION(32,70); -ACE_EXPLOSION_REFLECTION(32,80); -ACE_EXPLOSION_REFLECTION(32,90); -ACE_EXPLOSION_REFLECTION(32,100); -ACE_EXPLOSION_REFLECTION(32,110); -ACE_EXPLOSION_REFLECTION(32,120); -ACE_EXPLOSION_REFLECTION(32,130); -ACE_EXPLOSION_REFLECTION(32,140); -ACE_EXPLOSION_REFLECTION(32,150); -ACE_EXPLOSION_REFLECTION(32,160); -ACE_EXPLOSION_REFLECTION(32,170); -ACE_EXPLOSION_REFLECTION(32,180); -ACE_EXPLOSION_REFLECTION(32,190); -ACE_EXPLOSION_REFLECTION(32,200); -ACE_EXPLOSION_REFLECTION(32,210); -ACE_EXPLOSION_REFLECTION(32,220); -ACE_EXPLOSION_REFLECTION(32,230); -ACE_EXPLOSION_REFLECTION(32,240); -ACE_EXPLOSION_REFLECTION(32,250); -ACE_EXPLOSION_REFLECTION(32,260); -ACE_EXPLOSION_REFLECTION(32,270); -ACE_EXPLOSION_REFLECTION(32,280); -ACE_EXPLOSION_REFLECTION(32,290); -ACE_EXPLOSION_REFLECTION(32,300); -ACE_EXPLOSION_REFLECTION(32,310); -ACE_EXPLOSION_REFLECTION(32,320); -ACE_EXPLOSION_REFLECTION(32,330); -ACE_EXPLOSION_REFLECTION(32,340); -ACE_EXPLOSION_REFLECTION(32,350); -ACE_EXPLOSION_REFLECTION(32,360); -ACE_EXPLOSION_REFLECTION(32,370); -ACE_EXPLOSION_REFLECTION(32,380); -ACE_EXPLOSION_REFLECTION(32,390); -ACE_EXPLOSION_REFLECTION(32,400); -ACE_EXPLOSION_REFLECTION(32,410); -ACE_EXPLOSION_REFLECTION(32,420); -ACE_EXPLOSION_REFLECTION(32,430); -ACE_EXPLOSION_REFLECTION(32,440); -ACE_EXPLOSION_REFLECTION(32,450); -ACE_EXPLOSION_REFLECTION(32,460); -ACE_EXPLOSION_REFLECTION(32,470); -ACE_EXPLOSION_REFLECTION(32,480); -ACE_EXPLOSION_REFLECTION(32,490); -ACE_EXPLOSION_REFLECTION(32,500); -ACE_EXPLOSION_REFLECTION(34,10); -ACE_EXPLOSION_REFLECTION(34,20); -ACE_EXPLOSION_REFLECTION(34,30); -ACE_EXPLOSION_REFLECTION(34,40); -ACE_EXPLOSION_REFLECTION(34,50); -ACE_EXPLOSION_REFLECTION(34,60); -ACE_EXPLOSION_REFLECTION(34,70); -ACE_EXPLOSION_REFLECTION(34,80); -ACE_EXPLOSION_REFLECTION(34,90); -ACE_EXPLOSION_REFLECTION(34,100); -ACE_EXPLOSION_REFLECTION(34,110); -ACE_EXPLOSION_REFLECTION(34,120); -ACE_EXPLOSION_REFLECTION(34,130); -ACE_EXPLOSION_REFLECTION(34,140); -ACE_EXPLOSION_REFLECTION(34,150); -ACE_EXPLOSION_REFLECTION(34,160); -ACE_EXPLOSION_REFLECTION(34,170); -ACE_EXPLOSION_REFLECTION(34,180); -ACE_EXPLOSION_REFLECTION(34,190); -ACE_EXPLOSION_REFLECTION(34,200); -ACE_EXPLOSION_REFLECTION(34,210); -ACE_EXPLOSION_REFLECTION(34,220); -ACE_EXPLOSION_REFLECTION(34,230); -ACE_EXPLOSION_REFLECTION(34,240); -ACE_EXPLOSION_REFLECTION(34,250); -ACE_EXPLOSION_REFLECTION(34,260); -ACE_EXPLOSION_REFLECTION(34,270); -ACE_EXPLOSION_REFLECTION(34,280); -ACE_EXPLOSION_REFLECTION(34,290); -ACE_EXPLOSION_REFLECTION(34,300); -ACE_EXPLOSION_REFLECTION(34,310); -ACE_EXPLOSION_REFLECTION(34,320); -ACE_EXPLOSION_REFLECTION(34,330); -ACE_EXPLOSION_REFLECTION(34,340); -ACE_EXPLOSION_REFLECTION(34,350); -ACE_EXPLOSION_REFLECTION(34,360); -ACE_EXPLOSION_REFLECTION(34,370); -ACE_EXPLOSION_REFLECTION(34,380); -ACE_EXPLOSION_REFLECTION(34,390); -ACE_EXPLOSION_REFLECTION(34,400); -ACE_EXPLOSION_REFLECTION(34,410); -ACE_EXPLOSION_REFLECTION(34,420); -ACE_EXPLOSION_REFLECTION(34,430); -ACE_EXPLOSION_REFLECTION(34,440); -ACE_EXPLOSION_REFLECTION(34,450); -ACE_EXPLOSION_REFLECTION(34,460); -ACE_EXPLOSION_REFLECTION(34,470); -ACE_EXPLOSION_REFLECTION(34,480); -ACE_EXPLOSION_REFLECTION(34,490); -ACE_EXPLOSION_REFLECTION(34,500); -ACE_EXPLOSION_REFLECTION(36,10); -ACE_EXPLOSION_REFLECTION(36,20); -ACE_EXPLOSION_REFLECTION(36,30); -ACE_EXPLOSION_REFLECTION(36,40); -ACE_EXPLOSION_REFLECTION(36,50); -ACE_EXPLOSION_REFLECTION(36,60); -ACE_EXPLOSION_REFLECTION(36,70); -ACE_EXPLOSION_REFLECTION(36,80); -ACE_EXPLOSION_REFLECTION(36,90); -ACE_EXPLOSION_REFLECTION(36,100); -ACE_EXPLOSION_REFLECTION(36,110); -ACE_EXPLOSION_REFLECTION(36,120); -ACE_EXPLOSION_REFLECTION(36,130); -ACE_EXPLOSION_REFLECTION(36,140); -ACE_EXPLOSION_REFLECTION(36,150); -ACE_EXPLOSION_REFLECTION(36,160); -ACE_EXPLOSION_REFLECTION(36,170); -ACE_EXPLOSION_REFLECTION(36,180); -ACE_EXPLOSION_REFLECTION(36,190); -ACE_EXPLOSION_REFLECTION(36,200); -ACE_EXPLOSION_REFLECTION(36,210); -ACE_EXPLOSION_REFLECTION(36,220); -ACE_EXPLOSION_REFLECTION(36,230); -ACE_EXPLOSION_REFLECTION(36,240); -ACE_EXPLOSION_REFLECTION(36,250); -ACE_EXPLOSION_REFLECTION(36,260); -ACE_EXPLOSION_REFLECTION(36,270); -ACE_EXPLOSION_REFLECTION(36,280); -ACE_EXPLOSION_REFLECTION(36,290); -ACE_EXPLOSION_REFLECTION(36,300); -ACE_EXPLOSION_REFLECTION(36,310); -ACE_EXPLOSION_REFLECTION(36,320); -ACE_EXPLOSION_REFLECTION(36,330); -ACE_EXPLOSION_REFLECTION(36,340); -ACE_EXPLOSION_REFLECTION(36,350); -ACE_EXPLOSION_REFLECTION(36,360); -ACE_EXPLOSION_REFLECTION(36,370); -ACE_EXPLOSION_REFLECTION(36,380); -ACE_EXPLOSION_REFLECTION(36,390); -ACE_EXPLOSION_REFLECTION(36,400); -ACE_EXPLOSION_REFLECTION(36,410); -ACE_EXPLOSION_REFLECTION(36,420); -ACE_EXPLOSION_REFLECTION(36,430); -ACE_EXPLOSION_REFLECTION(36,440); -ACE_EXPLOSION_REFLECTION(36,450); -ACE_EXPLOSION_REFLECTION(36,460); -ACE_EXPLOSION_REFLECTION(36,470); -ACE_EXPLOSION_REFLECTION(36,480); -ACE_EXPLOSION_REFLECTION(36,490); -ACE_EXPLOSION_REFLECTION(36,500); -ACE_EXPLOSION_REFLECTION(38,10); -ACE_EXPLOSION_REFLECTION(38,20); -ACE_EXPLOSION_REFLECTION(38,30); -ACE_EXPLOSION_REFLECTION(38,40); -ACE_EXPLOSION_REFLECTION(38,50); -ACE_EXPLOSION_REFLECTION(38,60); -ACE_EXPLOSION_REFLECTION(38,70); -ACE_EXPLOSION_REFLECTION(38,80); -ACE_EXPLOSION_REFLECTION(38,90); -ACE_EXPLOSION_REFLECTION(38,100); -ACE_EXPLOSION_REFLECTION(38,110); -ACE_EXPLOSION_REFLECTION(38,120); -ACE_EXPLOSION_REFLECTION(38,130); -ACE_EXPLOSION_REFLECTION(38,140); -ACE_EXPLOSION_REFLECTION(38,150); -ACE_EXPLOSION_REFLECTION(38,160); -ACE_EXPLOSION_REFLECTION(38,170); -ACE_EXPLOSION_REFLECTION(38,180); -ACE_EXPLOSION_REFLECTION(38,190); -ACE_EXPLOSION_REFLECTION(38,200); -ACE_EXPLOSION_REFLECTION(38,210); -ACE_EXPLOSION_REFLECTION(38,220); -ACE_EXPLOSION_REFLECTION(38,230); -ACE_EXPLOSION_REFLECTION(38,240); -ACE_EXPLOSION_REFLECTION(38,250); -ACE_EXPLOSION_REFLECTION(38,260); -ACE_EXPLOSION_REFLECTION(38,270); -ACE_EXPLOSION_REFLECTION(38,280); -ACE_EXPLOSION_REFLECTION(38,290); -ACE_EXPLOSION_REFLECTION(38,300); -ACE_EXPLOSION_REFLECTION(38,310); -ACE_EXPLOSION_REFLECTION(38,320); -ACE_EXPLOSION_REFLECTION(38,330); -ACE_EXPLOSION_REFLECTION(38,340); -ACE_EXPLOSION_REFLECTION(38,350); -ACE_EXPLOSION_REFLECTION(38,360); -ACE_EXPLOSION_REFLECTION(38,370); -ACE_EXPLOSION_REFLECTION(38,380); -ACE_EXPLOSION_REFLECTION(38,390); -ACE_EXPLOSION_REFLECTION(38,400); -ACE_EXPLOSION_REFLECTION(38,410); -ACE_EXPLOSION_REFLECTION(38,420); -ACE_EXPLOSION_REFLECTION(38,430); -ACE_EXPLOSION_REFLECTION(38,440); -ACE_EXPLOSION_REFLECTION(38,450); -ACE_EXPLOSION_REFLECTION(38,460); -ACE_EXPLOSION_REFLECTION(38,470); -ACE_EXPLOSION_REFLECTION(38,480); -ACE_EXPLOSION_REFLECTION(38,490); -ACE_EXPLOSION_REFLECTION(38,500); -ACE_EXPLOSION_REFLECTION(40,10); -ACE_EXPLOSION_REFLECTION(40,20); -ACE_EXPLOSION_REFLECTION(40,30); -ACE_EXPLOSION_REFLECTION(40,40); -ACE_EXPLOSION_REFLECTION(40,50); -ACE_EXPLOSION_REFLECTION(40,60); -ACE_EXPLOSION_REFLECTION(40,70); -ACE_EXPLOSION_REFLECTION(40,80); -ACE_EXPLOSION_REFLECTION(40,90); -ACE_EXPLOSION_REFLECTION(40,100); -ACE_EXPLOSION_REFLECTION(40,110); -ACE_EXPLOSION_REFLECTION(40,120); -ACE_EXPLOSION_REFLECTION(40,130); -ACE_EXPLOSION_REFLECTION(40,140); -ACE_EXPLOSION_REFLECTION(40,150); -ACE_EXPLOSION_REFLECTION(40,160); -ACE_EXPLOSION_REFLECTION(40,170); -ACE_EXPLOSION_REFLECTION(40,180); -ACE_EXPLOSION_REFLECTION(40,190); -ACE_EXPLOSION_REFLECTION(40,200); -ACE_EXPLOSION_REFLECTION(40,210); -ACE_EXPLOSION_REFLECTION(40,220); -ACE_EXPLOSION_REFLECTION(40,230); -ACE_EXPLOSION_REFLECTION(40,240); -ACE_EXPLOSION_REFLECTION(40,250); -ACE_EXPLOSION_REFLECTION(40,260); -ACE_EXPLOSION_REFLECTION(40,270); -ACE_EXPLOSION_REFLECTION(40,280); -ACE_EXPLOSION_REFLECTION(40,290); -ACE_EXPLOSION_REFLECTION(40,300); -ACE_EXPLOSION_REFLECTION(40,310); -ACE_EXPLOSION_REFLECTION(40,320); -ACE_EXPLOSION_REFLECTION(40,330); -ACE_EXPLOSION_REFLECTION(40,340); -ACE_EXPLOSION_REFLECTION(40,350); -ACE_EXPLOSION_REFLECTION(40,360); -ACE_EXPLOSION_REFLECTION(40,370); -ACE_EXPLOSION_REFLECTION(40,380); -ACE_EXPLOSION_REFLECTION(40,390); -ACE_EXPLOSION_REFLECTION(40,400); -ACE_EXPLOSION_REFLECTION(40,410); -ACE_EXPLOSION_REFLECTION(40,420); -ACE_EXPLOSION_REFLECTION(40,430); -ACE_EXPLOSION_REFLECTION(40,440); -ACE_EXPLOSION_REFLECTION(40,450); -ACE_EXPLOSION_REFLECTION(40,460); -ACE_EXPLOSION_REFLECTION(40,470); -ACE_EXPLOSION_REFLECTION(40,480); -ACE_EXPLOSION_REFLECTION(40,490); -ACE_EXPLOSION_REFLECTION(40,500); -ACE_EXPLOSION_REFLECTION(42,10); -ACE_EXPLOSION_REFLECTION(42,20); -ACE_EXPLOSION_REFLECTION(42,30); -ACE_EXPLOSION_REFLECTION(42,40); -ACE_EXPLOSION_REFLECTION(42,50); -ACE_EXPLOSION_REFLECTION(42,60); -ACE_EXPLOSION_REFLECTION(42,70); -ACE_EXPLOSION_REFLECTION(42,80); -ACE_EXPLOSION_REFLECTION(42,90); -ACE_EXPLOSION_REFLECTION(42,100); -ACE_EXPLOSION_REFLECTION(42,110); -ACE_EXPLOSION_REFLECTION(42,120); -ACE_EXPLOSION_REFLECTION(42,130); -ACE_EXPLOSION_REFLECTION(42,140); -ACE_EXPLOSION_REFLECTION(42,150); -ACE_EXPLOSION_REFLECTION(42,160); -ACE_EXPLOSION_REFLECTION(42,170); -ACE_EXPLOSION_REFLECTION(42,180); -ACE_EXPLOSION_REFLECTION(42,190); -ACE_EXPLOSION_REFLECTION(42,200); -ACE_EXPLOSION_REFLECTION(42,210); -ACE_EXPLOSION_REFLECTION(42,220); -ACE_EXPLOSION_REFLECTION(42,230); -ACE_EXPLOSION_REFLECTION(42,240); -ACE_EXPLOSION_REFLECTION(42,250); -ACE_EXPLOSION_REFLECTION(42,260); -ACE_EXPLOSION_REFLECTION(42,270); -ACE_EXPLOSION_REFLECTION(42,280); -ACE_EXPLOSION_REFLECTION(42,290); -ACE_EXPLOSION_REFLECTION(42,300); -ACE_EXPLOSION_REFLECTION(42,310); -ACE_EXPLOSION_REFLECTION(42,320); -ACE_EXPLOSION_REFLECTION(42,330); -ACE_EXPLOSION_REFLECTION(42,340); -ACE_EXPLOSION_REFLECTION(42,350); -ACE_EXPLOSION_REFLECTION(42,360); -ACE_EXPLOSION_REFLECTION(42,370); -ACE_EXPLOSION_REFLECTION(42,380); -ACE_EXPLOSION_REFLECTION(42,390); -ACE_EXPLOSION_REFLECTION(42,400); -ACE_EXPLOSION_REFLECTION(42,410); -ACE_EXPLOSION_REFLECTION(42,420); -ACE_EXPLOSION_REFLECTION(42,430); -ACE_EXPLOSION_REFLECTION(42,440); -ACE_EXPLOSION_REFLECTION(42,450); -ACE_EXPLOSION_REFLECTION(42,460); -ACE_EXPLOSION_REFLECTION(42,470); -ACE_EXPLOSION_REFLECTION(42,480); -ACE_EXPLOSION_REFLECTION(42,490); -ACE_EXPLOSION_REFLECTION(42,500); -ACE_EXPLOSION_REFLECTION(44,10); -ACE_EXPLOSION_REFLECTION(44,20); -ACE_EXPLOSION_REFLECTION(44,30); -ACE_EXPLOSION_REFLECTION(44,40); -ACE_EXPLOSION_REFLECTION(44,50); -ACE_EXPLOSION_REFLECTION(44,60); -ACE_EXPLOSION_REFLECTION(44,70); -ACE_EXPLOSION_REFLECTION(44,80); -ACE_EXPLOSION_REFLECTION(44,90); -ACE_EXPLOSION_REFLECTION(44,100); -ACE_EXPLOSION_REFLECTION(44,110); -ACE_EXPLOSION_REFLECTION(44,120); -ACE_EXPLOSION_REFLECTION(44,130); -ACE_EXPLOSION_REFLECTION(44,140); -ACE_EXPLOSION_REFLECTION(44,150); -ACE_EXPLOSION_REFLECTION(44,160); -ACE_EXPLOSION_REFLECTION(44,170); -ACE_EXPLOSION_REFLECTION(44,180); -ACE_EXPLOSION_REFLECTION(44,190); -ACE_EXPLOSION_REFLECTION(44,200); -ACE_EXPLOSION_REFLECTION(44,210); -ACE_EXPLOSION_REFLECTION(44,220); -ACE_EXPLOSION_REFLECTION(44,230); -ACE_EXPLOSION_REFLECTION(44,240); -ACE_EXPLOSION_REFLECTION(44,250); -ACE_EXPLOSION_REFLECTION(44,260); -ACE_EXPLOSION_REFLECTION(44,270); -ACE_EXPLOSION_REFLECTION(44,280); -ACE_EXPLOSION_REFLECTION(44,290); -ACE_EXPLOSION_REFLECTION(44,300); -ACE_EXPLOSION_REFLECTION(44,310); -ACE_EXPLOSION_REFLECTION(44,320); -ACE_EXPLOSION_REFLECTION(44,330); -ACE_EXPLOSION_REFLECTION(44,340); -ACE_EXPLOSION_REFLECTION(44,350); -ACE_EXPLOSION_REFLECTION(44,360); -ACE_EXPLOSION_REFLECTION(44,370); -ACE_EXPLOSION_REFLECTION(44,380); -ACE_EXPLOSION_REFLECTION(44,390); -ACE_EXPLOSION_REFLECTION(44,400); -ACE_EXPLOSION_REFLECTION(44,410); -ACE_EXPLOSION_REFLECTION(44,420); -ACE_EXPLOSION_REFLECTION(44,430); -ACE_EXPLOSION_REFLECTION(44,440); -ACE_EXPLOSION_REFLECTION(44,450); -ACE_EXPLOSION_REFLECTION(44,460); -ACE_EXPLOSION_REFLECTION(44,470); -ACE_EXPLOSION_REFLECTION(44,480); -ACE_EXPLOSION_REFLECTION(44,490); -ACE_EXPLOSION_REFLECTION(44,500); -ACE_EXPLOSION_REFLECTION(46,10); -ACE_EXPLOSION_REFLECTION(46,20); -ACE_EXPLOSION_REFLECTION(46,30); -ACE_EXPLOSION_REFLECTION(46,40); -ACE_EXPLOSION_REFLECTION(46,50); -ACE_EXPLOSION_REFLECTION(46,60); -ACE_EXPLOSION_REFLECTION(46,70); -ACE_EXPLOSION_REFLECTION(46,80); -ACE_EXPLOSION_REFLECTION(46,90); -ACE_EXPLOSION_REFLECTION(46,100); -ACE_EXPLOSION_REFLECTION(46,110); -ACE_EXPLOSION_REFLECTION(46,120); -ACE_EXPLOSION_REFLECTION(46,130); -ACE_EXPLOSION_REFLECTION(46,140); -ACE_EXPLOSION_REFLECTION(46,150); -ACE_EXPLOSION_REFLECTION(46,160); -ACE_EXPLOSION_REFLECTION(46,170); -ACE_EXPLOSION_REFLECTION(46,180); -ACE_EXPLOSION_REFLECTION(46,190); -ACE_EXPLOSION_REFLECTION(46,200); -ACE_EXPLOSION_REFLECTION(46,210); -ACE_EXPLOSION_REFLECTION(46,220); -ACE_EXPLOSION_REFLECTION(46,230); -ACE_EXPLOSION_REFLECTION(46,240); -ACE_EXPLOSION_REFLECTION(46,250); -ACE_EXPLOSION_REFLECTION(46,260); -ACE_EXPLOSION_REFLECTION(46,270); -ACE_EXPLOSION_REFLECTION(46,280); -ACE_EXPLOSION_REFLECTION(46,290); -ACE_EXPLOSION_REFLECTION(46,300); -ACE_EXPLOSION_REFLECTION(46,310); -ACE_EXPLOSION_REFLECTION(46,320); -ACE_EXPLOSION_REFLECTION(46,330); -ACE_EXPLOSION_REFLECTION(46,340); -ACE_EXPLOSION_REFLECTION(46,350); -ACE_EXPLOSION_REFLECTION(46,360); -ACE_EXPLOSION_REFLECTION(46,370); -ACE_EXPLOSION_REFLECTION(46,380); -ACE_EXPLOSION_REFLECTION(46,390); -ACE_EXPLOSION_REFLECTION(46,400); -ACE_EXPLOSION_REFLECTION(46,410); -ACE_EXPLOSION_REFLECTION(46,420); -ACE_EXPLOSION_REFLECTION(46,430); -ACE_EXPLOSION_REFLECTION(46,440); -ACE_EXPLOSION_REFLECTION(46,450); -ACE_EXPLOSION_REFLECTION(46,460); -ACE_EXPLOSION_REFLECTION(46,470); -ACE_EXPLOSION_REFLECTION(46,480); -ACE_EXPLOSION_REFLECTION(46,490); -ACE_EXPLOSION_REFLECTION(46,500); -ACE_EXPLOSION_REFLECTION(48,10); -ACE_EXPLOSION_REFLECTION(48,20); -ACE_EXPLOSION_REFLECTION(48,30); -ACE_EXPLOSION_REFLECTION(48,40); -ACE_EXPLOSION_REFLECTION(48,50); -ACE_EXPLOSION_REFLECTION(48,60); -ACE_EXPLOSION_REFLECTION(48,70); -ACE_EXPLOSION_REFLECTION(48,80); -ACE_EXPLOSION_REFLECTION(48,90); -ACE_EXPLOSION_REFLECTION(48,100); -ACE_EXPLOSION_REFLECTION(48,110); -ACE_EXPLOSION_REFLECTION(48,120); -ACE_EXPLOSION_REFLECTION(48,130); -ACE_EXPLOSION_REFLECTION(48,140); -ACE_EXPLOSION_REFLECTION(48,150); -ACE_EXPLOSION_REFLECTION(48,160); -ACE_EXPLOSION_REFLECTION(48,170); -ACE_EXPLOSION_REFLECTION(48,180); -ACE_EXPLOSION_REFLECTION(48,190); -ACE_EXPLOSION_REFLECTION(48,200); -ACE_EXPLOSION_REFLECTION(48,210); -ACE_EXPLOSION_REFLECTION(48,220); -ACE_EXPLOSION_REFLECTION(48,230); -ACE_EXPLOSION_REFLECTION(48,240); -ACE_EXPLOSION_REFLECTION(48,250); -ACE_EXPLOSION_REFLECTION(48,260); -ACE_EXPLOSION_REFLECTION(48,270); -ACE_EXPLOSION_REFLECTION(48,280); -ACE_EXPLOSION_REFLECTION(48,290); -ACE_EXPLOSION_REFLECTION(48,300); -ACE_EXPLOSION_REFLECTION(48,310); -ACE_EXPLOSION_REFLECTION(48,320); -ACE_EXPLOSION_REFLECTION(48,330); -ACE_EXPLOSION_REFLECTION(48,340); -ACE_EXPLOSION_REFLECTION(48,350); -ACE_EXPLOSION_REFLECTION(48,360); -ACE_EXPLOSION_REFLECTION(48,370); -ACE_EXPLOSION_REFLECTION(48,380); -ACE_EXPLOSION_REFLECTION(48,390); -ACE_EXPLOSION_REFLECTION(48,400); -ACE_EXPLOSION_REFLECTION(48,410); -ACE_EXPLOSION_REFLECTION(48,420); -ACE_EXPLOSION_REFLECTION(48,430); -ACE_EXPLOSION_REFLECTION(48,440); -ACE_EXPLOSION_REFLECTION(48,450); -ACE_EXPLOSION_REFLECTION(48,460); -ACE_EXPLOSION_REFLECTION(48,470); -ACE_EXPLOSION_REFLECTION(48,480); -ACE_EXPLOSION_REFLECTION(48,490); -ACE_EXPLOSION_REFLECTION(48,500); -ACE_EXPLOSION_REFLECTION(50,10); -ACE_EXPLOSION_REFLECTION(50,20); -ACE_EXPLOSION_REFLECTION(50,30); -ACE_EXPLOSION_REFLECTION(50,40); -ACE_EXPLOSION_REFLECTION(50,50); -ACE_EXPLOSION_REFLECTION(50,60); -ACE_EXPLOSION_REFLECTION(50,70); -ACE_EXPLOSION_REFLECTION(50,80); -ACE_EXPLOSION_REFLECTION(50,90); -ACE_EXPLOSION_REFLECTION(50,100); -ACE_EXPLOSION_REFLECTION(50,110); -ACE_EXPLOSION_REFLECTION(50,120); -ACE_EXPLOSION_REFLECTION(50,130); -ACE_EXPLOSION_REFLECTION(50,140); -ACE_EXPLOSION_REFLECTION(50,150); -ACE_EXPLOSION_REFLECTION(50,160); -ACE_EXPLOSION_REFLECTION(50,170); -ACE_EXPLOSION_REFLECTION(50,180); -ACE_EXPLOSION_REFLECTION(50,190); -ACE_EXPLOSION_REFLECTION(50,200); -ACE_EXPLOSION_REFLECTION(50,210); -ACE_EXPLOSION_REFLECTION(50,220); -ACE_EXPLOSION_REFLECTION(50,230); -ACE_EXPLOSION_REFLECTION(50,240); -ACE_EXPLOSION_REFLECTION(50,250); -ACE_EXPLOSION_REFLECTION(50,260); -ACE_EXPLOSION_REFLECTION(50,270); -ACE_EXPLOSION_REFLECTION(50,280); -ACE_EXPLOSION_REFLECTION(50,290); -ACE_EXPLOSION_REFLECTION(50,300); -ACE_EXPLOSION_REFLECTION(50,310); -ACE_EXPLOSION_REFLECTION(50,320); -ACE_EXPLOSION_REFLECTION(50,330); -ACE_EXPLOSION_REFLECTION(50,340); -ACE_EXPLOSION_REFLECTION(50,350); -ACE_EXPLOSION_REFLECTION(50,360); -ACE_EXPLOSION_REFLECTION(50,370); -ACE_EXPLOSION_REFLECTION(50,380); -ACE_EXPLOSION_REFLECTION(50,390); -ACE_EXPLOSION_REFLECTION(50,400); -ACE_EXPLOSION_REFLECTION(50,410); -ACE_EXPLOSION_REFLECTION(50,420); -ACE_EXPLOSION_REFLECTION(50,430); -ACE_EXPLOSION_REFLECTION(50,440); -ACE_EXPLOSION_REFLECTION(50,450); -ACE_EXPLOSION_REFLECTION(50,460); -ACE_EXPLOSION_REFLECTION(50,470); -ACE_EXPLOSION_REFLECTION(50,480); -ACE_EXPLOSION_REFLECTION(50,490); -ACE_EXPLOSION_REFLECTION(50,500); -ACE_EXPLOSION_REFLECTION(52,10); -ACE_EXPLOSION_REFLECTION(52,20); -ACE_EXPLOSION_REFLECTION(52,30); -ACE_EXPLOSION_REFLECTION(52,40); -ACE_EXPLOSION_REFLECTION(52,50); -ACE_EXPLOSION_REFLECTION(52,60); -ACE_EXPLOSION_REFLECTION(52,70); -ACE_EXPLOSION_REFLECTION(52,80); -ACE_EXPLOSION_REFLECTION(52,90); -ACE_EXPLOSION_REFLECTION(52,100); -ACE_EXPLOSION_REFLECTION(52,110); -ACE_EXPLOSION_REFLECTION(52,120); -ACE_EXPLOSION_REFLECTION(52,130); -ACE_EXPLOSION_REFLECTION(52,140); -ACE_EXPLOSION_REFLECTION(52,150); -ACE_EXPLOSION_REFLECTION(52,160); -ACE_EXPLOSION_REFLECTION(52,170); -ACE_EXPLOSION_REFLECTION(52,180); -ACE_EXPLOSION_REFLECTION(52,190); -ACE_EXPLOSION_REFLECTION(52,200); -ACE_EXPLOSION_REFLECTION(52,210); -ACE_EXPLOSION_REFLECTION(52,220); -ACE_EXPLOSION_REFLECTION(52,230); -ACE_EXPLOSION_REFLECTION(52,240); -ACE_EXPLOSION_REFLECTION(52,250); -ACE_EXPLOSION_REFLECTION(52,260); -ACE_EXPLOSION_REFLECTION(52,270); -ACE_EXPLOSION_REFLECTION(52,280); -ACE_EXPLOSION_REFLECTION(52,290); -ACE_EXPLOSION_REFLECTION(52,300); -ACE_EXPLOSION_REFLECTION(52,310); -ACE_EXPLOSION_REFLECTION(52,320); -ACE_EXPLOSION_REFLECTION(52,330); -ACE_EXPLOSION_REFLECTION(52,340); -ACE_EXPLOSION_REFLECTION(52,350); -ACE_EXPLOSION_REFLECTION(52,360); -ACE_EXPLOSION_REFLECTION(52,370); -ACE_EXPLOSION_REFLECTION(52,380); -ACE_EXPLOSION_REFLECTION(52,390); -ACE_EXPLOSION_REFLECTION(52,400); -ACE_EXPLOSION_REFLECTION(52,410); -ACE_EXPLOSION_REFLECTION(52,420); -ACE_EXPLOSION_REFLECTION(52,430); -ACE_EXPLOSION_REFLECTION(52,440); -ACE_EXPLOSION_REFLECTION(52,450); -ACE_EXPLOSION_REFLECTION(52,460); -ACE_EXPLOSION_REFLECTION(52,470); -ACE_EXPLOSION_REFLECTION(52,480); -ACE_EXPLOSION_REFLECTION(52,490); -ACE_EXPLOSION_REFLECTION(52,500); -ACE_EXPLOSION_REFLECTION(54,10); -ACE_EXPLOSION_REFLECTION(54,20); -ACE_EXPLOSION_REFLECTION(54,30); -ACE_EXPLOSION_REFLECTION(54,40); -ACE_EXPLOSION_REFLECTION(54,50); -ACE_EXPLOSION_REFLECTION(54,60); -ACE_EXPLOSION_REFLECTION(54,70); -ACE_EXPLOSION_REFLECTION(54,80); -ACE_EXPLOSION_REFLECTION(54,90); -ACE_EXPLOSION_REFLECTION(54,100); -ACE_EXPLOSION_REFLECTION(54,110); -ACE_EXPLOSION_REFLECTION(54,120); -ACE_EXPLOSION_REFLECTION(54,130); -ACE_EXPLOSION_REFLECTION(54,140); -ACE_EXPLOSION_REFLECTION(54,150); -ACE_EXPLOSION_REFLECTION(54,160); -ACE_EXPLOSION_REFLECTION(54,170); -ACE_EXPLOSION_REFLECTION(54,180); -ACE_EXPLOSION_REFLECTION(54,190); -ACE_EXPLOSION_REFLECTION(54,200); -ACE_EXPLOSION_REFLECTION(54,210); -ACE_EXPLOSION_REFLECTION(54,220); -ACE_EXPLOSION_REFLECTION(54,230); -ACE_EXPLOSION_REFLECTION(54,240); -ACE_EXPLOSION_REFLECTION(54,250); -ACE_EXPLOSION_REFLECTION(54,260); -ACE_EXPLOSION_REFLECTION(54,270); -ACE_EXPLOSION_REFLECTION(54,280); -ACE_EXPLOSION_REFLECTION(54,290); -ACE_EXPLOSION_REFLECTION(54,300); -ACE_EXPLOSION_REFLECTION(54,310); -ACE_EXPLOSION_REFLECTION(54,320); -ACE_EXPLOSION_REFLECTION(54,330); -ACE_EXPLOSION_REFLECTION(54,340); -ACE_EXPLOSION_REFLECTION(54,350); -ACE_EXPLOSION_REFLECTION(54,360); -ACE_EXPLOSION_REFLECTION(54,370); -ACE_EXPLOSION_REFLECTION(54,380); -ACE_EXPLOSION_REFLECTION(54,390); -ACE_EXPLOSION_REFLECTION(54,400); -ACE_EXPLOSION_REFLECTION(54,410); -ACE_EXPLOSION_REFLECTION(54,420); -ACE_EXPLOSION_REFLECTION(54,430); -ACE_EXPLOSION_REFLECTION(54,440); -ACE_EXPLOSION_REFLECTION(54,450); -ACE_EXPLOSION_REFLECTION(54,460); -ACE_EXPLOSION_REFLECTION(54,470); -ACE_EXPLOSION_REFLECTION(54,480); -ACE_EXPLOSION_REFLECTION(54,490); -ACE_EXPLOSION_REFLECTION(54,500); -ACE_EXPLOSION_REFLECTION(56,10); -ACE_EXPLOSION_REFLECTION(56,20); -ACE_EXPLOSION_REFLECTION(56,30); -ACE_EXPLOSION_REFLECTION(56,40); -ACE_EXPLOSION_REFLECTION(56,50); -ACE_EXPLOSION_REFLECTION(56,60); -ACE_EXPLOSION_REFLECTION(56,70); -ACE_EXPLOSION_REFLECTION(56,80); -ACE_EXPLOSION_REFLECTION(56,90); -ACE_EXPLOSION_REFLECTION(56,100); -ACE_EXPLOSION_REFLECTION(56,110); -ACE_EXPLOSION_REFLECTION(56,120); -ACE_EXPLOSION_REFLECTION(56,130); -ACE_EXPLOSION_REFLECTION(56,140); -ACE_EXPLOSION_REFLECTION(56,150); -ACE_EXPLOSION_REFLECTION(56,160); -ACE_EXPLOSION_REFLECTION(56,170); -ACE_EXPLOSION_REFLECTION(56,180); -ACE_EXPLOSION_REFLECTION(56,190); -ACE_EXPLOSION_REFLECTION(56,200); -ACE_EXPLOSION_REFLECTION(56,210); -ACE_EXPLOSION_REFLECTION(56,220); -ACE_EXPLOSION_REFLECTION(56,230); -ACE_EXPLOSION_REFLECTION(56,240); -ACE_EXPLOSION_REFLECTION(56,250); -ACE_EXPLOSION_REFLECTION(56,260); -ACE_EXPLOSION_REFLECTION(56,270); -ACE_EXPLOSION_REFLECTION(56,280); -ACE_EXPLOSION_REFLECTION(56,290); -ACE_EXPLOSION_REFLECTION(56,300); -ACE_EXPLOSION_REFLECTION(56,310); -ACE_EXPLOSION_REFLECTION(56,320); -ACE_EXPLOSION_REFLECTION(56,330); -ACE_EXPLOSION_REFLECTION(56,340); -ACE_EXPLOSION_REFLECTION(56,350); -ACE_EXPLOSION_REFLECTION(56,360); -ACE_EXPLOSION_REFLECTION(56,370); -ACE_EXPLOSION_REFLECTION(56,380); -ACE_EXPLOSION_REFLECTION(56,390); -ACE_EXPLOSION_REFLECTION(56,400); -ACE_EXPLOSION_REFLECTION(56,410); -ACE_EXPLOSION_REFLECTION(56,420); -ACE_EXPLOSION_REFLECTION(56,430); -ACE_EXPLOSION_REFLECTION(56,440); -ACE_EXPLOSION_REFLECTION(56,450); -ACE_EXPLOSION_REFLECTION(56,460); -ACE_EXPLOSION_REFLECTION(56,470); -ACE_EXPLOSION_REFLECTION(56,480); -ACE_EXPLOSION_REFLECTION(56,490); -ACE_EXPLOSION_REFLECTION(56,500); -ACE_EXPLOSION_REFLECTION(58,10); -ACE_EXPLOSION_REFLECTION(58,20); -ACE_EXPLOSION_REFLECTION(58,30); -ACE_EXPLOSION_REFLECTION(58,40); -ACE_EXPLOSION_REFLECTION(58,50); -ACE_EXPLOSION_REFLECTION(58,60); -ACE_EXPLOSION_REFLECTION(58,70); -ACE_EXPLOSION_REFLECTION(58,80); -ACE_EXPLOSION_REFLECTION(58,90); -ACE_EXPLOSION_REFLECTION(58,100); -ACE_EXPLOSION_REFLECTION(58,110); -ACE_EXPLOSION_REFLECTION(58,120); -ACE_EXPLOSION_REFLECTION(58,130); -ACE_EXPLOSION_REFLECTION(58,140); -ACE_EXPLOSION_REFLECTION(58,150); -ACE_EXPLOSION_REFLECTION(58,160); -ACE_EXPLOSION_REFLECTION(58,170); -ACE_EXPLOSION_REFLECTION(58,180); -ACE_EXPLOSION_REFLECTION(58,190); -ACE_EXPLOSION_REFLECTION(58,200); -ACE_EXPLOSION_REFLECTION(58,210); -ACE_EXPLOSION_REFLECTION(58,220); -ACE_EXPLOSION_REFLECTION(58,230); -ACE_EXPLOSION_REFLECTION(58,240); -ACE_EXPLOSION_REFLECTION(58,250); -ACE_EXPLOSION_REFLECTION(58,260); -ACE_EXPLOSION_REFLECTION(58,270); -ACE_EXPLOSION_REFLECTION(58,280); -ACE_EXPLOSION_REFLECTION(58,290); -ACE_EXPLOSION_REFLECTION(58,300); -ACE_EXPLOSION_REFLECTION(58,310); -ACE_EXPLOSION_REFLECTION(58,320); -ACE_EXPLOSION_REFLECTION(58,330); -ACE_EXPLOSION_REFLECTION(58,340); -ACE_EXPLOSION_REFLECTION(58,350); -ACE_EXPLOSION_REFLECTION(58,360); -ACE_EXPLOSION_REFLECTION(58,370); -ACE_EXPLOSION_REFLECTION(58,380); -ACE_EXPLOSION_REFLECTION(58,390); -ACE_EXPLOSION_REFLECTION(58,400); -ACE_EXPLOSION_REFLECTION(58,410); -ACE_EXPLOSION_REFLECTION(58,420); -ACE_EXPLOSION_REFLECTION(58,430); -ACE_EXPLOSION_REFLECTION(58,440); -ACE_EXPLOSION_REFLECTION(58,450); -ACE_EXPLOSION_REFLECTION(58,460); -ACE_EXPLOSION_REFLECTION(58,470); -ACE_EXPLOSION_REFLECTION(58,480); -ACE_EXPLOSION_REFLECTION(58,490); -ACE_EXPLOSION_REFLECTION(58,500); -ACE_EXPLOSION_REFLECTION(60,10); -ACE_EXPLOSION_REFLECTION(60,20); -ACE_EXPLOSION_REFLECTION(60,30); -ACE_EXPLOSION_REFLECTION(60,40); -ACE_EXPLOSION_REFLECTION(60,50); -ACE_EXPLOSION_REFLECTION(60,60); -ACE_EXPLOSION_REFLECTION(60,70); -ACE_EXPLOSION_REFLECTION(60,80); -ACE_EXPLOSION_REFLECTION(60,90); -ACE_EXPLOSION_REFLECTION(60,100); -ACE_EXPLOSION_REFLECTION(60,110); -ACE_EXPLOSION_REFLECTION(60,120); -ACE_EXPLOSION_REFLECTION(60,130); -ACE_EXPLOSION_REFLECTION(60,140); -ACE_EXPLOSION_REFLECTION(60,150); -ACE_EXPLOSION_REFLECTION(60,160); -ACE_EXPLOSION_REFLECTION(60,170); -ACE_EXPLOSION_REFLECTION(60,180); -ACE_EXPLOSION_REFLECTION(60,190); -ACE_EXPLOSION_REFLECTION(60,200); -ACE_EXPLOSION_REFLECTION(60,210); -ACE_EXPLOSION_REFLECTION(60,220); -ACE_EXPLOSION_REFLECTION(60,230); -ACE_EXPLOSION_REFLECTION(60,240); -ACE_EXPLOSION_REFLECTION(60,250); -ACE_EXPLOSION_REFLECTION(60,260); -ACE_EXPLOSION_REFLECTION(60,270); -ACE_EXPLOSION_REFLECTION(60,280); -ACE_EXPLOSION_REFLECTION(60,290); -ACE_EXPLOSION_REFLECTION(60,300); -ACE_EXPLOSION_REFLECTION(60,310); -ACE_EXPLOSION_REFLECTION(60,320); -ACE_EXPLOSION_REFLECTION(60,330); -ACE_EXPLOSION_REFLECTION(60,340); -ACE_EXPLOSION_REFLECTION(60,350); -ACE_EXPLOSION_REFLECTION(60,360); -ACE_EXPLOSION_REFLECTION(60,370); -ACE_EXPLOSION_REFLECTION(60,380); -ACE_EXPLOSION_REFLECTION(60,390); -ACE_EXPLOSION_REFLECTION(60,400); -ACE_EXPLOSION_REFLECTION(60,410); -ACE_EXPLOSION_REFLECTION(60,420); -ACE_EXPLOSION_REFLECTION(60,430); -ACE_EXPLOSION_REFLECTION(60,440); -ACE_EXPLOSION_REFLECTION(60,450); -ACE_EXPLOSION_REFLECTION(60,460); -ACE_EXPLOSION_REFLECTION(60,470); -ACE_EXPLOSION_REFLECTION(60,480); -ACE_EXPLOSION_REFLECTION(60,490); -ACE_EXPLOSION_REFLECTION(60,500); -ACE_EXPLOSION_REFLECTION(62,10); -ACE_EXPLOSION_REFLECTION(62,20); -ACE_EXPLOSION_REFLECTION(62,30); -ACE_EXPLOSION_REFLECTION(62,40); -ACE_EXPLOSION_REFLECTION(62,50); -ACE_EXPLOSION_REFLECTION(62,60); -ACE_EXPLOSION_REFLECTION(62,70); -ACE_EXPLOSION_REFLECTION(62,80); -ACE_EXPLOSION_REFLECTION(62,90); -ACE_EXPLOSION_REFLECTION(62,100); -ACE_EXPLOSION_REFLECTION(62,110); -ACE_EXPLOSION_REFLECTION(62,120); -ACE_EXPLOSION_REFLECTION(62,130); -ACE_EXPLOSION_REFLECTION(62,140); -ACE_EXPLOSION_REFLECTION(62,150); -ACE_EXPLOSION_REFLECTION(62,160); -ACE_EXPLOSION_REFLECTION(62,170); -ACE_EXPLOSION_REFLECTION(62,180); -ACE_EXPLOSION_REFLECTION(62,190); -ACE_EXPLOSION_REFLECTION(62,200); -ACE_EXPLOSION_REFLECTION(62,210); -ACE_EXPLOSION_REFLECTION(62,220); -ACE_EXPLOSION_REFLECTION(62,230); -ACE_EXPLOSION_REFLECTION(62,240); -ACE_EXPLOSION_REFLECTION(62,250); -ACE_EXPLOSION_REFLECTION(62,260); -ACE_EXPLOSION_REFLECTION(62,270); -ACE_EXPLOSION_REFLECTION(62,280); -ACE_EXPLOSION_REFLECTION(62,290); -ACE_EXPLOSION_REFLECTION(62,300); -ACE_EXPLOSION_REFLECTION(62,310); -ACE_EXPLOSION_REFLECTION(62,320); -ACE_EXPLOSION_REFLECTION(62,330); -ACE_EXPLOSION_REFLECTION(62,340); -ACE_EXPLOSION_REFLECTION(62,350); -ACE_EXPLOSION_REFLECTION(62,360); -ACE_EXPLOSION_REFLECTION(62,370); -ACE_EXPLOSION_REFLECTION(62,380); -ACE_EXPLOSION_REFLECTION(62,390); -ACE_EXPLOSION_REFLECTION(62,400); -ACE_EXPLOSION_REFLECTION(62,410); -ACE_EXPLOSION_REFLECTION(62,420); -ACE_EXPLOSION_REFLECTION(62,430); -ACE_EXPLOSION_REFLECTION(62,440); -ACE_EXPLOSION_REFLECTION(62,450); -ACE_EXPLOSION_REFLECTION(62,460); -ACE_EXPLOSION_REFLECTION(62,470); -ACE_EXPLOSION_REFLECTION(62,480); -ACE_EXPLOSION_REFLECTION(62,490); -ACE_EXPLOSION_REFLECTION(62,500); -ACE_EXPLOSION_REFLECTION(64,10); -ACE_EXPLOSION_REFLECTION(64,20); -ACE_EXPLOSION_REFLECTION(64,30); -ACE_EXPLOSION_REFLECTION(64,40); -ACE_EXPLOSION_REFLECTION(64,50); -ACE_EXPLOSION_REFLECTION(64,60); -ACE_EXPLOSION_REFLECTION(64,70); -ACE_EXPLOSION_REFLECTION(64,80); -ACE_EXPLOSION_REFLECTION(64,90); -ACE_EXPLOSION_REFLECTION(64,100); -ACE_EXPLOSION_REFLECTION(64,110); -ACE_EXPLOSION_REFLECTION(64,120); -ACE_EXPLOSION_REFLECTION(64,130); -ACE_EXPLOSION_REFLECTION(64,140); -ACE_EXPLOSION_REFLECTION(64,150); -ACE_EXPLOSION_REFLECTION(64,160); -ACE_EXPLOSION_REFLECTION(64,170); -ACE_EXPLOSION_REFLECTION(64,180); -ACE_EXPLOSION_REFLECTION(64,190); -ACE_EXPLOSION_REFLECTION(64,200); -ACE_EXPLOSION_REFLECTION(64,210); -ACE_EXPLOSION_REFLECTION(64,220); -ACE_EXPLOSION_REFLECTION(64,230); -ACE_EXPLOSION_REFLECTION(64,240); -ACE_EXPLOSION_REFLECTION(64,250); -ACE_EXPLOSION_REFLECTION(64,260); -ACE_EXPLOSION_REFLECTION(64,270); -ACE_EXPLOSION_REFLECTION(64,280); -ACE_EXPLOSION_REFLECTION(64,290); -ACE_EXPLOSION_REFLECTION(64,300); -ACE_EXPLOSION_REFLECTION(64,310); -ACE_EXPLOSION_REFLECTION(64,320); -ACE_EXPLOSION_REFLECTION(64,330); -ACE_EXPLOSION_REFLECTION(64,340); -ACE_EXPLOSION_REFLECTION(64,350); -ACE_EXPLOSION_REFLECTION(64,360); -ACE_EXPLOSION_REFLECTION(64,370); -ACE_EXPLOSION_REFLECTION(64,380); -ACE_EXPLOSION_REFLECTION(64,390); -ACE_EXPLOSION_REFLECTION(64,400); -ACE_EXPLOSION_REFLECTION(64,410); -ACE_EXPLOSION_REFLECTION(64,420); -ACE_EXPLOSION_REFLECTION(64,430); -ACE_EXPLOSION_REFLECTION(64,440); -ACE_EXPLOSION_REFLECTION(64,450); -ACE_EXPLOSION_REFLECTION(64,460); -ACE_EXPLOSION_REFLECTION(64,470); -ACE_EXPLOSION_REFLECTION(64,480); -ACE_EXPLOSION_REFLECTION(64,490); -ACE_EXPLOSION_REFLECTION(64,500); -ACE_EXPLOSION_REFLECTION(66,10); -ACE_EXPLOSION_REFLECTION(66,20); -ACE_EXPLOSION_REFLECTION(66,30); -ACE_EXPLOSION_REFLECTION(66,40); -ACE_EXPLOSION_REFLECTION(66,50); -ACE_EXPLOSION_REFLECTION(66,60); -ACE_EXPLOSION_REFLECTION(66,70); -ACE_EXPLOSION_REFLECTION(66,80); -ACE_EXPLOSION_REFLECTION(66,90); -ACE_EXPLOSION_REFLECTION(66,100); -ACE_EXPLOSION_REFLECTION(66,110); -ACE_EXPLOSION_REFLECTION(66,120); -ACE_EXPLOSION_REFLECTION(66,130); -ACE_EXPLOSION_REFLECTION(66,140); -ACE_EXPLOSION_REFLECTION(66,150); -ACE_EXPLOSION_REFLECTION(66,160); -ACE_EXPLOSION_REFLECTION(66,170); -ACE_EXPLOSION_REFLECTION(66,180); -ACE_EXPLOSION_REFLECTION(66,190); -ACE_EXPLOSION_REFLECTION(66,200); -ACE_EXPLOSION_REFLECTION(66,210); -ACE_EXPLOSION_REFLECTION(66,220); -ACE_EXPLOSION_REFLECTION(66,230); -ACE_EXPLOSION_REFLECTION(66,240); -ACE_EXPLOSION_REFLECTION(66,250); -ACE_EXPLOSION_REFLECTION(66,260); -ACE_EXPLOSION_REFLECTION(66,270); -ACE_EXPLOSION_REFLECTION(66,280); -ACE_EXPLOSION_REFLECTION(66,290); -ACE_EXPLOSION_REFLECTION(66,300); -ACE_EXPLOSION_REFLECTION(66,310); -ACE_EXPLOSION_REFLECTION(66,320); -ACE_EXPLOSION_REFLECTION(66,330); -ACE_EXPLOSION_REFLECTION(66,340); -ACE_EXPLOSION_REFLECTION(66,350); -ACE_EXPLOSION_REFLECTION(66,360); -ACE_EXPLOSION_REFLECTION(66,370); -ACE_EXPLOSION_REFLECTION(66,380); -ACE_EXPLOSION_REFLECTION(66,390); -ACE_EXPLOSION_REFLECTION(66,400); -ACE_EXPLOSION_REFLECTION(66,410); -ACE_EXPLOSION_REFLECTION(66,420); -ACE_EXPLOSION_REFLECTION(66,430); -ACE_EXPLOSION_REFLECTION(66,440); -ACE_EXPLOSION_REFLECTION(66,450); -ACE_EXPLOSION_REFLECTION(66,460); -ACE_EXPLOSION_REFLECTION(66,470); -ACE_EXPLOSION_REFLECTION(66,480); -ACE_EXPLOSION_REFLECTION(66,490); -ACE_EXPLOSION_REFLECTION(66,500); -ACE_EXPLOSION_REFLECTION(68,10); -ACE_EXPLOSION_REFLECTION(68,20); -ACE_EXPLOSION_REFLECTION(68,30); -ACE_EXPLOSION_REFLECTION(68,40); -ACE_EXPLOSION_REFLECTION(68,50); -ACE_EXPLOSION_REFLECTION(68,60); -ACE_EXPLOSION_REFLECTION(68,70); -ACE_EXPLOSION_REFLECTION(68,80); -ACE_EXPLOSION_REFLECTION(68,90); -ACE_EXPLOSION_REFLECTION(68,100); -ACE_EXPLOSION_REFLECTION(68,110); -ACE_EXPLOSION_REFLECTION(68,120); -ACE_EXPLOSION_REFLECTION(68,130); -ACE_EXPLOSION_REFLECTION(68,140); -ACE_EXPLOSION_REFLECTION(68,150); -ACE_EXPLOSION_REFLECTION(68,160); -ACE_EXPLOSION_REFLECTION(68,170); -ACE_EXPLOSION_REFLECTION(68,180); -ACE_EXPLOSION_REFLECTION(68,190); -ACE_EXPLOSION_REFLECTION(68,200); -ACE_EXPLOSION_REFLECTION(68,210); -ACE_EXPLOSION_REFLECTION(68,220); -ACE_EXPLOSION_REFLECTION(68,230); -ACE_EXPLOSION_REFLECTION(68,240); -ACE_EXPLOSION_REFLECTION(68,250); -ACE_EXPLOSION_REFLECTION(68,260); -ACE_EXPLOSION_REFLECTION(68,270); -ACE_EXPLOSION_REFLECTION(68,280); -ACE_EXPLOSION_REFLECTION(68,290); -ACE_EXPLOSION_REFLECTION(68,300); -ACE_EXPLOSION_REFLECTION(68,310); -ACE_EXPLOSION_REFLECTION(68,320); -ACE_EXPLOSION_REFLECTION(68,330); -ACE_EXPLOSION_REFLECTION(68,340); -ACE_EXPLOSION_REFLECTION(68,350); -ACE_EXPLOSION_REFLECTION(68,360); -ACE_EXPLOSION_REFLECTION(68,370); -ACE_EXPLOSION_REFLECTION(68,380); -ACE_EXPLOSION_REFLECTION(68,390); -ACE_EXPLOSION_REFLECTION(68,400); -ACE_EXPLOSION_REFLECTION(68,410); -ACE_EXPLOSION_REFLECTION(68,420); -ACE_EXPLOSION_REFLECTION(68,430); -ACE_EXPLOSION_REFLECTION(68,440); -ACE_EXPLOSION_REFLECTION(68,450); -ACE_EXPLOSION_REFLECTION(68,460); -ACE_EXPLOSION_REFLECTION(68,470); -ACE_EXPLOSION_REFLECTION(68,480); -ACE_EXPLOSION_REFLECTION(68,490); -ACE_EXPLOSION_REFLECTION(68,500); -ACE_EXPLOSION_REFLECTION(70,10); -ACE_EXPLOSION_REFLECTION(70,20); -ACE_EXPLOSION_REFLECTION(70,30); -ACE_EXPLOSION_REFLECTION(70,40); -ACE_EXPLOSION_REFLECTION(70,50); -ACE_EXPLOSION_REFLECTION(70,60); -ACE_EXPLOSION_REFLECTION(70,70); -ACE_EXPLOSION_REFLECTION(70,80); -ACE_EXPLOSION_REFLECTION(70,90); -ACE_EXPLOSION_REFLECTION(70,100); -ACE_EXPLOSION_REFLECTION(70,110); -ACE_EXPLOSION_REFLECTION(70,120); -ACE_EXPLOSION_REFLECTION(70,130); -ACE_EXPLOSION_REFLECTION(70,140); -ACE_EXPLOSION_REFLECTION(70,150); -ACE_EXPLOSION_REFLECTION(70,160); -ACE_EXPLOSION_REFLECTION(70,170); -ACE_EXPLOSION_REFLECTION(70,180); -ACE_EXPLOSION_REFLECTION(70,190); -ACE_EXPLOSION_REFLECTION(70,200); -ACE_EXPLOSION_REFLECTION(70,210); -ACE_EXPLOSION_REFLECTION(70,220); -ACE_EXPLOSION_REFLECTION(70,230); -ACE_EXPLOSION_REFLECTION(70,240); -ACE_EXPLOSION_REFLECTION(70,250); -ACE_EXPLOSION_REFLECTION(70,260); -ACE_EXPLOSION_REFLECTION(70,270); -ACE_EXPLOSION_REFLECTION(70,280); -ACE_EXPLOSION_REFLECTION(70,290); -ACE_EXPLOSION_REFLECTION(70,300); -ACE_EXPLOSION_REFLECTION(70,310); -ACE_EXPLOSION_REFLECTION(70,320); -ACE_EXPLOSION_REFLECTION(70,330); -ACE_EXPLOSION_REFLECTION(70,340); -ACE_EXPLOSION_REFLECTION(70,350); -ACE_EXPLOSION_REFLECTION(70,360); -ACE_EXPLOSION_REFLECTION(70,370); -ACE_EXPLOSION_REFLECTION(70,380); -ACE_EXPLOSION_REFLECTION(70,390); -ACE_EXPLOSION_REFLECTION(70,400); -ACE_EXPLOSION_REFLECTION(70,410); -ACE_EXPLOSION_REFLECTION(70,420); -ACE_EXPLOSION_REFLECTION(70,430); -ACE_EXPLOSION_REFLECTION(70,440); -ACE_EXPLOSION_REFLECTION(70,450); -ACE_EXPLOSION_REFLECTION(70,460); -ACE_EXPLOSION_REFLECTION(70,470); -ACE_EXPLOSION_REFLECTION(70,480); -ACE_EXPLOSION_REFLECTION(70,490); -ACE_EXPLOSION_REFLECTION(70,500); -ACE_EXPLOSION_REFLECTION(72,10); -ACE_EXPLOSION_REFLECTION(72,20); -ACE_EXPLOSION_REFLECTION(72,30); -ACE_EXPLOSION_REFLECTION(72,40); -ACE_EXPLOSION_REFLECTION(72,50); -ACE_EXPLOSION_REFLECTION(72,60); -ACE_EXPLOSION_REFLECTION(72,70); -ACE_EXPLOSION_REFLECTION(72,80); -ACE_EXPLOSION_REFLECTION(72,90); -ACE_EXPLOSION_REFLECTION(72,100); -ACE_EXPLOSION_REFLECTION(72,110); -ACE_EXPLOSION_REFLECTION(72,120); -ACE_EXPLOSION_REFLECTION(72,130); -ACE_EXPLOSION_REFLECTION(72,140); -ACE_EXPLOSION_REFLECTION(72,150); -ACE_EXPLOSION_REFLECTION(72,160); -ACE_EXPLOSION_REFLECTION(72,170); -ACE_EXPLOSION_REFLECTION(72,180); -ACE_EXPLOSION_REFLECTION(72,190); -ACE_EXPLOSION_REFLECTION(72,200); -ACE_EXPLOSION_REFLECTION(72,210); -ACE_EXPLOSION_REFLECTION(72,220); -ACE_EXPLOSION_REFLECTION(72,230); -ACE_EXPLOSION_REFLECTION(72,240); -ACE_EXPLOSION_REFLECTION(72,250); -ACE_EXPLOSION_REFLECTION(72,260); -ACE_EXPLOSION_REFLECTION(72,270); -ACE_EXPLOSION_REFLECTION(72,280); -ACE_EXPLOSION_REFLECTION(72,290); -ACE_EXPLOSION_REFLECTION(72,300); -ACE_EXPLOSION_REFLECTION(72,310); -ACE_EXPLOSION_REFLECTION(72,320); -ACE_EXPLOSION_REFLECTION(72,330); -ACE_EXPLOSION_REFLECTION(72,340); -ACE_EXPLOSION_REFLECTION(72,350); -ACE_EXPLOSION_REFLECTION(72,360); -ACE_EXPLOSION_REFLECTION(72,370); -ACE_EXPLOSION_REFLECTION(72,380); -ACE_EXPLOSION_REFLECTION(72,390); -ACE_EXPLOSION_REFLECTION(72,400); -ACE_EXPLOSION_REFLECTION(72,410); -ACE_EXPLOSION_REFLECTION(72,420); -ACE_EXPLOSION_REFLECTION(72,430); -ACE_EXPLOSION_REFLECTION(72,440); -ACE_EXPLOSION_REFLECTION(72,450); -ACE_EXPLOSION_REFLECTION(72,460); -ACE_EXPLOSION_REFLECTION(72,470); -ACE_EXPLOSION_REFLECTION(72,480); -ACE_EXPLOSION_REFLECTION(72,490); -ACE_EXPLOSION_REFLECTION(72,500); -ACE_EXPLOSION_REFLECTION(74,10); -ACE_EXPLOSION_REFLECTION(74,20); -ACE_EXPLOSION_REFLECTION(74,30); -ACE_EXPLOSION_REFLECTION(74,40); -ACE_EXPLOSION_REFLECTION(74,50); -ACE_EXPLOSION_REFLECTION(74,60); -ACE_EXPLOSION_REFLECTION(74,70); -ACE_EXPLOSION_REFLECTION(74,80); -ACE_EXPLOSION_REFLECTION(74,90); -ACE_EXPLOSION_REFLECTION(74,100); -ACE_EXPLOSION_REFLECTION(74,110); -ACE_EXPLOSION_REFLECTION(74,120); -ACE_EXPLOSION_REFLECTION(74,130); -ACE_EXPLOSION_REFLECTION(74,140); -ACE_EXPLOSION_REFLECTION(74,150); -ACE_EXPLOSION_REFLECTION(74,160); -ACE_EXPLOSION_REFLECTION(74,170); -ACE_EXPLOSION_REFLECTION(74,180); -ACE_EXPLOSION_REFLECTION(74,190); -ACE_EXPLOSION_REFLECTION(74,200); -ACE_EXPLOSION_REFLECTION(74,210); -ACE_EXPLOSION_REFLECTION(74,220); -ACE_EXPLOSION_REFLECTION(74,230); -ACE_EXPLOSION_REFLECTION(74,240); -ACE_EXPLOSION_REFLECTION(74,250); -ACE_EXPLOSION_REFLECTION(74,260); -ACE_EXPLOSION_REFLECTION(74,270); -ACE_EXPLOSION_REFLECTION(74,280); -ACE_EXPLOSION_REFLECTION(74,290); -ACE_EXPLOSION_REFLECTION(74,300); -ACE_EXPLOSION_REFLECTION(74,310); -ACE_EXPLOSION_REFLECTION(74,320); -ACE_EXPLOSION_REFLECTION(74,330); -ACE_EXPLOSION_REFLECTION(74,340); -ACE_EXPLOSION_REFLECTION(74,350); -ACE_EXPLOSION_REFLECTION(74,360); -ACE_EXPLOSION_REFLECTION(74,370); -ACE_EXPLOSION_REFLECTION(74,380); -ACE_EXPLOSION_REFLECTION(74,390); -ACE_EXPLOSION_REFLECTION(74,400); -ACE_EXPLOSION_REFLECTION(74,410); -ACE_EXPLOSION_REFLECTION(74,420); -ACE_EXPLOSION_REFLECTION(74,430); -ACE_EXPLOSION_REFLECTION(74,440); -ACE_EXPLOSION_REFLECTION(74,450); -ACE_EXPLOSION_REFLECTION(74,460); -ACE_EXPLOSION_REFLECTION(74,470); -ACE_EXPLOSION_REFLECTION(74,480); -ACE_EXPLOSION_REFLECTION(74,490); -ACE_EXPLOSION_REFLECTION(74,500); -ACE_EXPLOSION_REFLECTION(76,10); -ACE_EXPLOSION_REFLECTION(76,20); -ACE_EXPLOSION_REFLECTION(76,30); -ACE_EXPLOSION_REFLECTION(76,40); -ACE_EXPLOSION_REFLECTION(76,50); -ACE_EXPLOSION_REFLECTION(76,60); -ACE_EXPLOSION_REFLECTION(76,70); -ACE_EXPLOSION_REFLECTION(76,80); -ACE_EXPLOSION_REFLECTION(76,90); -ACE_EXPLOSION_REFLECTION(76,100); -ACE_EXPLOSION_REFLECTION(76,110); -ACE_EXPLOSION_REFLECTION(76,120); -ACE_EXPLOSION_REFLECTION(76,130); -ACE_EXPLOSION_REFLECTION(76,140); -ACE_EXPLOSION_REFLECTION(76,150); -ACE_EXPLOSION_REFLECTION(76,160); -ACE_EXPLOSION_REFLECTION(76,170); -ACE_EXPLOSION_REFLECTION(76,180); -ACE_EXPLOSION_REFLECTION(76,190); -ACE_EXPLOSION_REFLECTION(76,200); -ACE_EXPLOSION_REFLECTION(76,210); -ACE_EXPLOSION_REFLECTION(76,220); -ACE_EXPLOSION_REFLECTION(76,230); -ACE_EXPLOSION_REFLECTION(76,240); -ACE_EXPLOSION_REFLECTION(76,250); -ACE_EXPLOSION_REFLECTION(76,260); -ACE_EXPLOSION_REFLECTION(76,270); -ACE_EXPLOSION_REFLECTION(76,280); -ACE_EXPLOSION_REFLECTION(76,290); -ACE_EXPLOSION_REFLECTION(76,300); -ACE_EXPLOSION_REFLECTION(76,310); -ACE_EXPLOSION_REFLECTION(76,320); -ACE_EXPLOSION_REFLECTION(76,330); -ACE_EXPLOSION_REFLECTION(76,340); -ACE_EXPLOSION_REFLECTION(76,350); -ACE_EXPLOSION_REFLECTION(76,360); -ACE_EXPLOSION_REFLECTION(76,370); -ACE_EXPLOSION_REFLECTION(76,380); -ACE_EXPLOSION_REFLECTION(76,390); -ACE_EXPLOSION_REFLECTION(76,400); -ACE_EXPLOSION_REFLECTION(76,410); -ACE_EXPLOSION_REFLECTION(76,420); -ACE_EXPLOSION_REFLECTION(76,430); -ACE_EXPLOSION_REFLECTION(76,440); -ACE_EXPLOSION_REFLECTION(76,450); -ACE_EXPLOSION_REFLECTION(76,460); -ACE_EXPLOSION_REFLECTION(76,470); -ACE_EXPLOSION_REFLECTION(76,480); -ACE_EXPLOSION_REFLECTION(76,490); -ACE_EXPLOSION_REFLECTION(76,500); -ACE_EXPLOSION_REFLECTION(78,10); -ACE_EXPLOSION_REFLECTION(78,20); -ACE_EXPLOSION_REFLECTION(78,30); -ACE_EXPLOSION_REFLECTION(78,40); -ACE_EXPLOSION_REFLECTION(78,50); -ACE_EXPLOSION_REFLECTION(78,60); -ACE_EXPLOSION_REFLECTION(78,70); -ACE_EXPLOSION_REFLECTION(78,80); -ACE_EXPLOSION_REFLECTION(78,90); -ACE_EXPLOSION_REFLECTION(78,100); -ACE_EXPLOSION_REFLECTION(78,110); -ACE_EXPLOSION_REFLECTION(78,120); -ACE_EXPLOSION_REFLECTION(78,130); -ACE_EXPLOSION_REFLECTION(78,140); -ACE_EXPLOSION_REFLECTION(78,150); -ACE_EXPLOSION_REFLECTION(78,160); -ACE_EXPLOSION_REFLECTION(78,170); -ACE_EXPLOSION_REFLECTION(78,180); -ACE_EXPLOSION_REFLECTION(78,190); -ACE_EXPLOSION_REFLECTION(78,200); -ACE_EXPLOSION_REFLECTION(78,210); -ACE_EXPLOSION_REFLECTION(78,220); -ACE_EXPLOSION_REFLECTION(78,230); -ACE_EXPLOSION_REFLECTION(78,240); -ACE_EXPLOSION_REFLECTION(78,250); -ACE_EXPLOSION_REFLECTION(78,260); -ACE_EXPLOSION_REFLECTION(78,270); -ACE_EXPLOSION_REFLECTION(78,280); -ACE_EXPLOSION_REFLECTION(78,290); -ACE_EXPLOSION_REFLECTION(78,300); -ACE_EXPLOSION_REFLECTION(78,310); -ACE_EXPLOSION_REFLECTION(78,320); -ACE_EXPLOSION_REFLECTION(78,330); -ACE_EXPLOSION_REFLECTION(78,340); -ACE_EXPLOSION_REFLECTION(78,350); -ACE_EXPLOSION_REFLECTION(78,360); -ACE_EXPLOSION_REFLECTION(78,370); -ACE_EXPLOSION_REFLECTION(78,380); -ACE_EXPLOSION_REFLECTION(78,390); -ACE_EXPLOSION_REFLECTION(78,400); -ACE_EXPLOSION_REFLECTION(78,410); -ACE_EXPLOSION_REFLECTION(78,420); -ACE_EXPLOSION_REFLECTION(78,430); -ACE_EXPLOSION_REFLECTION(78,440); -ACE_EXPLOSION_REFLECTION(78,450); -ACE_EXPLOSION_REFLECTION(78,460); -ACE_EXPLOSION_REFLECTION(78,470); -ACE_EXPLOSION_REFLECTION(78,480); -ACE_EXPLOSION_REFLECTION(78,490); -ACE_EXPLOSION_REFLECTION(78,500); -ACE_EXPLOSION_REFLECTION(80,10); -ACE_EXPLOSION_REFLECTION(80,20); -ACE_EXPLOSION_REFLECTION(80,30); -ACE_EXPLOSION_REFLECTION(80,40); -ACE_EXPLOSION_REFLECTION(80,50); -ACE_EXPLOSION_REFLECTION(80,60); -ACE_EXPLOSION_REFLECTION(80,70); -ACE_EXPLOSION_REFLECTION(80,80); -ACE_EXPLOSION_REFLECTION(80,90); -ACE_EXPLOSION_REFLECTION(80,100); -ACE_EXPLOSION_REFLECTION(80,110); -ACE_EXPLOSION_REFLECTION(80,120); -ACE_EXPLOSION_REFLECTION(80,130); -ACE_EXPLOSION_REFLECTION(80,140); -ACE_EXPLOSION_REFLECTION(80,150); -ACE_EXPLOSION_REFLECTION(80,160); -ACE_EXPLOSION_REFLECTION(80,170); -ACE_EXPLOSION_REFLECTION(80,180); -ACE_EXPLOSION_REFLECTION(80,190); -ACE_EXPLOSION_REFLECTION(80,200); -ACE_EXPLOSION_REFLECTION(80,210); -ACE_EXPLOSION_REFLECTION(80,220); -ACE_EXPLOSION_REFLECTION(80,230); -ACE_EXPLOSION_REFLECTION(80,240); -ACE_EXPLOSION_REFLECTION(80,250); -ACE_EXPLOSION_REFLECTION(80,260); -ACE_EXPLOSION_REFLECTION(80,270); -ACE_EXPLOSION_REFLECTION(80,280); -ACE_EXPLOSION_REFLECTION(80,290); -ACE_EXPLOSION_REFLECTION(80,300); -ACE_EXPLOSION_REFLECTION(80,310); -ACE_EXPLOSION_REFLECTION(80,320); -ACE_EXPLOSION_REFLECTION(80,330); -ACE_EXPLOSION_REFLECTION(80,340); -ACE_EXPLOSION_REFLECTION(80,350); -ACE_EXPLOSION_REFLECTION(80,360); -ACE_EXPLOSION_REFLECTION(80,370); -ACE_EXPLOSION_REFLECTION(80,380); -ACE_EXPLOSION_REFLECTION(80,390); -ACE_EXPLOSION_REFLECTION(80,400); -ACE_EXPLOSION_REFLECTION(80,410); -ACE_EXPLOSION_REFLECTION(80,420); -ACE_EXPLOSION_REFLECTION(80,430); -ACE_EXPLOSION_REFLECTION(80,440); -ACE_EXPLOSION_REFLECTION(80,450); -ACE_EXPLOSION_REFLECTION(80,460); -ACE_EXPLOSION_REFLECTION(80,470); -ACE_EXPLOSION_REFLECTION(80,480); -ACE_EXPLOSION_REFLECTION(80,490); -ACE_EXPLOSION_REFLECTION(80,500); -ACE_EXPLOSION_REFLECTION(82,10); -ACE_EXPLOSION_REFLECTION(82,20); -ACE_EXPLOSION_REFLECTION(82,30); -ACE_EXPLOSION_REFLECTION(82,40); -ACE_EXPLOSION_REFLECTION(82,50); -ACE_EXPLOSION_REFLECTION(82,60); -ACE_EXPLOSION_REFLECTION(82,70); -ACE_EXPLOSION_REFLECTION(82,80); -ACE_EXPLOSION_REFLECTION(82,90); -ACE_EXPLOSION_REFLECTION(82,100); -ACE_EXPLOSION_REFLECTION(82,110); -ACE_EXPLOSION_REFLECTION(82,120); -ACE_EXPLOSION_REFLECTION(82,130); -ACE_EXPLOSION_REFLECTION(82,140); -ACE_EXPLOSION_REFLECTION(82,150); -ACE_EXPLOSION_REFLECTION(82,160); -ACE_EXPLOSION_REFLECTION(82,170); -ACE_EXPLOSION_REFLECTION(82,180); -ACE_EXPLOSION_REFLECTION(82,190); -ACE_EXPLOSION_REFLECTION(82,200); -ACE_EXPLOSION_REFLECTION(82,210); -ACE_EXPLOSION_REFLECTION(82,220); -ACE_EXPLOSION_REFLECTION(82,230); -ACE_EXPLOSION_REFLECTION(82,240); -ACE_EXPLOSION_REFLECTION(82,250); -ACE_EXPLOSION_REFLECTION(82,260); -ACE_EXPLOSION_REFLECTION(82,270); -ACE_EXPLOSION_REFLECTION(82,280); -ACE_EXPLOSION_REFLECTION(82,290); -ACE_EXPLOSION_REFLECTION(82,300); -ACE_EXPLOSION_REFLECTION(82,310); -ACE_EXPLOSION_REFLECTION(82,320); -ACE_EXPLOSION_REFLECTION(82,330); -ACE_EXPLOSION_REFLECTION(82,340); -ACE_EXPLOSION_REFLECTION(82,350); -ACE_EXPLOSION_REFLECTION(82,360); -ACE_EXPLOSION_REFLECTION(82,370); -ACE_EXPLOSION_REFLECTION(82,380); -ACE_EXPLOSION_REFLECTION(82,390); -ACE_EXPLOSION_REFLECTION(82,400); -ACE_EXPLOSION_REFLECTION(82,410); -ACE_EXPLOSION_REFLECTION(82,420); -ACE_EXPLOSION_REFLECTION(82,430); -ACE_EXPLOSION_REFLECTION(82,440); -ACE_EXPLOSION_REFLECTION(82,450); -ACE_EXPLOSION_REFLECTION(82,460); -ACE_EXPLOSION_REFLECTION(82,470); -ACE_EXPLOSION_REFLECTION(82,480); -ACE_EXPLOSION_REFLECTION(82,490); -ACE_EXPLOSION_REFLECTION(82,500); -ACE_EXPLOSION_REFLECTION(84,10); -ACE_EXPLOSION_REFLECTION(84,20); -ACE_EXPLOSION_REFLECTION(84,30); -ACE_EXPLOSION_REFLECTION(84,40); -ACE_EXPLOSION_REFLECTION(84,50); -ACE_EXPLOSION_REFLECTION(84,60); -ACE_EXPLOSION_REFLECTION(84,70); -ACE_EXPLOSION_REFLECTION(84,80); -ACE_EXPLOSION_REFLECTION(84,90); -ACE_EXPLOSION_REFLECTION(84,100); -ACE_EXPLOSION_REFLECTION(84,110); -ACE_EXPLOSION_REFLECTION(84,120); -ACE_EXPLOSION_REFLECTION(84,130); -ACE_EXPLOSION_REFLECTION(84,140); -ACE_EXPLOSION_REFLECTION(84,150); -ACE_EXPLOSION_REFLECTION(84,160); -ACE_EXPLOSION_REFLECTION(84,170); -ACE_EXPLOSION_REFLECTION(84,180); -ACE_EXPLOSION_REFLECTION(84,190); -ACE_EXPLOSION_REFLECTION(84,200); -ACE_EXPLOSION_REFLECTION(84,210); -ACE_EXPLOSION_REFLECTION(84,220); -ACE_EXPLOSION_REFLECTION(84,230); -ACE_EXPLOSION_REFLECTION(84,240); -ACE_EXPLOSION_REFLECTION(84,250); -ACE_EXPLOSION_REFLECTION(84,260); -ACE_EXPLOSION_REFLECTION(84,270); -ACE_EXPLOSION_REFLECTION(84,280); -ACE_EXPLOSION_REFLECTION(84,290); -ACE_EXPLOSION_REFLECTION(84,300); -ACE_EXPLOSION_REFLECTION(84,310); -ACE_EXPLOSION_REFLECTION(84,320); -ACE_EXPLOSION_REFLECTION(84,330); -ACE_EXPLOSION_REFLECTION(84,340); -ACE_EXPLOSION_REFLECTION(84,350); -ACE_EXPLOSION_REFLECTION(84,360); -ACE_EXPLOSION_REFLECTION(84,370); -ACE_EXPLOSION_REFLECTION(84,380); -ACE_EXPLOSION_REFLECTION(84,390); -ACE_EXPLOSION_REFLECTION(84,400); -ACE_EXPLOSION_REFLECTION(84,410); -ACE_EXPLOSION_REFLECTION(84,420); -ACE_EXPLOSION_REFLECTION(84,430); -ACE_EXPLOSION_REFLECTION(84,440); -ACE_EXPLOSION_REFLECTION(84,450); -ACE_EXPLOSION_REFLECTION(84,460); -ACE_EXPLOSION_REFLECTION(84,470); -ACE_EXPLOSION_REFLECTION(84,480); -ACE_EXPLOSION_REFLECTION(84,490); -ACE_EXPLOSION_REFLECTION(84,500); -ACE_EXPLOSION_REFLECTION(86,10); -ACE_EXPLOSION_REFLECTION(86,20); -ACE_EXPLOSION_REFLECTION(86,30); -ACE_EXPLOSION_REFLECTION(86,40); -ACE_EXPLOSION_REFLECTION(86,50); -ACE_EXPLOSION_REFLECTION(86,60); -ACE_EXPLOSION_REFLECTION(86,70); -ACE_EXPLOSION_REFLECTION(86,80); -ACE_EXPLOSION_REFLECTION(86,90); -ACE_EXPLOSION_REFLECTION(86,100); -ACE_EXPLOSION_REFLECTION(86,110); -ACE_EXPLOSION_REFLECTION(86,120); -ACE_EXPLOSION_REFLECTION(86,130); -ACE_EXPLOSION_REFLECTION(86,140); -ACE_EXPLOSION_REFLECTION(86,150); -ACE_EXPLOSION_REFLECTION(86,160); -ACE_EXPLOSION_REFLECTION(86,170); -ACE_EXPLOSION_REFLECTION(86,180); -ACE_EXPLOSION_REFLECTION(86,190); -ACE_EXPLOSION_REFLECTION(86,200); -ACE_EXPLOSION_REFLECTION(86,210); -ACE_EXPLOSION_REFLECTION(86,220); -ACE_EXPLOSION_REFLECTION(86,230); -ACE_EXPLOSION_REFLECTION(86,240); -ACE_EXPLOSION_REFLECTION(86,250); -ACE_EXPLOSION_REFLECTION(86,260); -ACE_EXPLOSION_REFLECTION(86,270); -ACE_EXPLOSION_REFLECTION(86,280); -ACE_EXPLOSION_REFLECTION(86,290); -ACE_EXPLOSION_REFLECTION(86,300); -ACE_EXPLOSION_REFLECTION(86,310); -ACE_EXPLOSION_REFLECTION(86,320); -ACE_EXPLOSION_REFLECTION(86,330); -ACE_EXPLOSION_REFLECTION(86,340); -ACE_EXPLOSION_REFLECTION(86,350); -ACE_EXPLOSION_REFLECTION(86,360); -ACE_EXPLOSION_REFLECTION(86,370); -ACE_EXPLOSION_REFLECTION(86,380); -ACE_EXPLOSION_REFLECTION(86,390); -ACE_EXPLOSION_REFLECTION(86,400); -ACE_EXPLOSION_REFLECTION(86,410); -ACE_EXPLOSION_REFLECTION(86,420); -ACE_EXPLOSION_REFLECTION(86,430); -ACE_EXPLOSION_REFLECTION(86,440); -ACE_EXPLOSION_REFLECTION(86,450); -ACE_EXPLOSION_REFLECTION(86,460); -ACE_EXPLOSION_REFLECTION(86,470); -ACE_EXPLOSION_REFLECTION(86,480); -ACE_EXPLOSION_REFLECTION(86,490); -ACE_EXPLOSION_REFLECTION(86,500); -ACE_EXPLOSION_REFLECTION(88,10); -ACE_EXPLOSION_REFLECTION(88,20); -ACE_EXPLOSION_REFLECTION(88,30); -ACE_EXPLOSION_REFLECTION(88,40); -ACE_EXPLOSION_REFLECTION(88,50); -ACE_EXPLOSION_REFLECTION(88,60); -ACE_EXPLOSION_REFLECTION(88,70); -ACE_EXPLOSION_REFLECTION(88,80); -ACE_EXPLOSION_REFLECTION(88,90); -ACE_EXPLOSION_REFLECTION(88,100); -ACE_EXPLOSION_REFLECTION(88,110); -ACE_EXPLOSION_REFLECTION(88,120); -ACE_EXPLOSION_REFLECTION(88,130); -ACE_EXPLOSION_REFLECTION(88,140); -ACE_EXPLOSION_REFLECTION(88,150); -ACE_EXPLOSION_REFLECTION(88,160); -ACE_EXPLOSION_REFLECTION(88,170); -ACE_EXPLOSION_REFLECTION(88,180); -ACE_EXPLOSION_REFLECTION(88,190); -ACE_EXPLOSION_REFLECTION(88,200); -ACE_EXPLOSION_REFLECTION(88,210); -ACE_EXPLOSION_REFLECTION(88,220); -ACE_EXPLOSION_REFLECTION(88,230); -ACE_EXPLOSION_REFLECTION(88,240); -ACE_EXPLOSION_REFLECTION(88,250); -ACE_EXPLOSION_REFLECTION(88,260); -ACE_EXPLOSION_REFLECTION(88,270); -ACE_EXPLOSION_REFLECTION(88,280); -ACE_EXPLOSION_REFLECTION(88,290); -ACE_EXPLOSION_REFLECTION(88,300); -ACE_EXPLOSION_REFLECTION(88,310); -ACE_EXPLOSION_REFLECTION(88,320); -ACE_EXPLOSION_REFLECTION(88,330); -ACE_EXPLOSION_REFLECTION(88,340); -ACE_EXPLOSION_REFLECTION(88,350); -ACE_EXPLOSION_REFLECTION(88,360); -ACE_EXPLOSION_REFLECTION(88,370); -ACE_EXPLOSION_REFLECTION(88,380); -ACE_EXPLOSION_REFLECTION(88,390); -ACE_EXPLOSION_REFLECTION(88,400); -ACE_EXPLOSION_REFLECTION(88,410); -ACE_EXPLOSION_REFLECTION(88,420); -ACE_EXPLOSION_REFLECTION(88,430); -ACE_EXPLOSION_REFLECTION(88,440); -ACE_EXPLOSION_REFLECTION(88,450); -ACE_EXPLOSION_REFLECTION(88,460); -ACE_EXPLOSION_REFLECTION(88,470); -ACE_EXPLOSION_REFLECTION(88,480); -ACE_EXPLOSION_REFLECTION(88,490); -ACE_EXPLOSION_REFLECTION(88,500); -ACE_EXPLOSION_REFLECTION(90,10); -ACE_EXPLOSION_REFLECTION(90,20); -ACE_EXPLOSION_REFLECTION(90,30); -ACE_EXPLOSION_REFLECTION(90,40); -ACE_EXPLOSION_REFLECTION(90,50); -ACE_EXPLOSION_REFLECTION(90,60); -ACE_EXPLOSION_REFLECTION(90,70); -ACE_EXPLOSION_REFLECTION(90,80); -ACE_EXPLOSION_REFLECTION(90,90); -ACE_EXPLOSION_REFLECTION(90,100); -ACE_EXPLOSION_REFLECTION(90,110); -ACE_EXPLOSION_REFLECTION(90,120); -ACE_EXPLOSION_REFLECTION(90,130); -ACE_EXPLOSION_REFLECTION(90,140); -ACE_EXPLOSION_REFLECTION(90,150); -ACE_EXPLOSION_REFLECTION(90,160); -ACE_EXPLOSION_REFLECTION(90,170); -ACE_EXPLOSION_REFLECTION(90,180); -ACE_EXPLOSION_REFLECTION(90,190); -ACE_EXPLOSION_REFLECTION(90,200); -ACE_EXPLOSION_REFLECTION(90,210); -ACE_EXPLOSION_REFLECTION(90,220); -ACE_EXPLOSION_REFLECTION(90,230); -ACE_EXPLOSION_REFLECTION(90,240); -ACE_EXPLOSION_REFLECTION(90,250); -ACE_EXPLOSION_REFLECTION(90,260); -ACE_EXPLOSION_REFLECTION(90,270); -ACE_EXPLOSION_REFLECTION(90,280); -ACE_EXPLOSION_REFLECTION(90,290); -ACE_EXPLOSION_REFLECTION(90,300); -ACE_EXPLOSION_REFLECTION(90,310); -ACE_EXPLOSION_REFLECTION(90,320); -ACE_EXPLOSION_REFLECTION(90,330); -ACE_EXPLOSION_REFLECTION(90,340); -ACE_EXPLOSION_REFLECTION(90,350); -ACE_EXPLOSION_REFLECTION(90,360); -ACE_EXPLOSION_REFLECTION(90,370); -ACE_EXPLOSION_REFLECTION(90,380); -ACE_EXPLOSION_REFLECTION(90,390); -ACE_EXPLOSION_REFLECTION(90,400); -ACE_EXPLOSION_REFLECTION(90,410); -ACE_EXPLOSION_REFLECTION(90,420); -ACE_EXPLOSION_REFLECTION(90,430); -ACE_EXPLOSION_REFLECTION(90,440); -ACE_EXPLOSION_REFLECTION(90,450); -ACE_EXPLOSION_REFLECTION(90,460); -ACE_EXPLOSION_REFLECTION(90,470); -ACE_EXPLOSION_REFLECTION(90,480); -ACE_EXPLOSION_REFLECTION(90,490); -ACE_EXPLOSION_REFLECTION(90,500); -ACE_EXPLOSION_REFLECTION(92,10); -ACE_EXPLOSION_REFLECTION(92,20); -ACE_EXPLOSION_REFLECTION(92,30); -ACE_EXPLOSION_REFLECTION(92,40); -ACE_EXPLOSION_REFLECTION(92,50); -ACE_EXPLOSION_REFLECTION(92,60); -ACE_EXPLOSION_REFLECTION(92,70); -ACE_EXPLOSION_REFLECTION(92,80); -ACE_EXPLOSION_REFLECTION(92,90); -ACE_EXPLOSION_REFLECTION(92,100); -ACE_EXPLOSION_REFLECTION(92,110); -ACE_EXPLOSION_REFLECTION(92,120); -ACE_EXPLOSION_REFLECTION(92,130); -ACE_EXPLOSION_REFLECTION(92,140); -ACE_EXPLOSION_REFLECTION(92,150); -ACE_EXPLOSION_REFLECTION(92,160); -ACE_EXPLOSION_REFLECTION(92,170); -ACE_EXPLOSION_REFLECTION(92,180); -ACE_EXPLOSION_REFLECTION(92,190); -ACE_EXPLOSION_REFLECTION(92,200); -ACE_EXPLOSION_REFLECTION(92,210); -ACE_EXPLOSION_REFLECTION(92,220); -ACE_EXPLOSION_REFLECTION(92,230); -ACE_EXPLOSION_REFLECTION(92,240); -ACE_EXPLOSION_REFLECTION(92,250); -ACE_EXPLOSION_REFLECTION(92,260); -ACE_EXPLOSION_REFLECTION(92,270); -ACE_EXPLOSION_REFLECTION(92,280); -ACE_EXPLOSION_REFLECTION(92,290); -ACE_EXPLOSION_REFLECTION(92,300); -ACE_EXPLOSION_REFLECTION(92,310); -ACE_EXPLOSION_REFLECTION(92,320); -ACE_EXPLOSION_REFLECTION(92,330); -ACE_EXPLOSION_REFLECTION(92,340); -ACE_EXPLOSION_REFLECTION(92,350); -ACE_EXPLOSION_REFLECTION(92,360); -ACE_EXPLOSION_REFLECTION(92,370); -ACE_EXPLOSION_REFLECTION(92,380); -ACE_EXPLOSION_REFLECTION(92,390); -ACE_EXPLOSION_REFLECTION(92,400); -ACE_EXPLOSION_REFLECTION(92,410); -ACE_EXPLOSION_REFLECTION(92,420); -ACE_EXPLOSION_REFLECTION(92,430); -ACE_EXPLOSION_REFLECTION(92,440); -ACE_EXPLOSION_REFLECTION(92,450); -ACE_EXPLOSION_REFLECTION(92,460); -ACE_EXPLOSION_REFLECTION(92,470); -ACE_EXPLOSION_REFLECTION(92,480); -ACE_EXPLOSION_REFLECTION(92,490); -ACE_EXPLOSION_REFLECTION(92,500); -ACE_EXPLOSION_REFLECTION(94,10); -ACE_EXPLOSION_REFLECTION(94,20); -ACE_EXPLOSION_REFLECTION(94,30); -ACE_EXPLOSION_REFLECTION(94,40); -ACE_EXPLOSION_REFLECTION(94,50); -ACE_EXPLOSION_REFLECTION(94,60); -ACE_EXPLOSION_REFLECTION(94,70); -ACE_EXPLOSION_REFLECTION(94,80); -ACE_EXPLOSION_REFLECTION(94,90); -ACE_EXPLOSION_REFLECTION(94,100); -ACE_EXPLOSION_REFLECTION(94,110); -ACE_EXPLOSION_REFLECTION(94,120); -ACE_EXPLOSION_REFLECTION(94,130); -ACE_EXPLOSION_REFLECTION(94,140); -ACE_EXPLOSION_REFLECTION(94,150); -ACE_EXPLOSION_REFLECTION(94,160); -ACE_EXPLOSION_REFLECTION(94,170); -ACE_EXPLOSION_REFLECTION(94,180); -ACE_EXPLOSION_REFLECTION(94,190); -ACE_EXPLOSION_REFLECTION(94,200); -ACE_EXPLOSION_REFLECTION(94,210); -ACE_EXPLOSION_REFLECTION(94,220); -ACE_EXPLOSION_REFLECTION(94,230); -ACE_EXPLOSION_REFLECTION(94,240); -ACE_EXPLOSION_REFLECTION(94,250); -ACE_EXPLOSION_REFLECTION(94,260); -ACE_EXPLOSION_REFLECTION(94,270); -ACE_EXPLOSION_REFLECTION(94,280); -ACE_EXPLOSION_REFLECTION(94,290); -ACE_EXPLOSION_REFLECTION(94,300); -ACE_EXPLOSION_REFLECTION(94,310); -ACE_EXPLOSION_REFLECTION(94,320); -ACE_EXPLOSION_REFLECTION(94,330); -ACE_EXPLOSION_REFLECTION(94,340); -ACE_EXPLOSION_REFLECTION(94,350); -ACE_EXPLOSION_REFLECTION(94,360); -ACE_EXPLOSION_REFLECTION(94,370); -ACE_EXPLOSION_REFLECTION(94,380); -ACE_EXPLOSION_REFLECTION(94,390); -ACE_EXPLOSION_REFLECTION(94,400); -ACE_EXPLOSION_REFLECTION(94,410); -ACE_EXPLOSION_REFLECTION(94,420); -ACE_EXPLOSION_REFLECTION(94,430); -ACE_EXPLOSION_REFLECTION(94,440); -ACE_EXPLOSION_REFLECTION(94,450); -ACE_EXPLOSION_REFLECTION(94,460); -ACE_EXPLOSION_REFLECTION(94,470); -ACE_EXPLOSION_REFLECTION(94,480); -ACE_EXPLOSION_REFLECTION(94,490); -ACE_EXPLOSION_REFLECTION(94,500); -ACE_EXPLOSION_REFLECTION(96,10); -ACE_EXPLOSION_REFLECTION(96,20); -ACE_EXPLOSION_REFLECTION(96,30); -ACE_EXPLOSION_REFLECTION(96,40); -ACE_EXPLOSION_REFLECTION(96,50); -ACE_EXPLOSION_REFLECTION(96,60); -ACE_EXPLOSION_REFLECTION(96,70); -ACE_EXPLOSION_REFLECTION(96,80); -ACE_EXPLOSION_REFLECTION(96,90); -ACE_EXPLOSION_REFLECTION(96,100); -ACE_EXPLOSION_REFLECTION(96,110); -ACE_EXPLOSION_REFLECTION(96,120); -ACE_EXPLOSION_REFLECTION(96,130); -ACE_EXPLOSION_REFLECTION(96,140); -ACE_EXPLOSION_REFLECTION(96,150); -ACE_EXPLOSION_REFLECTION(96,160); -ACE_EXPLOSION_REFLECTION(96,170); -ACE_EXPLOSION_REFLECTION(96,180); -ACE_EXPLOSION_REFLECTION(96,190); -ACE_EXPLOSION_REFLECTION(96,200); -ACE_EXPLOSION_REFLECTION(96,210); -ACE_EXPLOSION_REFLECTION(96,220); -ACE_EXPLOSION_REFLECTION(96,230); -ACE_EXPLOSION_REFLECTION(96,240); -ACE_EXPLOSION_REFLECTION(96,250); -ACE_EXPLOSION_REFLECTION(96,260); -ACE_EXPLOSION_REFLECTION(96,270); -ACE_EXPLOSION_REFLECTION(96,280); -ACE_EXPLOSION_REFLECTION(96,290); -ACE_EXPLOSION_REFLECTION(96,300); -ACE_EXPLOSION_REFLECTION(96,310); -ACE_EXPLOSION_REFLECTION(96,320); -ACE_EXPLOSION_REFLECTION(96,330); -ACE_EXPLOSION_REFLECTION(96,340); -ACE_EXPLOSION_REFLECTION(96,350); -ACE_EXPLOSION_REFLECTION(96,360); -ACE_EXPLOSION_REFLECTION(96,370); -ACE_EXPLOSION_REFLECTION(96,380); -ACE_EXPLOSION_REFLECTION(96,390); -ACE_EXPLOSION_REFLECTION(96,400); -ACE_EXPLOSION_REFLECTION(96,410); -ACE_EXPLOSION_REFLECTION(96,420); -ACE_EXPLOSION_REFLECTION(96,430); -ACE_EXPLOSION_REFLECTION(96,440); -ACE_EXPLOSION_REFLECTION(96,450); -ACE_EXPLOSION_REFLECTION(96,460); -ACE_EXPLOSION_REFLECTION(96,470); -ACE_EXPLOSION_REFLECTION(96,480); -ACE_EXPLOSION_REFLECTION(96,490); -ACE_EXPLOSION_REFLECTION(96,500); -ACE_EXPLOSION_REFLECTION(98,10); -ACE_EXPLOSION_REFLECTION(98,20); -ACE_EXPLOSION_REFLECTION(98,30); -ACE_EXPLOSION_REFLECTION(98,40); -ACE_EXPLOSION_REFLECTION(98,50); -ACE_EXPLOSION_REFLECTION(98,60); -ACE_EXPLOSION_REFLECTION(98,70); -ACE_EXPLOSION_REFLECTION(98,80); -ACE_EXPLOSION_REFLECTION(98,90); -ACE_EXPLOSION_REFLECTION(98,100); -ACE_EXPLOSION_REFLECTION(98,110); -ACE_EXPLOSION_REFLECTION(98,120); -ACE_EXPLOSION_REFLECTION(98,130); -ACE_EXPLOSION_REFLECTION(98,140); -ACE_EXPLOSION_REFLECTION(98,150); -ACE_EXPLOSION_REFLECTION(98,160); -ACE_EXPLOSION_REFLECTION(98,170); -ACE_EXPLOSION_REFLECTION(98,180); -ACE_EXPLOSION_REFLECTION(98,190); -ACE_EXPLOSION_REFLECTION(98,200); -ACE_EXPLOSION_REFLECTION(98,210); -ACE_EXPLOSION_REFLECTION(98,220); -ACE_EXPLOSION_REFLECTION(98,230); -ACE_EXPLOSION_REFLECTION(98,240); -ACE_EXPLOSION_REFLECTION(98,250); -ACE_EXPLOSION_REFLECTION(98,260); -ACE_EXPLOSION_REFLECTION(98,270); -ACE_EXPLOSION_REFLECTION(98,280); -ACE_EXPLOSION_REFLECTION(98,290); -ACE_EXPLOSION_REFLECTION(98,300); -ACE_EXPLOSION_REFLECTION(98,310); -ACE_EXPLOSION_REFLECTION(98,320); -ACE_EXPLOSION_REFLECTION(98,330); -ACE_EXPLOSION_REFLECTION(98,340); -ACE_EXPLOSION_REFLECTION(98,350); -ACE_EXPLOSION_REFLECTION(98,360); -ACE_EXPLOSION_REFLECTION(98,370); -ACE_EXPLOSION_REFLECTION(98,380); -ACE_EXPLOSION_REFLECTION(98,390); -ACE_EXPLOSION_REFLECTION(98,400); -ACE_EXPLOSION_REFLECTION(98,410); -ACE_EXPLOSION_REFLECTION(98,420); -ACE_EXPLOSION_REFLECTION(98,430); -ACE_EXPLOSION_REFLECTION(98,440); -ACE_EXPLOSION_REFLECTION(98,450); -ACE_EXPLOSION_REFLECTION(98,460); -ACE_EXPLOSION_REFLECTION(98,470); -ACE_EXPLOSION_REFLECTION(98,480); -ACE_EXPLOSION_REFLECTION(98,490); -ACE_EXPLOSION_REFLECTION(98,500); -ACE_EXPLOSION_REFLECTION(100,10); -ACE_EXPLOSION_REFLECTION(100,20); -ACE_EXPLOSION_REFLECTION(100,30); -ACE_EXPLOSION_REFLECTION(100,40); -ACE_EXPLOSION_REFLECTION(100,50); -ACE_EXPLOSION_REFLECTION(100,60); -ACE_EXPLOSION_REFLECTION(100,70); -ACE_EXPLOSION_REFLECTION(100,80); -ACE_EXPLOSION_REFLECTION(100,90); -ACE_EXPLOSION_REFLECTION(100,100); -ACE_EXPLOSION_REFLECTION(100,110); -ACE_EXPLOSION_REFLECTION(100,120); -ACE_EXPLOSION_REFLECTION(100,130); -ACE_EXPLOSION_REFLECTION(100,140); -ACE_EXPLOSION_REFLECTION(100,150); -ACE_EXPLOSION_REFLECTION(100,160); -ACE_EXPLOSION_REFLECTION(100,170); -ACE_EXPLOSION_REFLECTION(100,180); -ACE_EXPLOSION_REFLECTION(100,190); -ACE_EXPLOSION_REFLECTION(100,200); -ACE_EXPLOSION_REFLECTION(100,210); -ACE_EXPLOSION_REFLECTION(100,220); -ACE_EXPLOSION_REFLECTION(100,230); -ACE_EXPLOSION_REFLECTION(100,240); -ACE_EXPLOSION_REFLECTION(100,250); -ACE_EXPLOSION_REFLECTION(100,260); -ACE_EXPLOSION_REFLECTION(100,270); -ACE_EXPLOSION_REFLECTION(100,280); -ACE_EXPLOSION_REFLECTION(100,290); -ACE_EXPLOSION_REFLECTION(100,300); -ACE_EXPLOSION_REFLECTION(100,310); -ACE_EXPLOSION_REFLECTION(100,320); -ACE_EXPLOSION_REFLECTION(100,330); -ACE_EXPLOSION_REFLECTION(100,340); -ACE_EXPLOSION_REFLECTION(100,350); -ACE_EXPLOSION_REFLECTION(100,360); -ACE_EXPLOSION_REFLECTION(100,370); -ACE_EXPLOSION_REFLECTION(100,380); -ACE_EXPLOSION_REFLECTION(100,390); -ACE_EXPLOSION_REFLECTION(100,400); -ACE_EXPLOSION_REFLECTION(100,410); -ACE_EXPLOSION_REFLECTION(100,420); -ACE_EXPLOSION_REFLECTION(100,430); -ACE_EXPLOSION_REFLECTION(100,440); -ACE_EXPLOSION_REFLECTION(100,450); -ACE_EXPLOSION_REFLECTION(100,460); -ACE_EXPLOSION_REFLECTION(100,470); -ACE_EXPLOSION_REFLECTION(100,480); -ACE_EXPLOSION_REFLECTION(100,490); -ACE_EXPLOSION_REFLECTION(100,500); - +ACE_EXPLOSION_RANGE(2); +ACE_EXPLOSION_RANGE(4); +ACE_EXPLOSION_RANGE(6); +ACE_EXPLOSION_RANGE(8); +ACE_EXPLOSION_RANGE(10); +ACE_EXPLOSION_RANGE(12); +ACE_EXPLOSION_RANGE(14); +ACE_EXPLOSION_RANGE(16); +ACE_EXPLOSION_RANGE(18); +ACE_EXPLOSION_RANGE(20); +ACE_EXPLOSION_RANGE(22); +ACE_EXPLOSION_RANGE(24); +ACE_EXPLOSION_RANGE(26); +ACE_EXPLOSION_RANGE(28); +ACE_EXPLOSION_RANGE(30); +ACE_EXPLOSION_RANGE(32); +ACE_EXPLOSION_RANGE(34); +ACE_EXPLOSION_RANGE(36); +ACE_EXPLOSION_RANGE(38); +ACE_EXPLOSION_RANGE(40); +ACE_EXPLOSION_RANGE(42); +ACE_EXPLOSION_RANGE(44); +ACE_EXPLOSION_RANGE(46); +ACE_EXPLOSION_RANGE(48); +ACE_EXPLOSION_RANGE(50); +ACE_EXPLOSION_RANGE(52); +ACE_EXPLOSION_RANGE(54); +ACE_EXPLOSION_RANGE(56); +ACE_EXPLOSION_RANGE(58); +ACE_EXPLOSION_RANGE(60); +ACE_EXPLOSION_RANGE(62); +ACE_EXPLOSION_RANGE(64); +ACE_EXPLOSION_RANGE(66); +ACE_EXPLOSION_RANGE(68); +ACE_EXPLOSION_RANGE(70); +ACE_EXPLOSION_RANGE(72); +ACE_EXPLOSION_RANGE(74); +ACE_EXPLOSION_RANGE(76); +ACE_EXPLOSION_RANGE(78); +ACE_EXPLOSION_RANGE(80); +ACE_EXPLOSION_RANGE(82); +ACE_EXPLOSION_RANGE(84); +ACE_EXPLOSION_RANGE(86); +ACE_EXPLOSION_RANGE(88); +ACE_EXPLOSION_RANGE(90); +ACE_EXPLOSION_RANGE(92); +ACE_EXPLOSION_RANGE(94); +ACE_EXPLOSION_RANGE(96); +ACE_EXPLOSION_RANGE(98); +ACE_EXPLOSION_RANGE(100); diff --git a/addons/frag/functions/fnc_doExplosions.sqf b/addons/frag/functions/fnc_doExplosions.sqf index 749c4bd2ec..f6daee1c06 100644 --- a/addons/frag/functions/fnc_doExplosions.sqf +++ b/addons/frag/functions/fnc_doExplosions.sqf @@ -1,7 +1,7 @@ -//fnc_doExplosions.sqf -#include "script_component.hpp" - -private ["_params", "_explosions", "_index", "_i", "_exp", "_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"]; +//fnc_doExplosions.sqf +#include "script_component.hpp" + +private ["_params", "_explosions", "_index", "_i", "_exp", "_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"]; _params = _this select 0; _explosions = _params select 0; _index = _params select 1; @@ -20,7 +20,7 @@ for "_i" from _index to ((_index+2) min (count _explosions)) do { }; _index = _index + 2; if(_index >= (count _explosions)) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; } else { _params set[1, _index]; }; diff --git a/addons/frag/functions/fnc_doReflections.sqf b/addons/frag/functions/fnc_doReflections.sqf index b0e24f0972..7702e34fd5 100644 --- a/addons/frag/functions/fnc_doReflections.sqf +++ b/addons/frag/functions/fnc_doReflections.sqf @@ -1,7 +1,7 @@ -//fnc_doReflections.sqf -#include "script_component.hpp" - -private ["_pos", "_ammo", "_depth", "_hit", "_range", "_hitFactor", "_indirectHitRange", "_indirectHit", "_testParams"]; +//fnc_doReflections.sqf +#include "script_component.hpp" + +private ["_pos", "_ammo", "_depth", "_hit", "_range", "_hitFactor", "_indirectHitRange", "_indirectHit", "_testParams"]; _pos = _this select 0; _ammo = _this select 1; diff --git a/addons/frag/functions/fnc_findReflections.sqf b/addons/frag/functions/fnc_findReflections.sqf index 193e1e7154..7f8fd2a13c 100644 --- a/addons/frag/functions/fnc_findReflections.sqf +++ b/addons/frag/functions/fnc_findReflections.sqf @@ -1,6 +1,6 @@ -//fnc_findReflections.sqf -#include "script_component.hpp" - +//fnc_findReflections.sqf +#include "script_component.hpp" + private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"]; _params = _this select 0; @@ -21,15 +21,15 @@ _indirectHit = _explosiveInfo select 1; _distanceCount = (floor _indirectHitRange*4) min 100; if(_zIndex < 5) then { - _lastPos = _pos; - _zAng = _zIndex*20+2; - if(_zAng > 80) then { - _radi = 1; - _zAng = 90; + _lastPos = _pos; + _zAng = _zIndex*20+2; + if(_zAng > 80) then { + _radi = 1; + _zAng = 90; }; for "_i" from 0 to _radi do { _test = true; - _vec = [1, ((_i*_split)+_rand) mod 360, _zAng] call cba_fnc_polar2vect; + _vec = [1, ((_i*_split)+_rand) mod 360, _zAng] call CBA_fnc_polar2vect; for "_x" from 1 to _distanceCount do { _testPos = _pos vectorAdd (_vec vectorMultiply _x); // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; @@ -43,7 +43,7 @@ if(_zIndex < 5) then { // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; // TEST_PAIRS pushBack [_pos, _lastPos, [1,0,0,1]]; - }; + }; // if(terrainIntersectASL [_pos, _testPos]) exitWith {}; _lastPos = _testPos; }; @@ -106,7 +106,7 @@ if(_zIndex < 5) then { _range = _range - (_range%2); if(_hit >= 10 && _range > 0) then { - // TEST_ICONS pushBack [_bpos, format["h: %1, r: %2, hf: %3 d: %4 ihr: %5", _hit, _range, _hitFactor, _distance, _indirectHitRange*4]]; + // TEST_ICONS pushBack [_bpos, format["h: %1, r: %2, hf: %3 d: %4 ihr: %5", _hit, _range, _hitFactor, _distance, _indirectHitRange*4]]; // TEST_PAIRS pushBack [_pos, _bpos, [1,0,0,1]]; _refExp = format["ace_explosion_reflection_%1_%2", _range, _hit]; // _refExp createVehicle (ASLtoATL _bpos); @@ -122,5 +122,5 @@ if(_zIndex < 5) then { // _dirvec = _dirvec vectorMultiply 100; // _can setVelocity _dirvec; [DFUNC(doExplosions), 0, [_explosions, 0]] call CBA_fnc_addPerFrameHandler; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/frag/functions/fnc_stopTracing.sqf b/addons/frag/functions/fnc_stopTracing.sqf index 13c8f31f33..f8ddf42084 100644 --- a/addons/frag/functions/fnc_stopTracing.sqf +++ b/addons/frag/functions/fnc_stopTracing.sqf @@ -1,5 +1,5 @@ #include "script_component.hpp" if(GVAR(tracesStarted)) then { GVAR(tracesStarted) = false; - [GVAR(traceID)] call cba_fnc_removePerFrameHandler; + [GVAR(traceID)] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/frag/functions/fnc_trackTrace.sqf b/addons/frag/functions/fnc_trackTrace.sqf index b87892ab15..24910db163 100644 --- a/addons/frag/functions/fnc_trackTrace.sqf +++ b/addons/frag/functions/fnc_trackTrace.sqf @@ -10,5 +10,5 @@ if (alive _tracerObj && (count GVAR(traces)) > 0) then { _positions = _data select 4; _positions set [(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]]; } else { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/gestures/$PBOPREFIX$ b/addons/gestures/$PBOPREFIX$ new file mode 100644 index 0000000000..47459a13ac --- /dev/null +++ b/addons/gestures/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\gestures \ No newline at end of file diff --git a/addons/gestures/CfgEventHandlers.hpp b/addons/gestures/CfgEventHandlers.hpp new file mode 100644 index 0000000000..7b003bbe8c --- /dev/null +++ b/addons/gestures/CfgEventHandlers.hpp @@ -0,0 +1,11 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/gestures/CfgVehicles.hpp b/addons/gestures/CfgVehicles.hpp new file mode 100644 index 0000000000..019cffdb45 --- /dev/null +++ b/addons/gestures/CfgVehicles.hpp @@ -0,0 +1,145 @@ +class CfgVehicles { + + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ADDON { + displayName = CSTRING(Gestures); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = ""; + showDisabled = 1; + priority = 3.5; + icon = PATHTOF(UI\gestures_ca.paa); + + class GVAR(Advance) { + displayName = CSTRING(BIgestureAdvance); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow 'gestureAdvance';); + showDisabled = 1; + priority = 1.9; + }; + class GVAR(Go) { + displayName = CSTRING(BIgestureGo); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow ([ARR_2('gestureGo','gestureGoB')] select floor random 2);); + showDisabled = 1; + priority = 1.8; + }; + class GVAR(Follow) { + displayName = CSTRING(BIgestureFollow); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow 'gestureFollow';); + showDisabled = 1; + priority = 1.7; + }; + class GVAR(Up) { + displayName = CSTRING(BIgestureUp); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow 'gestureUp';); + showDisabled = 1; + priority = 1.5; + }; + class GVAR(CeaseFire) { + displayName = CSTRING(BIgestureCeaseFire); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow 'gestureCeaseFire';); + showDisabled = 1; + priority = 1.3; + }; + class GVAR(Freeze) { + displayName = CSTRING(BIgestureFreeze); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow 'gestureFreeze';); + showDisabled = 1; + priority = 1.2; + }; + class GVAR(Forward) { + displayName = CSTRING(forward); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(forward)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.9; + }; + class GVAR(Regroup) { + displayName = CSTRING(regroup); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(regroup)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.8; + }; + class GVAR(Stop) { + displayName = CSTRING(stop); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(stop)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.7; + }; + class GVAR(Cover) { + displayName = CSTRING(cover); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(cover)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.6; + }; + class GVAR(Point) { + displayName = CSTRING(point); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(point)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.5; + }; + class GVAR(Engage) { + displayName = CSTRING(engage); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(engage)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.4; + }; + class GVAR(Hold) { + displayName = CSTRING(hold); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(hold)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.3; + }; + class GVAR(Warning) { + displayName = CSTRING(warning); + condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + statement = QUOTE(QUOTE(QGVAR(warning)) call FUNC(playSignal)); + showDisabled = 1; + priority = 1.2; + }; + /* + class class GVAR(Yes) { + displayName = ECSTRING(common,Yes); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow ([ARR_2('gestureYes','gestureNod')] select floor random 2);); + showDisabled = 1; + priority = 1.1; + hotkey = "8"; + }; + + class class GVAR(No) { + displayName = ECSTRING(common,No); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow 'gestureNo';); + showDisabled = 1; + priority = 1.0; + hotkey = "9"; + }; + + class class GVAR(Hi) { + displayName = CSTRING(Gestures_Hi); + condition = QUOTE(canStand _target); + statement = QUOTE(_target playActionNow ([ARR_3('gestureHi','gestureHiB','gestureHiC')] select floor random 3);); + showDisabled = 1; + priority = 0.9; + hotkey = "0"; + }; + */ + + }; + + }; + }; +}; diff --git a/addons/interaction/UI/gestures_ca.paa b/addons/gestures/UI/gestures_ca.paa similarity index 100% rename from addons/interaction/UI/gestures_ca.paa rename to addons/gestures/UI/gestures_ca.paa diff --git a/addons/gestures/XEH_postInit.sqf b/addons/gestures/XEH_postInit.sqf new file mode 100644 index 0000000000..fec57ab111 --- /dev/null +++ b/addons/gestures/XEH_postInit.sqf @@ -0,0 +1,38 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +#include "key.sqf" + +// reload mutex, you can't play signal while reloading +GVAR(ReloadMutex) = true; + +// Event for main display to be loaded: +["mainDisplayLoaded", { + // handle reloading + (findDisplay 46) displayAddEventHandler ["KeyDown", { + if ((_this select 1) in actionKeys "ReloadMagazine") then { + if ((isNull ACE_player) || {!alive ACE_player}) exitWith {false}; + private _weapon = currentWeapon ACE_player; + + if (_weapon != "") then { + GVAR(ReloadMutex) = false; + + private _gesture = getText (configfile >> "CfgWeapons" >> _weapon >> "reloadAction"); + private _isLauncher = _weapon isKindOf ["Launcher", (configFile >> "CfgWeapons")]; + private _config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher; + private _duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed"); + + if (_duration != 0) then { + _duration = if (_duration < 0) then { abs _duration } else { 1 / _duration }; + } else { + _duration = 3; + }; + + TRACE_2("Reloading, blocking gestures",_weapon,_duration); + [{GVAR(ReloadMutex) = true;}, [], _duration] call EFUNC(common,waitAndExecute); + }; + }; + false + }]; +}] call EFUNC(common,addEventHandler); diff --git a/addons/gestures/XEH_preInit.sqf b/addons/gestures/XEH_preInit.sqf new file mode 100644 index 0000000000..7fd2bb47f2 --- /dev/null +++ b/addons/gestures/XEH_preInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(playSignal); + +ADDON = true; diff --git a/addons/gestures/anim/ace_cover.rtm b/addons/gestures/anim/ace_cover.rtm new file mode 100644 index 0000000000..ce15001076 Binary files /dev/null and b/addons/gestures/anim/ace_cover.rtm differ diff --git a/addons/gestures/anim/ace_cover_stand_lowered.rtm b/addons/gestures/anim/ace_cover_stand_lowered.rtm new file mode 100644 index 0000000000..b6838579ba Binary files /dev/null and b/addons/gestures/anim/ace_cover_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_engage.rtm b/addons/gestures/anim/ace_engage.rtm new file mode 100644 index 0000000000..7dd573fb8f Binary files /dev/null and b/addons/gestures/anim/ace_engage.rtm differ diff --git a/addons/gestures/anim/ace_engage_stand_lowered.rtm b/addons/gestures/anim/ace_engage_stand_lowered.rtm new file mode 100644 index 0000000000..e4dee60e60 Binary files /dev/null and b/addons/gestures/anim/ace_engage_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_forward.rtm b/addons/gestures/anim/ace_forward.rtm new file mode 100644 index 0000000000..3715c4f7fc Binary files /dev/null and b/addons/gestures/anim/ace_forward.rtm differ diff --git a/addons/gestures/anim/ace_forward_stand_lowered.rtm b/addons/gestures/anim/ace_forward_stand_lowered.rtm new file mode 100644 index 0000000000..40ca7465aa Binary files /dev/null and b/addons/gestures/anim/ace_forward_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_hold.rtm b/addons/gestures/anim/ace_hold.rtm new file mode 100644 index 0000000000..e6fcb3e742 Binary files /dev/null and b/addons/gestures/anim/ace_hold.rtm differ diff --git a/addons/gestures/anim/ace_hold_stand_lowered.rtm b/addons/gestures/anim/ace_hold_stand_lowered.rtm new file mode 100644 index 0000000000..9ab8bca0cc Binary files /dev/null and b/addons/gestures/anim/ace_hold_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_point.rtm b/addons/gestures/anim/ace_point.rtm new file mode 100644 index 0000000000..9e64cc630d Binary files /dev/null and b/addons/gestures/anim/ace_point.rtm differ diff --git a/addons/gestures/anim/ace_point_stand_lowered.rtm b/addons/gestures/anim/ace_point_stand_lowered.rtm new file mode 100644 index 0000000000..4d0fc5c1d2 Binary files /dev/null and b/addons/gestures/anim/ace_point_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_regroup.rtm b/addons/gestures/anim/ace_regroup.rtm new file mode 100644 index 0000000000..2c40118e7c Binary files /dev/null and b/addons/gestures/anim/ace_regroup.rtm differ diff --git a/addons/gestures/anim/ace_regroup_stand_lowered.rtm b/addons/gestures/anim/ace_regroup_stand_lowered.rtm new file mode 100644 index 0000000000..9cd871f218 Binary files /dev/null and b/addons/gestures/anim/ace_regroup_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_stop.rtm b/addons/gestures/anim/ace_stop.rtm new file mode 100644 index 0000000000..af1d8465be Binary files /dev/null and b/addons/gestures/anim/ace_stop.rtm differ diff --git a/addons/gestures/anim/ace_stop_stand_lowered.rtm b/addons/gestures/anim/ace_stop_stand_lowered.rtm new file mode 100644 index 0000000000..8b6d9270b6 Binary files /dev/null and b/addons/gestures/anim/ace_stop_stand_lowered.rtm differ diff --git a/addons/gestures/anim/ace_warning.rtm b/addons/gestures/anim/ace_warning.rtm new file mode 100644 index 0000000000..ff42d81727 Binary files /dev/null and b/addons/gestures/anim/ace_warning.rtm differ diff --git a/addons/gestures/anim/ace_warning_stand_lowered.rtm b/addons/gestures/anim/ace_warning_stand_lowered.rtm new file mode 100644 index 0000000000..9c9e86ec79 Binary files /dev/null and b/addons/gestures/anim/ace_warning_stand_lowered.rtm differ diff --git a/addons/gestures/cfgMovesBasic.hpp b/addons/gestures/cfgMovesBasic.hpp new file mode 100644 index 0000000000..a708787fd5 --- /dev/null +++ b/addons/gestures/cfgMovesBasic.hpp @@ -0,0 +1,200 @@ +class CfgMovesBasic { + class ManActions { + GVAR(forward) = QGVAR(forward); + GVAR(stop) = QGVAR(stop); + GVAR(cover) = QGVAR(cover); + GVAR(regroup) = QGVAR(regroup); + GVAR(engage) = QGVAR(engage); + GVAR(point) = QGVAR(point); + GVAR(hold) = QGVAR(hold); + GVAR(warning) = QGVAR(warningS); + + GVAR(forwardStandLowered) = QGVAR(forwardStandLowered); + GVAR(stopStandLowered) = QGVAR(stopStandLowered); + GVAR(coverStandLowered) = QGVAR(coverStandLowered); + GVAR(regroupStandLowered) = QGVAR(regroupStandLowered); + GVAR(engageStandLowered) = QGVAR(engageStandLowered); + GVAR(pointStandLowered) = QGVAR(pointStandLowered); + GVAR(holdStandLowered) = QGVAR(holdStandLowered); + GVAR(warningStandLowered) = QGVAR(warningStandLowered); + }; + + class Actions { + class NoActions: ManActions { + GVAR(forward)[] = {QGVAR(forward), "Gesture"}; + GVAR(stop)[] = {QGVAR(stop), "Gesture"}; + GVAR(cover)[] = {QGVAR(cover), "Gesture"}; + GVAR(regroup)[] = {QGVAR(regroup), "Gesture"}; + GVAR(engage)[] = {QGVAR(engage), "Gesture"}; + GVAR(point)[] = {QGVAR(point), "Gesture"}; + GVAR(hold)[] = {QGVAR(hold), "Gesture"}; + GVAR(warning)[] = {QGVAR(warning), "Gesture"}; + + GVAR(forwardStandLowered)[] = {QGVAR(forwardStandLowered), "Gesture"}; + GVAR(stopStandLowered)[] = {QGVAR(stopStandLowered), "Gesture"}; + GVAR(coverStandLowered)[] = {QGVAR(coverStandLowered), "Gesture"}; + GVAR(regroupStandLowered)[] = {QGVAR(regroupStandLowered), "Gesture"}; + GVAR(engageStandLowered)[] = {QGVAR(engageStandLowered), "Gesture"}; + GVAR(pointStandLowered)[] = {QGVAR(pointStandLowered), "Gesture"}; + GVAR(holdStandLowered)[] = {QGVAR(holdStandLowered), "Gesture"}; + GVAR(warningStandLowered)[] = {QGVAR(warningStandLowered), "Gesture"}; + }; + }; +}; + +class CfgGesturesMale { + class Default; + + class BlendAnims { + GVAR(LeftArm)[] = { + "LeftShoulder", 1, + "LeftArm", 1, + "LeftArmRoll", 1, + "LeftForeArm", 1, + "LeftForeArmRoll", 1, + "LeftHand", 1, + "LeftHandIndex1", 1, + "LeftHandIndex2", 1, + "LeftHandIndex3", 1, + "LeftHandMiddle1", 1, + "LeftHandMiddle2", 1, + "LeftHandMiddle3", 1, + "LeftHandPinky1", 1, + "LeftHandMiddle2", 1, + "LeftHandMiddle3", 1, + "LeftHandPinky1", 1, + "LeftHandPinky2", 1, + "LeftHandPinky3", 1, + "LeftHandRing", 1, + "LeftHandRing1", 1, + "LeftHandRing2", 1, + "LeftHandRing3", 1, + "LeftHandThumb1", 1, + "LeftHandThumb2", 1, + "LeftHandThumb3", 1 + }; + }; + + class States { + class GVAR(Base): Default { + actions = "NoActions"; + canPullTrigger = 0; + connectAs = ""; + connectFrom[] = {}; + connectTo[] = {}; + disableWeapons = 0; + enableBinocular = 1; + enableMissile = 1; + enableOptics = 0; + equivalentTo = ""; + file = "\A3\anims_f\Data\anim\Sdr\gst\GestureHi.rtm"; + forceAim = 0; + headBobMode = 0; + headBobStrength = 0; + interpolateFrom[] = {}; + interpolateTo[] = {}; + interpolateWith[] = {}; + interpolationRestart = 0; + interpolationSpeed = 6; + looped = 0; + mask = QGVAR(LeftArm); + minPlayTime = 0.5; + preload = 0; + ragdoll = 0; + relSpeedMax = 1; + relSpeedMin = 1; + showHandGun = 0; + showItemInHand = 0; + showItemInRightHand = 0; + showWeaponAim = 1; + soundEdge[] = {0.5,1}; + soundEnabled = 1; + soundOverride = ""; + speed = -2; + static = 0; + terminal = 0; + Walkcycles = 1; + weaponIK = 1; + + leftHandIKBeg = 1; + leftHandIKCurve[] = {0, 1, 0.1, 0, 0.8, 0, 1, 1}; + leftHandIKEnd = 1; + + rightHandIKBeg = 1; + rightHandIKCurve[] = {1}; + rightHandIKEnd = 1; + }; + + class GVAR(forward): GVAR(Base) { + file = QUOTE(PATHTOF(anim\ace_forward.rtm)); + speed = 1; + }; + + class GVAR(forwardStandLowered): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_forward_stand_lowered.rtm)); + }; + + class GVAR(stop): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_stop.rtm)); + speed = 0.6; + }; + + class GVAR(stopStandLowered): GVAR(stop) { + file = QUOTE(PATHTOF(anim\ace_stop_stand_lowered.rtm)); + }; + + class GVAR(cover): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_cover.rtm)); + speed = 0.8; + }; + + class GVAR(coverStandLowered): GVAR(cover) { + file = QUOTE(PATHTOF(anim\ace_cover_stand_lowered.rtm)); + }; + + class GVAR(regroup): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_regroup.rtm)); + speed = 0.8; + }; + + class GVAR(regroupStandLowered): GVAR(regroup) { + file = QUOTE(PATHTOF(anim\ace_regroup_stand_lowered.rtm)); + }; + + class GVAR(engage): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_engage.rtm)); + speed = 0.9; + }; + + class GVAR(engageStandLowered): GVAR(engage) { + file = QUOTE(PATHTOF(anim\ace_engage_stand_lowered.rtm)); + }; + + class GVAR(point): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_point.rtm)); + speed = 0.8; + }; + + class GVAR(pointStandLowered): GVAR(point) { + file = QUOTE(PATHTOF(anim\ace_point_stand_lowered.rtm)); + }; + + class GVAR(hold): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_hold.rtm)); + speed = 0.8; + }; + + class GVAR(holdStandLowered): GVAR(hold) { + file = QUOTE(PATHTOF(anim\ace_hold_stand_lowered.rtm)); + }; + + class GVAR(warning): GVAR(forward) { + file = QUOTE(PATHTOF(anim\ace_warning.rtm)); + speed = 0.8; + }; + + class GVAR(warningStandLowered): GVAR(warning) { + file = QUOTE(PATHTOF(anim\ace_warning_stand_lowered.rtm)); + }; + }; +}; diff --git a/addons/gestures/config.cpp b/addons/gestures/config.cpp new file mode 100644 index 0000000000..6a3fa402d0 --- /dev/null +++ b/addons/gestures/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interact_menu"}; + author[] = {"joko // Jonas", "Emperias", "Zigomarvin"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; +}; + +#include "CfgMovesBasic.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/gestures/functions/fnc_playSignal.sqf b/addons/gestures/functions/fnc_playSignal.sqf new file mode 100644 index 0000000000..b8a218f565 --- /dev/null +++ b/addons/gestures/functions/fnc_playSignal.sqf @@ -0,0 +1,33 @@ +/* + * Author: joko // Jonas, Emperias, Zigomarvin + * Detect if the player and play the Gesture Animation + * + * Arguments: + * Animation + * + * Return Value: + * + * + * Example: + * "GeniusAnimation" call ace_gestures_fnc_playSignal + * + * Public: No + */ +#include "script_component.hpp" + +TRACE_1("params",_this); + +if (!GVAR(ReloadMutex)) exitWith {false}; + +private _gesture = if (_this select [0,2] == "BI") then { + _this select [2] +} else { + if (((animationState ACE_player) select [0, 12]) in ["amovpercmstp", "amovpercmwlk", "amovpercmtac"] && weaponLowered ACE_player) then { + format ["%1StandLowered", _this] + } else { + _this + }; +}; + +ACE_player playAction _gesture; +true diff --git a/addons/gestures/functions/script_component.hpp b/addons/gestures/functions/script_component.hpp new file mode 100644 index 0000000000..53f6849ebc --- /dev/null +++ b/addons/gestures/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\gestures\script_component.hpp" diff --git a/addons/gestures/key.sqf b/addons/gestures/key.sqf new file mode 100644 index 0000000000..125463d4d1 --- /dev/null +++ b/addons/gestures/key.sqf @@ -0,0 +1,38 @@ +#include "\a3\editor_f\Data\Scripts\dikCodes.h" + +{ + _x params ["_currentName","_key"]; + + if (_currentName select [0,1] == "BI") then { + _currentName = _currentName select [2]; + }; + + private _code = (compile format [QUOTE(QUOTE(QGVAR(%1)) call FUNC(playSignal);), _currentName]); + + [ + "ACE3 Gestures", + _currentName, + localize format[LSTRING(%1), _currentName], + _code, + {false}, + [_key, [false, (_key != -1), false]], + false + ] call CBA_fnc_addKeybind; + + false +} count [ + ["stop", DIK_NUMPAD2], + ["cover", DIK_NUMPAD3], + ["forward", DIK_NUMPAD4], + ["regroup", DIK_NUMPAD5], + ["engage", DIK_NUMPAD6], + ["point", DIK_NUMPAD7], + ["hold", DIK_NUMPAD8], + ["warning", DIK_NUMPAD9], + ["BIgestureGo", -1], + ["BIgestureAdvance", -1], + ["BIgestureFollow", -1], + ["BIgestureUp", -1], + ["BIgestureFreeze", -1], + ["BIgestureCeaseFire", -1] +]; diff --git a/addons/gestures/script_component.hpp b/addons/gestures/script_component.hpp new file mode 100644 index 0000000000..06650c6ba8 --- /dev/null +++ b/addons/gestures/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT Gestures +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_GESTURES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_GESTURES + #define DEBUG_SETTINGS DEBUG_SETTINGS_GESTURES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/gestures/stringtable.xml b/addons/gestures/stringtable.xml new file mode 100644 index 0000000000..cc9b776cd1 --- /dev/null +++ b/addons/gestures/stringtable.xml @@ -0,0 +1,198 @@ + + + + + ACE Gestures + ACE Gesten + ACE Gesty + ACE Posunky + ACE Signaux + ACE Kézjelek + ACE Gesti + ACE Gestos + ACE Жесты + ACE Gestos + + + Gestures + Gesten + Gestos + Gesty + Posunky + Signaux + Жесты + Kézjelek + Gestos + Gesti + + + Advance + Vordringen + Avanzar + Naprzód + Postoupit + Avancer + Продвигаться + Előre + Avançar + Avanzare + + + Go + Los + Adelante + Szybko + Jít + Aller + Идти + Mozgás + Mover-se + Muoversi + + + Follow + Folgen + Seguirme + Za mną + Následovat + Suivre + Следовать + Utánam + Seguir + Seguire + + + Up + Aufstehen + Arriba + Do góry + Vztyk + Debout + Вверх + Fel + Acima + Alzarsi + + + Cease Fire + Feuer einstellen + Alto el fuego + Wstrzymać ogień + Zastavit palbu + Halte au feu + Прекратить огонь + Tüzet szüntess + Cessar Fogo + Cessare il Fuoco + + + Point + Zeigen + Señalar + Wskazać + Ukázat + Pointer + Точка + Mutat + Apontar + Puntare a + + + Freeze + Keine Bewegung + Alto + Stać + Stát + Halte + Замереть + Állj + Alto + Fermi + + + + Stop + Stop + Stop + Stop + + + + Cover + Deckung + Cubrirse + Do osłony + Krýt se + A couvert + Укрыться + Fedezékbe + Proteger-se + Copertura + + + + Rally up + Regroupement + Sammeln + Zbiórka + + + + Move forward + En avant + Vorwärts Bewegen + Naprzód + + + + Engage + Engager + Atak + + + + Point + Pointer + Zeigen + Wskaż + + + + Hold + Tenir + Anhalten + Wstrzymać + + + + Warning + Attention + Achtung + Uwaga + + + Hi + Hallo + Hola + Witaj + Ahoj + Salut + Привет + Helló + Olá + Ciao + + + Attack + Angreifen + Atacar + Do ataku + Zaútočit + Attaquer + Атаковать + Támadás + Atacar + Attaccare + + + \ No newline at end of file diff --git a/addons/goggles/config.cpp b/addons/goggles/config.cpp index 95b699eb1c..0812200a87 100644 --- a/addons/goggles/config.cpp +++ b/addons/goggles/config.cpp @@ -183,13 +183,13 @@ class CfgGlasses { ACE_Resistance = 1; ACE_Protection = 1; }; - class G_Bandanna_sport:G_Bandanna_blk { + class G_Bandanna_sport: G_Bandanna_shades { ACE_Color[] = {1,0,0}; ACE_TintAmount=COLOUR; ACE_Resistance = 1; ACE_Protection = 1; }; - class G_Bandanna_aviator:G_Bandanna_blk { + class G_Bandanna_aviator: G_Bandanna_shades { ACE_Color[] = {0,0,-1}; ACE_TintAmount=COLOUR; ACE_Resistance = 1; diff --git a/addons/goggles/functions/fnc_handleKilled.sqf b/addons/goggles/functions/fnc_handleKilled.sqf index d156fb684c..e8e207c478 100644 --- a/addons/goggles/functions/fnc_handleKilled.sqf +++ b/addons/goggles/functions/fnc_handleKilled.sqf @@ -26,7 +26,9 @@ GVAR(EffectsActive) = false; _unit setVariable ["ACE_EyesDamaged", false]; -[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; +if (GVAR(DustHandler) != -1) then { + [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; +}; GVAR(DustHandler) = -1; true diff --git a/addons/hearing/ACE_Settings.hpp b/addons/hearing/ACE_Settings.hpp index 262c3edc34..13f445a987 100644 --- a/addons/hearing/ACE_Settings.hpp +++ b/addons/hearing/ACE_Settings.hpp @@ -25,4 +25,10 @@ class ACE_Settings { displayName = CSTRING(enabledForZeusUnits_DisplayName); description = CSTRING(enabledForZeusUnits_Description); }; + class GVAR(autoAddEarplugsToUnits) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(autoAddEarplugsToUnits_DisplayName); + description = CSTRING(autoAddEarplugsToUnits_Description); + }; }; diff --git a/addons/hearing/CfgEventHandlers.hpp b/addons/hearing/CfgEventHandlers.hpp index f09f259266..e31501d1c3 100644 --- a/addons/hearing/CfgEventHandlers.hpp +++ b/addons/hearing/CfgEventHandlers.hpp @@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers { class Extended_Init_EventHandlers { class CAManBase { class GVAR(AddEarPlugs) { - init = QUOTE( if (local (_this select 0)) then {_this call FUNC(addEarPlugs)}; ); + serverInit = QUOTE( _this call FUNC(addEarPlugs) ); }; }; }; @@ -33,3 +33,11 @@ class Extended_Explosion_EventHandlers { }; }; }; + +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE(_this call FUNC(handleRespawn)); + }; + }; +}; diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 2273653c3a..76a2f90a80 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -101,6 +101,7 @@ class CfgVehicles { function = QFUNC(moduleHearing); scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa); class Arguments { class EnableCombatDeafness { @@ -136,6 +137,12 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; + class autoAddEarplugsToUnits { + displayName = CSTRING(autoAddEarplugsToUnits_DisplayName); + description = CSTRING(autoAddEarplugsToUnits_Description); + typeName = "BOOL"; + defaultValue = 1; + }; }; class ModuleDescription { description = CSTRING(Module_Description); diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp index 7c21baaed2..7e1c932f62 100644 --- a/addons/hearing/CfgWeapons.hpp +++ b/addons/hearing/CfgWeapons.hpp @@ -42,7 +42,8 @@ class CfgWeapons { class H_PilotHelmetFighter_O: H_PilotHelmetFighter_B {}; class H_PilotHelmetFighter_I: H_PilotHelmetFighter_B {}; - class H_Cap_headphones: H_HelmetB { + class HelmetBase; + class H_Cap_headphones: HelmetBase { GVAR(protection) = 0.5; GVAR(lowerVolume) = 0.60; }; diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index 66406ad917..b8745acaaa 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -26,7 +26,7 @@ GVAR(time4) = 0; ["playerChanged", { GVAR(deafnessDV) = 0; GVAR(deafnessPrior) = 0; - ACE_player setvariable [QGVAR(deaf), false]; + ACE_player setVariable [QGVAR(deaf), false]; GVAR(beep) = false; GVAR(beep2) = false; diff --git a/addons/hearing/XEH_preInit.sqf b/addons/hearing/XEH_preInit.sqf index 16b9f35f80..3355d0cff4 100644 --- a/addons/hearing/XEH_preInit.sqf +++ b/addons/hearing/XEH_preInit.sqf @@ -6,6 +6,7 @@ PREP(addEarPlugs); PREP(earRinging); PREP(explosionNear); PREP(firedNear); +PREP(handleRespawn); PREP(hasEarPlugsIn); PREP(moduleHearing); PREP(putInEarPlugs); diff --git a/addons/hearing/functions/fnc_addEarPlugs.sqf b/addons/hearing/functions/fnc_addEarPlugs.sqf index b2e43bc718..9e6bd0cab2 100644 --- a/addons/hearing/functions/fnc_addEarPlugs.sqf +++ b/addons/hearing/functions/fnc_addEarPlugs.sqf @@ -14,29 +14,50 @@ * Public: No */ #include "script_component.hpp" + params ["_unit"]; +TRACE_2("params",_unit,typeOf _unit); -// Exit if hearing is disabled or soldier has earplugs already in (persistence scenarios) -if (!GVAR(enableCombatDeafness) || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {}; +// only run this after the settings are initialized +if !(EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addEarPlugs), _this]; +}; -private ["_launcher"]; +// Exit if hearing is disabled OR autoAdd is disabled OR soldier has earplugs already in (persistence scenarios) +if (!GVAR(enableCombatDeafness) || {!GVAR(autoAddEarplugsToUnits)} || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {}; // add earplugs if the soldier has a rocket launcher -_launcher = secondaryWeapon _unit; - -if (_launcher != "") exitWith { +if ((secondaryWeapon _unit) != "") exitWith { + TRACE_1("has launcher - adding",_unit); _unit addItem "ACE_EarPlugs"; }; // otherwise add earplugs if the soldier has a big rifle -private ["_magazine", "_ammo"]; +if ((primaryWeapon _unit) == "") exitWith {}; -_magazine = primaryWeaponMagazine _unit select 0; +(primaryWeaponMagazine _unit) params [["_magazine", ""]]; +if (_magazine == "") exitWith {}; -if (isNil "_magazine") exitWith {}; +private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); +private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); +private _count = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count"); -_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); +private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber"); +_caliber = call { + if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; + if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; + if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; + if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; + if (_caliber <= 0) then { 6.5 } else { _caliber }; +}; +private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5; -if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "audiblefire") > 8) then { +//If unit has a machine gun boost effective loudness 50% +if (_count >= 50) then {_loudness = _loudness * 1.5}; + +TRACE_2("primaryWeapon",_unit,_loudness); + +if (_loudness > 0.2) then { + TRACE_1("loud gun - adding",_unit); _unit addItem "ACE_EarPlugs"; }; diff --git a/addons/hearing/functions/fnc_handleRespawn.sqf b/addons/hearing/functions/fnc_handleRespawn.sqf new file mode 100644 index 0000000000..527d5d6b16 --- /dev/null +++ b/addons/hearing/functions/fnc_handleRespawn.sqf @@ -0,0 +1,35 @@ +/* + * Author: PabstMirror + * Reset earplugs on respawn, and then re-add if appropriate + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call ACE_hearing_fnc_handleRespawn; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; +TRACE_2("params",_unit,typeOf _unit); + +if (!local _unit) exitWith {}; //XEH should only be called on local units + +private _respawn = [0] call BIS_fnc_missionRespawnType; + +//if respawn is not Group or side: +if (_respawn <= 3) then { + //Remove earplugs if they have them: + if (_unit getVariable ["ACE_hasEarPlugsin", false]) then { + TRACE_1("had EarPlugs in - removing",_unit); + _unit setVariable ["ACE_hasEarPlugsin", false, true]; + }; +}; + +//Re-add if they need them: +[_unit] call FUNC(addEarPlugs); diff --git a/addons/hearing/functions/fnc_moduleHearing.sqf b/addons/hearing/functions/fnc_moduleHearing.sqf index 0aa8843485..35836ddb0c 100644 --- a/addons/hearing/functions/fnc_moduleHearing.sqf +++ b/addons/hearing/functions/fnc_moduleHearing.sqf @@ -20,4 +20,5 @@ if ((_logic getVariable "DisableEarRinging") != -1) then { }; [_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(autoAddEarplugsToUnits), "autoAddEarplugsToUnits"] call EFUNC(common,readSettingFromModule); ACE_LOGINFO("Hearing Module Initialized."); diff --git a/addons/hearing/functions/fnc_updateVolume.sqf b/addons/hearing/functions/fnc_updateVolume.sqf index f1cb063971..e36151aea4 100644 --- a/addons/hearing/functions/fnc_updateVolume.sqf +++ b/addons/hearing/functions/fnc_updateVolume.sqf @@ -42,7 +42,7 @@ if (!_justUpdateVolume) then { GVAR(deafnessPrior) = GVAR(deafnessDV); if (GVAR(deafnessDV) > 19.75) then { - ACE_player setvariable [QGVAR(deaf), true]; + ACE_player setVariable [QGVAR(deaf), true]; if ((!GVAR(DisableEarRinging)) && {ACE_time > GVAR(time4)}) then { playSound "ACE_Combat_Deafness"; GVAR(beep2) = true; @@ -50,7 +50,7 @@ if (!_justUpdateVolume) then { GVAR(time4) = ACE_time + 30; }; } else { - ACE_player setvariable [QGVAR(deaf), false]; + ACE_player setVariable [QGVAR(deaf), false]; }; if (GVAR(deafnessDV) > 10) then { diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index 05dde3a1bf..783326152c 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -165,5 +165,13 @@ Permite que unidades remotamente controladas pelo Zeus sejam atingidas por danos auditivos. Permitir a las unidades por control remoto de zeus que puedan tener daños auditivos. + + Add earplugs to units + Dodaj stopery dla jednostek + + + Add the `ACE_EarPlugs` item to all units that have loud weapons. Can disable if using custom loadouts. + Dodaje `ACE_EarPlugs` - stopery - do wszystkich jednostek, które posiadają głośną broń. Można wyłaczyć w przypadku korzystania z niestandardowych loadoutów. + \ No newline at end of file diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index 9426de13fd..2eb7611a6a 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -93,7 +93,7 @@ GVAR(no_cams) sort true; GVAR(pos) = getPosVisual GVAR(huntIR); if ((!dialog) || (count GVAR(no_cams) == 0) || ((GVAR(pos) select 2) <= 20)) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; + [_this select 1] call CBA_fnc_removePerFrameHandler; GVAR(stop) = true; diff --git a/addons/huntir/functions/fnc_huntir.sqf b/addons/huntir/functions/fnc_huntir.sqf index b1c269533d..e06ada87ea 100644 --- a/addons/huntir/functions/fnc_huntir.sqf +++ b/addons/huntir/functions/fnc_huntir.sqf @@ -48,7 +48,7 @@ createDialog "ace_huntir_cam_dialog_off"; _nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE]; if ((!dialog) || GVAR(done)) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; + [_this select 1] call CBA_fnc_removePerFrameHandler; if (dialog && GVAR(state) == "connected") then { [_nearestHuntIRs select 0] call FUNC(cam); diff --git a/addons/interact_menu/ACE_Settings.hpp b/addons/interact_menu/ACE_Settings.hpp index 381405987c..075408499b 100644 --- a/addons/interact_menu/ACE_Settings.hpp +++ b/addons/interact_menu/ACE_Settings.hpp @@ -96,4 +96,13 @@ class ACE_Settings { displayName = CSTRING(addBuildingActions); description = CSTRING(addBuildingActionsDescription); }; + class GVAR(menuAnimationSpeed) { + value = 0; + typeName = "SCALAR"; + isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); + displayName = CSTRING(menuAnimationSpeed); + description = CSTRING(menuAnimationSpeed_Description); + values[] = {"$str_speed_normal", "2x", "3x"}; + }; }; diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index 59fb01a353..1dd1401a7d 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -41,14 +41,14 @@ GVAR(ParsedTextCached) = []; // Statement [0] call FUNC(keyDown) },{[0,false] call FUNC(keyUp)}, -[219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key +[219, [false, false, false]], false] call CBA_fnc_addKeybind; //Left Windows Key ["ACE3 Common", QGVAR(SelfInteractKey), (localize LSTRING(SelfInteractKey)), { // Statement [1] call FUNC(keyDown) },{[1,false] call FUNC(keyUp)}, -[219, [false, true, false]], false] call cba_fnc_addKeybind; //Left Windows Key + Ctrl/Strg +[219, [false, true, false]], false] call CBA_fnc_addKeybind; //Left Windows Key + Ctrl/Strg // Listens for the falling unconscious event, just in case the menu needs to be closed diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 6dd4c5ee74..d84130e21c 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -17,7 +17,7 @@ params ["_target"]; private ["_objectType","_actionsVarName","_isMan"]; _objectType = _target; _isMan = false; -if (typeName _target == "OBJECT") then { +if (_target isEqualType objNull) then { _objectType = typeOf _target; _isMan = _target isKindOf "CAManBase"; }; diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index 2c8cdc279c..123f83110d 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -17,7 +17,7 @@ params ["_target"]; private ["_objectType","_actionsVarName","_isMan"]; _objectType = _target; _isMan = false; -if (typeName _target == "OBJECT") then { +if (_target isEqualType objNull) then { _objectType = typeOf _target; _isMan = _target isKindOf "CAManBase"; }; diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index 256984c104..0edef384d4 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -40,11 +40,11 @@ params [ ["_modifierFunction", {}] ]; -_position = if (typeName (_position) == "STRING") then { +_position = if (_position isEqualType "") then { // If the action is set to a selection, create the suitable code compile format ["_target selectionPosition '%1'", _position]; } else { - if (typeName (_position) == "ARRAY") then { + if (_position isEqualType []) then { // If the action is set to a array position, create the suitable code compile format ["%1", _position]; } else { diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 8c8ecf0c20..56c0e6e19c 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -78,6 +78,21 @@ if (GVAR(useCursorMenu)) then { GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff ((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)); +if (GVAR(menuAnimationSpeed) > 0) then { + //Auto expand the first level when self, mounted vehicle or zeus (skips the first animation as there is only one choice) + if (GVAR(openedMenuType) == 0) then { + if (isNull curatorCamera) then { + if (vehicle ACE_player != ACE_player) then { + GVAR(menuDepthPath) = [["ACE_SelfActions", (vehicle ACE_player)]]; + }; + } else { + GVAR(menuDepthPath) = [["ACE_ZeusActions", (getAssignedCuratorLogic player)]]; + }; + } else { + GVAR(menuDepthPath) = [["ACE_SelfActions", ACE_player]]; + }; +}; + ["interactMenuOpened", [_menuType]] call EFUNC(common,localEvent); true diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 54f197a2a3..1f7cf8140b 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -14,13 +14,12 @@ BEGIN_COUNTER(fnc_render); -private ["_cursorPos2", "_p1", "_p2", "_forEachIndex", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i", "_actionData", "_player", "_target"]; - -_foundTarget = false; +private _foundTarget = false; if (GVAR(openedMenuType) >= 0) then { - // _cursorPos1 = positionCameraToWorld [0, 0, 2]; - _cursorPos2 = positionCameraToWorld [0, 0, 2]; + BEGIN_COUNTER(fnc_renderMenuOpen); + + private _cursorPos2 = positionCameraToWorld [0, 0, 2]; // Render all available nearby interactions call FUNC(renderActionPoints); @@ -30,27 +29,26 @@ if (GVAR(openedMenuType) >= 0) then { [[0.5,0.5], "\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa"] call FUNC(renderSelector); }; - _cursorScreenPos = [worldToScreen _cursorPos2, GVAR(cursorPos)] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + private _cursorScreenPos = [worldToScreen _cursorPos2, GVAR(cursorPos)] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); - _closestDistance = 1000000; - _closestSelection = -1; + private _closestDistance = 1000000; + private _closestSelection = -1; { - _sPos = _x select 1; - _disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2); - if(_disSq < 0.0125 && _disSq < _closestDistance) then { - _closestDistance = _disSq; + _x params ["", "_sPos"]; + private _distanceFromCursor = _cursorScreenPos distance2d _sPos; + if ((_distanceFromCursor < 0.1118) && {_distanceFromCursor < _closestDistance}) then { + _closestDistance = _distanceFromCursor; _closestSelection = _forEachIndex; }; } forEach GVAR(currentOptions); - if(_closestSelection == -1) exitWith {}; - _closest = GVAR(currentOptions) select _closestSelection; + private _closest = GVAR(currentOptions) select _closestSelection; + _closest params ["_action", "_sPos", "_hoverPath"]; - _sPos = _closest select 1; - _cTime = ACE_diagTime; - _delta = _cTime - GVAR(lastTime); + private _cTime = ACE_diagTime; + private _delta = _cTime - GVAR(lastTime); GVAR(lastTime) = _cTime; GVAR(rotationAngle) = (GVAR(rotationAngle) + (270*_delta)) mod 360; @@ -58,28 +56,17 @@ if (GVAR(openedMenuType) >= 0) then { _foundTarget = true; GVAR(actionSelected) = true; - GVAR(selectedAction) = (_closest select 0) select 1; + GVAR(selectedAction) = _action select 1; GVAR(selectedTarget) = (GVAR(selectedAction)) select 2; - _misMatch = false; - _hoverPath = (_closest select 2); + private _misMatch = !(GVAR(lastPath) isEqualTo _hoverPath); - if((count GVAR(lastPath)) != (count _hoverPath)) then { - _misMatch = true; - } else { - { - if !(_x isEqualTo (_hoverPath select _forEachIndex)) exitWith { - _misMatch = true; - }; - } forEach GVAR(lastPath); - }; - - if(_misMatch && {ACE_diagTime-GVAR(expandedTime) > 0.25}) then { + if(_misMatch && {ACE_diagTime-GVAR(expandedTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then { GVAR(startHoverTime) = ACE_diagTime; GVAR(lastPath) = _hoverPath; GVAR(expanded) = false; } else { - if(!GVAR(expanded) && ACE_diagTime-GVAR(startHoverTime) > 0.25) then { + if(!GVAR(expanded) && {ACE_diagTime-GVAR(startHoverTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then { GVAR(expanded) = true; // Start the expanding menu animation only if the user is not going up the menu @@ -89,13 +76,12 @@ if (GVAR(openedMenuType) >= 0) then { GVAR(menuDepthPath) = +GVAR(lastPath); // Execute the current action if it's run on hover - private "_runOnHover"; - _tmp = ((GVAR(selectedAction) select 0) select 9) select 3; - _runOnHover = true; - if ((typeName _tmp) == "CODE" ) then { + private _tmp = ((GVAR(selectedAction) select 0) select 9) select 3; + private _runOnHover = true; + if (_tmp isEqualType {}) then { _runOnHover = call _tmp; } else { - if ((typeName _tmp) == "BOOL" ) then { + if (_tmp isEqualType false) then { _runOnHover = _tmp; } else { _runOnHover = _tmp > 0; @@ -103,14 +89,14 @@ if (GVAR(openedMenuType) >= 0) then { }; if (_runOnHover) then { this = GVAR(selectedTarget); - _player = ACE_Player; - _target = GVAR(selectedTarget); + private _player = ACE_Player; + private _target = GVAR(selectedTarget); // Clear the conditions caches ["clearConditionCaches", []] call EFUNC(common,localEvent); // Check the action conditions - _actionData = GVAR(selectedAction) select 0; + private _actionData = GVAR(selectedAction) select 0; if ([_target, _player, _actionData select 6] call (_actionData select 4)) then { // Call the statement [_target, _player, _actionData select 6] call (_actionData select 3); @@ -121,6 +107,7 @@ if (GVAR(openedMenuType) >= 0) then { }; }; }; + END_COUNTER(fnc_renderMenuOpen); }; if(!_foundTarget && GVAR(actionSelected)) then { diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index 81a6887f97..c5b2c887ce 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -34,7 +34,7 @@ _fnc_renderNearbyActions = { // Quick oclussion test. Skip objects more than 1 m behind the camera plane _lambda = ((getPosASL _x) vectorDiff _cameraPos) vectorDotProduct _cameraDir; - if (_lambda > -1) then { + if ((_lambda > -1) && {!isObjectHidden _target}) then { _numInteractions = 0; // Prevent interacting with yourself or your own vehicle if (_target != ACE_player && {_target != vehicle ACE_player}) then { diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 21c434fe03..573845c08a 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -101,9 +101,9 @@ if (GVAR(UseListMenu)) then { }; // Animate menu scale -if (_menuInSelectedPath && (_menuDepth == count _path)) then { - _scaleX = _scaleX * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * 8) min 1)); - _scaleY = _scaleY * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * 8) min 1)); +if (_menuInSelectedPath && {_menuDepth == count _path}) then { + _scaleX = _scaleX * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); + _scaleY = _scaleY * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); }; _target = _actionObject; @@ -116,7 +116,7 @@ _angle = _centerAngle - _angleSpan / 2; private ["_offset","_newPos"]; _newPos = if (GVAR(UseListMenu)) then { [(_sPos select 0) + _scaleX, - (_sPos select 1) + _scaleY * (_foreachindex - _numChildren/2 + 0.5)]; + (_sPos select 1) + _scaleY * (_forEachIndex - _numChildren/2 + 0.5)]; } else { [(_sPos select 0) - _scaleX * (cos _angle), (_sPos select 1) + _scaleY * (sin _angle)]; diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 42966c43c1..424426f653 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -299,5 +299,13 @@ Menu interakce Menú de interacción + + Interaction Animation Speed + Szybkość animacji interakcji + + + Makes menu animations faster and decreases the time needed to hover to show sub actions + Przyśpiesza animacje menu interakcji oraz czas wymagany do pokazania podmenu + - + \ No newline at end of file diff --git a/addons/interaction/ACE_Settings.hpp b/addons/interaction/ACE_Settings.hpp index 075c1f056d..a4e6dad42c 100644 --- a/addons/interaction/ACE_Settings.hpp +++ b/addons/interaction/ACE_Settings.hpp @@ -4,4 +4,11 @@ class ACE_Settings { value = 1; typeName = "BOOL"; }; + class GVAR(enableMagazinePassing) { + value = 1; + typeName = "BOOL"; + isClientSettable = 1; + displayName = CSTRING(PassMagazineSetting); + category = ECSTRING(interact_menu,Category_InteractionMenu); + }; }; diff --git a/addons/interaction/ACE_ZeusActions.hpp b/addons/interaction/ACE_ZeusActions.hpp index 5a7ea9d631..af29186895 100644 --- a/addons/interaction/ACE_ZeusActions.hpp +++ b/addons/interaction/ACE_ZeusActions.hpp @@ -199,47 +199,47 @@ class ACE_ZeusActions { class wedge { displayName = "$STR_Wedge"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\wedge_ca.paa"; - statement = "{_x setWaypointFormation 'WEDGE';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'WEDGE';} forEach (curatorSelected select 2);"; }; class vee { displayName = "$STR_Vee"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\vee_ca.paa"; - statement = "{_x setWaypointFormation 'VEE';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'VEE';} forEach (curatorSelected select 2);"; }; class line { displayName = "$STR_Line"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\line_ca.paa"; - statement = "{_x setWaypointFormation 'LINE';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'LINE';} forEach (curatorSelected select 2);"; }; class column { displayName = "$STR_Column"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\column_ca.paa"; - statement = "{_x setWaypointFormation 'COLUMN';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'COLUMN';} forEach (curatorSelected select 2);"; }; class file { displayName = "$STR_File"; icon = "\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\file_ca.paa"; - statement = "{_x setWaypointFormation 'FILE';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'FILE';} forEach (curatorSelected select 2);"; }; class stag_column { displayName = "$STR_Staggered"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\stag_column_ca.paa"; - statement = "{_x setWaypointFormation 'STAG COLUMN';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'STAG COLUMN';} forEach (curatorSelected select 2);"; }; class ech_left { displayName = "$STR_EchL"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\ech_left_ca.paa"; - statement = "{_x setWaypointFormation 'ECH LEFT';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'ECH LEFT';} forEach (curatorSelected select 2);"; }; class ech_right { displayName = "$STR_EchR"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\ech_right_ca.paa"; - statement = "{_x setWaypointFormation 'ECH RIGHT';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'ECH RIGHT';} forEach (curatorSelected select 2);"; }; class diamond { displayName = "$STR_Diamond"; icon="\A3\UI_F_Curator\Data\RscCommon\RscAttributeFormation\diamond_ca.paa"; - statement = "{_x setWaypointFormation 'DIAMOND';} forEach (curatorSelected select 1);"; + statement = "{_x setWaypointFormation 'DIAMOND';} forEach (curatorSelected select 2);"; }; }; }; diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 56fb06a85b..55bc0b1159 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = "ACE_Interaction_fnc_moduleInteraction"; scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); class Arguments { @@ -35,6 +36,32 @@ class CfgVehicles { icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; selection = "pelvis"; + class ACE_PassMagazine { + displayName = CSTRING(PassMagazine); + condition = ""; + statement = ""; + showDisabled = 0; + priority = 3.3; + icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\cargomag_ca.paa"; + + class ACE_PassMagazinePrimary { + displayName = CSTRING(PassMagazinePrimary); + condition = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(canPassMagazine)); + statement = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(passMagazine)); + showDisabled = 0; + priority = 3; + icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\primaryweapon_ca.paa"; + }; + class ACE_PassMagazineHandgun { + displayName = CSTRING(PassMagazineHandgun); + condition = QUOTE([ARR_3(_player,_target,handgunWeapon _target)] call FUNC(canPassMagazine)); + statement = QUOTE([ARR_3(_player,_target,handgunWeapon _target)] call FUNC(passMagazine)); + showDisabled = 0; + priority = 1; + icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\handgun_ca.paa"; + }; + }; + class ACE_TeamManagement { displayName = CSTRING(TeamManagement); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {GVAR(EnableTeamManagement)}); @@ -270,112 +297,6 @@ class CfgVehicles { hotkey = "M"; }; }; - - class ACE_Gestures { - displayName = CSTRING(Gestures); - condition = "canStand _target"; - statement = ""; - showDisabled = 1; - priority = 3.5; - icon = PATHTOF(UI\gestures_ca.paa); - hotkey = "G"; - - /*class ACE_Gesture_Advance { - displayName = CSTRING(Gestures_Attack); - condition = "canStand _target"; - statement = "_target playActionNow 'gestureAttack';"; - showDisabled = 1; - priority = 2.0; - };*/ - class ACE_Gesture_Advance { - displayName = CSTRING(Gestures_Advance); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureAdvance';); - showDisabled = 1; - priority = 1.9; - hotkey = "1"; - }; - class ACE_Gesture_Go { - displayName = CSTRING(Gestures_Go); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow ([ARR_2('gestureGo','gestureGoB')] select floor random 2);); - showDisabled = 1; - priority = 1.8; - hotkey = "2"; - }; - class ACE_Gesture_Follow { - displayName = CSTRING(Gestures_Follow); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureFollow';); - showDisabled = 1; - priority = 1.7; - hotkey = "3"; - }; - /*class ACE_Gesture_Point { - displayName = CSTRING(Gestures_Point); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gesturePoint';); - showDisabled = 1; - priority = 1.6; - };*/ - class ACE_Gesture_Up { - displayName = CSTRING(Gestures_Up); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureUp';); - showDisabled = 1; - priority = 1.5; - hotkey = "4"; - }; - class ACE_Gesture_Cover { - displayName = CSTRING(Gestures_Cover); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureCover';); - showDisabled = 1; - priority = 1.4; - hotkey = "5"; - }; - class ACE_Gesture_CeaseFire { - displayName = CSTRING(Gestures_Cease_Fire); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureCeaseFire';); - showDisabled = 1; - priority = 1.3; - hotkey = "6"; - }; - class ACE_Gesture_Freeze { - displayName = CSTRING(Gestures_Freeze); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureFreeze';); - showDisabled = 1; - priority = 1.2; - hotkey = "7"; - }; - class ACE_Gesture_Yes { - displayName = ECSTRING(common,Yes); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow ([ARR_2('gestureYes','gestureNod')] select floor random 2);); - showDisabled = 1; - priority = 1.1; - hotkey = "8"; - }; - class ACE_Gesture_No { - displayName = ECSTRING(common,No); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow 'gestureNo';); - showDisabled = 1; - priority = 1.0; - hotkey = "9"; - }; - class ACE_Gesture_Hi { - displayName = CSTRING(Gestures_Hi); - condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow ([ARR_3('gestureHi','gestureHiB','gestureHiC')] select floor random 3);); - showDisabled = 1; - priority = 0.9; - hotkey = "0"; - }; - }; - class ACE_Equipment { displayName = CSTRING(Equipment); condition = QUOTE(true); @@ -557,6 +478,14 @@ class CfgVehicles { }; }; + class Pod_Heli_Transport_04_base_F: StaticWeapon { + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + distance = 5; + }; + }; + }; + class StaticMGWeapon: StaticWeapon {}; class HMG_01_base_F: StaticMGWeapon {}; @@ -618,4 +547,23 @@ class CfgVehicles { class ACE_SelfActions {}; }; + + class RoadCone_F: thingX { + class ACE_Actions { + class ACE_MainActions { + displayName = CSTRING(MainAction); + selection = ""; + distance = 2; + condition = "true"; + }; + }; + }; + + class RoadBarrier_F: RoadCone_F { + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[0,0,0.500671]"; + }; + }; + }; }; diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index ee90af64ad..bed8a349bc 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -29,19 +29,11 @@ GVAR(isOpeningDoor) = false; if (_unit == ACE_player) then { addCamShake [4, 0.5, 5]; - private _message = parseText format ([["%1 >", localize LSTRING(YouWereTappedRight)], ["< %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 0)); - [_message] call FUNC(displayTextStructured); + private _message = parseText format ([["%1 >", localize LSTRING(YouWereTappedRight)], ["< %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 1)); + [_message] call EFUNC(common,displayTextStructured); }; }] call EFUNC(common,addEventHandler); -// restore global fire teams for JIP -private "_team"; -{ - _team = _x getVariable [QGVAR(assignedFireTeam), ""]; - if (_team != "") then {_x assignTeam _team}; - false -} count allUnits; - // add keybinds ["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), { // Conditions: canInteract @@ -67,8 +59,11 @@ private "_team"; // Conditions: specific if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false}; + //Tap whichever shoulder is closest + private _shoulderNum = [0, 1] select (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180); + // Statement - [ACE_player, cursorTarget, 0] call FUNC(tapShoulder); + [ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder); true }, {false}, diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 95be20f141..258567482d 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -20,6 +20,8 @@ PREP(sendAway); PREP(canJoinGroup); PREP(canJoinTeam); PREP(joinTeam); +PREP(canPassMagazine); +PREP(passMagazine); PREP(canBecomeLeader); PREP(doBecomeLeader); PREP(canTapShoulder); diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf new file mode 100644 index 0000000000..1c1dd1bb2d --- /dev/null +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -0,0 +1,30 @@ +/* + * Author: BaerMitUmlaut + * Checks if unit has a spare magazine for the specified weapon. + * + * Arguments: + * 0: Unit that passes the magazine + * 1: Unit to pass the magazine to + * 2: Weapon classname + * + * Return Value: + * Unit can pass magazine + * + * Example: + * [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine + * + * Public: No + */ + +#include "script_component.hpp" +params ["_player", "_target", "_weapon"]; +private ["_compatibleMags"]; + +if (!GVAR(enableMagazinePassing)) exitWith {false}; + +_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); +{ + _x params ["_className", "", "_loaded"]; + if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true}; + false +} foreach (magazinesAmmoFull _player); diff --git a/addons/interaction/functions/fnc_hideMouseHint.sqf b/addons/interaction/functions/fnc_hideMouseHint.sqf index 39f43e7fa3..d7f9d9140e 100644 --- a/addons/interaction/functions/fnc_hideMouseHint.sqf +++ b/addons/interaction/functions/fnc_hideMouseHint.sqf @@ -19,4 +19,4 @@ if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith { (QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; -showHUD true; +["mouseHint", []] call EFUNC(common,showHud); //This is equivalent to the old showHud true diff --git a/addons/interaction/functions/fnc_joinTeam.sqf b/addons/interaction/functions/fnc_joinTeam.sqf index 9283e7b474..1f713d8ba2 100644 --- a/addons/interaction/functions/fnc_joinTeam.sqf +++ b/addons/interaction/functions/fnc_joinTeam.sqf @@ -18,11 +18,7 @@ params ["_unit", "_team"]; -// make sure correct team is set on JIP -_unit setVariable [QGVAR(assignedFireTeam), _team, true]; - -// join fire team on every machine in that group -["assignTeam", units group _unit, [_unit, _team]] call EFUNC(common,targetEvent); +["CBA_teamColorChanged", [_unit, _team]] call CBA_fnc_globalEvent; // display message if (_unit == ACE_player) then { diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf new file mode 100644 index 0000000000..2afe2f3817 --- /dev/null +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -0,0 +1,57 @@ +/* + * Author: BaerMitUmlaut + * Pass spare magazine for the specified weapon. + * + * Arguments: + * 0: Unit that passes the magazine + * 1: Unit to pass the magazine to + * 2: Weapon classname + * + * Return Value: + * None + * + * Example: + * [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_magToPassazine + * + * Public: No + */ + +#include "script_component.hpp" +params ["_player", "_target", "_weapon"]; +private ["_compatibleMags", "_filteredMags", "_magToPass", "_magToPassIndex", "_playerName", "_magToPassDisplayName"]; + +_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); +_filteredMags = [magazinesAmmoFull _player, { + params ["_className", "", "_loaded"]; + _className in _compatibleMags && !_loaded +}] call EFUNC(common,filter); + +//select magazine with most ammo +_magToPass = _filteredMags select 0; +_magToPassIndex = 0; +{ + _x params ["_className", "_ammoCount"]; + if ((_ammoCount > (_magToPass select 1)) && (_target canAdd _className)) then { + _magToPass = _x; + _magToPassIndex = _forEachIndex; + }; +} foreach _filteredMags; + +//remove all magazines and add them again, except the one to be passed +//needed because of missing commands, see http://feedback.arma3.com/view.php?id=12782 +_magToPass params ["_magToPassClassName", "_magToPassAmmoCount"]; +_player removeMagazines _magToPassClassName; +{ + _x params ["_className", "_ammoCount"]; + if ((_className == _magToPassClassName) && (_forEachIndex != _magToPassIndex)) then { + _player addMagazine [_className, _ammoCount]; + }; +} foreach _filteredMags; + +_player playActionNow "PutDown"; + +_target addMagazine [_magToPassClassName, _magToPassAmmoCount]; + +_playerName = [_player] call EFUNC(common,getName); +_magToPassDisplayName = getText (configFile >> "CfgMagazines" >> _magToPassClassName >> "displayName"); +["displayTextStructured", [_target], [[LSTRING(PassMagazineHint), _playerName, _magToPassDisplayName], 1.5, _target]] call EFUNC(common,targetEvent); \ No newline at end of file diff --git a/addons/interaction/functions/fnc_showMouseHint.sqf b/addons/interaction/functions/fnc_showMouseHint.sqf index e8f279cc0c..429b7d7670 100644 --- a/addons/interaction/functions/fnc_showMouseHint.sqf +++ b/addons/interaction/functions/fnc_showMouseHint.sqf @@ -50,4 +50,4 @@ if (_scroll == "") exitWith { (_display displayCtrl 1002) ctrlSetText _scroll; -showHUD false; +["mouseHint", [false, true, true, true, true, true, true, false]] call EFUNC(common,showHud); //This is equivalent to the old showHud false diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 13383f8088..b84a987a9c 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -253,138 +253,6 @@ << Voltar << Indietro - - Gestures - Gesten - Gestos - Gesty - Posunky - Signaux - Жесты - Kézjelek - Gestos - Gesti - - - Attack - Angreifen - Atacar - Do ataku - Zaútočit - Attaquer - Атаковать - Támadás - Atacar - Attaccare - - - Advance - Vordringen - Avanzar - Naprzód - Postoupit - Avancer - Продвигаться - Előre - Avançar - Avanzare - - - Go - Los - Adelante - Szybko - Jít - Aller - Идти - Mozgás - Mover-se - Muoversi - - - Follow - Folgen - Seguirme - Za mną - Následovat - Suivre - Следовать - Utánam - Seguir - Seguire - - - Point - Zeigen - Señalar - Wskazać - Ukázat - Pointer - Точка - Mutat - Apontar - Puntare a - - - Up - Aufstehen - Arriba - Do góry - Vztyk - Debout - Вверх - Fel - Acima - Alzarsi - - - Cover - Deckung - Cubrirse - Do osłony - Krýt se - A couvert - Укрыться - Fedezékbe - Proteger-se - Copertura - - - Cease Fire - Feuer einstellen - Alto el fuego - Wstrzymać ogień - Zastavit palbu - Halte au feu - Прекратить огонь - Tüzet szüntess - Cessar Fogo - Cessare il Fuoco - - - Freeze - Keine Bewegung - Alto - Stać - Stát - Halte - Замереть - Állj - Alto - Fermi - - - Hi - Hallo - Hola - Witaj - Ahoj - Salut - Привет - Helló - Olá - Ciao - Put weapon on back Waffe wegstecken @@ -823,5 +691,30 @@ O módulo de gestão de equipe é composto por: a atribuição de cores para os membros da equipe, comando das equipes, juntando-se / deixando equipes. Управление группами позволяет назначать цвета членам групп, брать командование, вступать в группы или покидать их. + + Pass magazine + Magazin geben + Podaj magazynek + + + Primary magazine + Gewehrmagazin + Magazynek karabinowy + + + Pistol magazine + Pistolenmagazin + Magazynek pistoletowy + + + %1 passed you a %2 magazine. + %1 hat dir ein %2 Magazin gegeben. + %1 podał Ci magazynek %2. + + + Show "pass magazine" interaction + Zeige "Magazine geben" Interaktion + Pokaż interakcję "podaj magazynek" + - + \ No newline at end of file diff --git a/addons/inventory/RscDisplayInventory.hpp b/addons/inventory/RscDisplayInventory.hpp index f845f50a35..c3a1904678 100644 --- a/addons/inventory/RscDisplayInventory.hpp +++ b/addons/inventory/RscDisplayInventory.hpp @@ -87,31 +87,37 @@ class RscDisplayInventory { class BackgroundSlotPrimaryMuzzle: BackgroundSlotPrimary { x = X_PART(26.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class BackgroundSlotPrimaryUnderBarrel: BackgroundSlotPrimary { - x = X_PART(29); + x = X_PART(28.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class BackgroundSlotPrimaryFlashlight: BackgroundSlotPrimary { - x = X_PART(31.4); + x = X_PART(30.6); y = Y_PART(9.2); //not sure why different (double check release) - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class BackgroundSlotPrimaryOptics: BackgroundSlotPrimary { - x = X_PART(33.8); + x = X_PART(32.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); + h = H_PART(2); + }; + class BackgroundSlotPrimaryMagazineGL: BackgroundSlotPrimary { + x = X_PART(34.6); + y = Y_PART(9.1); + w = W_PART(1.9); h = H_PART(2); }; class BackgroundSlotPrimaryMagazine: BackgroundSlotPrimary { x = X_PART(36.2); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class BackgroundSlotSecondary: BackgroundSlotPrimary { @@ -292,31 +298,37 @@ class RscDisplayInventory { class SlotPrimaryMuzzle: SlotPrimary { x = X_PART(26.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class SlotPrimaryUnderBarrel: SlotPrimary { - x = X_PART(29); + x = X_PART(28.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class SlotPrimaryFlashlight: SlotPrimary { - x = X_PART(31.4); + x = X_PART(30.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class SlotPrimaryOptics: SlotPrimary { - x = X_PART(33.8); + x = X_PART(32.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); + h = H_PART(2); + }; + class SlotPrimaryMagazineGL: SlotPrimary { + x = X_PART(34.6); + y = Y_PART(9.1); + w = W_PART(1.9); h = H_PART(2); }; class SlotPrimaryMagazine: SlotPrimary { - x = X_PART(36.2); + x = X_PART(36.6); y = Y_PART(9.1); - w = W_PART(2.3); + w = W_PART(1.9); h = H_PART(2); }; class SlotSecondary: SlotPrimary { diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index cf02d5359e..8be68be5b5 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -55,7 +55,7 @@ if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1}) _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); }; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; GVAR(pfehID) = -1; }; diff --git a/addons/javelin/initKeybinds.sqf b/addons/javelin/initKeybinds.sqf index 15215466e8..10b5e2813d 100644 --- a/addons/javelin/initKeybinds.sqf +++ b/addons/javelin/initKeybinds.sqf @@ -19,7 +19,7 @@ [ACE_player] call FUNC(lockKeyUp); false }, -[15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key +[15, [false, false, false]], false] call CBA_fnc_addKeybind; //Tab Key ["ACE3 Weapons", QGVAR(cycleFireMode), localize LSTRING(CycleFireMode), { false }, @@ -27,4 +27,4 @@ [ACE_player] call FUNC(cycleFireMode); false }, -[15, [false, true, false]], false] call cba_fnc_addKeybind; //Ctrl+Tab Key \ No newline at end of file +[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key \ No newline at end of file diff --git a/addons/kestrel4500/functions/fnc_updateDisplay.sqf b/addons/kestrel4500/functions/fnc_updateDisplay.sqf index e63b18bcfc..75c0db2e86 100644 --- a/addons/kestrel4500/functions/fnc_updateDisplay.sqf +++ b/addons/kestrel4500/functions/fnc_updateDisplay.sqf @@ -23,7 +23,7 @@ private ["_outputData"]; _outputData = [] call FUNC(generateOutputData); { - ctrlSetText [_x , _outputData select _foreachindex]; + ctrlSetText [_x , _outputData select _forEachIndex]; } forEach [74100, 74200, 74201, 74300, 74301, 74302, 74303, 74304, 74305, 74400, 74401, 74500, 74600, 74601, 74602, 74603, 74604, 74605]; if (GVAR(referenceHeadingMenu) == 1) then { diff --git a/addons/laser/CfgVehicles.hpp b/addons/laser/CfgVehicles.hpp index dd3f02a0cc..d8976ac204 100644 --- a/addons/laser/CfgVehicles.hpp +++ b/addons/laser/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { // @TODO: Changing the model and simulation hides it, but THEN IT DOESNT SPAWN WTF!? model = "\A3\Weapons_F\empty.p3d"; destrType = "DestructNo"; - simulation = "house"; + simulation = "LaserTarget"; class EventHandlers { init = QUOTE(_this call FUNC(laser_init)); diff --git a/addons/laser/functions/fnc_laserTargetPFH.sqf b/addons/laser/functions/fnc_laserTargetPFH.sqf index 4c4f242482..6d993b07de 100644 --- a/addons/laser/functions/fnc_laserTargetPFH.sqf +++ b/addons/laser/functions/fnc_laserTargetPFH.sqf @@ -10,7 +10,7 @@ _shooter = _args select 1; _uuid = _args select 2; if(isNull _laserTarget || !alive _shooter) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; REM(GVAR(VanillaLasers), _laserTarget); // Remove laseron diff --git a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf index 34ca98808b..29befe96cd 100644 --- a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf +++ b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf @@ -1,19 +1,36 @@ -// by commy2 and esteldunedain +/* + * Author: commy2 and esteldunedain + * Draw a Laser Point + * + * Arguments: + * 0: Target unit + * 1: Range + * 2: is Green + * 3: Brightness + * + * Return Value: + * None + * + * Example: + * [player, 10, false, 2] call ace_laserpointer_fnc_drawLaserpoint + * + * Public: No + */ #include "script_component.hpp" -params ["_unit", "_range", "_isGreen", "_brightness"]; +params ["_target", "_range", "_isGreen", "_brightness"]; -private ["_p0", "_v1", "_v2", "_v3", "_p1", "_pL", "_distance", "_pL2", "_camPos", "_size"]; +private _unit = ACE_player; -_p0 = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "righthand")); +private _p0 = AGLToASL (_target modelToWorldVisual (_target selectionPosition "righthand")); // Find a system of orthogonal reference vectors // _v1 points in the direction of the weapon // _v2 points to the right of the weapon // _v3 points to the top side of the weapon -_v1 = _unit weaponDirection currentWeapon _unit; -_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); -_v3 = _v2 vectorCrossProduct _v1; +private _v1 = _target weaponDirection currentWeapon _target; +private _v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); +private _v3 = _v2 vectorCrossProduct _v1; // Offset over the 3 reference axis // This offset could eventually be configured by weapon in the config @@ -22,23 +39,24 @@ _v3 = _v2 vectorCrossProduct _v1; #define OFFV3 0.08 // Offset _p0, the start of the laser -_p0 = _p0 vectorAdd (_v1 vectorMultiply OFFV1) vectorAdd (_v3 vectorMultiply OFFV3) vectorAdd (_v2 vectorMultiply OFFV2); +_p0 = _p0 vectorAdd (_v1 vectorMultiply OFFV1) vectorAdd (_v3 vectorMultiply OFFV3) vectorAdd (_v2 vectorMultiply OFFV2); // Calculate _p1, the potential end of the laser -_p1 = _p0 vectorAdd (_v1 vectorMultiply _range); +private _p1 = _p0 vectorAdd (_v1 vectorMultiply _range); -_pL = lineIntersectsSurfaces [_p0, _p1, ACE_player, vehicle ACE_player, true, 1, "GEOM", "FIRE"] select 0 select 0; +private _pL = lineIntersectsSurfaces [_p0, _p1, _unit, vehicle _unit] select 0 select 0; // no intersection found, quit if (isNil "_pL") exitWith {}; -_distance = _p0 vectorDistance _pL; +private _distance = _p0 vectorDistance _pL; //systemChat str _distance; if (_distance < 0.5) exitWith {}; _pL = _p0 vectorAdd (_v1 vectorMultiply _distance); -_pL2 = _p0 vectorAdd (_v1 vectorMultiply (_distance - 0.5)); + +private _pL2 = _p0 vectorAdd (_v1 vectorMultiply (_distance - 0.5)); _pL = ASLtoAGL _pL; @@ -50,19 +68,20 @@ drawLine3D [ ]; */ -//systemChat str [_unit, "FIRE"] intersect [_camPos, _pL]; +//systemChat str [_target, "FIRE"] intersect [_camPos, _pL]; -_camPos = positionCameraToWorld [0,0,0.2]; -if (count ([_unit, "FIRE"] intersect [_camPos, _pL]) > 0) exitWith {}; -if (count ([ACE_player, "FIRE"] intersect [_camPos, _pL]) > 0) exitWith {}; +private _camPos = positionCameraToWorld [0,0,0.2]; + +if (count ([_target, "FIRE"] intersect [_camPos, _pL]) > 0) exitWith {}; +if (count ([_unit, "FIRE"] intersect [_camPos, _pL]) > 0) exitWith {}; // Convert _camPos to ASL _camPos = AGLToASL _camPos; -if ( terrainIntersectASL [_camPos, _pL2]) exitWith {}; -if ( lineIntersects [_camPos, _pL2]) exitWith {}; +if (terrainIntersectASL [_camPos, _pL2]) exitWith {}; +if (lineIntersects [_camPos, _pL2]) exitWith {}; -_size = 2 * (_range - (positionCameraToWorld [0,0,0] vectorDistance _pL)) / _range; +private _size = 2 * (_range - (positionCameraToWorld [0,0,0] vectorDistance _pL)) / _range; drawIcon3D [ format ["\a3\weapons_f\acc\data\collimdot_%1_ca.paa", ["red", "green"] select _isGreen], diff --git a/addons/laserpointer/functions/fnc_onDraw.sqf b/addons/laserpointer/functions/fnc_onDraw.sqf index 9e61e70156..1945dcf2b7 100644 --- a/addons/laserpointer/functions/fnc_onDraw.sqf +++ b/addons/laserpointer/functions/fnc_onDraw.sqf @@ -1,34 +1,33 @@ -// by commy2 +/* + * Author: commy2 + * Draw the visible laser beams of all cached units. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_brightness", "_cacheName", "_isIR", "_laser", "_laserID", "_weapon"]; +private _isIR = currentVisionMode ACE_player; -_isIR = currentVisionMode ACE_player; if (_isIR == 2) exitWith {}; _isIR = _isIR == 1; -_brightness = 2 - call EFUNC(common,ambientBrightness); +private _brightness = 2 - call EFUNC(common,ambientBrightness); { - _weapon = currentWeapon _x; - - _laser = switch (_weapon) do { - case (primaryWeapon _x): { - primaryWeaponItems _x select 1; - }; - case (secondaryWeapon _x): { - secondaryWeaponItems _x select 1; - }; - case (handgunWeapon _x): { - handgunItems _x select 1; - }; - default {""}; - }; + private _weapon = currentWeapon _x; + private _laser = (_x weaponAccessories _weapon) select 1; if (_laser != "") then { - _cacheName = format [QGVAR(laser_%1), _laser]; - _laserID = missionNamespace getVariable [_cacheName, -1]; + private _cacheName = format [QGVAR(laser_%1), _laser]; + private _laserID = missionNamespace getVariable [_cacheName, -1]; + if (missionNamespace getVariable [_cacheName, -1] == -1) then { _laserID = getNumber (configFile >> "CfgWeapons" >> _laser >> "ACE_laserpointer"); missionNamespace setVariable [_cacheName, _laserID]; @@ -38,5 +37,5 @@ _brightness = 2 - call EFUNC(common,ambientBrightness); [_x, 100, (_laserID == 2 || _isIR), _brightness] call FUNC(drawLaserpoint); }; }; - -} forEach GVAR(nearUnits); + false +} count GVAR(nearUnits); diff --git a/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf b/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf index 3332631c49..e26d5f75c1 100644 --- a/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf +++ b/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf @@ -1,89 +1,54 @@ -// by commy2 +/* + * Author: Commy2 + * Switch between laser modes. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_weapon", "_error"]; +params ["_unit", "_weapon"]; -_unit = _this select 0; -_weapon = _this select 1; - -// 1 = primary, 2 = secondary, 3 = handgun -private "_currentWeaponType"; -_currentWeaponType = 0; - -private "_pointer"; -_pointer = switch (_weapon) do { - case (primaryWeapon _unit): { - _currentWeaponType = 1; - primaryWeaponItems _unit select 1 - }; - case (secondaryWeapon _unit): { - _currentWeaponType = 2; - secondaryWeaponItems _unit select 1 - }; - case (handgunWeapon _unit): { - _currentWeaponType = 3; - handgunItems _unit select 1 - }; - default {""}; -}; +private _pointer = (_unit weaponAccessories _weapon) select 1; if (_pointer == "") exitWith {}; -private "_config"; -_config = configFile >> "CfgWeapons" >> _pointer; +private _config = configFile >> "CfgWeapons" >> _pointer; -private "_nextPointer"; -_nextPointer = getText (_config >> "ACE_nextModeClass"); +private _nextPointer = getText (_config >> "ACE_nextModeClass"); if (_nextPointer == "") exitWith {}; //If system disabled, don't switch to a laser: -private "_nextPointerIsLaser"; -_nextPointerIsLaser = getNumber (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_laserpointer"); +private _nextPointerIsLaser = getNumber (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_laserpointer"); if ((!GVAR(enabled)) && {_nextPointerIsLaser == 1}) exitWith {}; // disable inheritance for this entry, because addons claim this as a base class for convenience if !((_config >> "ACE_nextModeClass") in configProperties [_config, "true", false]) exitWith {}; -private ["_description", "_picture"]; +_unit addWeaponItem [_weapon, _nextPointer]; -_description = getText (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_modeDescription"); -_picture = getText (configFile >> "CfgWeapons" >> _nextPointer >> "picture"); -_error = false; +private _error = false; -switch (_currentWeaponType) do { - case 1: { - _unit removePrimaryWeaponItem _pointer; - _unit addPrimaryWeaponItem _nextPointer; - if (((primaryWeaponItems _unit) select 1) != _nextPointer) then { - ERROR("NextPointer not compatible"); - _unit addPrimaryWeaponItem _pointer; - _error = true; - }; - }; - case 2: { - _unit removeSecondaryWeaponItem _pointer; - _unit addSecondaryWeaponItem _nextPointer; - if (((secondaryWeaponItems _unit) select 1) != _nextPointer) then { - ERROR("NextPointer not compatible"); - _unit addSecondaryWeaponItem _pointer; - _error = true; - }; - }; - case 3: { - _unit removeHandgunItem _pointer; - _unit addHandgunItem _nextPointer; - if (((handgunItems _unit) select 1) != _nextPointer) then { - ERROR("NextPointer not compatible"); - _unit addHandgunItem _pointer; - _error = true; - }; - }; +if ((_unit weaponAccessories _weapon) select 1 != _nextPointer) then { + ERROR("NextPointer not compatible"); + _unit addWeaponItem [_weapon, _pointer]; + _error = true; }; if (!_error) then { + private _description = getText (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_modeDescription"); + private _picture = getText (configFile >> "CfgWeapons" >> _nextPointer >> "picture"); + [_description, _picture] call EFUNC(common,displayTextPicture); } else { - ACE_LOGERROR_3("Failed to add %1 to %2 - reverting to %3",_nextPointer,_weapon,_pointer); + ACE_LOGERROR_3("Failed to add %1 to %2 - reverting to %3",_nextPointer,_weapon,_pointer); }; + playSound "ACE_Sound_Click"; diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf index 878f44cf9a..d9122139b7 100644 --- a/addons/logistics_wirecutter/functions/fnc_isFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks if object is a fence. Should work on any fence type, even (typeof == ""). + * Checks if object is a fence. Should work on any fence type, even (typeOf == ""). * Call is fairly expensive because of all of the string checking. * * Arguments: diff --git a/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf b/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf index 34e369199f..fc875c8d2b 100644 --- a/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf +++ b/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf @@ -27,7 +27,7 @@ _unitMagCounts = []; private "_xFullMagazineCount"; _x params ["_xClassname", "_xCount", "_xLoaded", "_xType"]; - _xFullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _xClassname >> "count"); + _xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count"); //for every partial magazine, that is either in inventory or can be moved there if ((_xCount < _xFullMagazineCount) && {_xCount > 0} && {(!_xLoaded) || {_player canAdd _xClassname}}) then { diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf index ab380cb1ed..f0fbcf49c1 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -24,7 +24,7 @@ private ["_structuredOutputText", "_picture", "_fullMags", "_partialMags", "_ful params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; _args params ["_magazineClassname", "_lastAmmoCount"]; -_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); +_fullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "count"); //Don't show anything if player can't interact: if (!([ACE_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith {}; diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf index b11fc3697d..859bbdfdfa 100644 --- a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -24,7 +24,7 @@ private ["_magazineCfg", "_fullMagazineCount", "_isBelt", "_startingAmmoCounts", params ["_target", "_player", "_magazineClassname"]; if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("Bad Mag Classname");}; -_magazineCfg = configfile >> "CfgMagazines" >> _magazineClassname; +_magazineCfg = configFile >> "CfgMagazines" >> _magazineClassname; // Calculate actual ammo to transfer during repack _fullMagazineCount = getNumber (_magazineCfg >> "count"); //Is linked belt magazine: @@ -57,7 +57,7 @@ _startingAmmoCounts = []; }; } forEach (magazinesAmmoFull _player); -if ((count _startingAmmoCounts) < 2) exitwith {ERROR("Not Enough Mags to Repack");}; +if ((count _startingAmmoCounts) < 2) exitWith {ERROR("Not Enough Mags to Repack");}; _simEvents = [_fullMagazineCount, _startingAmmoCounts, _isBelt] call FUNC(simulateRepackEvents); _totalTime = (_simEvents select ((count _simEvents) - 1) select 0); diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 7906de8bb7..7d7f98207f 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { class ACE_MapFlashlight { displayName = CSTRING(Action_Flashlights); icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa); - condition = QUOTE(GVAR(mapIllumination) && visibleMap && (count ([ACE_player] call FUNC(getUnitFlashlights)) > 0)); + condition = QUOTE(GVAR(mapIllumination) && visibleMap && {count ([ACE_player] call FUNC(getUnitFlashlights)) > 0}); statement = "true"; exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; insertChildren = QUOTE(_this call DFUNC(compileFlashlightMenu)); @@ -23,6 +23,7 @@ class CfgVehicles { function = QFUNC(moduleMap); scope = 2; isGlobal = 1; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_Map_ca.paa); class Arguments { class MapIllumination { @@ -82,6 +83,7 @@ class CfgVehicles { function = QFUNC(blueForceTrackingModule); scope = 2; isGlobal = 0; + isSingular = 1; icon = PATHTOF(UI\Icon_Module_BFTracking_ca.paa); class Arguments { class Enabled { diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index a89e3fb8e3..00e9e737cf 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -100,7 +100,7 @@ call FUNC(determineZoom); GVAR(glow) = objNull; ["playerInventoryChanged", { - _flashlights = [ACE_player] call FUNC(getUnitFlashlights); + private _flashlights = [ACE_player] call FUNC(getUnitFlashlights); if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then { GVAR(flashlightInUse) = ""; }; @@ -139,5 +139,9 @@ GVAR(hasWatch) = true; if (isNull (_this select 0)) exitWith { GVAR(hasWatch) = true; }; - GVAR(hasWatch) = "ItemWatch" in (_this select 1 select 17); + GVAR(hasWatch) = false; + { + if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;}; + false + } count (assignedItems ACE_player); }] call EFUNC(common,addEventHandler); diff --git a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf index 71e4e8c818..e9a619b5a4 100644 --- a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf +++ b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" // BEGIN_COUNTER(blueForceTrackingUpdate); -private ["_groupsToDrawMarkers", "_playerSide", "_anyPlayers", "_markerType", "_colour", "_marker"]; +private ["_groupsToDrawMarkers", "_playerSide", "_anyPlayers", "_colour", "_marker"]; // Delete last set of markers (always) { @@ -28,12 +28,10 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then { }; { - _markerType = [_x] call EFUNC(common,getMarkerType); + private _markerType = [_x] call EFUNC(common,getMarkerType); + private _colour = format ["Color%1", side _x]; - - _colour = format ["Color%1", side _x]; - - _marker = createMarkerLocal [format ["ACE_BFT_%1", _forEachIndex], [(getPos leader _x) select 0, (getPos leader _x) select 1]]; + private _marker = createMarkerLocal [format ["ACE_BFT_%1", _forEachIndex], [(getPos leader _x) select 0, (getPos leader _x) select 1]]; _marker setMarkerTypeLocal _markerType; _marker setMarkerColorLocal _colour; _marker setMarkerTextLocal (groupID _x); diff --git a/addons/map/functions/fnc_compileFlashlightMenu.sqf b/addons/map/functions/fnc_compileFlashlightMenu.sqf index 0d081bb57c..bc6746f46e 100644 --- a/addons/map/functions/fnc_compileFlashlightMenu.sqf +++ b/addons/map/functions/fnc_compileFlashlightMenu.sqf @@ -18,48 +18,29 @@ #include "script_component.hpp" -params ["_vehicle", "_player", "_parameters"]; +params ["", "_player"]; + +private["_action", "_actions", "_cfg", "_displayName", "_flashlights", "_icon", "_statement"]; _actions = []; _flashlights = [_player] call FUNC(getUnitFlashlights); //add all carried flashlight menus and on/off submenu actions { - _displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName"); - _icon = getText (configFile >> "CfgWeapons" >> _x >> "picture"); - - _children = { - params ["_vehicle", "_player", "_flashlight"]; - _actions = []; - - _onAction = [ - (_flashlight + "_On"), - "On", - "", - {[_this select 2] call FUNC(switchFlashlight)}, - {GVAR(flashlightInUse) != (_this select 2)}, - {}, - _flashlight - ] call EFUNC(interact_menu,createAction); - - _offAction = [ - (_flashlight + "_Off"), - "Off", - "", - {[""] call FUNC(switchFlashlight)}, - {GVAR(flashlightInUse) == (_this select 2)}, - {}, - _flashlight - ] call EFUNC(interact_menu,createAction); - - _actions pushBack [_onAction, [], _player]; - _actions pushBack [_offAction, [], _player]; - - _actions + _cfg = (configFile >> "CfgWeapons" >> _x); + _displayName = getText (_cfg >> "displayName"); + _icon = getText (_cfg >> "picture"); + + _statement = if (GVAR(flashlightInUse) == _x) then { + _displayName = format [localize LSTRING(turnLightOff), _displayName]; + {[""] call FUNC(switchFlashlight)} + } else { + _displayName = format [localize LSTRING(turnLightOn), _displayName]; + {[_this select 2] call FUNC(switchFlashlight)} }; - _parentAction = [_x, _displayName, _icon, {true}, {true}, _children, _x] call EFUNC(interact_menu,createAction); - _actions pushBack [_parentAction, [], _player]; + _action = [_x, _displayName, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); + _actions pushBack [_action, [], _player]; } forEach _flashlights; -_actions \ No newline at end of file +_actions diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index 01f3882f1f..d023573cd9 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -12,14 +12,13 @@ * Public: No */ #include "script_component.hpp" +params ["_unit"]; -EXPLODE_1_PVT(_this,_unit); - -private ["_isEnclosed","_nearObjects","_light","_ll","_flashlight", "_flareTint", "_lightTint", "_l"]; +private ["_fnc_blendColor", "_lightTint", "_fnc_calcColor", "_l", "_lightLevel", "_vehicle", "_isEnclosed", "_nearObjects", "_light", "_ll", "_flashlight", "_flareTint"]; // Blend two colors _fnc_blendColor = { - EXPLODE_3_PVT(_this,_c1,_c2,_alpha); + params ["_c1", "_c2", "_alpha"]; [(_c1 select 0) * (1 - _alpha) + (_c2 select 0) * _alpha, (_c1 select 1) * (1 - _alpha) + (_c2 select 1) * _alpha, (_c1 select 2) * (1 - _alpha) + (_c2 select 2) * _alpha, @@ -27,16 +26,17 @@ _fnc_blendColor = { }; // Ambient light tint depending on time of day -_lightTint = switch (true) do { - case (sunOrMoon == 1.0) : { [0.5,0.5,0.5,1] }; - case (sunOrMoon > 0.80) : {[[1.0 - overcast,0.2,0,1], [1,1,1,1], (sunOrMoon - 0.8)/0.2] call _fnc_blendColor}; - case (sunOrMoon > 0.50) : {[[0,0,0.1,1], [1.0 - overcast,0.2,0,1], (sunOrMoon - 0.5)/0.3] call _fnc_blendColor}; - case (sunOrMoon <= 0.5) : { [0,0,0.1,1] }; +_lightTint = call { + if (sunOrMoon == 1.0) exitWith { [0.5,0.5,0.5,1] }; + if (sunOrMoon > 0.80) exitWith { [[1.0 - overcast,0.2,0,1], [1,1,1,1], (sunOrMoon - 0.8)/0.2] call _fnc_blendColor }; + if (sunOrMoon > 0.50) exitWith { [[0,0,0.1,1], [1.0 - overcast,0.2,0,1], (sunOrMoon - 0.5)/0.3] call _fnc_blendColor }; + if (sunOrMoon <= 0.5) exitWith { [0,0,0.1,1] }; + [0,0,0,0] }; // Calculates overlay color from tint and light level _fnc_calcColor = { - EXPLODE_2_PVT(_this,_c1,_lightLevel); + params ["_c1", "_lightLevel"]; if (_lightLevel < 0.5) then { _l = _lightLevel / 0.5; @@ -68,7 +68,6 @@ if (_lightLevel > 0.95) exitWith { [false, [0.5,0.5,0.5,0]] }; -private "_vehicle"; _vehicle = vehicle _unit; // Do not obscure the map if the player is on a enclosed vehicle (assume internal illumination) @@ -124,4 +123,4 @@ if (_lightLevel > 0.95) exitWith { }; // Calculate resulting map color -[true, [_lightTint, _lightLevel] call _fnc_calcColor] \ No newline at end of file +[true, [_lightTint, _lightLevel] call _fnc_calcColor] diff --git a/addons/map/functions/fnc_determineZoom.sqf b/addons/map/functions/fnc_determineZoom.sqf index 345fc68583..bdfc9a866b 100644 --- a/addons/map/functions/fnc_determineZoom.sqf +++ b/addons/map/functions/fnc_determineZoom.sqf @@ -13,7 +13,7 @@ #include "script_component.hpp" private ["_grids", "_fourSize", "_sixSize", "_continue", "_size", "_i"]; -_grids = configFile >> "CfgWorlds" >> worldName >> "Grid"; +_grids = (configFile >> "CfgWorlds" >> worldName >> "Grid"); _fourSize = -1; _sixSize = -1; for "_i" from 1 to 10 do { diff --git a/addons/map/functions/fnc_flashlightGlow.sqf b/addons/map/functions/fnc_flashlightGlow.sqf index 5e72a6c183..011489f321 100644 --- a/addons/map/functions/fnc_flashlightGlow.sqf +++ b/addons/map/functions/fnc_flashlightGlow.sqf @@ -16,15 +16,16 @@ #include "script_component.hpp" +private ["_light", "_color", "_class"]; params ["_flashlight"]; _light = GVAR(glow); if (!isNull _light) then {deleteVehicle _light}; if (_flashlight != "") then { - _colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); - if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"}; - _class = format["ACE_FlashlightProxy_%1", _colour]; + _color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); + if !(_color in ["white", "red", "green", "blue", "yellow"]) then {_color = "white"}; + _class = format["ACE_FlashlightProxy_%1", _color]; _light = _class createVehicle [0,0,0]; _light attachTo [ACE_player, [0,0.5,-0.1], "head"]; @@ -32,4 +33,4 @@ if (_flashlight != "") then { _light = objNull; }; -GVAR(glow) = _light; \ No newline at end of file +GVAR(glow) = _light; diff --git a/addons/map/functions/fnc_getUnitFlashlights.sqf b/addons/map/functions/fnc_getUnitFlashlights.sqf index 8fb8066374..41874cc0ca 100644 --- a/addons/map/functions/fnc_getUnitFlashlights.sqf +++ b/addons/map/functions/fnc_getUnitFlashlights.sqf @@ -18,7 +18,7 @@ params ["_unit"]; -_flashlights = []; +private _flashlights = []; { if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then { @@ -26,4 +26,4 @@ _flashlights = []; }; } forEach (items _unit); -_flashlights \ No newline at end of file +_flashlights diff --git a/addons/map/functions/fnc_simulateMapLight.sqf b/addons/map/functions/fnc_simulateMapLight.sqf index ec08f14d4c..84fcc32773 100644 --- a/addons/map/functions/fnc_simulateMapLight.sqf +++ b/addons/map/functions/fnc_simulateMapLight.sqf @@ -16,6 +16,7 @@ #include "script_component.hpp" +private ["_hmd", "_flashlight", "_screenSize", "_realViewPortY", "_realViewPortX", "_fillTex", "_colourAlpha", "_shadeAlpha", "_colourList", "_maxColour"]; params ["_mapCtrl", "_mapScale", "_mapCentre", "_lightLevel"]; _hmd = hmd ACE_player; @@ -50,6 +51,7 @@ if (_flashlight == "") then { //ambient shade fill _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; } else { + private ["_mousePos", "_colour", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"]; //mouse pos _mousePos = GVAR(mousePos); @@ -86,4 +88,4 @@ if (_flashlight == "") then { _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) + _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //right _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) - _offsetYDown], _screenSize * 4, _screenSize, 0, "", 0]; //down _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) + _offsetYUp], _screenSize * 4, _screenSize * 4, 0, "", 0]; //up -}; \ No newline at end of file +}; diff --git a/addons/map/functions/fnc_updateMapEffects.sqf b/addons/map/functions/fnc_updateMapEffects.sqf index 72f5d0cec1..0e36a6fdd6 100644 --- a/addons/map/functions/fnc_updateMapEffects.sqf +++ b/addons/map/functions/fnc_updateMapEffects.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" - +private ["_mapCtrl", "_mapScale", "_mapCentre", "_light"]; _mapCtrl = findDisplay 12 displayCtrl 51; _mapScale = ctrlMapScale _mapCtrl; _mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; @@ -73,4 +73,4 @@ if (GVAR(mapLimitZoom)) then { _mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre]; ctrlMapAnimCommit _mapCtrl; }; -}; \ No newline at end of file +}; diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 8eab673caf..e7b55c56b0 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -256,6 +256,30 @@ Snížit jas Reducir brillo + + Turn On %1 + %1 Aktivieren + Encender %1 + Włącz %1 + Allumer %1 + Zapnout %1 + Accendi %1 + %1 Bekapcsolása + Ativar %1 + Активировать %1 + + + Turn Off %1 + %1 Deaktivieren + Apagar %1 + Wyłącz %1 + Éteindre %1 + Vypnout %1 + Spegni %1 + %1 Kikapcsolása + Desativar %1 + Деактивировать %1 + Set Channel At Start Ust. domyślny kanał diff --git a/addons/map_gestures/CfgVehicles.hpp b/addons/map_gestures/CfgVehicles.hpp index f5c2ae8f38..d4c88883e6 100644 --- a/addons/map_gestures/CfgVehicles.hpp +++ b/addons/map_gestures/CfgVehicles.hpp @@ -6,11 +6,13 @@ class CfgVehicles { displayName = CSTRING(moduleSettings_displayName); function = QFUNC(moduleSettings); isGlobal = 0; + isSingular = 1; author = ECSTRING(common,ACETeam); icon = PATHTOF(ui\icon_module_map_gestures_ca.paa); class Arguments { class enabled { displayName = CSTRING(enabled_DisplayName); + description = CSTRING(enabled_description); typeName = "BOOL"; defaultValue = 1; }; @@ -18,7 +20,7 @@ class CfgVehicles { displayName = CSTRING(maxRange_displayName); description = CSTRING(maxRange_description); typeName = "NUMBER"; - defaultValue = 4; + defaultValue = 7; }; class interval { displayName = CSTRING(interval_displayName); @@ -30,13 +32,13 @@ class CfgVehicles { displayName = CSTRING(defaultLeadColor_displayName); description = CSTRING(defaultLeadColor_description); typeName = "STRING"; - defaultValue = "0,0,0,0"; + defaultValue = "1,0.88,0,0.95"; }; class defaultColor { displayName = CSTRING(defaultColor_displayName); description = CSTRING(defaultColor_description); typeName = "STRING"; - defaultValue = "0,0,0,0"; + defaultValue = "1,0.88,0,0.7"; }; }; }; @@ -53,13 +55,13 @@ class CfgVehicles { displayName = CSTRING(leadColor_displayName); description = CSTRING(leadColor_description); typeName = "STRING"; - defaultValue = "0,0,0,0"; + defaultValue = "1,0.88,0,0.95"; }; class color { displayName = CSTRING(color_displayName); description = CSTRING(color_description); typeName = "STRING"; - defaultValue = "0,0,0,0"; + defaultValue = "1,0.88,0,0.7"; }; }; }; diff --git a/addons/map_gestures/XEH_postInit.sqf b/addons/map_gestures/XEH_postInit.sqf index 777463e86a..233ee23c04 100644 --- a/addons/map_gestures/XEH_postInit.sqf +++ b/addons/map_gestures/XEH_postInit.sqf @@ -1,8 +1,13 @@ #include "script_component.hpp" +if (["STMapGestures"] call EFUNC(common,isModLoaded)) exitWith { + ACE_LOGWARNING("st_map_gestures is installed - exiting [remove st_map_gestures.pbo to allow ace version]"); +}; + if (!hasInterface) exitWith {}; ["SettingsInitialized", { + if (!GVAR(enabled)) exitWith {}; [{ if (isNull (findDisplay 12)) exitWith {}; diff --git a/addons/map_gestures/functions/fnc_isValidColorArray.sqf b/addons/map_gestures/functions/fnc_isValidColorArray.sqf index 809bbaf117..fdf89a46d6 100644 --- a/addons/map_gestures/functions/fnc_isValidColorArray.sqf +++ b/addons/map_gestures/functions/fnc_isValidColorArray.sqf @@ -20,11 +20,11 @@ scopeName "main"; params ["_colorArray"]; if (isNil "_colorArray") exitWith {false}; -if ((typeName _colorArray) != "ARRAY") exitWith {false}; +if (!(_colorArray isEqualType [])) exitWith {false}; if (count _colorArray != 4) exitWith {false}; { - if ((typeName _x) != "SCALAR" || _x < 0 || _x > 1) exitWith {false breakOut "main"}; + if ((!(_x isEqualType 0)) || {_x < 0 || _x > 1}) exitWith {false breakOut "main"}; } count _colorArray; true diff --git a/addons/map_gestures/functions/fnc_moduleSettings.sqf b/addons/map_gestures/functions/fnc_moduleSettings.sqf index 99583074fc..56d3235d03 100644 --- a/addons/map_gestures/functions/fnc_moduleSettings.sqf +++ b/addons/map_gestures/functions/fnc_moduleSettings.sqf @@ -17,8 +17,6 @@ */ #include "script_component.hpp" -private ["_defaultColor", "_defaultLeadColor"]; - params ["_logic", "", "_activated"]; if (!_activated || !isServer) exitWith {}; @@ -27,11 +25,19 @@ if (!_activated || !isServer) exitWith {}; [_logic, QGVAR(maxRange), "maxRange"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(interval), "interval"] call EFUNC(common,readSettingFromModule); -_defaultLeadColor = call compile ("[" + (_logic getVariable ["defaultLeadColor", ""]) + "]"); -if (!([_defaultLeadColor] call FUNC(isValidColorArray))) exitWith {ERROR("defaultLeadColor is not a valid color array.")}; +//For default fallback colors, setting to empty ("") will not force on clients +private _defaultLeadColor = _logic getVariable ["defaultLeadColor", ""]; +if (_defaultLeadColor != "") then { + _defaultLeadColor = call compile ("[" + _defaultLeadColor + "]"); + if (!([_defaultLeadColor] call FUNC(isValidColorArray))) exitWith {ERROR("defaultLeadColor is not a valid color array.")}; + [QGVAR(defaultLeadColor), _defaultLeadColor, true, true] call EFUNC(common,setSetting); +}; -_defaultColor = call compile ("[" + (_logic getVariable ["defaultColor", ""]) + "]"); -if (!([_defaultColor] call FUNC(isValidColorArray))) exitWith {ERROR("defaultColor is not a valid color array.")}; +private _defaultColor = _logic getVariable ["defaultColor", ""]; +if (_defaultColor != "") then { + _defaultColor = call compile ("[" + _defaultColor + "]"); + if (!([_defaultColor] call FUNC(isValidColorArray))) exitWith {ERROR("defaultColor is not a valid color array.")}; + [QGVAR(defaultColor), _defaultColor, true, true] call EFUNC(common,setSetting); +}; -[QGVAR(defaultLeadColor), _defaultLeadColor, false, true] call EFUNC(common,setSetting); -[QGVAR(defaultColor), _defaultColor, false, true] call EFUNC(common,setSetting); +ACE_LOGINFO("Map Gestures Module Initialized."); diff --git a/addons/map_gestures/stringtable.xml b/addons/map_gestures/stringtable.xml index 1555307e90..2b17fd863e 100644 --- a/addons/map_gestures/stringtable.xml +++ b/addons/map_gestures/stringtable.xml @@ -4,156 +4,139 @@ Map Gestures Gestos no mapa + Gesty na mapie Жесты на карте Enabled Ativado + Aktywne Включено Map Gesture Max Range Distância para gestos no mapa + Maks. zasięg gestów Макс. дистанция жестов на карте Max range between players to show the map gesture indicator [default: 7 meters] Distância max. entre os jogadores para mostrar o indicador de gesto no mapa [padrão: 7 metros] + Maksymalny zasięg, w obrębie którego gesty będą widoczne dla graczy [domyślnie: 7 metrów] Макс. дистанция между игроками для отображения жестов на карте [по-умолчанию: 7 метров] - - Lead Default Alpha - Transparência padrão do líder - Лид. прозрачность по-умолчанию - - - Fallback Alpha value for group leaders. - Valor de transparência alternativo para líderes de grupo - Значение прозрачности для лидеров групп. - - - Default Alpha - Transparência padrão - Прозрачность по-умолчанию - - - Fallback Alpha value. - Valor alternativo de transparência - Значение прозрачности по-умолчанию. - Lead Default Color Cor padrão para o líder + Domyślny kolor lidera Лид. цвет по-умолчанию - Fallback Color value for group leaders. + Fallback Color value for group leaders when there is no group setting. [Module: leave blank to not force on clients] Valor de cor alternativa para líderes de grupo + Domyślny kolor dla liderów grup. Значение цвета для лидеров групп. Default Color Cor padrão + Kolor domyślny Цвет по-умолчанию - Fallback Color value. + Fallback Color value when there is no group setting. [Module: leave blank to not force on clients] Valor alternativo de cor + Kolor domyślny Значение цвета. - - Lead Alpha - Transparência do líder - Лид. прозрачность - - - Alpha value for group leaders of groups synced with this module. - Valor de transparência para líderes de grupo sincronizados com este módulo. - Значение прозрачности для лидеров групп, которые [группы] синхронизированы с этим модулем. - - - Alpha - Transparência - Прозрачность - - - Alpha value for group members of groups synced with this module. - Valor de transparência para membros de grupo sincronizados com este módulo. - Значение прозрачности для членов групп, которые [группы] синхронизированы с этим модулем. - Lead Color Cor do líder + Kolor lidera Лид. цвет Color value for group leaders of groups synced with this module. Valor de cor para líderes de grupo sincronizados com este módulo. + Kolor dla liderów grup zsynchronizowanych z tym modułem. Значение цвета для лидеров групп, которые [группы] синхронизированы с этим модулем. Color Cor + Kolor Цвет Color value for group members of groups synced with this module. Valor de cor para membros de grupo sincronizados com este módulo. + Kolor dla członków grup zsynchronizowanych z tym modułem. Значение цвета для членов групп, которые [группы] синхронизированы с этим модулем. Map Gestures - Group Settings Gestos no mapa - Definições de Grupo + Gesty na mapie - ustawienia grup Жесты на карте - настройки групп Update Interval Intervalo de atualizações + Interwał aktualizacji Интервал обновления Time between data updates. Tempo entre atualização de dados + Odstęp pomiędzy aktualizacjami danych Время между обновлениями данных. Group color configurations Configurações de cores de grupo + Konf. koloru grup Конфигурация цвета групп Group color configuration containing arrays of color pairs ([leadColor, color]). Configuração de cores de grupo contendo arrays com pares de cores ([leadColor, color]). + Konfiguracja kolorów grup zawierająca tablice par kolorów ([kolorLidera, kolor]). Конфигурация цвета групп содержит массив цветовых пар ([лид. цвет, цвет]). Hash of Group ID mapped to the Group color configuration index. Hashes de ID de grupos mapeados para o índice de configuração de cor de grupos. + Hasz ID grup zmapowanych w indeksie konfiguracji koloru grup. Хеш ID групп, соответствующих индексам конфигурации цвета групп. GroupID Color configuration mapping Mapeamento de configuração para cores de GroupID + Mapowanie kolorów poprzez GroupID Соответствие ID групп конфигурации цвета групп Enables the Map Gestures. Ativa os gestos no mapa + Aktywuje gesty na mapie. Включает указания на карте. Name Text Color Cor do texto do nome + Kolor nazw Цвет текста имени Color of the name tag text besides the map gestures mark. Cor do texto da etiqueta de nome que fica embaixo da marcação de gestos no mapa. + Kolor nazwy gracza obok markera gestu mapy. Цвет инмени игрока рядом с маркером жестов. Map Gestures Gestos no mapa + Gesty na mapie Жесты на карте diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index e47514f4fa..2105ee4a6a 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -16,7 +16,7 @@ private ["_config", "_marker", "_a", "_scope", "_icon", "_rgba", "_name"]; // init marker types if (isNil QGVAR(MarkersCache)) then { - _config = configfile >> "CfgMarkers"; + _config = configFile >> "CfgMarkers"; GVAR(MarkersCache) = []; for "_a" from 0 to (count _config - 1) do { @@ -32,7 +32,7 @@ if (isNil QGVAR(MarkersCache)) then { // init marker colors if (isNil QGVAR(MarkerColorsCache)) then { - _config = configfile >> "CfgMarkerColors"; + _config = configFile >> "CfgMarkerColors"; GVAR(MarkerColorsCache) = []; for "_a" from 0 to (count _config - 1) do { @@ -42,7 +42,7 @@ if (isNil QGVAR(MarkerColorsCache)) then { _name = getText (_marker >> "name"); _rgba = getArray (_marker >> "color"); { - if (typeName _x != "SCALAR") then { + if (!( _x isEqualType 0)) then { _rgba set [_forEachIndex, call compile _x]; }; } forEach _rgba; diff --git a/addons/markers/functions/fnc_mapDrawEH.sqf b/addons/markers/functions/fnc_mapDrawEH.sqf index babdfbbb44..05ab4f1ed4 100644 --- a/addons/markers/functions/fnc_mapDrawEH.sqf +++ b/addons/markers/functions/fnc_mapDrawEH.sqf @@ -37,7 +37,7 @@ _drawColor = getArray (_colorConfig >> "color"); //Convert possible code into numbers { - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { _drawColor set [_forEachIndex, (call compile _x)]; }; } forEach _drawColor; diff --git a/addons/markers/functions/fnc_onLBSelChangedColor.sqf b/addons/markers/functions/fnc_onLBSelChangedColor.sqf index 0b9c5af209..6f0139e327 100644 --- a/addons/markers/functions/fnc_onLBSelChangedColor.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedColor.sqf @@ -25,6 +25,6 @@ _data = _ctrl lbValue _index; GVAR(curSelMarkerColor) = _index; -_config = (configfile >> "CfgMarkerColors") select _data; +_config = (configFile >> "CfgMarkerColors") select _data; GVAR(currentMarkerColorConfigName) = (configName _config); diff --git a/addons/markers/functions/fnc_onLBSelChangedShape.sqf b/addons/markers/functions/fnc_onLBSelChangedShape.sqf index c8587e6205..f9fc48730f 100644 --- a/addons/markers/functions/fnc_onLBSelChangedShape.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedShape.sqf @@ -25,6 +25,6 @@ _data = _ctrl lbValue _index; GVAR(curSelMarkerShape) = _index; -_config = (configfile >> "CfgMarkers") select _data; +_config = (configFile >> "CfgMarkers") select _data; GVAR(currentMarkerConfigName) = (configName _config); diff --git a/addons/markers/functions/fnc_setMarkerJIP.sqf b/addons/markers/functions/fnc_setMarkerJIP.sqf index 4e6b47b46b..acdda408df 100644 --- a/addons/markers/functions/fnc_setMarkerJIP.sqf +++ b/addons/markers/functions/fnc_setMarkerJIP.sqf @@ -29,14 +29,14 @@ TRACE_3("params",_allMapMarkers,_allMapMarkersProperties,_logic); _data = _allMapMarkersProperties select _index; _data params ["_name", "_color", "_pos", "_dir"]; - _config = (configfile >> "CfgMarkers") >> _name; + _config = (configFile >> "CfgMarkers") >> _name; if (!isClass _config) then { WARNING("CfgMarker not found, changed to milDot"); _config == (configFile >> "CfgMarkers" >> "MilDot"); }; _x setMarkerTypeLocal (configName _config); - _config = (configfile >> "CfgMarkerColors") >> _color; + _config = (configFile >> "CfgMarkerColors") >> _color; if (!isClass _config) then { WARNING("CfgMarkerColors not found, changed to Default"); _config == (configFile >> "CfgMarkerColors" >> "Default"); diff --git a/addons/markers/functions/fnc_setMarkerNetwork.sqf b/addons/markers/functions/fnc_setMarkerNetwork.sqf index c56a1fb93c..61a0a74e3a 100644 --- a/addons/markers/functions/fnc_setMarkerNetwork.sqf +++ b/addons/markers/functions/fnc_setMarkerNetwork.sqf @@ -24,14 +24,14 @@ _data params ["_markerClassname", "_colorClassname", "_markerPos", "_markerDir"] TRACE_2("params",_marker,_data); -_config = (configfile >> "CfgMarkers") >> _markerClassname; +_config = (configFile >> "CfgMarkers") >> _markerClassname; if (!isClass _config) then { WARNING("CfgMarker not found, changed to milDot"); _config == (configFile >> "CfgMarkers" >> "MilDot"); }; _marker setMarkerTypeLocal (configName _config); -_config = (configfile >> "CfgMarkerColors") >> _colorClassname; +_config = (configFile >> "CfgMarkerColors") >> _colorClassname; if (!isClass _config) then { WARNING("CfgMarkerColors not found, changed to Default"); _config == (configFile >> "CfgMarkerColors" >> "Default"); diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index ea9e03974a..91f7c3aaf1 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -254,7 +254,7 @@ class ACE_Medical_Actions { animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; }; class SalineIV_500: SalineIV { - displayName = CSTRING(Actions_Saline4_500); + displayName = CSTRING(Actions_Saline4_500); items[] = {"ACE_salineIV_500"}; }; class SalineIV_250: SalineIV { @@ -670,7 +670,7 @@ class ACE_Medical_Advanced { }; class Treatment { class Bandaging { - class FieldDressing { + class FieldDressing { // How effect is the bandage for treating one wounds type injury effectiveness = 1; // What is the chance and delays (in seconds) of the treated default injury reopening @@ -683,198 +683,296 @@ class ACE_Medical_Advanced { reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class AbrasionMinor: Abrasion {}; + class AbrasionMedium: Abrasion {}; + class AbrasionLarge: Abrasion {}; class Avulsions: Abrasion { effectiveness = 0.3; reopeningChance = 0.5; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; + class AvulsionsMinor: Avulsions {}; + class AvulsionsMedium: Avulsions {}; + class AvulsionsLarge: Avulsions {}; class Contusion: Abrasion { effectiveness = 1; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class ContusionMinor: Contusion {}; + class ContusionMedium: Contusion {}; + class ContusionLarge: Contusion {}; class CrushWound: Abrasion { effectiveness = 0.6; reopeningChance = 0.2; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; + class CrushWoundMinor: CrushWound {}; + class CrushWoundMedium: CrushWound {}; + class CrushWoundLarge: CrushWound {}; class Cut: Abrasion { effectiveness = 0.4; reopeningChance = 0.5; reopeningMinDelay = 220; reopeningMaxDelay = 260; }; + class CutMinor: Cut {}; + class CutMedium: Cut {}; + class CutLarge: Cut {}; + class Laceration: Abrasion { effectiveness = 0.7; reopeningChance = 0.3; reopeningMinDelay = 120; reopeningMaxDelay = 260; }; + class LacerationMinor: Laceration {}; + class LacerationMedium: Laceration {}; + class LacerationLarge: Laceration {}; + class velocityWound: Abrasion { effectiveness = 0.3; reopeningChance = 0.8; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; + class velocityWoundMinor: velocityWound {}; + class velocityWoundMedium: velocityWound {}; + class velocityWoundLarge: velocityWound {}; class punctureWound: Abrasion { effectiveness = 0.5; reopeningChance = 0.8; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; + class punctureWoundMinor: punctureWound {}; + class punctureWoundMedium: punctureWound {}; + class punctureWoundLarge: punctureWound {}; }; class PackingBandage: fieldDressing { - class Abrasion { + class Abrasion { effectiveness = 1; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class AbrasionMinor: Abrasion {}; + class AbrasionMedium: Abrasion {}; + class AbrasionLarge: Abrasion {}; class Avulsions: Abrasion { effectiveness = 1; reopeningChance = 0.3; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; + class AvulsionsMinor: Avulsions {}; + class AvulsionsMedium: Avulsions {}; + class AvulsionsLarge: Avulsions {}; class Contusion: Abrasion { effectiveness = 1; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class ContusionMinor: Contusion {}; + class ContusionMedium: Contusion {}; + class ContusionLarge: Contusion {}; class CrushWound: Abrasion { effectiveness = 0.6; reopeningChance = 0.2; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; + class CrushWoundMinor: CrushWound {}; + class CrushWoundMedium: CrushWound {}; + class CrushWoundLarge: CrushWound {}; class Cut: Abrasion { effectiveness = 0.2; reopeningChance = 0.6; reopeningMinDelay = 30; reopeningMaxDelay = 260; }; + class CutMinor: Cut {}; + class CutMedium: Cut {}; + class CutLarge: Cut {}; class Laceration: Abrasion { effectiveness = 0.3; reopeningChance = 0.3; reopeningMinDelay = 120; reopeningMaxDelay = 260; }; + class LacerationMinor: Laceration {}; + class LacerationMedium: Laceration {}; + class LacerationLarge: Laceration {}; class velocityWound: Abrasion { effectiveness = 1; reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; + class velocityWoundMinor: velocityWound {}; + class velocityWoundMedium: velocityWound {}; + class velocityWoundLarge: velocityWound {}; class punctureWound: Abrasion { effectiveness = 0.3; reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; + class punctureWoundMinor: punctureWound {}; + class punctureWoundMedium: punctureWound {}; + class punctureWoundLarge: punctureWound {}; }; class ElasticBandage: fieldDressing { - class Abrasion { + class Abrasion { effectiveness = 1; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class AbrasionMinor: Abrasion {}; + class AbrasionMedium: Abrasion {}; + class AbrasionLarge: Abrasion {}; class Avulsions: Abrasion { effectiveness = 0.3; reopeningChance = 0.4; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; + class AvulsionsMinor: Avulsions {}; + class AvulsionsMedium: Avulsions {}; + class AvulsionsLarge: Avulsions {}; class Contusion: Abrasion { effectiveness = 1; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class ContusionMinor: Contusion {}; + class ContusionMedium: Contusion {}; + class ContusionLarge: Contusion {}; class CrushWound: Abrasion { effectiveness = 1; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class CrushWoundMinor: CrushWound {}; + class CrushWoundMedium: CrushWound {}; + class CrushWoundLarge: CrushWound {}; class Cut: Abrasion { effectiveness = 1; reopeningChance = 0.2; reopeningMinDelay = 10; reopeningMaxDelay = 400; }; + class CutMinor: Cut {}; + class CutMedium: Cut {}; + class CutLarge: Cut {}; class Laceration: Abrasion { effectiveness = 1; reopeningChance = 0.3; reopeningMinDelay = 120; reopeningMaxDelay = 260; }; + class LacerationMinor: Laceration {}; + class LacerationMedium: Laceration {}; + class LacerationLarge: Laceration {}; class velocityWound: Abrasion { effectiveness = 0.5; reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; + class velocityWoundMinor: velocityWound {}; + class velocityWoundMedium: velocityWound {}; + class velocityWoundLarge: velocityWound {}; class punctureWound: Abrasion { effectiveness = 0.85; reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; + class punctureWoundMinor: punctureWound {}; + class punctureWoundMedium: punctureWound {}; + class punctureWoundLarge: punctureWound {}; }; class QuikClot: fieldDressing { - class Abrasion { + class Abrasion { effectiveness = 0.7; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class AbrasionMinor: Abrasion {}; + class AbrasionMedium: Abrasion {}; + class AbrasionLarge: Abrasion {}; class Avulsions: Abrasion { effectiveness = 0.2; reopeningChance = 0.1; reopeningMinDelay = 300; reopeningMaxDelay = 350; }; + class AvulsionsMinor: Avulsions {}; + class AvulsionsMedium: Avulsions {}; + class AvulsionsLarge: Avulsions {}; class Contusion: Abrasion { effectiveness = 0.7; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class ContusionMinor: Contusion {}; + class ContusionMedium: Contusion {}; + class ContusionLarge: Contusion {}; class CrushWound: Abrasion { effectiveness = 0.7; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class CrushWoundMinor: CrushWound {}; + class CrushWoundMedium: CrushWound {}; + class CrushWoundLarge: CrushWound {}; class Cut: Abrasion { effectiveness = 0.7; reopeningChance = 0.2; reopeningMinDelay = 100; reopeningMaxDelay = 400; }; + class CutMinor: Cut {}; + class CutMedium: Cut {}; + class CutLarge: Cut {}; class Laceration: Abrasion { effectiveness = 0.7; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + class LacerationMinor: Laceration {}; + class LacerationMedium: Laceration {}; + class LacerationLarge: Laceration {}; class velocityWound: Abrasion { effectiveness = 0.7; reopeningChance = 0.1; reopeningMinDelay = 200; reopeningMaxDelay = 300; }; + class velocityWoundMinor: velocityWound {}; + class velocityWoundMedium: velocityWound {}; + class velocityWoundLarge: velocityWound {}; class punctureWound: Abrasion { effectiveness = 0.5; reopeningChance = 0.1; reopeningMinDelay = 200; reopeningMaxDelay = 300; }; + class punctureWoundMinor: punctureWound {}; + class punctureWoundMedium: punctureWound {}; + class punctureWoundLarge: punctureWound {}; }; }; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 3a675e9258..e673b27908 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -17,6 +17,7 @@ class CfgVehicles { function = QUOTE(DFUNC(moduleMedicalSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); @@ -153,6 +154,7 @@ class CfgVehicles { function = QUOTE(FUNC(moduleAdvancedMedicalSettings)); functionPriority = 10; isGlobal = 2; + isSingular = 1; isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); @@ -274,6 +276,7 @@ class CfgVehicles { function = QUOTE(DFUNC(moduleReviveSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); @@ -426,43 +429,42 @@ class CfgVehicles { }; }; - #define ARM_LEG_ARMOR_DEFAULT 3 - #define ARM_LEG_ARMOR_BETTER 5 - #define ARM_LEG_ARMOR_CSAT 4 + #define ARM_LEG_ARMOR_DEFAULT 1 + #define ARM_LEG_ARMOR_BETTER 1 + #define ARM_LEG_ARMOR_CSAT 1 - class Land; - class Man: Land { - class HitPoints; - }; + #define ADD_ACE_HITPOINTS(ARM_ARMOR,LEG_ARMOR) \ + class HitLeftArm { \ + armor = ARM_ARMOR; \ + material = -1; \ + name = "hand_l"; \ + passThrough = 1; \ + radius = 0.08; \ + explosionShielding = 1; \ + visual = "injury_hands"; \ + minimalHit = 0.01; \ + }; \ + class HitRightArm: HitLeftArm { \ + name = "hand_r"; \ + }; \ + class HitLeftLeg { \ + armor = LEG_ARMOR; \ + material = -1; \ + name = "leg_l"; \ + passThrough = 1; \ + radius = 0.1; \ + explosionShielding = 1; \ + visual = "injury_legs"; \ + minimalHit = 0.01; \ + }; \ + class HitRightLeg: HitLeftLeg { \ + name = "leg_r"; \ + }; + class Man; class CAManBase: Man { - class HitPoints: HitPoints { // custom hitpoints. addons might want to adjust these accordingly - class HitLeftArm { - armor = ARM_LEG_ARMOR_DEFAULT; - material = -1; - name = "hand_l"; // @todo hopefully these still include the whole arm + hands - passThrough = 1; - radius = 0.08; - explosionShielding = 1; - visual = "injury_hands"; - minimalHit = 0.01; - }; - class HitRightArm: HitLeftArm { - name = "hand_r"; // @todo hopefully these still include the whole arm + hands - }; - class HitLeftLeg { - armor = ARM_LEG_ARMOR_DEFAULT; - material = -1; - name = "leg_l"; - passThrough = 1; - radius = 0.1; - explosionShielding = 1; - visual = "injury_legs"; - minimalHit = 0.01; - }; - class HitRightLeg: HitLeftLeg { - name = "leg_r"; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_DEFAULT,ARM_LEG_ARMOR_DEFAULT) }; class ACE_SelfActions { @@ -494,7 +496,7 @@ class CfgVehicles { class GVAR(loadPatient) { displayName = CSTRING(LoadPatient); distance = 5; - condition = QUOTE(_target getvariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target == _target); + condition = QUOTE(_target getVariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target == _target); statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionLoadUnit)); showDisabled = 0; priority = 2; @@ -504,7 +506,7 @@ class CfgVehicles { class GVAR(UnLoadPatient) { displayName = CSTRING(UnloadPatient); distance = 5; - condition = QUOTE(_target getvariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target != _target); + condition = QUOTE(_target getVariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target != _target); statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionUnloadUnit)); showDisabled = 0; priority = 2; @@ -522,174 +524,82 @@ class CfgVehicles { class B_Soldier_base_F: SoldierWB {}; class B_Soldier_04_f: B_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_BETTER,ARM_LEG_ARMOR_BETTER) }; }; class B_Soldier_05_f: B_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_BETTER,ARM_LEG_ARMOR_BETTER) }; }; class I_Soldier_base_F: SoldierGB {}; class I_Soldier_03_F: I_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_BETTER,ARM_LEG_ARMOR_BETTER) }; }; class I_Soldier_04_F: I_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_BETTER; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_BETTER,ARM_LEG_ARMOR_BETTER) }; }; class O_Soldier_base_F: SoldierEB { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_CSAT; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_CSAT,ARM_LEG_ARMOR_BETTER) + }; + }; + + class O_Soldier_diver_base_F: O_Soldier_base_F { + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_CSAT,ARM_LEG_ARMOR_BETTER) }; }; class O_Soldier_02_F: O_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_CSAT; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_CSAT,ARM_LEG_ARMOR_BETTER) }; }; class O_officer_F: O_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = ARM_LEG_ARMOR_CSAT; // @todo is that suppossed to be the case? - }; - class HitRightArm: HitRightArm { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitLeftLeg: HitLeftLeg { - armor = ARM_LEG_ARMOR_CSAT; - }; - class HitRightLeg: HitRightLeg { - armor = ARM_LEG_ARMOR_CSAT; - }; + class HitPoints { + ADD_ACE_HITPOINTS(ARM_LEG_ARMOR_CSAT,ARM_LEG_ARMOR_BETTER) }; }; - class O_Protagonist_VR_F: O_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead; - class HitBody; - class HitHands; - class HitLegs; - class HitLeftArm: HitLeftArm { - armor = 2; - }; - class HitRightArm: HitRightArm { - armor = 2; - }; - class HitLeftLeg: HitLeftLeg { - armor = 2; - }; - class HitRightLeg: HitRightLeg { - armor = 2; - }; - }; - }; + //These VR guys already have limb hitpoints that we should be able to use + //Note: the selections are a little weird, eg: class leg_l {name = "leg_l";}; + // class B_Soldier_VR_F: B_Soldier_base_F { { + // class HitPoints { + //Has class hand_l, hand_r, leg_l, leg_r Hitpoints already + // }; + // }; + // class O_Soldier_VR_F: O_Soldier_base_F { { + // class HitPoints { + //Has class hand_l, hand_r, leg_l, leg_r Hitpoints already + // }; + // }; + // class I_Soldier_VR_F: I_Soldier_base_F { { + // class HitPoints { + //Has class hand_l, hand_r, leg_l, leg_r Hitpoints already + // }; + // }; + // class C_Soldier_VR_F: C_man_1 { + // class HitPoints { + //Has class hand_l, hand_r, leg_l, leg_r Hitpoints already + // }; + // }; + // class O_Protagonist_VR_F: O_Soldier_base_F { + // class HitPoints { + //Has class hand_l, hand_r, leg_l, leg_r Hitpoints already + // }; + // }; class MapBoard_altis_F; class ACE_bodyBagObject: MapBoard_altis_F { diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 064f78682f..d833e44740 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -160,7 +160,7 @@ GVAR(lastHeartBeatSound) = ACE_time; if (GVAR(level) == 1) then { _heartRate = 60 + 40 * _pain; }; - if (_heartRate <= 0) exitwith {}; + if (_heartRate <= 0) exitWith {}; _interval = 60 / (_heartRate min 40); if ((ACE_player getVariable ["ACE_isUnconscious", false])) then { @@ -175,11 +175,11 @@ GVAR(lastHeartBeatSound) = ACE_time; // Pain effect, no pain effect in zeus camera if (isNull curatorCamera) then { - _strength = ((_pain - (ACE_player getvariable [QGVAR(painSuppress), 0])) max 0) min 1; + _strength = ((_pain - (ACE_player getVariable [QGVAR(painSuppress), 0])) max 0) min 1; _strength = _strength * (ACE_player getVariable [QGVAR(painCoefficient), GVAR(painCoefficient)]); if (GVAR(painEffectType) == 1) then { GVAR(effectPainCC) ppEffectEnable false; - if (_pain > (ACE_player getvariable [QGVAR(painSuppress), 0]) && {alive ACE_player}) then { + if (_pain > (ACE_player getVariable [QGVAR(painSuppress), 0]) && {alive ACE_player}) then { _strength = _strength * 0.15; GVAR(effectPainCA) ppEffectEnable true; GVAR(effectPainCA) ppEffectAdjust [_strength, _strength, false]; @@ -201,7 +201,7 @@ GVAR(lastHeartBeatSound) = ACE_time; }; } else { GVAR(effectPainCA) ppEffectEnable false; - if (_pain > (ACE_player getvariable [QGVAR(painSuppress), 0]) && {alive ACE_player}) then { + if (_pain > (ACE_player getVariable [QGVAR(painSuppress), 0]) && {alive ACE_player}) then { _strength = _strength * 0.9; GVAR(effectPainCC) ppEffectEnable true; GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - _strength,1 - _strength,0,0,0,0.2,2]]; @@ -246,24 +246,24 @@ GVAR(lastHeartBeatSound) = ACE_time; }; ["SettingsInitialized", { - if (GVAR(level) == 2) exitwith { + if (GVAR(level) == 2) exitWith { [ - {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 65)}, - {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.9}, + {(((_this select 0) getVariable [QGVAR(bloodVolume), 100]) < 65)}, + {(((_this select 0) getVariable [QGVAR(pain), 0]) - ((_this select 0) getVariable [QGVAR(painSuppress), 0])) > 0.9}, {(([_this select 0] call FUNC(getBloodLoss)) > 0.25)}, - {((_this select 0) getvariable [QGVAR(inReviveState), false])}, - {((_this select 0) getvariable [QGVAR(inCardiacArrest), false])}, - {((_this select 0) getvariable ["ACE_isDead", false])}, - {(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)} + {((_this select 0) getVariable [QGVAR(inReviveState), false])}, + {((_this select 0) getVariable [QGVAR(inCardiacArrest), false])}, + {((_this select 0) getVariable ["ACE_isDead", false])}, + {(((_this select 0) getVariable [QGVAR(airwayStatus), 100]) < 80)} ] call FUNC(addUnconsciousCondition); }; [ - {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 40)}, - {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.6}, + {(((_this select 0) getVariable [QGVAR(bloodVolume), 100]) < 40)}, + {(((_this select 0) getVariable [QGVAR(pain), 0]) - ((_this select 0) getVariable [QGVAR(painSuppress), 0])) > 0.6}, {(([_this select 0] call FUNC(getBloodLoss)) > 0.1)}, - {((_this select 0) getvariable [QGVAR(inReviveState), false])}, - {((_this select 0) getvariable ["ACE_isDead", false])} + {((_this select 0) getVariable [QGVAR(inReviveState), false])}, + {((_this select 0) getVariable ["ACE_isDead", false])} ] call FUNC(addUnconsciousCondition); }] call EFUNC(common,addEventHandler); diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 9563752d92..5deaf77ceb 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -12,6 +12,7 @@ PREP(actionPlaceInBodyBag); PREP(actionRemoveTourniquet); PREP(actionLoadUnit); PREP(actionUnloadUnit); +PREP(addDamageToUnit); PREP(addHeartRateAdjustment); PREP(addToInjuredCollection); PREP(addToLog); diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index 16d9573fc9..910a086364 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -17,7 +17,7 @@ class CfgPatches { #include "CfgFactionClasses.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#include "CFgSounds.hpp" +#include "CfgSounds.hpp" #include "ACE_Medical_Treatments.hpp" #include "ACE_Settings.hpp" #include "UI\RscTitles.hpp" diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index 94f3e6ad34..83852f8042 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -17,7 +17,7 @@ private ["_heartRateOutput", "_heartRate", "_logOutPut"]; params ["_caller", "_unit", "_selectionName"]; -_heartRate = _unit getvariable [QGVAR(heartRate), 80]; +_heartRate = _unit getVariable [QGVAR(heartRate), 80]; if (!alive _unit) then { _heartRate = 0; }; diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf index 072b9b1a7e..ff2bd12438 100644 --- a/addons/medical/functions/fnc_actionDiagnose.sqf +++ b/addons/medical/functions/fnc_actionDiagnose.sqf @@ -21,25 +21,25 @@ _genericMessages = [LSTRING(diagnoseMessage)]; _genericMessages pushBack ([_target] call EFUNC(common,getName)); if (alive _target) then { - _genericMessages pushback LSTRING(diagnoseAlive); + _genericMessages pushBack LSTRING(diagnoseAlive); } else { - _genericMessages pushback LSTRING(diagnoseDead); + _genericMessages pushBack LSTRING(diagnoseDead); }; -if (_target getvariable[QGVAR(hasLostBlood), 0] > 0) then { - if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then { - _genericMessages pushback LSTRING(lostBloodALot); +if (_target getVariable[QGVAR(hasLostBlood), 0] > 0) then { + if (_target getVariable[QGVAR(hasLostBlood), 0] > 1) then { + _genericMessages pushBack LSTRING(lostBloodALot); } else { - _genericMessages pushback LSTRING(lostBlood); + _genericMessages pushBack LSTRING(lostBlood); }; } else { - _genericMessages pushback LSTRING(noBloodloss); + _genericMessages pushBack LSTRING(noBloodloss); }; if (alive _target) then { - if (_target getvariable[QGVAR(hasPain), false]) then { - _genericMessages pushback LSTRING(inPain); + if (_target getVariable[QGVAR(hasPain), false]) then { + _genericMessages pushBack LSTRING(inPain); } else { - _genericMessages pushback LSTRING(noPain); + _genericMessages pushBack LSTRING(noPain); }; }; diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 42a94997d8..41970e23d2 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -17,7 +17,7 @@ private "_vehicle"; params ["_caller", "_target"]; -if ([_target] call EFUNC(common,isAwake)) exitwith { +if ([_target] call EFUNC(common,isAwake)) exitWith { ["displayTextStructured", [_caller], [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); }; if ([_target] call FUNC(isBeingCarried)) then { diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index b920f276f0..81412f60c4 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -20,17 +20,17 @@ params ["_caller", "_target", "_selectionName"]; // grab the required data _part = [_selectionName] call FUNC(selectionNameToNumber); -_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +_tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; // Check if there is a tourniquet on this bodypart -if ((_tourniquets select _part) == 0) exitwith { +if ((_tourniquets select _part) == 0) exitWith { _output = LSTRING(noTourniquetOnBodyPart); ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); }; // Removing the tourniquet _tourniquets set[_part, 0]; -_target setvariable [QGVAR(tourniquets), _tourniquets, true]; +_target setVariable [QGVAR(tourniquets), _tourniquets, true]; // Adding the tourniquet item to the caller _caller addItem "ACE_tourniquet"; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index 6bb4f5beed..3d6d1d964c 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -18,7 +18,7 @@ params ["_caller", "_target", ["_drag", false]]; // cannot unload a unit not in a vehicle. -if (vehicle _target == _target) exitwith {}; -if (([_target] call EFUNC(common,isAwake))) exitwith {}; +if (vehicle _target == _target) exitWith {}; +if (([_target] call EFUNC(common,isAwake))) exitWith {}; ["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) diff --git a/addons/medical/functions/fnc_addDamageToUnit.sqf b/addons/medical/functions/fnc_addDamageToUnit.sqf new file mode 100644 index 0000000000..78d81821e4 --- /dev/null +++ b/addons/medical/functions/fnc_addDamageToUnit.sqf @@ -0,0 +1,63 @@ +/* + * Author: PabstMirror + * Manually Apply Damage to a unit (can cause lethal damage) + * NOTE: because of caching, this will not have instant effects (~3 frame delay) + * + * Arguments: + * 0: The Unit + * 1: Damage to Add + * 2: Selection ("head", "body", "hand_l", "hand_r", "leg_l", "leg_r") + * 3: Projectile Type + * + * Return Value: + * HandleDamage's return + * + * Example: + * [player, 0.8, "leg_r", "bullet"] call ace_medical_fnc_addDamageToUnit + * [cursorTarget, 1, "body", "stab"] call ace_medical_fnc_addDamageToUnit + * + * Public: Yes + */ +#define DEBUG_MODE_FULL +#define DEBUG_TESTRESULTS +#include "script_component.hpp" + +params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_selection", "", [""]], ["_typeOfDamage", "", [""]]]; +TRACE_4("params",_unit,_damageToAdd,_selection,_typeOfDamage); + +_selection = toLower _selection; +if ((isNull _unit) || {!local _unit} || {!alive _unit}) exitWith {ACE_LOGERROR_1("addDamageToUnit - badUnit %1", _this); -1}; +if (_damageToAdd < 0) exitWith {ACE_LOGERROR_1("addDamageToUnit - bad damage %1", _this); -1}; +if (!(_selection in GVAR(SELECTIONS))) exitWith {ACE_LOGERROR_1("addDamageToUnit - bad selection %1", _this); -1}; + +//Get the hitpoint and the index +private _hitpoint = [_unit, _selection, true] call ace_medical_fnc_translateSelections; +(getAllHitPointsDamage _unit) params [["_allHitPoints", []]]; +private _hitpointIndex = -1; +{ //case insensitive find + if (_x == _hitpoint) exitWith {_hitpointIndex = _forEachIndex;}; +} forEach _allHitPoints; +if (_hitpointIndex < 0) exitWith {ACE_LOGERROR_1("addDamageToUnit - bad hitpointIndex %1", _this); -1}; + +private _currentDamage = _unit getHitIndex _hitpointIndex; + +#ifdef DEBUG_TESTRESULTS +private _checkAtFrame = diag_frameno + 5; +private _partNumber = [_selection] call FUNC(selectionNameToNumber); +private _startDmg = (_unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _partNumber; +private _debugCode = { + params ["", "_unit", "_startDmg", "_damageToAdd", "_partNumber"]; + private _endDmg = (_unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _partNumber; + if ((!alive _unit) || {_endDmg > _startDmg}) then { + ACE_LOGINFO_6("addDamageToUnit - PASSED - [unit:%1, partNo:%2, addDmg:%3] results:[alive:%4 old:%5 new:%6]", _unit, _partNumber, _damageToAdd, alive _unit, _startDmg, _endDmg); + } else { + ACE_LOGERROR_6("addDamageToUnit - FAILED - [unit:%1, partNo:%2, addDmg:%3] results:[alive:%4 old:%5 new:%6]", _unit, _partNumber, _damageToAdd, alive _unit, _startDmg, _endDmg); + }; +}; +[{diag_frameno > (_this select 0)}, _debugCode, [_checkAtFrame, _unit, _startDmg, _damageToAdd, _partNumber]] call EFUNC(common,waitUntilAndExecute); +#endif + +private _return = [_unit, _selection, (_currentDamage + _damageToAdd), _unit, _typeOfDamage, _hitpointIndex] call FUNC(handleDamage); +TRACE_1("handleDamage called",_return); + +_return diff --git a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf index 9f2e7a8bf9..cc8c093071 100644 --- a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf +++ b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf @@ -19,7 +19,7 @@ params [["_unit", objNull, [objNull]], ["_value", 0, [0]], ["_time", 1, [0]], ["_callBack", {}, [{}]]]; -_adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; -_adjustment pushback [_value, _time, _callBack]; -_unit setvariable [QGVAR(heartRateAdjustments), _adjustment ]; +_adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; +_adjustment pushBack [_value, _time, _callBack]; +_unit setVariable [QGVAR(heartRateAdjustments), _adjustment ]; ["Medical_onHeartRateAdjustmentAdded", [_unit, _value, _time]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_addToInjuredCollection.sqf b/addons/medical/functions/fnc_addToInjuredCollection.sqf index 0ed9b9747f..48e400f7b2 100644 --- a/addons/medical/functions/fnc_addToInjuredCollection.sqf +++ b/addons/medical/functions/fnc_addToInjuredCollection.sqf @@ -17,12 +17,12 @@ params ["_unit", ["_force", false]]; if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { - if !(local _unit) exitwith { + if !(local _unit) exitWith { [[_unit, _force], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; - if ((_unit getvariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitwith{}; - _unit setvariable [QGVAR(addedToUnitLoop), true, true]; + if ((_unit getVariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitWith{}; + _unit setVariable [QGVAR(addedToUnitLoop), true, true]; [{ params ["_args", "_idPFH"]; @@ -34,17 +34,17 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { [_idPFH] call CBA_fnc_removePerFrameHandler; if (!local _unit) then { if (GVAR(level) >= 2) then { - _unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 80], true]; - _unit setvariable [QGVAR(bloodPressure), _unit getvariable [QGVAR(bloodPressure), [80, 120]], true]; + _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true]; + _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; }; - _unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 100], true]; + _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true]; }; } else { [_unit, _interval] call FUNC(handleUnitVitals); private "_pain"; - _pain = _unit getvariable [QGVAR(pain), 0]; - if (_pain > (_unit getvariable [QGVAR(painSuppress), 0])) then { + _pain = _unit getVariable [QGVAR(pain), 0]; + if (_pain > (_unit getVariable [QGVAR(painSuppress), 0])) then { // This introduces wierd unconscious behaviour for basic medical and possibly also advanced. // TODO This is disabled as it's considered non critical code. // We will need to decide if we want unconscious triggered on high pain levels or if we can get rid of this entirely. diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf index 0e341792c9..8d1b337514 100644 --- a/addons/medical/functions/fnc_addToLog.sqf +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -19,7 +19,7 @@ private ["_moment", "_logVarName", "_log","_newLog", "_logs"]; params ["_unit", "_type", "_message", "_arguments"]; -if (!local _unit) exitwith { +if (!local _unit) exitWith { [_this, QFUNC(addToLog), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; @@ -29,24 +29,24 @@ _moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute]; _logVarName = format[QGVAR(logFile_%1), _type]; -_log = _unit getvariable [_logVarName, []]; +_log = _unit getVariable [_logVarName, []]; if (count _log >= 8) then { _newLog = []; { // ensure the first element will not be added - if (_foreachIndex > 0) then { - _newLog pushback _x; + if (_forEachIndex > 0) then { + _newLog pushBack _x; }; - } foreach _log; + } forEach _log; _log = _newLog; }; -_log pushback [_message, _moment, _type, _arguments]; +_log pushBack [_message, _moment, _type, _arguments]; -_unit setvariable [_logVarName, _log, true]; +_unit setVariable [_logVarName, _log, true]; ["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call EFUNC(common,localEvent); -_logs = _unit getvariable [QGVAR(allLogs), []]; +_logs = _unit getVariable [QGVAR(allLogs), []]; if !(_logVarName in _logs) then { - _logs pushback _logVarName; - _unit setvariable [QGVAR(allLogs), _logs, true]; + _logs pushBack _logVarName; + _unit setVariable [QGVAR(allLogs), _logs, true]; }; diff --git a/addons/medical/functions/fnc_addToTriageCard.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf index b1df46f751..bd988fa84c 100644 --- a/addons/medical/functions/fnc_addToTriageCard.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -17,28 +17,28 @@ private ["_log", "_inList", "_amount"]; params ["_unit", "_newItem"]; -if (!local _unit) exitwith { +if (!local _unit) exitWith { [_this, QUOTE(DFUNC(addToTriageCard)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -_log = _unit getvariable [QGVAR(triageCard), []]; +_log = _unit getVariable [QGVAR(triageCard), []]; _inList = false; _amount = 1; { - if ((_x select 0) == _newItem) exitwith { + if ((_x select 0) == _newItem) exitWith { private "_info"; - _info = _log select _foreachIndex; + _info = _log select _forEachIndex; _info set [1,(_info select 1) + 1]; _info set [2, ACE_gameTime]; - _log set [_foreachIndex, _info]; + _log set [_forEachIndex, _info]; _amount = (_info select 1); _inList = true; }; -} foreach _log; +} forEach _log; if (!_inList) then { - _log pushback [_newItem, 1, ACE_gameTime]; + _log pushBack [_newItem, 1, ACE_gameTime]; }; -_unit setvariable [QGVAR(triageCard), _log, true]; +_unit setVariable [QGVAR(triageCard), _log, true]; ["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_addUnconsciousCondition.sqf b/addons/medical/functions/fnc_addUnconsciousCondition.sqf index 6a867088da..195cd557d7 100644 --- a/addons/medical/functions/fnc_addUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_addUnconsciousCondition.sqf @@ -15,9 +15,9 @@ if (isnil QGVAR(unconsciousConditions)) then { GVAR(unconsciousConditions) = []; }; -if (typeName _this == typeName []) then { +if (_this isEqualType []) then { { - if (typeName _x == typeName {}) then { + if (_x isEqualType {}) then { GVAR(unconsciousConditions) pushback _x; }; } foreach _this; diff --git a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf index 2aecfb9a12..e6856335cc 100644 --- a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf +++ b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf @@ -17,14 +17,14 @@ private ["_accessLevel", "_return"]; params ["_caller", "_target"]; -_accessLevel = _target getvariable [QGVAR(allowSharedEquipmentAccess), -1]; +_accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1]; _return = false; if (_accessLevel >= 0) then { - if (_accessLevel == 0) exitwith { _return = true; }; - if (_accessLevel == 1) exitwith { _return = (side _target == side _caller); }; - if (_accessLevel == 2) exitwith { _return = (group _target == group _caller); }; + if (_accessLevel == 0) exitWith { _return = true; }; + if (_accessLevel == 1) exitWith { _return = (side _target == side _caller); }; + if (_accessLevel == 2) exitWith { _return = (group _target == group _caller); }; }; _return; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 60685ee20a..1d9fadf455 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -37,7 +37,7 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then { } else { // Check for required class if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0] + missionNamespace getVariable [(getText (_config >> "requiredMedic")), 0] }; 0; }; @@ -55,9 +55,9 @@ if (getText (_config >> "condition") != "") then { if (isnil _condition) then { _condition = compile _condition; } else { - _condition = missionNamespace getvariable _condition; + _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _selectionName, _className] call _condition; @@ -66,7 +66,7 @@ if (getText (_config >> "condition") != "") then { if (!_return) exitwith { false }; _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { - missionNamespace getvariable [getText(_config >> "patientStateCondition"), 0] + missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] } else { getNumber(_config >> "patientStateCondition") }; @@ -85,8 +85,8 @@ _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isI if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; if !(isnil _x) exitwith { private "_val"; - _val = missionNamespace getvariable _x; - if (typeName _val == "SCALAR") then { + _val = missionNamespace getVariable _x; + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //AdvancedMedicalSettings_anywhere case 1: {call _medVeh}; //AdvancedMedicalSettings_vehicle diff --git a/addons/medical/functions/fnc_copyDeadBody.sqf b/addons/medical/functions/fnc_copyDeadBody.sqf index 9cd43dada6..af601d9f33 100644 --- a/addons/medical/functions/fnc_copyDeadBody.sqf +++ b/addons/medical/functions/fnc_copyDeadBody.sqf @@ -17,15 +17,15 @@ private ["_newUnit", "_class", "_group", "_position", "_side", "_name"]; params ["_oldBody", "_caller"]; -if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies +if (alive _oldBody) exitWith {_oldBody}; // we only want to do this for dead bodies -_name = _oldBody getvariable ["ACE_name", "unknown"]; -_class = typeof _oldBody; +_name = _oldBody getVariable ["ACE_name", "unknown"]; +_class = typeOf _oldBody; _side = side _caller; _group = createGroup _side; _position = getPos _oldBody; -_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"]; +_newUnit = _group createUnit [typeOf _oldBody, _position, [], 0, "NONE"]; _newUnit setVariable ["ACE_name", _name, true]; _newUnit disableAI "TARGET"; @@ -71,12 +71,12 @@ if (isMultiplayer) then { hideObject _oldBody; }; -_newUnit setvariable [QGVAR(copyOfUnit), _oldBody, true]; -_oldBody setvariable [QGVAR(hasCopy), _newUnit, true]; -_newUnit setvariable ["ACE_isDead", true, true]; -_newUnit setvariable ["ACE_isUnconscious", true, true]; -_newUnit setvariable [QGVAR(disableInteraction), true, true]; -_oldBody setvariable [QGVAR(disableInteraction), true, true]; +_newUnit setVariable [QGVAR(copyOfUnit), _oldBody, true]; +_oldBody setVariable [QGVAR(hasCopy), _newUnit, true]; +_newUnit setVariable ["ACE_isDead", true, true]; +_newUnit setVariable ["ACE_isUnconscious", true, true]; +_newUnit setVariable [QGVAR(disableInteraction), true, true]; +_oldBody setVariable [QGVAR(disableInteraction), true, true]; [_newUnit, 0.89] call FUNC(setStructuralDamage); _newUnit; diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index 54fd6694dd..a87c2b6274 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -59,7 +59,7 @@ _createLitter = { _createdLitter = []; { - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {}; _x params ["_selection", "_litterCondition", "_litterOptions"]; @@ -69,18 +69,18 @@ _createdLitter = []; if (isnil _litterCondition) then { _litterCondition = if (_litterCondition != "") then {compile _litterCondition} else {{true}}; } else { - _litterCondition = missionNamespace getvariable _litterCondition; - if (typeName _litterCondition != "CODE") then {_litterCondition = {false}}; + _litterCondition = missionNamespace getVariable _litterCondition; + if (!(_litterCondition isEqualType {})) then {_litterCondition = {false}}; }; if !([_caller, _target, _selectionName, _className, _usersOfItems, _previousDamage] call _litterCondition) exitwith {}; - if (typeName _litterOptions == "ARRAY") then { + if (_litterOptions isEqualType []) then { // Loop through through the litter options and place the litter { - if (typeName _x == "ARRAY" && {(count _x > 0)}) then { + if (_x isEqualType [] && {(count _x > 0)}) then { [_target, _x select (floor(random(count _x)))] call _createLitter; }; - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { [_target, _x] call _createLitter; }; } foreach _litterOptions; diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index 7fc4823202..8be0e00903 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -25,29 +25,29 @@ private ["_damageThreshold", "_damageBodyPart", "_chanceFatal"]; params ["_unit", "_part", ["_withDamage", 0]]; -if (!alive _unit) exitwith {true}; -if (_part < 0 || _part > 5) exitwith {false}; -if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true }; +if (!alive _unit) exitWith {true}; +if (_part < 0 || _part > 5) exitWith {false}; +if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitWith { true }; // Find the correct Damage threshold for unit. _damageThreshold = [1,1,1]; if ([_unit] call EFUNC(common,IsPlayer)) then { - _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(playerDamageThreshold), GVAR(playerDamageThreshold), GVAR(playerDamageThreshold) * 1.7]]; + _damageThreshold =_unit getVariable[QGVAR(unitDamageThreshold), [GVAR(playerDamageThreshold), GVAR(playerDamageThreshold), GVAR(playerDamageThreshold) * 1.7]]; } else { - _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(AIDamageThreshold), GVAR(AIDamageThreshold), GVAR(AIDamageThreshold) * 1.7]]; + _damageThreshold =_unit getVariable[QGVAR(unitDamageThreshold), [GVAR(AIDamageThreshold), GVAR(AIDamageThreshold), GVAR(AIDamageThreshold) * 1.7]]; }; _damageThreshold params ["_thresholdHead", "_thresholdTorso", "_thresholdLimbs"]; -_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; +_damageBodyPart = ((_unit getVariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; // Check if damage to body part is higher as damage head -if (_part == 0) exitwith { +if (_part == 0) exitWith { _chanceFatal = CHANGE_FATAL_HEAD + ((INCREASE_CHANCE_HEAD * (_damageBodyPart - _thresholdHead)) * 10); (_damageBodyPart >= _thresholdHead && {(_chanceFatal >= random(1))}); }; // Check if damage to body part is higher as damage torso -if (_part == 1) exitwith { +if (_part == 1) exitWith { _chanceFatal = CHANGE_FATAL_TORSO + ((INCREASE_CHANCE_TORSO * (_damageBodyPart - _thresholdTorso)) * 10); (_damageBodyPart >= _thresholdTorso && {(_chanceFatal >= random(1))}); }; diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index 222de4463f..279bbf060d 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -46,7 +46,7 @@ if (_show) then { }; disableSerialization; - _display = uiNamespace getvariable QGVAR(DisplayInformation); + _display = uiNamespace getVariable QGVAR(DisplayInformation); if (isnil "_display") exitwith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; @@ -59,26 +59,26 @@ if (_show) then { _genericMessages pushback [localize _partText, [1, 1, 1, 1]]; }; - if (_target getvariable[QGVAR(isBleeding), false]) then { + if (_target getVariable[QGVAR(isBleeding), false]) then { _genericMessages pushback [localize LSTRING(Status_Bleeding), [1, 0.1, 0.1, 1]]; }; - if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then { + if (_target getVariable[QGVAR(hasLostBlood), 0] > 1) then { _genericMessages pushback [localize LSTRING(Status_Lost_Blood), [1, 0.1, 0.1, 1]]; }; - if (((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then { + if (((_target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then { _genericMessages pushback [localize LSTRING(Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]]; }; - if (_target getvariable[QGVAR(hasPain), false]) then { + if (_target getVariable[QGVAR(hasPain), false]) then { _genericMessages pushback [localize LSTRING(Status_Pain), [1, 1, 1, 1]]; }; _totalIvVolume = 0; { private "_value"; - _value = _target getvariable _x; + _value = _target getVariable _x; if !(isnil "_value") then { - _totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]); + _totalIvVolume = _totalIvVolume + (_target getVariable [_x, 0]); }; } foreach GVAR(IVBags); if (_totalIvVolume >= 1) then { @@ -88,7 +88,7 @@ if (_show) then { _damaged = [false, false, false, false, false, false]; _selectionBloodLoss = [0,0,0,0,0,0]; if (GVAR(level) >= 2 && {([_target] call FUNC(hasMedicalEnabled))}) then { - _openWounds = _target getvariable [QGVAR(openWounds), []]; + _openWounds = _target getVariable [QGVAR(openWounds), []]; private "_amountOf"; { _x params ["", "_x1", "_selectionX", "_amountOf", "_x4"]; @@ -110,7 +110,7 @@ if (_show) then { }; } foreach _openWounds; - _bandagedwounds = _target getvariable [QGVAR(bandagedWounds), []]; + _bandagedwounds = _target getVariable [QGVAR(bandagedWounds), []]; { _x params ["", "", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding @@ -133,10 +133,10 @@ if (_show) then { } else { _damaged = [true, true, true, true, true, true]; { - _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; - - if (_target getHitPointDamage _x > 0 && {_forEachIndex == _selectionN}) then { - _pointDamage = _target getHitPointDamage _x; + private _hitPoint = [_target, _x, true] call FUNC(translateSelections); + _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _hitPoint]; + if (_target getHitPointDamage _hitPoint > 0 && {_forEachIndex == _selectionN}) then { + _pointDamage = _target getHitPointDamage _hitPoint; _severity = switch (true) do { case (_pointDamage > 0.5): {localize LSTRING(HeavilyWounded)}; case (_pointDamage > 0.1): {localize LSTRING(LightlyWounded)}; @@ -152,7 +152,7 @@ if (_show) then { ] select _forEachIndex); _allInjuryTexts pushBack [format ["%1 %2", _severity, toLower _part], [1,1,1,1]]; }; - } forEach ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + } forEach GVAR(SELECTIONS); }; // Handle the body image coloring @@ -200,7 +200,7 @@ if (_show) then { lbClear _logCtrl; private ["_logs", "_message", "_moment", "_arguments", "_lbCtrl"]; - _logs = _target getvariable [QGVAR(logFile_Activity), []]; + _logs = _target getVariable [QGVAR(logFile_Activity), []]; { // [_message,_moment,_type, _arguments] _x params ["_message", "_moment", "_type", "_arguments"]; @@ -209,7 +209,7 @@ if (_show) then { }; { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } foreach _arguments; diff --git a/addons/medical/functions/fnc_displayTriageCard.sqf b/addons/medical/functions/fnc_displayTriageCard.sqf index 9849242de1..47af145055 100644 --- a/addons/medical/functions/fnc_displayTriageCard.sqf +++ b/addons/medical/functions/fnc_displayTriageCard.sqf @@ -27,13 +27,13 @@ if (_show) then { private ["_target", "_display", "_alphaLevel", "_alphaLevel", "_lbCtrl"]; params ["_args", "_idPFH"]; _args params ["_target"]; - if (GVAR(TriageCardTarget) != _target) exitwith { + if (GVAR(TriageCardTarget) != _target) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; disableSerialization; - _display = uiNamespace getvariable QGVAR(triageCard); - if (isnil "_display") exitwith { + _display = uiNamespace getVariable QGVAR(triageCard); + if (isNil "_display") exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; @@ -43,7 +43,7 @@ if (_show) then { _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; - _log = _target getvariable [QGVAR(triageCard), []]; + _log = _target getVariable [QGVAR(triageCard), []]; { _x params ["_item", "_amount"]; _message = _item; @@ -54,15 +54,15 @@ if (_show) then { _message = localize _message; }; }; - _triageCardTexts pushback format["%1x - %2", _amount, _message]; - } foreach _log; + _triageCardTexts pushBack format["%1x - %2", _amount, _message]; + } forEach _log; if (count _triageCardTexts == 0) then { _lbCtrl lbAdd (localize LSTRING(TriageCard_NoEntry)); }; { _lbCtrl lbAdd _x; - } foreach _triageCardTexts; + } forEach _triageCardTexts; _triageStatus = [_target] call FUNC(getTriageStatus); diff --git a/addons/medical/functions/fnc_dropDownTriageCard.sqf b/addons/medical/functions/fnc_dropDownTriageCard.sqf index d207c7f9a4..e7a4d3c0a9 100644 --- a/addons/medical/functions/fnc_dropDownTriageCard.sqf +++ b/addons/medical/functions/fnc_dropDownTriageCard.sqf @@ -17,8 +17,8 @@ private ["_ctrl", "_display", "_idc", "_pos"]; params ["_show"]; disableSerialization; -_display = uiNamespace getvariable QGVAR(triageCard); -if (isnil "_display") exitwith {}; +_display = uiNamespace getVariable QGVAR(triageCard); +if (isNil "_display") exitWith {}; _pos = [0,0,0,0]; if (_show) then { diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index a3fdbd5b94..26727d3d8e 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -22,8 +22,8 @@ _totalBloodLoss = 0; // Advanced medical bloodloss handling if (GVAR(level) >= 2) then { - _tourniquets = _unit getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; - _openWounds = _unit getvariable [QGVAR(openWounds), []]; + _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; + _openWounds = _unit getVariable [QGVAR(openWounds), []]; //_cardiacOutput = [_unit] call FUNC(getCardiacOutput); { @@ -33,17 +33,17 @@ if (GVAR(level) >= 2) then { // (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT)); }; - } foreach _openWounds; + } forEach _openWounds; - _internalWounds = _unit getvariable [QGVAR(internalWounds), []]; + _internalWounds = _unit getVariable [QGVAR(internalWounds), []]; { _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); - } foreach _internalWounds; + } forEach _internalWounds; // cap the blood loss to be no greater as the current cardiac output //(_totalBloodLoss min _cardiacOutput); } else { - { _totalBloodLoss = _totalBloodLoss + _x } forEach (_unit getvariable [QGVAR(bodyPartStatus), []]); + { _totalBloodLoss = _totalBloodLoss + _x } forEach (_unit getVariable [QGVAR(bodyPartStatus), []]); _totalBloodLoss = (_totalBloodLoss / 6) * BLOODLOSSRATE_BASIC; }; _totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0); diff --git a/addons/medical/functions/fnc_getBloodPressure.sqf b/addons/medical/functions/fnc_getBloodPressure.sqf index 659949d716..3fdc4f9d52 100644 --- a/addons/medical/functions/fnc_getBloodPressure.sqf +++ b/addons/medical/functions/fnc_getBloodPressure.sqf @@ -25,7 +25,7 @@ private ["_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistan params ["_unit"]; _cardiacOutput = [_unit] call FUNC(getCardiacOutput); -_resistance = _unit getvariable [QGVAR(peripheralResistance), 100]; +_resistance = _unit getVariable [QGVAR(peripheralResistance), 100]; _bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance; _bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance; diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 3524e15cb5..1737bb3b98 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -31,23 +31,23 @@ private ["_bloodVolume", "_bloodVolumeChange", "_ivVolume"]; params ["_unit"]; -_bloodVolume = _unit getvariable [QGVAR(bloodVolume), 100]; +_bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss)); if (_bloodVolume < 100.0) then { { - if ((_unit getvariable [_x, 0]) > 0) then { + if ((_unit getVariable [_x, 0]) > 0) then { _bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND; - _ivVolume = (_unit getvariable [_x, 0]) + IV_CHANGE_PER_SECOND; - _unit setvariable [_x,_ivVolume]; + _ivVolume = (_unit getVariable [_x, 0]) + IV_CHANGE_PER_SECOND; + _unit setVariable [_x,_ivVolume]; }; - } foreach GVAR(IVBags); + } forEach GVAR(IVBags); } else { { - if ((_unit getvariable [_x, 0]) > 0) then { - _unit setvariable [_x, 0]; // lets get rid of exessive IV volume + if ((_unit getVariable [_x, 0]) > 0) then { + _unit setVariable [_x, 0]; // lets get rid of exessive IV volume }; - } foreach GVAR(IVBags); + } forEach GVAR(IVBags); }; _bloodVolumeChange; diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index f24aa438ca..d07319e8b5 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -24,4 +24,4 @@ params ["_unit"]; -((_unit getvariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getvariable [QGVAR(heartRate), 80])/80-1); +((_unit getVariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getVariable [QGVAR(heartRate), 80])/80-1); diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index d46733452a..3ba4b7875f 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -19,11 +19,11 @@ private ["_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjust params ["_unit"]; _hrIncrease = 0; -if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { - _heartRate = _unit getvariable [QGVAR(heartRate), 80]; +if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then { + _heartRate = _unit getVariable [QGVAR(heartRate), 80]; _bloodLoss = [_unit] call FUNC(getBloodLoss); - _adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; + _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; { _x params ["_values", "_time", "_callBack"]; if (abs _values > 0) then { @@ -35,22 +35,22 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { if ( (_time - 1) <= 0) then { _time = 0; - _adjustment set [_foreachIndex, ObjNull]; + _adjustment set [_forEachIndex, ObjNull]; [_unit] call _callBack; } else { _time = _time - 1; - _adjustment set [_foreachIndex, [_values - _change, _time]]; + _adjustment set [_forEachIndex, [_values - _change, _time]]; }; } else { - _adjustment set [_foreachIndex, ObjNull]; + _adjustment set [_forEachIndex, ObjNull]; [_unit] call _callBack; }; - } foreach _adjustment; + } forEach _adjustment; _adjustment = _adjustment - [ObjNull]; - _unit setvariable [QGVAR(heartRateAdjustments), _adjustment]; + _unit setVariable [QGVAR(heartRateAdjustments), _adjustment]; - _bloodVolume = _unit getvariable [QGVAR(bloodVolume), 100]; + _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; if (_bloodVolume > 75) then { if (_bloodLoss >0.0) then { if (_bloodLoss <0.5) then { diff --git a/addons/medical/functions/fnc_getTriageStatus.sqf b/addons/medical/functions/fnc_getTriageStatus.sqf index 4dcef530a3..79af660407 100644 --- a/addons/medical/functions/fnc_getTriageStatus.sqf +++ b/addons/medical/functions/fnc_getTriageStatus.sqf @@ -17,7 +17,7 @@ private ["_unit","_return","_status"]; params ["_unit"]; -_status = _unit getvariable [QGVAR(triageLevel), -1]; +_status = _unit getVariable [QGVAR(triageLevel), -1]; _return = switch (_status) do { case 1: {[localize LSTRING(Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]}; case 2: {[localize LSTRING(Triage_Status_Delayed), 2, [0.7, 0.5, 0, 0.9]]}; diff --git a/addons/medical/functions/fnc_getTypeOfDamage.sqf b/addons/medical/functions/fnc_getTypeOfDamage.sqf index 7a351e0b77..56cb8f75ef 100644 --- a/addons/medical/functions/fnc_getTypeOfDamage.sqf +++ b/addons/medical/functions/fnc_getTypeOfDamage.sqf @@ -17,7 +17,7 @@ params ["_typeOfProjectile"]; if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"}; -if (_typeOfProjectile isKindOf "ShotgunBase") exitwith {"bullet"}; +if (_typeOfProjectile isKindOf "ShotgunBase") exitWith {"bullet"}; if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"}; if (_typeOfProjectile isKindOf "TimeBombCore") exitWith {"explosive"}; if (_typeOfProjectile isKindOf "MineCore") exitWith {"explosive"}; diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index c354dd6ebd..cf8cc86c22 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -22,7 +22,7 @@ if (isnil QGVAR(unconsciousConditions)) then { _return = false; { - if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith { + if ((_x isEqualType {}) && {([_unit] call _x)}) exitwith { _return = true; }; } foreach GVAR(unconsciousConditions); diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf index 4a32adb9e5..277ffabf98 100644 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -36,22 +36,27 @@ if (isClass (_config >> _bandage)) then { _reopeningChance = getNumber (_config >> "reopeningChance"); _reopeningMinDelay = getNumber (_config >> "reopeningMinDelay"); _reopeningMaxDelay = getNumber (_config >> "reopeningMaxDelay") max _reopeningMinDelay; +} else { + ACE_LOGWARNING_2("No config for bandage [%1] config base [%2]", _bandage, _config); }; if (isClass (_config >> _className)) then { _woundTreatmentConfig = (_config >> _className); if (isNumber (_woundTreatmentConfig >> "reopeningChance")) then { _reopeningChance = getNumber (_woundTreatmentConfig >> "reopeningChance"); - }; + }; if (isNumber (_woundTreatmentConfig >> "reopeningMinDelay")) then { _reopeningMinDelay = getNumber (_woundTreatmentConfig >> "reopeningMinDelay"); - }; + }; if (isNumber (_woundTreatmentConfig >> "reopeningMaxDelay")) then { _reopeningMaxDelay = getNumber (_woundTreatmentConfig >> "reopeningMaxDelay") max _reopeningMinDelay; }; +} else { + ACE_LOGWARNING_2("No config for wound type [%1] config base [%2]", _className, _config); }; +TRACE_5("configs",_bandage,_className,_reopeningChance,_reopeningMinDelay,_reopeningMaxDelay); -_bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; +_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; _injuryType = _injury select 1; _exist = false; _bandagedInjury = []; @@ -72,24 +77,26 @@ if !(_exist) then { _bandagedWounds pushback _bandagedInjury; }; -_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; +_target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true]; +TRACE_1("",_reopeningChance); // Check if we are ever going to reopen this if (random(1) <= _reopeningChance) then { _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); + TRACE_1("Will open",_delay); [{ private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; params ["_target", "_impact", "_part", "_injuryIndex", "_injury"]; //if (alive _target) then { - _openWounds = _target getvariable [QGVAR(openWounds), []]; + _openWounds = _target getVariable [QGVAR(openWounds), []]; if ((count _openWounds)-1 < _injuryIndex) exitwith {}; _selectedInjury = _openWounds select _injuryIndex; if (_selectedInjury select 1 == _injury select 1 && (_selectedInjury select 2) == (_injury select 2)) then { // matching the IDs _selectedInjury set [3, (_selectedInjury select 3) + _impact]; _openWounds set [_injuryIndex, _selectedInjury]; - _bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; + _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; _exist = false; _injuryId = _injury select 1; { @@ -102,11 +109,12 @@ if (random(1) <= _reopeningChance) then { } foreach _bandagedWounds; if (_exist) then { - _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; - _target setvariable [QGVAR(openWounds), _openWounds, true]; + TRACE_2("Reopening Wound",_bandagedWounds,_openWounds); + _target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true]; + _target setVariable [QGVAR(openWounds), _openWounds, true]; }; }; // Otherwise something went wrong, we we don't reopen them.. //}; - }, [_target, _impact, _part, _injuryIndex, +_injury], _delay, 0] call EFUNC(common,waitAndExecute); + }, [_target, _impact, _part, _injuryIndex, +_injury], _delay] call EFUNC(common,waitAndExecute); }; diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index 31e65218c2..9db65db732 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -52,12 +52,12 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { { deleteVehicle _x; } forEach _objects; - GVAR(allCreatedLitter) set[_foreachIndex, objNull]; + GVAR(allCreatedLitter) set[_forEachIndex, objNull]; }; } forEach GVAR(allCreatedLitter); GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull]; - if ( (count GVAR(allCreatedLitter)) == 0) exitwith { + if ( (count GVAR(allCreatedLitter)) == 0) exitWith { [(_this select 1)] call CBA_fnc_removePerFrameHandler; GVAR(litterPFHRunning) = false; }; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 6d955e72fd..628c1cb92e 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -8,6 +8,7 @@ * 2: Amount Of Damage * 3: Shooter * 4: Projectile + * 5: HitPointIndex (-1 for structural) * * Return Value: * Damage To Be Inflicted @@ -28,7 +29,7 @@ if !(local _unit) exitWith { private ["_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"]; // bug, assumed fixed, @todo excessive testing, if nothing happens remove -if (typeName _projectile == "OBJECT") then { +if (_projectile isEqualType objNull) then { _projectile = typeOf _projectile; _this set [4, _projectile]; }; @@ -38,6 +39,7 @@ TRACE_3("ACE_DEBUG: HandleDamage",_selection,_damage,_unit); // If damage is in dummy hitpoints, "hands" and "legs", don't change anything if (_selection == "hands") exitWith {_unit getHit "hands"}; if (_selection == "legs") exitWith {_unit getHit "legs"}; +if (_selection == "arms") exitWith {_unit getHit "arms"}; // Deal with the new hitpoint and selection names introduced with Arma v1.50 and later. // This will convert new selection names into selection names that the medical system understands @@ -46,8 +48,8 @@ if (_selection == "legs") exitWith {_unit getHit "legs"}; _selection = [_unit, _selection, _hitPointIndex] call FUNC(translateSelections); _this set [1, _selection]; // ensure that the parameters are set correctly -// If the damage is being weird, we just tell it to fuck off. Ignore: "hands", "legs", "?" -if (_selection != "" && {!(_selection in GVAR(SELECTIONS))}) exitWith {0}; //@todo "neck", "pelvis", "spine1", "spine2", "spine3" +// If the damage is being weird, we just tell it to fuck off. Ignore: "hands", "legs", "arms" +if (_selection != "" && {!(_selection in GVAR(SELECTIONS))}) exitWith {0}; // Exit if we disable damage temporarily if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith { @@ -85,7 +87,7 @@ if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectio if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { _damageReturn = 0.9; }; - if ([_unit] call FUNC(setDead)) then { + if ([_unit, false, true] call FUNC(setDead)) then { _damageReturn = 1; } else { _damageReturn = _damageReturn min 0.89; @@ -109,8 +111,8 @@ if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitW }; if (_damageReturn >= 0.9 && {_selection in ["", "head", "body"]}) exitWith { - if (_unit getvariable ["ACE_isUnconscious", false]) exitwith { - [_unit] call FUNC(setDead); + if (_unit getVariable ["ACE_isUnconscious", false]) exitwith { + [_unit, false, true] call FUNC(setDead); 0.89; }; if (_delayedUnconsicous) then { @@ -131,7 +133,7 @@ if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) > 0) && {_dam if (vehicle _unit != _unit and {damage (vehicle _unit) >= 1}) then { [_unit] call EFUNC(common,unloadPerson); }; - [_unit] call FUNC(setDead); + [_unit, false, true] call FUNC(setDead); 0.89; }; diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index 5035fbe282..33b1d3f7ee 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -23,14 +23,14 @@ private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"]; params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "_newDamage"]; _part = [_selectionName] call FUNC(selectionNameToNumber); -if (_part < 0) exitwith {}; +if (_part < 0) exitWith {}; _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; // Sorting out the damage -_damageBodyParts = _unit getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_damageBodyParts = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; -_unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; +_unit setVariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); @@ -47,7 +47,7 @@ _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); // [_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_internalInjuries); //}; -if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { +if (alive _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { // If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed. if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then { [_unit] call FUNC(setUnconscious); diff --git a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf index bac5a32976..e42e6be725 100644 --- a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf @@ -15,7 +15,7 @@ params ["_unit"]; -if (!local _unit) exitwith {}; +if (!local _unit) exitWith {}; private "_bodyStatus"; diff --git a/addons/medical/functions/fnc_handleDamage_airway.sqf b/addons/medical/functions/fnc_handleDamage_airway.sqf index 8b627faae1..ace7041cb5 100644 --- a/addons/medical/functions/fnc_handleDamage_airway.sqf +++ b/addons/medical/functions/fnc_handleDamage_airway.sqf @@ -21,12 +21,12 @@ private "_bodyPartn"; params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); -if (_bodyPartn > 1) exitwith {}; +if (_bodyPartn > 1) exitWith {}; if (_amountOfDamage > 0.5) then { if (random(1) >= 0.8) then { - if !(_unit getvariable[QGVAR(airwayCollapsed), false]) then { - _unit setvariable [QGVAR(airwayCollapsed), true, true]; + if !(_unit getVariable[QGVAR(airwayCollapsed), false]) then { + _unit setVariable [QGVAR(airwayCollapsed), true, true]; }; }; }; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index 92fc97c717..04dceff84d 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -16,7 +16,7 @@ private ["_damageBodyParts", "_cache_params", "_cache_damages"]; params ["_target"]; TRACE_1("ACE_DEBUG: HandleDamage_BASIC Called",_target); -_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_damageBodyParts = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; _cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []]; _cache_damages = _target getVariable QGVAR(cachedDamages); @@ -24,6 +24,7 @@ TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_c { _x params ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"]; + TRACE_6("_x",_unit,_selectionName,_amountOfDamage,_sourceOfDamage,_typeOfProjectile,_typeOfDamage); if !(isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) then { _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitwith {}; @@ -31,9 +32,9 @@ TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_c private ["_newDamage", "_pain"]; _newDamage = (_cache_damages select _foreachIndex); _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; - _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts]; + _unit setVariable [QGVAR(bodyPartStatus), _damageBodyParts]; - if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { + if (alive _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { // If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed. if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then { [_unit, true, 0.5+random(10)] call FUNC(setUnconscious); @@ -46,8 +47,8 @@ TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_c }foreach _cache_params; // We broadcast the value across the net here, in order to avoid broadcasting it multiple times earlier in the above code block -_target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; -TRACE_2("ACE_DEBUG: HandleDamage BASIC Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus)); +_target setVariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; +TRACE_2("ACE_DEBUG: HandleDamage BASIC Broadcast value here",_unit, _target getVariable QGVAR(bodyPartStatus)); EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); _target setHitPointDamage ["hitHead", _headDamage min 0.95]; @@ -56,5 +57,6 @@ _target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95] _target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; { - _target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95]; -}foreach GVAR(HITPOINTS); + private _hitPointName = [_target, _x, true] call FUNC(translateSelections); + _target setHitPointDamage [_hitPointName, (_damageBodyParts select _foreachIndex) min 0.95]; +}foreach GVAR(SELECTIONS); diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 910221a850..1eae9544ad 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -8,29 +8,25 @@ * 2: Amount Of Damage * 3: Shooter * 4: Projectile - * 5: Current damage to be returned + * 5: HitPointIndex (-1 for structural) * * Return Value: * * * Public: No */ - #include "script_component.hpp" private ["_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"]; -params ["_unit", "_selectionName", "_damage", "_source", "_projectile"]; -TRACE_8("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage, _source, _projectile,GVAR(SELECTIONS),GVAR(HITPOINTS),damage _unit); +params ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitPointIndex"]; + _hitSelections = GVAR(SELECTIONS); -_hitPoints = GVAR(HITPOINTS); -// Calculate change in damage. +// Calculate change in damage - use getHitIndex because selection is translated (hitdiaphragm->body) _newDamage = _damage - (damage _unit); -if (_selectionName in _hitSelections) then { - _newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName))); -}; +if (_hitPointIndex >= 0) then {_newDamage = _damage - (_unit getHitIndex _hitPointIndex)}; -//_damage = _damage + _newDamage; +TRACE_7("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage, _source, _projectile,_hitPointIndex,_newDamage); // Check for vehicle crash if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then { @@ -45,8 +41,14 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN // Handle falling damage _impactVelocity = (velocity _unit) select 2; if (_impactVelocity < -5 && {vehicle _unit == _unit}) then { + TRACE_1("Starting isFalling", time); _unit setVariable [QGVAR(isFalling), true]; _unit setVariable [QGVAR(impactVelocity), _impactVelocity]; +} else { + if ((_unit getVariable [QGVAR(isFalling), false]) && {diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2}) then { + TRACE_1("Ending isFalling", time); + _unit setVariable [QGVAR(isFalling), false]; + }; }; if (_unit getVariable [QGVAR(isFalling), false]) then { if !(_selectionName in ["", "leg_l", "leg_r"]) then { @@ -85,9 +87,9 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t _cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []]; _cache_damages = _unit getVariable QGVAR(cachedDamages); { - _params = _x + [_cache_damages select _foreachIndex]; + _params = _x + [_cache_damages select _forEachIndex]; _params call FUNC(handleDamage_advanced); - } foreach _cache_params; + } forEach _cache_params; [_unit] call FUNC(handleDamage_advancedSetDamage); }; [_idPFH] call CBA_fnc_removePerFrameHandler; @@ -106,7 +108,7 @@ if (_selectionName != "") then { private ["_index","_otherDamage"]; _index = _cache_projectiles find _projectile; // Check if the current projectile has already been handled once - if (_index >= 0 && {_projectile != "falling"}) exitwith { + if (_index >= 0 && {_projectile != "falling"}) exitWith { _cache_damages = _unit getVariable QGVAR(cachedDamages); // Find the previous damage this projectile has done _otherDamage = (_cache_damages select _index); @@ -119,10 +121,10 @@ if (_selectionName != "") then { private ["_hitPoint", "_restore"]; // Restore the damage before the previous damage was processed _hitPoint = _cache_hitpoints select _index; - _restore = ((_unit getHitPointDamage _hitPoint) - _otherDamage) max 0; - _unit setHitPointDamage [_hitPoint, _restore]; + _restore = ((_unit getHitIndex _hitPoint) - _otherDamage) max 0; + _unit setHitIndex [_hitPoint, _restore]; - _cache_hitpoints set [_index, (_hitPoints select (_hitSelections find _selectionName))]; + _cache_hitpoints set [_index, _hitPointIndex]; _cache_damages set [_index, _newDamage]; _cache_params set[_index, _this]; @@ -139,7 +141,7 @@ if (_selectionName != "") then { // This is an unhandled projectile _cache_projectiles pushBack _projectile; - _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); + _cache_hitpoints pushBack _hitPointIndex; _cache_damages pushBack _newDamage; _cache_params pushBack _this; diff --git a/addons/medical/functions/fnc_handleDamage_fractures.sqf b/addons/medical/functions/fnc_handleDamage_fractures.sqf index 46000dbbdf..5292781420 100644 --- a/addons/medical/functions/fnc_handleDamage_fractures.sqf +++ b/addons/medical/functions/fnc_handleDamage_fractures.sqf @@ -59,12 +59,12 @@ if (_amountOfDamage > 0.05) then { }; private ["_fractures", "_fractureID", "_amountOf"]; - _fractures = _unit getvariable[QGVAR(fractures), []]; + _fractures = _unit getVariable[QGVAR(fractures), []]; _fractureID = 1; _amountOf = count _fractures; if (_amountOf > 0) then { _fractureID = (_fractures select (_amountOf - 1) select 0) + 1; }; - _fractures pushback [_fractureID, _fractureType, _bodyPartn, 1 /* percentage treated */]; - _unit setvariable [QGVAR(fractures), _fractures, true]; + _fractures pushBack [_fractureID, _fractureType, _bodyPartn, 1 /* percentage treated */]; + _unit setVariable [QGVAR(fractures), _fractures, true]; }; diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index ae032e6d64..38665a0e40 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -22,8 +22,8 @@ params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamag TRACE_6("ACE_DEBUG: HandleDamage Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); // Administration for open wounds and ids -_openWounds = _unit getvariable[QGVAR(openWounds), []]; -_woundID = _unit getvariable[QGVAR(lastUniqueWoundID), 1]; +_openWounds = _unit getVariable[QGVAR(openWounds), []]; +_woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1]; _extensionOutput = "ace_medical" callExtension format ["HandleDamageWounds,%1,%2,%3,%4", _selectionName, _damage, _typeOfDamage, _woundID]; @@ -37,28 +37,28 @@ _foundIndex = -1; _bodyPartNToAdd = _x select 2; { // Check if we have an id of the given class on the given bodypart already - if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith { - _foundIndex = _foreachIndex; + if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitWith { + _foundIndex = _forEachIndex; }; - } foreach _openWounds; + } forEach _openWounds; if (_foundIndex < 0) then { // Since it is a new injury, we will have to add it to the open wounds array to store it - _openWounds pushback _x; + _openWounds pushBack _x; } else { // We already have one of these, so we are just going to increase the number that we have of it with a new one. _injury = _openWounds select _foundIndex; _injury set [3, (_injury select 3) + 1]; }; -} foreach _woundsCreated; +} forEach _woundsCreated; -_unit setvariable [QGVAR(openWounds), _openWounds, true]; +_unit setVariable [QGVAR(openWounds), _openWounds, true]; // Only update if new wounds have been created if (count _woundsCreated > 0) then { - _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; + _unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true]; }; -_painLevel = _unit getvariable [QGVAR(pain), 0]; -_unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; -TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getvariable QGVAR(pain), _unit getvariable QGVAR(openWounds),_woundsCreated); +_painLevel = _unit getVariable [QGVAR(pain), 0]; +_unit setVariable [QGVAR(pain), _painLevel + _painToAdd]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getVariable QGVAR(pain), _unit getVariable QGVAR(openWounds),_woundsCreated); diff --git a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf index dc21012dd6..4384dce2d7 100644 --- a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf +++ b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf @@ -23,10 +23,10 @@ TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damag // Convert the selectionName to a number and ensure it is a valid selection. _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); -if (_bodyPartn < 0) exitwith {}; +if (_bodyPartn < 0) exitWith {}; // Get the injury type information. Format: [typeDamage thresholds, selectionSpecific, woundTypes] -_injuryTypeInfo = missionNamespace getvariable [format[QGVAR(woundInjuryType_%1), _typeOfDamage],[[], false, []]]; +_injuryTypeInfo = missionNamespace getVariable [format[QGVAR(woundInjuryType_%1), _typeOfDamage],[[], false, []]]; // This are the available injuries for this damage type. Format [[classtype, selections, bloodloss, minimalDamage, pain], ..] _allInjuriesForDamageType = _injuryTypeInfo select 2; @@ -34,7 +34,7 @@ _allInjuriesForDamageType = _injuryTypeInfo select 2; if (count _allInjuriesForDamageType == 0) then { // grabbing the configuration for unknown damage type - _injuryTypeInfo = missionNamespace getvariable [QGVAR(woundInjuryType_unknown),[[], false, []]]; + _injuryTypeInfo = missionNamespace getVariable [QGVAR(woundInjuryType_unknown),[[], false, []]]; _allInjuriesForDamageType = _injuryTypeInfo select 2; }; @@ -59,27 +59,27 @@ _allPossibleInjuries = []; // Find the wound which has the highest minimal damage, so we can use this later on for adding the correct injuries if (_minDamage > _highestPossibleDamage) then { - _highestPossibleSpot = _foreachIndex; + _highestPossibleSpot = _forEachIndex; _highestPossibleDamage = _minDamage; }; // Store the valid possible injury for the damage type, damage amount and selection - _allPossibleInjuries pushback _x; + _allPossibleInjuries pushBack _x; }; }; -} foreach _allInjuriesForDamageType; +} forEach _allInjuriesForDamageType; // No possible wounds available for this damage type or damage amount. -if (_highestPossibleSpot < 0) exitwith {}; +if (_highestPossibleSpot < 0) exitWith {}; // Administration for open wounds and ids -_openWounds = _unit getvariable[QGVAR(openWounds), []]; -_woundID = _unit getvariable[QGVAR(lastUniqueWoundID), 1]; +_openWounds = _unit getVariable[QGVAR(openWounds), []]; +_woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1]; _painToAdd = 0; _woundsCreated = []; { - if (_x select 0 <= _damage) exitwith { + if (_x select 0 <= _damage) exitWith { for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do { // Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage] @@ -92,10 +92,10 @@ _woundsCreated = []; if ((_injuryTypeInfo select 1)) then { { // Check if we have an id of the given class on the given bodypart already - if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith { - _foundIndex = _foreachIndex; + if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitWith { + _foundIndex = _forEachIndex; }; - } foreach _openWounds; + } forEach _openWounds; }; _injury = []; @@ -104,7 +104,7 @@ _woundsCreated = []; _injury = [_woundID, _toAddInjury select 0, _bodyPartNToAdd, 1, _toAddInjury select 2]; // Since it is a new injury, we will have to add it to the open wounds array to store it - _openWounds pushback _injury; + _openWounds pushBack _injury; // New injuries will also increase the wound ID _woundID = _woundID + 1; @@ -114,21 +114,21 @@ _woundsCreated = []; _injury set [3, (_injury select 3) + 1]; }; // Store the injury so we can process it later correctly. - _woundsCreated pushback _injury; + _woundsCreated pushBack _injury; // Collect the pain that is caused by this injury _painToAdd = _painToAdd + (_toAddInjury select 3); }; }; -} foreach (_injuryTypeInfo select 0); // foreach damage thresholds +} forEach (_injuryTypeInfo select 0); // forEach damage thresholds -_unit setvariable [QGVAR(openWounds), _openWounds, true]; +_unit setVariable [QGVAR(openWounds), _openWounds, true]; // Only update if new wounds have been created if (count _woundsCreated > 0) then { - _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; + _unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true]; }; -_painLevel = _unit getvariable [QGVAR(pain), 0]; -_unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; -TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getvariable QGVAR(pain), _unit getvariable QGVAR(openWounds),_woundsCreated); +_painLevel = _unit getVariable [QGVAR(pain), 0]; +_unit setVariable [QGVAR(pain), _painLevel + _painToAdd]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getVariable QGVAR(pain), _unit getVariable QGVAR(openWounds),_woundsCreated); diff --git a/addons/medical/functions/fnc_handleKilled.sqf b/addons/medical/functions/fnc_handleKilled.sqf index d6a4440d76..c8d08cbde2 100644 --- a/addons/medical/functions/fnc_handleKilled.sqf +++ b/addons/medical/functions/fnc_handleKilled.sqf @@ -15,11 +15,11 @@ private "_openWounds"; params ["_unit"]; -if (!local _unit) exitwith {}; +if (!local _unit) exitWith {}; -_unit setvariable [QGVAR(pain), 0]; +_unit setVariable [QGVAR(pain), 0]; if (GVAR(level) >= 2) then { - _unit setvariable [QGVAR(heartRate), 0]; - _unit setvariable [QGVAR(bloodPressure), [0, 0]]; - _unit setvariable [QGVAR(airwayStatus), 0]; + _unit setVariable [QGVAR(heartRate), 0]; + _unit setVariable [QGVAR(bloodPressure), [0, 0]]; + _unit setVariable [QGVAR(airwayStatus), 0]; }; diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index 50a30e90e8..91689f311f 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -17,17 +17,17 @@ params ["_unit", "_local"]; if (_local) then { - if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then { + if (_unit getVariable[QGVAR(addedToUnitLoop),false]) then { [_unit, true] call FUNC(addToInjuredCollection); }; - if ((_unit getvariable ["ACE_isUnconscious",false]) && {count (_unit getvariable [QGVAR(unconsciousArguments), []]) >= 6}) then { + if ((_unit getVariable ["ACE_isUnconscious",false]) && {count (_unit getVariable [QGVAR(unconsciousArguments), []]) >= 6}) then { private "_arguments"; - _arguments = (_unit getvariable [QGVAR(unconsciousArguments), []]); + _arguments = (_unit getVariable [QGVAR(unconsciousArguments), []]); _arguments set [2, ACE_time]; [DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler; - _unit setvariable [QGVAR(unconsciousArguments), nil, true]; + _unit setVariable [QGVAR(unconsciousArguments), nil, true]; }; }; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index fddf5489da..6159351cc9 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -18,58 +18,58 @@ params ["_unit", "_interval"]; TRACE_3("ACE_DEBUG",_unit,_interval,_unit); if (_interval == 0) exitWith {}; -_lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0]; +_lastTimeValuesSynced = _unit getVariable [QGVAR(lastMomentValuesSynced), 0]; _syncValues = (ACE_time - _lastTimeValuesSynced >= (10 + floor(random(10))) && GVAR(keepLocalSettingsSynced)); if (_syncValues) then { - _unit setvariable [QGVAR(lastMomentValuesSynced), ACE_time]; + _unit setVariable [QGVAR(lastMomentValuesSynced), ACE_time]; }; -_bloodVolume = (_unit getvariable [QGVAR(bloodVolume), 100]) + ([_unit] call FUNC(getBloodVolumeChange)); +_bloodVolume = (_unit getVariable [QGVAR(bloodVolume), 100]) + ([_unit] call FUNC(getBloodVolumeChange)); _bloodVolume = _bloodVolume max 0; -_unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; +_unit setVariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; TRACE_3("ACE_DEBUG",_bloodVolume,_syncValues,_unit); // Set variables for synchronizing information across the net if (_bloodVolume < 100) then { if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 45) then { TRACE_4("ACE_DEBUG_ADVANCED",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); - if (_unit getvariable [QGVAR(hasLostBlood), 0] != 2) then { - _unit setvariable [QGVAR(hasLostBlood), 2, true]; + if (_unit getVariable [QGVAR(hasLostBlood), 0] != 2) then { + _unit setVariable [QGVAR(hasLostBlood), 2, true]; }; } else { TRACE_4("ACE_DEBUG", _bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); - if (_unit getvariable [QGVAR(hasLostBlood), 0] != 1) then { - _unit setvariable [QGVAR(hasLostBlood), 1, true]; + if (_unit getVariable [QGVAR(hasLostBlood), 0] != 1) then { + _unit setVariable [QGVAR(hasLostBlood), 1, true]; }; } } else { TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); - if (_unit getvariable [QGVAR(hasLostBlood), 0] != 0) then { - _unit setvariable [QGVAR(hasLostBlood), 0, true]; + if (_unit getVariable [QGVAR(hasLostBlood), 0] != 0) then { + _unit setVariable [QGVAR(hasLostBlood), 0, true]; }; }; TRACE_3("ACE_DEBUG",[_unit] call FUNC(getBloodLoss),_unit getVariable QGVAR(isBleeding),_unit); if (([_unit] call FUNC(getBloodLoss)) > 0) then { - if !(_unit getvariable [QGVAR(isBleeding), false]) then { - _unit setvariable [QGVAR(isBleeding), true, true]; + if !(_unit getVariable [QGVAR(isBleeding), false]) then { + _unit setVariable [QGVAR(isBleeding), true, true]; }; } else { - if (_unit getvariable [QGVAR(isBleeding), false]) then { - _unit setvariable [QGVAR(isBleeding), false, true]; + if (_unit getVariable [QGVAR(isBleeding), false]) then { + _unit setVariable [QGVAR(isBleeding), false, true]; }; }; -_painStatus = _unit getvariable [QGVAR(pain), 0]; +_painStatus = _unit getVariable [QGVAR(pain), 0]; TRACE_4("ACE_DEBUG",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(painSuppress),_unit); -if (_painStatus > (_unit getvariable [QGVAR(painSuppress), 0])) then { - if !(_unit getvariable [QGVAR(hasPain), false]) then { - _unit setvariable [QGVAR(hasPain), true, true]; +if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then { + if !(_unit getVariable [QGVAR(hasPain), false]) then { + _unit setVariable [QGVAR(hasPain), true, true]; }; } else { - if (_unit getvariable [QGVAR(hasPain), false]) then { - _unit setvariable [QGVAR(hasPain), false, true]; + if (_unit getVariable [QGVAR(hasPain), false]) then { + _unit setVariable [QGVAR(hasPain), false, true]; }; }; @@ -98,7 +98,7 @@ if (GVAR(level) == 1) then { // handle advanced medical, with vitals if (GVAR(level) >= 2) then { TRACE_6("ACE_DEBUG_ADVANCED_VITALS",_painStatus,_bloodVolume, _unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); - if (_bloodVolume < 30) exitwith { + if (_bloodVolume < 30) exitWith { [_unit] call FUNC(setDead); }; @@ -111,11 +111,11 @@ if (GVAR(level) >= 2) then { }; // Set the vitals - _heartRate = (_unit getvariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); - _unit setvariable [QGVAR(heartRate), _heartRate max 0, _syncValues]; + _heartRate = (_unit getVariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); + _unit setVariable [QGVAR(heartRate), _heartRate max 0, _syncValues]; _bloodPressure = [_unit] call FUNC(getBloodPressure); - _unit setvariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; + _unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; if (_painStatus > 0 && {_painStatus < 10}) then { _painReduce = if (_painStatus > 5) then {0.002} else {0.001}; @@ -125,15 +125,15 @@ if (GVAR(level) >= 2) then { // TODO Disabled until implemented fully // Handle airway /*if (GVAR(setting_allowAirwayInjuries)) then { - _airwayStatus = _unit getvariable [QGVAR(airwayStatus), 100]; - if (((_unit getvariable [QGVAR(airwayOccluded), false]) || (_unit getvariable [QGVAR(airwayCollapsed), false])) && !((_unit getvariable [QGVAR(airwaySecured), false]))) then { + _airwayStatus = _unit getVariable [QGVAR(airwayStatus), 100]; + if (((_unit getVariable [QGVAR(airwayOccluded), false]) || (_unit getVariable [QGVAR(airwayCollapsed), false])) && !((_unit getVariable [QGVAR(airwaySecured), false]))) then { if (_airwayStatus >= 0.5) then { - _unit setvariable [QGVAR(airwayStatus), _airwayStatus - 0.5 * _interval, _syncValues]; + _unit setVariable [QGVAR(airwayStatus), _airwayStatus - 0.5 * _interval, _syncValues]; }; } else { - if !((_unit getvariable [QGVAR(airwayOccluded), false]) || (_unit getvariable [QGVAR(airwayCollapsed), false])) then { + if !((_unit getVariable [QGVAR(airwayOccluded), false]) || (_unit getVariable [QGVAR(airwayCollapsed), false])) then { if (_airwayStatus < 100) then { - _unit setvariable [QGVAR(airwayStatus), (_airwayStatus + 1.5 * _interval) min 100, _syncValues]; + _unit setVariable [QGVAR(airwayStatus), (_airwayStatus + 1.5 * _interval) min 100, _syncValues]; }; }; }; @@ -149,7 +149,7 @@ if (GVAR(level) >= 2) then { // TODO check for in revive state instead of variable _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; - if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { + if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then { if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { [_unit, true, 10+ random(20)] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already. }; @@ -183,10 +183,10 @@ if (GVAR(level) >= 2) then { TRACE_3("ACE_DEBUG_IVBAGS_SYNC",GVAR(IVBags),_syncValues,_unit); { private "_value"; - _value = _unit getvariable _x; - if !(isnil "_value") then { - _unit setvariable [_x,(_unit getvariable [_x, 0]), true]; + _value = _unit getVariable _x; + if !(isNil "_value") then { + _unit setVariable [_x,(_unit getVariable [_x, 0]), true]; }; - } foreach GVAR(IVBags); + } forEach GVAR(IVBags); }; }; diff --git a/addons/medical/functions/fnc_hasItem.sqf b/addons/medical/functions/fnc_hasItem.sqf index df1a3828f5..3eb2f1e5f0 100644 --- a/addons/medical/functions/fnc_hasItem.sqf +++ b/addons/medical/functions/fnc_hasItem.sqf @@ -18,14 +18,14 @@ private ["_medic", "_patient", "_item", "_return", "_crew"]; params ["_medic", "_patient", "_item"]; -if (isnil QGVAR(setting_allowSharedEquipment)) then { +if (isNil QGVAR(setting_allowSharedEquipment)) then { GVAR(setting_allowSharedEquipment) = true; }; -if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith { +if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { true }; -if ([_medic, _item] call EFUNC(common,hasItem)) exitwith { +if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { true }; @@ -33,10 +33,10 @@ _return = false; if ((vehicle _medic != _medic) && {[vehicle _medic] call FUNC(isMedicalVehicle)}) then { _crew = crew vehicle _medic; { - if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { + if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { _return = true; }; - } foreach _crew; + } forEach _crew; }; _return diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf index dd53cb3337..7937b6a157 100644 --- a/addons/medical/functions/fnc_hasItems.sqf +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -21,10 +21,10 @@ params ["_medic", "_patient", "_items"]; _return = true; { // - if (typeName _x == "ARRAY" && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { + if (_x isEqualType [] && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { _return = false; }; - if (typeName _x == "STRING" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith { + if (_x isEqualType "" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith { _return = false; }; }foreach _items; diff --git a/addons/medical/functions/fnc_hasMedicalEnabled.sqf b/addons/medical/functions/fnc_hasMedicalEnabled.sqf index cbf40078fd..5e2d73f925 100644 --- a/addons/medical/functions/fnc_hasMedicalEnabled.sqf +++ b/addons/medical/functions/fnc_hasMedicalEnabled.sqf @@ -19,9 +19,9 @@ private "_medicalEnabled"; params ["_unit"]; -_medicalEnabled = _unit getvariable QGVAR(enableMedical); -if (isnil "_medicalEnabled") exitwith { - (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1) +_medicalEnabled = _unit getVariable QGVAR(enableMedical); +if (isNil "_medicalEnabled") exitWith { + (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getVariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1) }; _medicalEnabled diff --git a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf index 955665233a..abbe512d74 100644 --- a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf +++ b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf @@ -16,4 +16,4 @@ params ["_target", "_selectionName"]; -(((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0); +(((_target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0); diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index bd97203f33..ad58a0126e 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -22,26 +22,26 @@ _unit setVariable ["ACE_isUnconscious", false, true]; // advanced // tourniquets -_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; +_unit setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; // wounds and injuries -_unit setvariable [QGVAR(openWounds), [], true]; -_unit setvariable [QGVAR(bandagedWounds), [], true]; +_unit setVariable [QGVAR(openWounds), [], true]; +_unit setVariable [QGVAR(bandagedWounds), [], true]; _unit setVariable [QGVAR(internalWounds), [], true]; -_unit setvariable [QGVAR(lastUniqueWoundID), 1, true]; +_unit setVariable [QGVAR(lastUniqueWoundID), 1, true]; // vitals _unit setVariable [QGVAR(heartRate), 80]; -_unit setvariable [QGVAR(heartRateAdjustments), []]; -_unit setvariable [QGVAR(bloodPressure), [80, 120]]; +_unit setVariable [QGVAR(heartRateAdjustments), []]; +_unit setVariable [QGVAR(bloodPressure), [80, 120]]; _unit setVariable [QGVAR(peripheralResistance), 100]; // fractures _unit setVariable [QGVAR(fractures), [], true]; // triage card and logs -_unit setvariable [QGVAR(triageLevel), 0, true]; -_unit setvariable [QGVAR(triageCard), [], true]; +_unit setVariable [QGVAR(triageLevel), 0, true]; +_unit setVariable [QGVAR(triageCard), [], true]; // IVs _unit setVariable [QGVAR(salineIVVolume), 0, true]; @@ -49,36 +49,36 @@ _unit setVariable [QGVAR(plasmaIVVolume), 0, true]; _unit setVariable [QGVAR(bloodIVVolume), 0, true]; // damage storage -_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; +_unit setVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; // airway -_unit setvariable [QGVAR(airwayStatus), 100]; +_unit setVariable [QGVAR(airwayStatus), 100]; _unit setVariable [QGVAR(airwayOccluded), false]; -_unit setvariable [QGVAR(airwayCollapsed), false]; +_unit setVariable [QGVAR(airwayCollapsed), false]; // generic medical admin -_unit setvariable [QGVAR(addedToUnitLoop), false, true]; -_unit setvariable [QGVAR(inCardiacArrest), false, true]; -_unit setvariable [QGVAR(hasLostBlood), 0, true]; -_unit setvariable [QGVAR(isBleeding), false, true]; -_unit setvariable [QGVAR(hasPain), false, true]; -_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; -_unit setvariable [QGVAR(painSuppress), 0, true]; +_unit setVariable [QGVAR(addedToUnitLoop), false, true]; +_unit setVariable [QGVAR(inCardiacArrest), false, true]; +_unit setVariable [QGVAR(hasLostBlood), 0, true]; +_unit setVariable [QGVAR(isBleeding), false, true]; +_unit setVariable [QGVAR(hasPain), false, true]; +_unit setVariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; +_unit setVariable [QGVAR(painSuppress), 0, true]; private ["_allUsedMedication", "_logs"]; // medication _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; { - _unit setvariable [_x select 0, nil]; -} foreach _allUsedMedication; + _unit setVariable [_x select 0, nil]; +} forEach _allUsedMedication; _unit setVariable [QGVAR(allUsedMedication), [], true]; -_logs = _unit getvariable [QGVAR(allLogs), []]; +_logs = _unit getVariable [QGVAR(allLogs), []]; { - _unit setvariable [_x, nil]; -} foreach _logs; -_unit setvariable [QGVAR(allLogs), [], true]; + _unit setVariable [_x, nil]; +} forEach _logs; +_unit setVariable [QGVAR(allLogs), [], true]; // items [{ diff --git a/addons/medical/functions/fnc_isInMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf index 34f1cf4244..330a1e5ea3 100644 --- a/addons/medical/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -39,16 +39,16 @@ _medicalFacility = _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]); { - if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { + if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith { _isInBuilding = true; }; -} foreach _objects; +} forEach _objects; if (!_isInBuilding) then { _objects = position _unit nearObjects 7.5; { - if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { + if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith { _isInBuilding = true; }; - } foreach _objects; + } forEach _objects; }; _isInBuilding; diff --git a/addons/medical/functions/fnc_isInStableCondition.sqf b/addons/medical/functions/fnc_isInStableCondition.sqf index 763185640c..e0298ed054 100644 --- a/addons/medical/functions/fnc_isInStableCondition.sqf +++ b/addons/medical/functions/fnc_isInStableCondition.sqf @@ -16,15 +16,15 @@ private ["_openWounds", "_openWounds"]; params ["_unit"]; -if (GVAR(level) <= 1) exitwith { +if (GVAR(level) <= 1) exitWith { ([_unit] call FUNC(getBloodloss)) == 0; }; _totalBloodLoss = 0; -_openWounds = _unit getvariable [QGVAR(openWounds), []]; +_openWounds = _unit getVariable [QGVAR(openWounds), []]; { // total bleeding ratio * percentage of injury left _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); -} foreach _openWounds; +} forEach _openWounds; (_totalBloodLoss == 0); diff --git a/addons/medical/functions/fnc_modifyMedicalAction.sqf b/addons/medical/functions/fnc_modifyMedicalAction.sqf index d16ab762d5..02e5985297 100644 --- a/addons/medical/functions/fnc_modifyMedicalAction.sqf +++ b/addons/medical/functions/fnc_modifyMedicalAction.sqf @@ -19,9 +19,9 @@ params ["_target", "_player", "_selectionN", "_actionData"]; -if (GVAR(level) < 2 || {!([_target] call FUNC(hasMedicalEnabled))}) exitwith { +if (GVAR(level) < 2 || {!([_target] call FUNC(hasMedicalEnabled))}) exitWith { private ["_pointDamage"]; - _pointDamage = (_target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN; + _pointDamage = (_target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN; if (_pointDamage >= 0.8) exitWith { _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; @@ -32,10 +32,10 @@ if (GVAR(level) < 2 || {!([_target] call FUNC(hasMedicalEnabled))}) exitwith { }; private ["_openWounds", "_amountOf"]; -_openWounds = _target getvariable [QGVAR(openWounds), []]; +_openWounds = _target getVariable [QGVAR(openWounds), []]; { _x params ["", "", "_selectionX", "_amountOf", "_x4"]; - if (_amountOf > 0 && {(_selectionN == _selectionX)} && {_x4 > 0}) exitwith { + if (_amountOf > 0 && {(_selectionN == _selectionX)} && {_x4 > 0}) exitWith { _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; }; -} foreach _openWounds; +} forEach _openWounds; diff --git a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf index 7a219f2559..368b065908 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf @@ -18,13 +18,13 @@ private ["_setting", "_objects"]; params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { - _setting = _logic getvariable ["class",0]; + _setting = _logic getVariable ["class",0]; _objects = synchronizedObjects _logic; { if (local _x) then { - _x setvariable[QGVAR(isMedicalFacility), true, true]; + _x setVariable[QGVAR(isMedicalFacility), true, true]; }; - } foreach _objects; + } forEach _objects; }; true; diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf index 6bef38fa27..8eb55b3d1b 100644 --- a/addons/medical/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -22,27 +22,27 @@ private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; _foundEntry = false; -_allUsedMedication = _target getvariable [QGVAR(allUsedMedication), []]; +_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; { _x params ["_variableX", "_allMedsFromClassname"]; - if (_variableX== _variable) exitwith { + if (_variableX== _variable) exitWith { if !(_className in _allMedsFromClassname) then { - _allMedsFromClassname pushback _className; + _allMedsFromClassname pushBack _className; _x set [1, _allMedsFromClassname]; - _allUsedMedication set [_foreachIndex, _x]; - _target setvariable [QGVAR(allUsedMedication), _allUsedMedication]; + _allUsedMedication set [_forEachIndex, _x]; + _target setVariable [QGVAR(allUsedMedication), _allUsedMedication]; }; _foundEntry = true; }; -} foreach _allUsedMedication; +} forEach _allUsedMedication; if (!_foundEntry) then { - _allUsedMedication pushback [_variable, [_className]]; - _target setvariable [QGVAR(allUsedMedication), _allUsedMedication]; + _allUsedMedication pushBack [_variable, [_className]]; + _target setVariable [QGVAR(allUsedMedication), _allUsedMedication]; }; -_usedMeds = _target getvariable [_variable, 0]; +_usedMeds = _target getVariable [_variable, 0]; if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVAR(enableOverdosing)) then { [_target] call FUNC(setDead); }; @@ -55,8 +55,8 @@ _hasOverDosed = 0; if ({_x == _med} count _classNamesUsed > _limit) then { _hasOverDosed = _hasOverDosed + 1; }; - } foreach _allUsedMedication; -} foreach _incompatabileMeds; + } forEach _allUsedMedication; +} forEach _incompatabileMeds; if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); @@ -68,7 +68,7 @@ if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { if (isNil _onOverDose) then { _onOverDose = compile _onOverDose; } else { - _onOverDose = missionNamespace getvariable _onOverDose; + _onOverDose = missionNamespace getVariable _onOverDose; }; [_target, _className] call _onOverDose; }; @@ -80,15 +80,15 @@ _viscosityAdjustment = _viscosityChange / _timeInSystem; params ["_args", "_idPFH"]; _args params ["_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_viscosityAdjustment", "_painReduce"]; private "_usedMeds"; - _usedMeds = _target getvariable [_variable, 0]; + _usedMeds = _target getVariable [_variable, 0]; _usedMeds = _usedMeds - _decreaseAmount; - _target setvariable [_variable, _usedMeds]; + _target setVariable [_variable, _usedMeds]; _amountDecreased = _amountDecreased + _decreaseAmount; // Restoring the viscosity while the medication is leaving the system - _target setvariable [QGVAR(peripheralResistance), ((_target getvariable [QGVAR(peripheralResistance), 100]) - _viscosityAdjustment) max 0]; - _target setvariable [QGVAR(painSuppress), ((_target getvariable [QGVAR(painSuppress), 0]) - _painReduce) max 0]; + _target setVariable [QGVAR(peripheralResistance), ((_target getVariable [QGVAR(peripheralResistance), 100]) - _viscosityAdjustment) max 0]; + _target setVariable [QGVAR(painSuppress), ((_target getVariable [QGVAR(painSuppress), 0]) - _painReduce) max 0]; if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _target) then { [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/medical/functions/fnc_onPropagateWound.sqf b/addons/medical/functions/fnc_onPropagateWound.sqf index f8b361ad17..84fc33dec2 100644 --- a/addons/medical/functions/fnc_onPropagateWound.sqf +++ b/addons/medical/functions/fnc_onPropagateWound.sqf @@ -18,19 +18,19 @@ private ["_unit", "_injury", "_openWounds", "_injuryID", "_exists"]; params ["_unit", "_injury"]; if (!local _unit) then { - _openWounds = _unit getvariable[QGVAR(openWounds), []]; + _openWounds = _unit getVariable[QGVAR(openWounds), []]; _injuryID = _injury select 0; _exists = false; { - if (_x select 0 == _injuryID) exitwith { + if (_x select 0 == _injuryID) exitWith { _exists = true; - _openWounds set [_foreachIndex, _injury]; + _openWounds set [_forEachIndex, _injury]; }; - } foreach _openWounds; + } forEach _openWounds; if (!_exists) then { - _openWounds pushback _injury; + _openWounds pushBack _injury; }; - _unit setvariable [QGVAR(openWounds), _openWounds]; + _unit setVariable [QGVAR(openWounds), _openWounds]; }; diff --git a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf index 091bea7ef8..dff59fb2cf 100644 --- a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf +++ b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf @@ -17,8 +17,8 @@ private ["_unit", "_openWounds", "_originOfrequest"]; params ["_unit", "_originOfrequest"]; if (local _unit && !(local _originOfrequest)) then { - _openWounds = _unit getvariable [QGVAR(openWounds), []]; + _openWounds = _unit getVariable [QGVAR(openWounds), []]; { ["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent); - } foreach _openWounds; + } forEach _openWounds; }; diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf index 764d0bf591..42dd98dc1f 100644 --- a/addons/medical/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -25,14 +25,14 @@ GVAR(minLethalDamages) = []; for "_i" from 0 to (count _configDamageTypes -1) /* step +1 */ do { // Only get the subclasses in damageType class if (isClass(_configDamageTypes select _i)) then { - _allFoundDamageTypes pushback (configName (_configDamageTypes select _i)); + _allFoundDamageTypes pushBack (configName (_configDamageTypes select _i)); _minLethalDamage = if (isNumber((_configDamageTypes select _i) >> "lethalDamage")) then { getNumber((_configDamageTypes select _i) >> "lethalDamage"); } else { _defaultMinLethalDamage }; - GVAR(minLethalDamages) pushback _minLethalDamage; + GVAR(minLethalDamages) pushBack _minLethalDamage; }; }; GVAR(allAvailableDamageTypes) = _allFoundDamageTypes; @@ -43,7 +43,7 @@ GVAR(fractureClassNames) = []; // function for parsing a sublcass of an injury _parseForSubClassWounds = { _subClass = _this select 0; - if (isClass (_entry >> _subClass)) exitwith { + if (isClass (_entry >> _subClass)) exitWith { _subClassConfig = (_entry >> _subClass); _subClasstype = _classType + (configName _subClassConfig); _subClassselections = if (isArray(_subClassConfig >> "selections")) then { getArray(_subClassConfig >> "selections");} else { _selections }; @@ -54,8 +54,8 @@ _parseForSubClassWounds = { _subClasscauses = if (isArray(_subClassConfig >> "causes")) then { getArray(_subClassConfig >> "causes");} else { _causes }; _subClassDisplayName = if (isText(_subClassConfig >> "name")) then { getText(_subClassConfig >> "name");} else {_classDisplayName + " " + _subClass}; if (count _selections > 0 && {count _causes > 0}) then { - GVAR(woundClassNames) pushback _subClasstype; - _allWoundClasses pushback [_classID, _subClassselections, _subClassbloodLoss, _subClasspain, [_subClassminDamage, _subClassmaxDamage], _subClasscauses, _subClassDisplayName]; + GVAR(woundClassNames) pushBack _subClasstype; + _allWoundClasses pushBack [_classID, _subClassselections, _subClassbloodLoss, _subClasspain, [_subClassminDamage, _subClassmaxDamage], _subClasscauses, _subClassDisplayName]; _classID = _classID + 1; }; true; @@ -82,12 +82,12 @@ if (isClass _woundsConfig) then { _classDisplayName = if (isText(_entry >> "name")) then { getText(_entry >> "name");} else {_classType}; // TODO instead of hardcoding minor, medium and large just go through all sub classes recursively until none are found - if (["Minor"] call _parseForSubClassWounds || ["Medium"] call _parseForSubClassWounds || ["Large"] call _parseForSubClassWounds) exitwith {}; // continue to the next one + if (["Minor"] call _parseForSubClassWounds || ["Medium"] call _parseForSubClassWounds || ["Large"] call _parseForSubClassWounds) exitWith {}; // continue to the next one // There were no subclasses, so we will add this one instead. if (count _selections > 0 && count _causes > 0) then { - GVAR(woundClassNames) pushback _classType; - _allWoundClasses pushback [_classID, _selections, _bloodLoss, _pain, [_minDamage, _maxDamage], _causes, _classDisplayName]; + GVAR(woundClassNames) pushBack _classType; + _allWoundClasses pushBack [_classID, _selections, _bloodLoss, _pain, [_minDamage, _maxDamage], _causes, _classDisplayName]; _classID = _classID + 1; }; true; @@ -107,16 +107,16 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); { // Check if this type is in the causes of a wound class, if so, we will store the wound types for this damage type if (_type in (_x select 5)) then { - _woundTypes pushback _x; + _woundTypes pushBack _x; }; - } foreach _allWoundClasses; + } forEach _allWoundClasses; _typeThresholds = _thresholds; _selectionSpecificType = _selectionSpecific; if (isClass(_damageTypesConfig >> _x)) then { if (isArray(_damageTypesConfig >> _x >> "thresholds")) then { _typeThresholds = getArray(_damageTypesConfig >> _x >> "thresholds");}; if (isNumber(_damageTypesConfig >> _x >> "selectionSpecific")) then { _selectionSpecificType = getNumber(_damageTypesConfig >> _x >> "selectionSpecific");}; }; - missionNamespace setvariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]]; + missionNamespace setVariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]]; private ["_minDamageThresholds", "_amountThresholds"]; // extension loading @@ -129,11 +129,11 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); _minDamageThresholds = _minDamageThresholds + ":"; _amountThresholds = _amountThresholds + ":"; }; - } foreach _typeThresholds; + } forEach _typeThresholds; - "ace_medical" callExtension format ["addDamageType,%1,%2,%3,%4,%5", _type, GVAR(minLethalDamages) select _foreachIndex, _minDamageThresholds, _amountThresholds, _selectionSpecificType]; + "ace_medical" callExtension format ["addDamageType,%1,%2,%3,%4,%5", _type, GVAR(minLethalDamages) select _forEachIndex, _minDamageThresholds, _amountThresholds, _selectionSpecificType]; -} foreach _allFoundDamageTypes; +} forEach _allFoundDamageTypes; // Extension loading @@ -151,7 +151,7 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); if (_forEachIndex < (count _selections) - 1) then { _allowedSelections = _allowedSelections + ":"; }; - } foreach _selections; + } forEach _selections; _causes = ""; @@ -160,11 +160,11 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); if (_forEachIndex < (count _causesArray) - 1) then { _causes = _causes + ":"; }; - } foreach _causesArray; + } forEach _causesArray; _classDisplayName = _x select 6; "ace_medical" callExtension format["addInjuryType,%1,%2,%3,%4,%5,%6,%7,%8,%9", _classID, _className, _allowedSelections, _bloodLoss, _pain, _minDamage, _maxDamage, _causes, _classDisplayName]; -} foreach _allWoundClasses; +} forEach _allWoundClasses; "ace_medical" callExtension "ConfigComplete"; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index 4792f879ec..bcb590143d 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -18,14 +18,14 @@ private ["_unit","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound", "_pain"]; params ["_unit", "_pain"]; -if (!local _unit || !GVAR(enableScreams)) exitwith{}; +if (!local _unit || !GVAR(enableScreams)) exitWith{}; // Lock if the unit is already playing a sound. -if ((_unit getvariable [QGVAR(playingInjuredSound),false])) exitwith {}; -_unit setvariable [QGVAR(playingInjuredSound),true]; +if ((_unit getVariable [QGVAR(playingInjuredSound),false])) exitWith {}; +_unit setVariable [QGVAR(playingInjuredSound),true]; // Play the sound if there is any damage present. -if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitwith { +if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { // Classnames of the available sounds. _availableSounds_A = [ "WoundedGuyA_01", @@ -75,9 +75,9 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitwith { // Clean up the lock [{ - (_this select 0) setvariable [QGVAR(playingInjuredSound),nil]; + (_this select 0) setVariable [QGVAR(playingInjuredSound),nil]; }, [_unit], _delay, _delay] call EFUNC(common,waitAndExecute); }; // Clean up in case there has not been played any sounds. -_unit setvariable [QGVAR(playingInjuredSound),nil]; +_unit setVariable [QGVAR(playingInjuredSound),nil]; diff --git a/addons/medical/functions/fnc_requestWoundSync.sqf b/addons/medical/functions/fnc_requestWoundSync.sqf index 31cf726214..1d7d6de53f 100644 --- a/addons/medical/functions/fnc_requestWoundSync.sqf +++ b/addons/medical/functions/fnc_requestWoundSync.sqf @@ -16,7 +16,7 @@ params [ "_target", "_caller"]; -if (local _target || GVAR(level) < 2) exitwith {}; // if the target is local, we already got the most update to date information -if (_target getvariable [QGVAR(isWoundSynced), false]) exitwith {}; -_target setvariable [QGVAR(isWoundSynced), true]; +if (local _target || GVAR(level) < 2) exitWith {}; // if the target is local, we already got the most update to date information +if (_target getVariable [QGVAR(isWoundSynced), false]) exitWith {}; +_target setVariable [QGVAR(isWoundSynced), true]; ["medical_woundUpdateRequest", [_target], [_target, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 017befcaad..7b2c195f10 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -17,9 +17,9 @@ private "_timeInCardiacArrest"; params ["_unit"]; -if (_unit getvariable [QGVAR(inCardiacArrest),false]) exitwith {}; -_unit setvariable [QGVAR(inCardiacArrest), true,true]; -_unit setvariable [QGVAR(heartRate), 0]; +if (_unit getVariable [QGVAR(inCardiacArrest),false]) exitWith {}; +_unit setVariable [QGVAR(inCardiacArrest), true,true]; +_unit setVariable [QGVAR(heartRate), 0]; ["Medical_onEnteredCardiacArrest", [_unit]] call EFUNC(common,localEvent); @@ -31,14 +31,14 @@ _timeInCardiacArrest = 120 + round(random(600)); params ["_args", "_idPFH"]; _args params ["_unit", "_startTime", "_timeInCardiacArrest"]; - _heartRate = _unit getvariable [QGVAR(heartRate), 80]; - if (_heartRate > 0 || !alive _unit) exitwith { + _heartRate = _unit getVariable [QGVAR(heartRate), 80]; + if (_heartRate > 0 || !alive _unit) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; - _unit setvariable [QGVAR(inCardiacArrest), nil,true]; + _unit setVariable [QGVAR(inCardiacArrest), nil,true]; }; - if (ACE_time - _startTime >= _timeInCardiacArrest) exitwith { + if (ACE_time - _startTime >= _timeInCardiacArrest) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; - _unit setvariable [QGVAR(inCardiacArrest), nil,true]; + _unit setVariable [QGVAR(inCardiacArrest), nil,true]; [_unit] call FUNC(setDead); }; }, 1, [_unit, ACE_time, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index c8c81a699e..030945daaf 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -4,19 +4,21 @@ * * Arguments: * 0: The unit that will be killed + * 1: Force Dead (ignore revive setting) + * 1: Delay setDamage for a frame * * ReturnValue: - * None + * Did he died? * * Public: yes */ #include "script_component.hpp" -private ["_unit", "_force", "_reviveVal", "_lifesLeft"]; -params ["_unit", ["_force", false]]; +private ["_reviveVal", "_lifesLeft"]; +params ["_unit", ["_force", false], ["_delaySetDamage", false]]; -if (!alive _unit) exitwith{true}; +if ((!alive _unit) || {_unit getVariable ["ACE_isDead", false]}) exitWith {true}; if (!local _unit) exitwith { [[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ false; @@ -24,9 +26,9 @@ if (!local _unit) exitwith { _reviveVal = _unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]; if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == 2)) && !_force) exitwith { - if (_unit getvariable [QGVAR(inReviveState), false]) exitwith { + if (_unit getVariable [QGVAR(inReviveState), false]) exitwith { if (GVAR(amountOfReviveLives) > 0) then { - _lifesLeft = _unit getvariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; + _lifesLeft = _unit getVariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; if (_lifesLeft == 0) then { [_unit, true] call FUNC(setDead); }; @@ -35,48 +37,56 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == false; }; - _unit setvariable [QGVAR(inReviveState), true, true]; - _unit setvariable [QGVAR(reviveStartTime), ACE_time]; + _unit setVariable [QGVAR(inReviveState), true, true]; + _unit setVariable [QGVAR(reviveStartTime), ACE_time]; [_unit, true] call FUNC(setUnconscious); [{ private "_startTime"; params ["_args", "_idPFH"]; _args params ["_unit"]; - _startTime = _unit getvariable [QGVAR(reviveStartTime), 0]; + _startTime = _unit getVariable [QGVAR(reviveStartTime), 0]; if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith { [_idPFH] call CBA_fnc_removePerFrameHandler; - _unit setvariable [QGVAR(inReviveState), nil, true]; - _unit setvariable [QGVAR(reviveStartTime), nil]; + _unit setVariable [QGVAR(inReviveState), nil, true]; + _unit setVariable [QGVAR(reviveStartTime), nil]; [_unit, true] call FUNC(setDead); }; - if !(_unit getvariable [QGVAR(inReviveState), false]) exitwith { + if !(_unit getVariable [QGVAR(inReviveState), false]) exitwith { // revived without dieing, so in case we have lifes, remove one. if (GVAR(amountOfReviveLives) > 0) then { - _lifesLeft = _unit getvariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; - _unit setvariable [QGVAR(amountOfReviveLives), _lifesLeft - 1, true]; + _lifesLeft = _unit getVariable[QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)]; + _unit setVariable [QGVAR(amountOfReviveLives), _lifesLeft - 1, true]; }; - _unit setvariable [QGVAR(reviveStartTime), nil]; + _unit setVariable [QGVAR(reviveStartTime), nil]; [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (GVAR(level) >= 2) then { - if (_unit getvariable [QGVAR(heartRate), 60] > 0) then { - _unit setvariable [QGVAR(heartRate), 0]; + if (_unit getVariable [QGVAR(heartRate), 60] > 0) then { + _unit setVariable [QGVAR(heartRate), 0]; }; }; }, 1, [_unit] ] call CBA_fnc_addPerFrameHandler; false; }; -_unit setvariable ["ACE_isDead", true, true]; +_unit setVariable ["ACE_isDead", true, true]; if (isPLayer _unit) then { - _unit setvariable ["isDeadPlayer", true, true]; + _unit setVariable ["isDeadPlayer", true, true]; }; ["medical_onSetDead", [_unit]] call EFUNC(common,localEvent); -[_unit, 1] call FUNC(setStructuralDamage); +//Delay a frame before killing the unit via scripted damage +//to avoid triggering the "Killed" Event twice (and having the wrong killer) + +if (!_delaySetDamage) then { + [_unit, 1] call FUNC(setStructuralDamage); +} else { + [FUNC(setStructuralDamage), [_unit, 1]] call EFUNC(common,execNextFrame); +}; + true; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index aac48a8641..910745d7bb 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -32,17 +32,17 @@ params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", // No change, fuck off. (why is there no xor?) if (_set isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {}; -if !(_set) exitwith { - _unit setvariable ["ACE_isUnconscious", false, true]; +if !(_set) exitWith { + _unit setVariable ["ACE_isUnconscious", false, true]; }; -if !(!(isNull _unit) && {(_unit isKindOf "CAManBase") && ([_unit] call EFUNC(common,isAwake))}) exitwith{}; +if !(!(isNull _unit) && {(_unit isKindOf "CAManBase") && ([_unit] call EFUNC(common,isAwake))}) exitWith{}; -if (!local _unit) exitwith { +if (!local _unit) exitWith { [[_unit, _set, _minWaitingTime, _force], QUOTE(DFUNC(setUnconscious)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -_unit setvariable ["ACE_isUnconscious", true, true]; +_unit setVariable ["ACE_isUnconscious", true, true]; _unit setUnconscious true; if (_unit == ACE_player) then { diff --git a/addons/medical/functions/fnc_translateSelections.sqf b/addons/medical/functions/fnc_translateSelections.sqf index f2fe4c1de9..b377b3004d 100644 --- a/addons/medical/functions/fnc_translateSelections.sqf +++ b/addons/medical/functions/fnc_translateSelections.sqf @@ -6,15 +6,18 @@ * Arguments: * 0: Unit * 1: selection name - * 2: HitPoint Index + * 2: HitPoint Index/True to get hitpoint * * Return Value: - * translated selection name + * translated selection/hitpoint name * * Example: * [bob, "pelvis", 4] call ace_medical_fnc_translateSelections * Returns "body" * + * [bob, "body", true] call ace_medical_fnc_translateSelections + * Returns "HitBody" + * * Public: No */ #include "script_component.hpp" @@ -35,14 +38,44 @@ params ["_unit", "_selection", "_hitPointIndex"]; if (_selection == "") exitWith {""}; + +//Get Selection from standard selection ["head","body","hand_l","hand_r","leg_l","leg_r"] +if (_hitPointIndex isEqualTo true) exitWith { + private _returnHitPoint = GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selection); + //If the selection is a valid hitpoint just return it: + if (!isNil {_unit getHitPointDamage _returnHitPoint}) exitWith { + _returnHitPoint; + }; + + //Those VR fuckers have weird limb hitpoints + private _hitPoints = switch (_selection) do { + case ("hand_l"): {L_ARM_HITPOINTS}; + case ("hand_r"): {R_ARM_HITPOINTS}; + case ("leg_l"): {L_LEG_HITPOINTS}; + case ("leg_r"): {R_LEG_HITPOINTS}; + case ("head"): {HEAD_HITPOINTS}; + case ("body"): {TORSO_HITPOINTS}; + default {[]}; + }; + { + if (!isNil {_unit getHitPointDamage _x}) exitWith { + _returnHitPoint = _x; + }; + } forEach _hitPoints; + _returnHitPoint +}; + + +//Get Selection from Selection/HitIndex: + if (_selection in HEAD_SELECTIONS) exitWith {"head"}; if (_selection in TORSO_SELECTIONS) exitWith {"body"}; // Not necessary unless we get more hitpoints variants in an next arma update -/*if (_selection in L_ARM_SELECTIONS) exitwith {"hand_l"}; -if (_selection in R_ARM_SELECTIONS) exitwith {"hand_r"}; -if (_selection in L_LEG_SELECTIONS) exitwith {"leg_l"}; -if (_selection in R_LEG_SELECTIONS) exitwith {"leg_r"};*/ +/*if (_selection in L_ARM_SELECTIONS) exitWith {"hand_l"}; +if (_selection in R_ARM_SELECTIONS) exitWith {"hand_r"}; +if (_selection in L_LEG_SELECTIONS) exitWith {"leg_l"}; +if (_selection in R_LEG_SELECTIONS) exitWith {"leg_r"};*/ //Backup method to detect weird selections/hitpoints if ((_selection == "?") || {!(_selection in GVAR(SELECTIONS))}) exitWith { diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 2d0e44d488..d7f80edc35 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -42,7 +42,7 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then { } else { // Check for required class if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0]; + missionNamespace getVariable [(getText (_config >> "requiredMedic")), 0]; }; 0; }; @@ -63,9 +63,9 @@ if (isText (_config >> "Condition")) then { if (isnil _condition) then { _condition = compile _condition; } else { - _condition = missionNamespace getvariable _condition; + _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _selectionName, _className] call _condition; @@ -75,7 +75,7 @@ if (isText (_config >> "Condition")) then { if (!_return) exitwith {false}; _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { - missionNamespace getvariable [getText(_config >> "patientStateCondition"), 0] + missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] } else { getNumber(_config >> "patientStateCondition") }; @@ -97,8 +97,8 @@ if ("All" in _locations) then { if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; if !(isnil _x) exitwith { private "_val"; - _val = missionNamespace getvariable _x; - if (typeName _val == "SCALAR") then { + _val = missionNamespace getVariable _x; + if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //AdvancedMedicalSettings_anywhere case 1: {call _medVeh}; //AdvancedMedicalSettings_vehicle @@ -119,7 +119,7 @@ _consumeItems = if (isNumber (_config >> "itemConsumed")) then { } else { // Check for required class if (isText (_config >> "itemConsumed")) exitwith { - missionNamespace getvariable [(getText (_config >> "itemConsumed")), 0]; + missionNamespace getVariable [(getText (_config >> "itemConsumed")), 0]; }; 0; }; @@ -135,19 +135,19 @@ if (_callbackProgress == "") then { if (isNil _callbackProgress) then { _callbackProgress = compile _callbackProgress; } else { - _callbackProgress = missionNamespace getvariable _callbackProgress; + _callbackProgress = missionNamespace getVariable _callbackProgress; }; // Patient Animation _patientAnim = getText (_config >> "animationPatient"); -if (_target getvariable ["ACE_isUnconscious", false] && GVAR(allowUnconsciousAnimationOnTreatment)) then { +if (_target getVariable ["ACE_isUnconscious", false] && GVAR(allowUnconsciousAnimationOnTreatment)) then { if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then { _patientAnim = getText (_config >> "animationPatientUnconscious"); }; }; if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) then { - if (_target getvariable ["ACE_isUnconscious", false]) then { + if (_target getVariable ["ACE_isUnconscious", false]) then { [_target, _patientAnim, 2, true] call EFUNC(common,doAnimation); } else { [_target, _patientAnim, 1, true] call EFUNC(common,doAnimation); @@ -160,7 +160,7 @@ if (_caller == _target) then { _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); }; -_caller setvariable [QGVAR(selectedWeaponOnTreatment), (weaponState _caller)]; +_caller setVariable [QGVAR(selectedWeaponOnTreatment), (weaponState _caller)]; // Cannot use secondairy weapon for animation if (currentWeapon _caller == secondaryWeapon _caller) then { @@ -184,12 +184,12 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { if ((stance _caller) == "STAND") then { switch (_wpn) do {//If standing, end in a crouched animation based on their current weapon - case ("rfl"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWrflDnon"];}; - case ("pst"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWpstDnon"];}; - case ("non"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSnonWnonDnon"];}; + case ("rfl"): {_caller setVariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWrflDnon"];}; + case ("pst"): {_caller setVariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWpstDnon"];}; + case ("non"): {_caller setVariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSnonWnonDnon"];}; }; } else { - _caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _caller]; + _caller setVariable [QGVAR(treatmentPrevAnimCaller), animationState _caller]; }; [_caller, _callerAnim] call EFUNC(common,doAnimation); }; @@ -203,9 +203,9 @@ _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { if (isnil _treatmentTimeConfig) then { _treatmentTimeConfig = compile _treatmentTimeConfig; } else { - _treatmentTimeConfig = missionNamespace getvariable _treatmentTimeConfig; + _treatmentTimeConfig = missionNamespace getVariable _treatmentTimeConfig; }; - if (typeName _treatmentTimeConfig == "SCALAR") exitwith { + if (_treatmentTimeConfig isEqualType 0) exitwith { _treatmentTimeConfig; }; [_caller, _target, _selectionName, _className] call _treatmentTimeConfig; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf index f09de600ae..f86e620625 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf @@ -18,7 +18,7 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"]; -if (alive _target && {(_target getvariable [QGVAR(inCardiacArrest), false] || _target getvariable [QGVAR(inReviveState), false])}) then { +if (alive _target && {(_target getVariable [QGVAR(inCardiacArrest), false] || _target getVariable [QGVAR(inReviveState), false])}) then { [[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_CPRLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index 9024489a3b..7f273d1fad 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -17,17 +17,17 @@ private "_reviveStartTime"; params ["_caller","_target"]; -if (_target getvariable [QGVAR(inReviveState), false]) then { - _reviveStartTime = _target getvariable [QGVAR(reviveStartTime),0]; +if (_target getVariable [QGVAR(inReviveState), false]) then { + _reviveStartTime = _target getVariable [QGVAR(reviveStartTime),0]; if (_reviveStartTime > 0) then { - _target setvariable [QGVAR(reviveStartTime), (_reviveStartTime + random(20)) min ACE_time]; + _target setVariable [QGVAR(reviveStartTime), (_reviveStartTime + random(20)) min ACE_time]; }; }; if (GVAR(level) > 1 && {(random 1) >= 0.6}) then { - _target setvariable [QGVAR(inCardiacArrest), nil,true]; - _target setvariable [QGVAR(heartRate), 40]; - _target setvariable [QGVAR(bloodPressure), [50,70]]; + _target setVariable [QGVAR(inCardiacArrest), nil,true]; + _target setVariable [QGVAR(heartRate), 40]; + _target setVariable [QGVAR(bloodPressure), [50,70]]; }; [_target, "activity", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index aa3669c227..2d9c383902 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -19,7 +19,10 @@ #include "script_component.hpp" params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]]; -if !([_target] call FUNC(hasMedicalEnabled)) exitwith { +[_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message + +if !([_target] call FUNC(hasMedicalEnabled)) exitWith { _this call FUNC(treatmentBasic_bandage); }; @@ -28,9 +31,6 @@ if !([_target] call FUNC(hasMedicalEnabled)) exitwith { if (_x != "") then { [_target, _x] call FUNC(addToTriageCard); }; -}foreach _items;*/ - -[_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message +}forEach _items;*/ true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index 2ef1174e63..5c02ecc0cb 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -20,11 +20,11 @@ params ["_target", "_bandage", "_selectionName", ["_specificClass", -1]]; // Ensure it is a valid bodypart _part = [_selectionName] call FUNC(selectionNameToNumber); -if (_part < 0) exitwith {false}; +if (_part < 0) exitWith {false}; // Get the open wounds for this unit -_openWounds = _target getvariable [QGVAR(openWounds), []]; -if (count _openWounds == 0) exitwith {false}; // nothing to do here! +_openWounds = _target getVariable [QGVAR(openWounds), []]; +if (count _openWounds == 0) exitWith {false}; // nothing to do here! // Get the default effectiveness for the used bandage _config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); @@ -48,6 +48,7 @@ _exit = false; // Select the classname from the wound classname storage _className = GVAR(woundClassNames) select _classID; + // Check if this wound type has attributes specified for the used bandage if (isClass (_config >> _className)) then { // Collect the effectiveness from the used bandage for this wound type @@ -55,12 +56,14 @@ _exit = false; if (isNumber (_woundTreatmentConfig >> "effectiveness")) then { _woundEffectivenss = getNumber (_woundTreatmentConfig >> "effectiveness"); }; + } else { + ACE_LOGWARNING_2("No config for wound type [%1] config base [%2]", _className, _config); }; TRACE_2("Wound classes: ", _specificClass, _classID); - if (_specificClass == _classID) exitwith { + if (_specificClass == _classID) exitWith { _effectivenessFound = _woundEffectivenss; - _mostEffectiveSpot = _foreachIndex; + _mostEffectiveSpot = _forEachIndex; _mostEffectiveInjury = _x; _exit = true; }; @@ -68,14 +71,14 @@ _exit = false; // Check if this is the currently most effective found. if (_woundEffectivenss * ((_x select 4) * (_x select 3)) > _effectivenessFound * ((_mostEffectiveInjury select 4) * (_mostEffectiveInjury select 3))) then { _effectivenessFound = _woundEffectivenss; - _mostEffectiveSpot = _foreachIndex; + _mostEffectiveSpot = _forEachIndex; _mostEffectiveInjury = _x; }; }; - if (_exit) exitwith {}; -} foreach _openWounds; + if (_exit) exitWith {}; +} forEach _openWounds; -if (_effectivenessFound == -1) exitwith {}; // Seems everything is patched up on this body part already.. +if (_effectivenessFound == -1) exitWith {}; // Seems everything is patched up on this body part already.. // TODO refactor this part @@ -84,7 +87,7 @@ _impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_eff _mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _impact) max 0]; _openWounds set [_mostEffectiveSpot, _mostEffectiveInjury]; -_target setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; +_target setVariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; if (USE_WOUND_EVENT_SYNC) then { ["medical_propagateWound", [_target, _mostEffectiveInjury]] call EFUNC(common,globalEvent); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index ed5eb0858d..e3befb13a9 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -13,24 +13,24 @@ private "_allUsedMedication"; params ["_caller", "_target"]; -if (alive _target) exitwith { +if (alive _target) exitWith { _target setVariable [QGVAR(pain), 0, true]; _target setVariable [QGVAR(morphine), 0, true]; _target setVariable [QGVAR(bloodVolume), 100, true]; // tourniquets - _target setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; + _target setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; // wounds and injuries - _target setvariable [QGVAR(openWounds), [], true]; - _target setvariable [QGVAR(bandagedWounds), [], true]; + _target setVariable [QGVAR(openWounds), [], true]; + _target setVariable [QGVAR(bandagedWounds), [], true]; _target setVariable [QGVAR(internalWounds), [], true]; // vitals _target setVariable [QGVAR(heartRate), 80]; - _target setvariable [QGVAR(heartRateAdjustments), []]; - _target setvariable [QGVAR(bloodPressure), [80, 120]]; + _target setVariable [QGVAR(heartRateAdjustments), []]; + _target setVariable [QGVAR(bloodPressure), [80, 120]]; _target setVariable [QGVAR(peripheralResistance), 100]; // fractures @@ -42,28 +42,28 @@ if (alive _target) exitwith { _target setVariable [QGVAR(bloodIVVolume), 0]; // damage storage - _target setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; + _target setVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; // airway - _target setvariable [QGVAR(airwayStatus), 100, true]; + _target setVariable [QGVAR(airwayStatus), 100, true]; _target setVariable [QGVAR(airwayOccluded), false, true]; - _target setvariable [QGVAR(airwayCollapsed), false, true]; + _target setVariable [QGVAR(airwayCollapsed), false, true]; // generic medical admin - _target setvariable [QGVAR(addedToUnitLoop), false, true]; - _target setvariable [QGVAR(inCardiacArrest), false, true]; - _target setvariable [QGVAR(inReviveState), false, true]; + _target setVariable [QGVAR(addedToUnitLoop), false, true]; + _target setVariable [QGVAR(inCardiacArrest), false, true]; + _target setVariable [QGVAR(inReviveState), false, true]; _target setVariable ["ACE_isUnconscious", false, true]; - _target setvariable [QGVAR(hasLostBlood), 0, true]; - _target setvariable [QGVAR(isBleeding), false, true]; - _target setvariable [QGVAR(hasPain), false, true]; - _target setvariable [QGVAR(painSuppress), 0, true]; + _target setVariable [QGVAR(hasLostBlood), 0, true]; + _target setVariable [QGVAR(isBleeding), false, true]; + _target setVariable [QGVAR(hasPain), false, true]; + _target setVariable [QGVAR(painSuppress), 0, true]; // medication _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; { - _target setvariable [_x select 0, nil]; - } foreach _allUsedMedication; + _target setVariable [_x select 0, nil]; + } forEach _allUsedMedication; // Resetting damage _target setDamage 0; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index b5b0af1401..e551eb4afe 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -27,7 +27,7 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"]; [_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); }; -} foreach _items; +} forEach _items; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index c2797d825d..952f245da9 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -20,9 +20,9 @@ params ["_target", "_className"]; // We have added a new dose of this medication to our system, so let's increase it _varName = format[QGVAR(%1_inSystem), _className]; -_currentInSystem = _target getvariable [_varName, 0]; +_currentInSystem = _target getVariable [_varName, 0]; _currentInSystem = _currentInSystem + 1; -_target setvariable [_varName, _currentInSystem]; +_target setVariable [_varName, _currentInSystem]; // Find the proper attributes for the used medication _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); @@ -51,11 +51,11 @@ if (isClass (_medicationConfig >> _className)) then { if (isNil _hrCallback) then { _hrCallback = compile _hrCallback; } else { - _hrCallback = missionNamespace getvariable _hrCallback; + _hrCallback = missionNamespace getVariable _hrCallback; }; // Adjust the heart rate based upon config entry -_heartRate = _target getvariable [QGVAR(heartRate), 70]; +_heartRate = _target getVariable [QGVAR(heartRate), 70]; if (alive _target) then { if (_heartRate > 0) then { if (_heartRate <= 45) then { @@ -72,17 +72,17 @@ if (alive _target) then { if (_painReduce > 0) then { // Reduce pain - _painSuppress = _target getvariable [QGVAR(painSuppress), 0]; - _target setvariable [QGVAR(painSuppress), (_painSuppress + _painReduce) max 0]; + _painSuppress = _target getVariable [QGVAR(painSuppress), 0]; + _target setVariable [QGVAR(painSuppress), (_painSuppress + _painReduce) max 0]; if (!GVAR(painIsOnlySuppressed)) then { - _pain = _target getvariable [QGVAR(pain), 0]; - _target setvariable [QGVAR(pain), (_pain - _painReduce) max 0, true]; + _pain = _target getVariable [QGVAR(pain), 0]; + _target setVariable [QGVAR(pain), (_pain - _painReduce) max 0, true]; }; }; -_resistance = _target getvariable [QGVAR(peripheralResistance), 100]; +_resistance = _target getVariable [QGVAR(peripheralResistance), 100]; _resistance = _resistance + _viscosityChange; -_target setvariable [QGVAR(peripheralResistance), _resistance max 0]; +_target setVariable [QGVAR(peripheralResistance), _resistance max 0]; // Call back to ensure that the medication is decreased over time [_target, _classname, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange, _painReduce] call FUNC(onMedicationUsage); diff --git a/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf index ee04decfbd..73b40f8a9b 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf @@ -18,7 +18,7 @@ params ["_target", "_selectionName"]; -_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_damageBodyParts = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; // Ensure it is a valid bodypart _part = [_selectionName] call FUNC(selectionNameToNumber); @@ -33,8 +33,8 @@ if ((_damageBodyParts select _part) > 0) then { _damageOnPart = _damageOnPart - BANDAGEHEAL; }; _damageBodyParts set [_part, _damageOnPart max 0]; - _target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; - TRACE_2("ACE_DEBUG: Treatment BASIC Bandage Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus)); + _target setVariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; + TRACE_2("ACE_DEBUG: Treatment BASIC Bandage Broadcast value here",_unit, _target getVariable QGVAR(bodyPartStatus)); }; EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); @@ -44,7 +44,8 @@ _target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95] _target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; { - _target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95]; -}foreach GVAR(HITPOINTS); + private _hitPointName = [_target, _x, true] call FUNC(translateSelections); + _target setHitPointDamage [_hitPointName, (_damageBodyParts select _foreachIndex) min 0.95]; +}foreach GVAR(SELECTIONS); true; diff --git a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf index d387e91f89..f15dbd0c71 100644 --- a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf @@ -19,6 +19,6 @@ params ["_caller", "_target","_className"]; [_target, false] call FUNC(setUnconscious); -if (_target getvariable [QGVAR(inReviveState), false]) then { - _target setvariable [QGVAR(inReviveState), nil, true]; +if (_target getVariable [QGVAR(inReviveState), false]) then { + _target setVariable [QGVAR(inReviveState), nil, true]; }; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index 2a7bbc6adf..bf18370a5e 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -19,7 +19,7 @@ private "_removeItem"; params ["_caller", "_target", "_selectionName", "_className", "_items"]; -if (count _items == 0) exitwith {false}; +if (count _items == 0) exitWith {false}; _removeItem = _items select 0; [[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf index 37cba2ad1b..ef8a83af65 100644 --- a/addons/medical/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical/functions/fnc_treatmentIVLocal.sqf @@ -18,8 +18,8 @@ private ["_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; params ["_target", "_treatmentClassname"]; -_bloodVolume = _target getvariable [QGVAR(bloodVolume), 100]; -if (_bloodVolume >= 100) exitwith {}; +_bloodVolume = _target getVariable [QGVAR(bloodVolume), 100]; +if (_bloodVolume >= 100) exitWith {}; // Find the proper attributes for the used IV _config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV"); @@ -35,9 +35,9 @@ if (isClass (_config >> _treatmentClassname)) then { }; _varName = format["ACE_Medical_IVVolume_%1",_typeOf]; -_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded, true]; +_target setVariable [_varName, (_target getVariable [_varName, 0]) + _volumeAdded, true]; if !(_varName in GVAR(IVBags)) then { - GVAR(IVBags) pushback _varName; + GVAR(IVBags) pushBack _varName; publicVariable QGVAR(IVBags); }; diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index 5d3ba6e1d4..8f45ada7c3 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -24,16 +24,16 @@ _selectionName = _this select 2; _className = _this select 3; _items = _this select 4; -if (count _items == 0) exitwith {false}; +if (count _items == 0) exitWith {false}; _part = [_selectionName] call FUNC(selectionNameToNumber); -if (_part == 0 || _part == 1) exitwith { +if (_part == 0 || _part == 1) exitWith { // ["displayTextStructured", [_caller], ["You cannot apply a CAT on this body part!"]] call EFUNC(common,targetEvent); false; }; -_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; -if ((_tourniquets select _part) > 0) exitwith { +_tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +if ((_tourniquets select _part) > 0) exitWith { _output = "There is already a tourniquet on this body part!"; // TODO localization ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); false; diff --git a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf index d1ffd34e4b..be9b03c9f1 100644 --- a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf @@ -21,26 +21,26 @@ params ["_target", "_tourniquetItem", "_selectionName"]; _part = [_selectionName] call FUNC(selectionNameToNumber); // Place a tourniquet on the bodypart -_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +_tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; _applyingTo = (_tourniquets select _part) + 1 + round(random(100)); _tourniquets set[_part, _applyingTo]; -_target setvariable [QGVAR(tourniquets), _tourniquets, true]; +_target setVariable [QGVAR(tourniquets), _tourniquets, true]; [{ params ["_args", "_idPFH"]; _args params ["_target", "_applyingTo", "_part", "_time"]; - if (!alive _target) exitwith { + if (!alive _target) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; - _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; - if !((_tourniquets select _part) == _applyingTo) exitwith { + _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; + if !((_tourniquets select _part) == _applyingTo) exitWith { // Tourniquet has been removed [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (ACE_time - _time > 120) then { - _target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005]; + _target setVariable [QGVAR(pain), (_target getVariable [QGVAR(pain), 0]) + 0.005]; }; }, 5, [_target, _applyingTo, _part, ACE_time] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index 4aac0eda6a..4029721566 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -25,7 +25,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; }; if (vehicle _caller == _caller) then { - _lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]; + _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); switch (toLower _lastAnim) do { @@ -38,9 +38,9 @@ if (vehicle _caller == _caller) then { [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); }; -_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; +_caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; -_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), []]); +_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { for "_index" from 0 to 99 do { _caller action ["SwitchWeapon", _caller, _caller, _index]; @@ -55,7 +55,7 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") { _x params ["_unit", "_item"]; _unit addItem _item; -} foreach _usersOfItems; +} forEach _usersOfItems; // Record specific callback _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); @@ -67,7 +67,7 @@ _callback = getText (_config >> "callbackFailure"); _callback = if (isNil _callback) then { compile _callback } else { - missionNamespace getvariable _callback + missionNamespace getVariable _callback }; _args call _callback; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index c2347c59ee..9b21ff228f 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -25,7 +25,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; }; if (vehicle _caller == _caller) then { - _lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]; + _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); switch (toLower _lastAnim) do { @@ -38,9 +38,9 @@ if (vehicle _caller == _caller) then { [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); }; -_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; +_caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; -_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), []]); +_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { for "_index" from 0 to 99 do { _caller action ["SwitchWeapon", _caller, _caller, _index]; @@ -62,18 +62,14 @@ _callback = getText (_config >> "callbackSuccess"); if (isNil _callback) then { _callback = compile _callback; } else { - _callback = missionNamespace getvariable _callback; + _callback = missionNamespace getVariable _callback; }; //Get current damage before treatment (for litter) -_previousDamage = switch (toLower _selectionName) do { - case ("head"): {_target getHitPointDamage "HitHead"}; - case ("body"): {_target getHitPointDamage "HitBody"}; - case ("hand_l"): {_target getHitPointDamage "HitLeftArm"}; - case ("hand_r"): {_target getHitPointDamage "HitRightArm"}; - case ("leg_l"): {_target getHitPointDamage "HitLeftLeg"}; - case ("leg_r"): {_target getHitPointDamage "HitRightLeg"}; - default {damage _target}; +_previousDamage = if (_selectionName in GVAR(SELECTIONS)) then { + _target getHitPointDamage ([_target, _selectionName, true] call FUNC(translateSelections)); +} else { + damage _target; }; _args call _callback; @@ -81,7 +77,7 @@ _args pushBack _previousDamage; _args call FUNC(createLitter); //If we're not already tracking vitals, start: -if (!(_target getvariable [QGVAR(addedToUnitLoop),false])) then { +if (!(_target getVariable [QGVAR(addedToUnitLoop),false])) then { [_target] call FUNC(addToInjuredCollection); }; diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index 0e8c424ca3..2922cae465 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -25,7 +25,7 @@ _args params ["_unit", "_originalPos", "_startingTime", "_minWaitingTime", "_has TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _originalPos, _startingTime, _minWaitingTime, _hasMovedOut, _parachuteCheck); -if (!alive _unit) exitwith { +if (!alive _unit) exitWith { if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then { TRACE_1("Removing fake weapon [on death]",_unit); _unit removeWeapon "ACE_FakePrimaryWeapon"; @@ -47,8 +47,8 @@ if (!alive _unit) exitwith { }; // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation -if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { - TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call FUNC(isBeingCarried), [_unit] call FUNC(isBeingDragged), _idPFH, _unit getvariable QGVAR(unconsciousArguments),animationState _unit); +if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith { + TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call FUNC(isBeingCarried), [_unit] call FUNC(isBeingDragged), _idPFH, _unit getVariable QGVAR(unconsciousArguments),animationState _unit); // TODO, handle this with carry instead, so we can remove the PFH here. // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then { @@ -128,17 +128,17 @@ if (_parachuteCheck) then { }; }; -if (!local _unit) exitwith { - TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _args, _startingTime, _minWaitingTime, _idPFH, _unit getvariable QGVAR(unconsciousArguments)); +if (!local _unit) exitWith { + TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _args, _startingTime, _minWaitingTime, _idPFH, _unit getVariable QGVAR(unconsciousArguments)); _args set [3, _minWaitingTime - (ACE_time - _startingTime)]; - _unit setvariable [QGVAR(unconsciousArguments), _args, true]; + _unit setVariable [QGVAR(unconsciousArguments), _args, true]; [_idPFH] call CBA_fnc_removePerFrameHandler; }; // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs -if ((ACE_time - _startingTime) >= _minWaitingTime) exitwith { +if ((ACE_time - _startingTime) >= _minWaitingTime) exitWith { TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition)); if (!([_unit] call FUNC(getUnconsciousCondition))) then { - _unit setvariable ["ACE_isUnconscious", false, true]; + _unit setVariable ["ACE_isUnconscious", false, true]; }; }; diff --git a/addons/medical/functions/fnc_useItem.sqf b/addons/medical/functions/fnc_useItem.sqf index 770d8b6ea7..7abf80c464 100644 --- a/addons/medical/functions/fnc_useItem.sqf +++ b/addons/medical/functions/fnc_useItem.sqf @@ -19,16 +19,16 @@ private ["_return","_crew"]; params ["_medic", "_patient", "_item"]; -if (isnil QGVAR(setting_allowSharedEquipment)) then { +if (isNil QGVAR(setting_allowSharedEquipment)) then { GVAR(setting_allowSharedEquipment) = true; }; -if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith { +if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { [[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [true, _patient]; }; -if ([_medic, _item] call EFUNC(common,hasItem)) exitwith { +if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { [[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [true, _medic]; }; @@ -37,11 +37,11 @@ _return = [false, objNull]; if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) then { _crew = crew vehicle _medic; { - if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { + if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { _return = [true, _x]; [[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; - } foreach _crew; + } forEach _crew; }; _return diff --git a/addons/medical/functions/fnc_useItems.sqf b/addons/medical/functions/fnc_useItems.sqf index 0d937c0938..ce45d752a9 100644 --- a/addons/medical/functions/fnc_useItems.sqf +++ b/addons/medical/functions/fnc_useItems.sqf @@ -21,18 +21,18 @@ params ["_medic", "_patient", "_items"]; _itemsUsedBy = []; { // handle a one of type use item - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { { _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; - } foreach _x; + if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushBack [(_itemUsedInfo select 1), _x]}; + } forEach _x; }; // handle required item - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushBack [(_itemUsedInfo select 1), _x]}; }; -} foreach _items; +} forEach _items; [count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/medical/ui/RscTitles.hpp b/addons/medical/ui/RscTitles.hpp index 06d1dda866..b81643990c 100644 --- a/addons/medical/ui/RscTitles.hpp +++ b/addons/medical/ui/RscTitles.hpp @@ -59,7 +59,7 @@ class Rsctitles { style = 0x00 + 0x100; // ST_LEFT + ST_SHADOW font = "PuristaMedium"; colorText[] = {0.95, 0.95, 0.95, 0.75}; - colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; text = CSTRING(Injuries); }; class InjuryList: ACE_gui_listBoxBase { diff --git a/addons/medical/ui/triagecard.hpp b/addons/medical/ui/triagecard.hpp index f8b0b21a71..74ce4a8e18 100644 --- a/addons/medical/ui/triagecard.hpp +++ b/addons/medical/ui/triagecard.hpp @@ -113,7 +113,7 @@ class GVAR(triageCard) { animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.9)"; animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.9)"; animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.9)"; - action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setvariable [ARR_3('ACE_medical_triageLevel',0,true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel',0,true)];); }; class selectTriageStatusMinor: selectTriageStatus { idc = 2003; @@ -131,7 +131,7 @@ class GVAR(triageCard) { animTextureFocused = "#(argb,8,8,3)color(0,0.5,0,0.9)"; animTexturePressed = "#(argb,8,8,3)color(0,0.5,0,0.9)"; animTextureDefault = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setvariable [ARR_3('ACE_medical_triageLevel',1,true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel',1,true)];); }; class selectTriageStatusDelayed: selectTriageStatus { idc = 2004; @@ -149,7 +149,7 @@ class GVAR(triageCard) { animTextureFocused = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; animTexturePressed = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; animTextureDefault = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setvariable [ARR_3('ACE_medical_triageLevel',2,true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel',2,true)];); }; class selectTriageStatusImmediate: selectTriageStatus { idc = 2005; @@ -167,7 +167,7 @@ class GVAR(triageCard) { animTextureFocused = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; animTexturePressed = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; animTextureDefault = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setvariable [ARR_3('ACE_medical_triageLevel', 3, true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel', 3, true)];); }; class selectTriageStatusDeceased: selectTriageStatus { idc = 2006; @@ -185,7 +185,7 @@ class GVAR(triageCard) { animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.9)"; animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.9)"; animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.9)"; - action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setvariable [ARR_3('ACE_medical_triageLevel', 4, true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel', 4, true)];); }; }; }; \ No newline at end of file diff --git a/addons/medical_menu/CfgVehicles.hpp b/addons/medical_menu/CfgVehicles.hpp index 7bbe7db2ad..d2bbf55fd1 100644 --- a/addons/medical_menu/CfgVehicles.hpp +++ b/addons/medical_menu/CfgVehicles.hpp @@ -10,6 +10,7 @@ class CfgVehicles { function = QUOTE(DFUNC(module)); functionPriority = 1; isGlobal = 0; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/medical_menu/XEH_postInit.sqf b/addons/medical_menu/XEH_postInit.sqf index ad1acabdb3..92e2af341f 100644 --- a/addons/medical_menu/XEH_postInit.sqf +++ b/addons/medical_menu/XEH_postInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -if (!hasInterface) exitwith {}; +if (!hasInterface) exitWith {}; GVAR(MenuPFHID) = -1; GVAR(lastOpenedOn) = -1; @@ -24,7 +24,7 @@ GVAR(pendingReopen) = false; // Conditions: canInteract if !([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; - if !([ACE_player, _target] call FUNC(canOpenMenu)) exitwith {false}; + if !([ACE_player, _target] call FUNC(canOpenMenu)) exitWith {false}; // Statement [_target] call FUNC(openMenu); diff --git a/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf b/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf index 2bb4499753..8cbbe2d32f 100644 --- a/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf +++ b/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf @@ -21,7 +21,7 @@ params ["_player", "_target", "_name"]; private ["_actions", "_collectedActions", "_bodyPart"]; -if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitwith {[]}; +if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitWith {[]}; _actions = if (EGVAR(medical,level) == 2) then { GVAR(actionsAdvanced); diff --git a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf index e5b49e58bc..67e295e22e 100644 --- a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf +++ b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf @@ -19,7 +19,7 @@ #define END_IDC 27 #define AMOUNT_OF_ENTRIES (count _entries) -if (!hasInterface) exitwith{}; +if (!hasInterface) exitWith{}; private ["_entries", "_display", "_newTarget", "_ctrl", "_code"]; @@ -28,9 +28,9 @@ params ["_name"]; disableSerialization; _display = uiNamespace getVariable QGVAR(medicalMenu); -if (isNil "_display") exitwith {}; // no valid dialog present +if (isNil "_display") exitWith {}; // no valid dialog present -if (_name isEqualTo "toggle") exitwith { +if (_name isEqualTo "toggle") exitWith { _newTarget = ACE_player; //If we are on the player, and only if our old target is still valid, switch to it: if ((GVAR(INTERACTION_TARGET) == ACE_player) && @@ -61,11 +61,11 @@ GVAR(LatestDisplayOptionMenu) = _name; // The triage card has no options available lbClear 212; -if (_name isEqualTo "triage") exitwith { +if (_name isEqualTo "triage") exitWith { ctrlEnable [212, true]; private ["_log", "_triageCardTexts", "_message"]; - _log = GVAR(INTERACTION_TARGET) getvariable [QEGVAR(medical,triageCard), []]; + _log = GVAR(INTERACTION_TARGET) getVariable [QEGVAR(medical,triageCard), []]; _triageCardTexts = []; { _x params ["_item", "_amount", "_time"]; @@ -77,11 +77,11 @@ if (_name isEqualTo "triage") exitwith { _message = localize _message; }; }; - _triageCardTexts pushback format["%1x - %2 (%3m)", _amount, _message, round((ACE_gameTime - _time) / 60)]; + _triageCardTexts pushBack format["%1x - %2 (%3m)", _amount, _message, round((ACE_gameTime - _time) / 60)]; nil; } count _log; - if (count _triageCardTexts == 0) exitwith { + if (count _triageCardTexts == 0) exitWith { lbAdd [212,(localize ELSTRING(medical,TriageCard_NoEntry))]; }; { @@ -96,7 +96,7 @@ _entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTreatmentO { //player sidechat format["TRIGGERED: %1",_x]; - if (_forEachIndex > END_IDC) exitwith {}; + if (_forEachIndex > END_IDC) exitWith {}; _ctrl = (_display displayCtrl (START_IDC + _forEachIndex)); if (!(_forEachIndex > AMOUNT_OF_ENTRIES)) then { _ctrl ctrlSetText (_x select 0); diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index 2b47312453..806338b7a6 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -20,7 +20,7 @@ private "_target"; params ["_display"]; -if (isNil "_display") exitwith {}; +if (isNil "_display") exitWith {}; if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), true] call EFUNC(common,blurScreen);}; if (EGVAR(interact_menu,menuBackground)==2) then {0 cutRsc[QEGVAR(interact_menu,menuBackground), "PLAIN", 1, false];}; diff --git a/addons/medical_menu/functions/fnc_openMenu.sqf b/addons/medical_menu/functions/fnc_openMenu.sqf index 1c77da6a5a..a8a51ff028 100644 --- a/addons/medical_menu/functions/fnc_openMenu.sqf +++ b/addons/medical_menu/functions/fnc_openMenu.sqf @@ -17,7 +17,7 @@ params ["_interactionTarget"]; -if (dialog || {isNull _interactionTarget}) exitwith { +if (dialog || {isNull _interactionTarget}) exitWith { disableSerialization; private ["_display", "_handled"]; diff --git a/addons/medical_menu/functions/fnc_setTriageStatus.sqf b/addons/medical_menu/functions/fnc_setTriageStatus.sqf index 7e7c764aee..8a85eeb950 100644 --- a/addons/medical_menu/functions/fnc_setTriageStatus.sqf +++ b/addons/medical_menu/functions/fnc_setTriageStatus.sqf @@ -15,4 +15,4 @@ params ["_target", "_status"]; -_target setvariable [QEGVAR(medical,triageLevel), _status, true]; +_target setVariable [QEGVAR(medical,triageLevel), _status, true]; diff --git a/addons/medical_menu/functions/fnc_updateActivityLog.sqf b/addons/medical_menu/functions/fnc_updateActivityLog.sqf index 92e8474b4b..50acb12e94 100644 --- a/addons/medical_menu/functions/fnc_updateActivityLog.sqf +++ b/addons/medical_menu/functions/fnc_updateActivityLog.sqf @@ -31,7 +31,7 @@ lbClear _logCtrl; }; { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } forEach _arguments; diff --git a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf index 49da12e7f4..900e375fb7 100644 --- a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf +++ b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf @@ -31,7 +31,7 @@ lbClear _logCtrl; }; { - if (typeName _x == "STRING" && {isLocalized _x}) then { + if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } forEach _arguments; diff --git a/addons/medical_menu/functions/fnc_updateUIInfo.sqf b/addons/medical_menu/functions/fnc_updateUIInfo.sqf index 56a22689db..412a2045e6 100644 --- a/addons/medical_menu/functions/fnc_updateUIInfo.sqf +++ b/addons/medical_menu/functions/fnc_updateUIInfo.sqf @@ -23,7 +23,7 @@ private["_allInjuryTexts", "_bandagedwounds", "_damaged", "_genericMessages", "_ if (isNil "_display" || {isNull _display}) exitWith {ERROR("No display");}; _selectionN = GVAR(selectedBodyPart); -if (_selectionN < 0 || {_selectionN > 5}) exitwith {}; +if (_selectionN < 0 || {_selectionN > 5}) exitWith {}; _genericMessages = []; _partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN; @@ -128,7 +128,7 @@ if ((EGVAR(medical,level) >= 2) && {([_target] call EFUNC(medical,hasMedicalEnab ] select _forEachIndex); _allInjuryTexts pushBack [format ["%1 %2", _severity, toLower _part], [1,1,1,1]]; }; - } forEach (_target getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]); + } forEach (_target getVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]); }; [_selectionBloodLoss, _damaged, _display] call FUNC(updateBodyImage); diff --git a/addons/medical_menu/ui/menu.hpp b/addons/medical_menu/ui/menu.hpp index 29247b6071..5968a643ff 100644 --- a/addons/medical_menu/ui/menu.hpp +++ b/addons/medical_menu/ui/menu.hpp @@ -19,8 +19,8 @@ class GVAR(medicalMenu) { y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; h = "16 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; text = "#(argb,8,8,3)color(0,0,0,0.8)"; - colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; - colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorText[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {0,0,0,"(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; }; class BottomBackground: CenterBackground { y = "(18.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; @@ -40,7 +40,7 @@ class GVAR(medicalMenu) { font = "PuristaMedium"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; colorText[] = {0.95, 0.95, 0.95, 0.75}; - colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; text = ""; }; diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp index ee16870fe0..3fcf92beaa 100644 --- a/addons/microdagr/CfgVehicles.hpp +++ b/addons/microdagr/CfgVehicles.hpp @@ -38,6 +38,7 @@ class CfgVehicles { function = QFUNC(moduleMapFill); scope = 2; isGlobal = 0; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_microDAGR_ca.paa)); functionPriority = 0; class Arguments { diff --git a/addons/microdagr/gui.hpp b/addons/microdagr/gui.hpp index 2eeb99563c..28c664b6d8 100644 --- a/addons/microdagr/gui.hpp +++ b/addons/microdagr/gui.hpp @@ -59,10 +59,10 @@ class GVAR(TheDialog) { //Redfine Scaling for the RscTitle -#define PROFILE_X (profilenamespace getvariable ['IGUI_GRID_GPS_X', 0]) -#define PROFILE_Y (profilenamespace getvariable ['IGUI_GRID_GPS_Y', 0]) -#define PROFILE_W (profilenamespace getvariable ['IGUI_GRID_GPS_W', 1]) -#define PROFILE_H ((16/9) * (profilenamespace getvariable ['IGUI_GRID_GPS_W', 1])) +#define PROFILE_X (profilenamespace getVariable ['IGUI_GRID_GPS_X', 0]) +#define PROFILE_Y (profilenamespace getVariable ['IGUI_GRID_GPS_Y', 0]) +#define PROFILE_W (profilenamespace getVariable ['IGUI_GRID_GPS_W', 1]) +#define PROFILE_H ((16/9) * (profilenamespace getVariable ['IGUI_GRID_GPS_W', 1])) #define X_PART(num) QUOTE((num) / 25 * PROFILE_W + PROFILE_X) #define Y_PART(num) QUOTE((num) / 25 * PROFILE_H + PROFILE_Y) diff --git a/addons/microdagr/README.md b/addons/microdagr/readme.md similarity index 100% rename from addons/microdagr/README.md rename to addons/microdagr/readme.md diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 64146b8e7e..fc0546f797 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -26,7 +26,7 @@ class CfgAmmo { thrustTime = 1.07; thrust = 530; fuseDistance = 2; - + effectsMissileInit = "MissileDAR1"; effectsMissile = "missile2"; whistleDist = 4; @@ -34,34 +34,34 @@ class CfgAmmo { // Turn off arma crosshair-guidance manualControl = 0; - + // ACE uses these values trackOversteer = 1; trackLead = 0; - + // Begin ACE guidance Configs class ADDON { enabled = 1; - + minDeflection = 0.00025; // Minium flap deflection for guidance maxDeflection = 0.001; // Maximum flap deflection for guidance incDeflection = 0.0005; // The incrmeent in which deflection adjusts. - + canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode - + // Guidance type for munitions defaultSeekerType = "SALH"; - seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; - + seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; + defaultSeekerLockMode = "LOAL"; - seekerLockModes[] = { "LOAL", "LOBL" }; - + seekerLockModes[] = { "LOAL", "LOBL" }; + seekerAngle = 90; // Angle in front of the missile which can be searched seekerAccuracy = 1; // seeker accuracy multiplier - + seekerMinRange = 1; seekerMaxRange = 2500; // Range from the missile which the seeker can visually search - + // Attack profile type selection defaultAttackProfile = "LIN"; attackProfiles[] = { "LIN", "DIR", "MID", "HI" }; @@ -71,10 +71,12 @@ class CfgAmmo { class ACE_Hydra70_DAGR: M_PG_AT { displayName = CSTRING(Hydra70_DAGR); displayNameShort = CSTRING(Hydra70_DAGR_Short); - + description = CSTRING(Hydra70_DAGR_Desc); descriptionShort = CSTRING(Hydra70_DAGR_Desc); + EGVAR(rearm,caliber) = 70; + //Explicity add guidance config class ADDON: ADDON {}; }; @@ -82,14 +84,14 @@ class CfgAmmo { class ACE_Hellfire_AGM114K: ACE_Hydra70_DAGR { displayName = CSTRING(Hellfire_AGM114K); displayNameShort = CSTRING(Hellfire_AGM114K_Short); - + description = CSTRING(Hellfire_AGM114K_desc); descriptionShort = CSTRING(Hellfire_AGM114K_desc); - + // @TODO: placeholder model to at least make it look different model = "\A3\Weapons_F\Ammo\Missile_AT_03_fly_F"; proxyShape = "\A3\Weapons_F\Ammo\Missile_AT_03_F"; - + hit = 1400; indirectHit = 71; indirectHitRange = 4.5; @@ -98,7 +100,7 @@ class CfgAmmo { //Explicity add guidance config class ADDON: ADDON {}; }; - + // Titan class M_Titan_AT: MissileBase {}; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 78f48250dd..122d690bae 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -13,7 +13,7 @@ _args = _this select 0; EXPLODE_7_PVT((_args select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if(!alive _projectile || isNull _projectile || isNull _shooter) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; }; _launchParams = _args select 1; diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf index 70ef644384..8e1de2cb3d 100644 --- a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -18,10 +18,8 @@ #include "script_component.hpp" -private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -_units = [_this,1,[],[[]]] call BIS_fnc_param; -_activated = [_this,2,true,[true]] call BIS_fnc_param; +private ["_ambianceSounds", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_missionRoot", "_unparsedSounds", "_splittedList", "_soundPath"]; +params ["_logic", "_units", "_activated"]; // We only play this on the locality of the logic, since the sounds are broadcasted across the network if (_activated && local _logic) then { @@ -34,51 +32,49 @@ if (_activated && local _logic) then { _volume = (_logic getVariable ["soundVolume", 30]) max 1; _followPlayers = _logic getVariable ["followPlayers", false]; - _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; + _splittedList = _unparsedSounds splitString ","; + _missionRoot = str missionConfigFile select [0, count str missionConfigFile - 15]; - _nilCheckPassedList = ""; { _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); - _splittedList set [_forEachIndex, _x]; - }forEach _splittedList; - _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; - { if (isClass (missionConfigFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushBack (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); + // CfgSounds accepts a leading backslash, but a double backslash + // is not accepted in the path, so we have to filter that. + _soundPath = getArray (missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0; + if (_soundPath select [0,1] == "\") then { + _ambianceSounds pushBack (_missionRoot + (_soundPath select [1])); + } else { + _ambianceSounds pushBack (_missionRoot + _soundPath); + }; } else { if (isClass (configFile >> "CfgSounds" >> _x)) then { _ambianceSounds pushBack ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); + } else { + ACE_LOGERROR_1("Ambient Sounds: Sound ""%1"" not found.",_x); }; }; - }forEach _splittedList; + + false + } count _splittedList; if (count _ambianceSounds == 0) exitWith {}; { - if !([".", _x, true] call BIS_fnc_inString) then { + if ((_x find ".") == -1) then { _ambianceSounds set [_forEachIndex, _x + ".wss"]; }; - }forEach _ambianceSounds; + } forEach _ambianceSounds; [{ - private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"]; - _args = _this select 0; - _logic = _args select 0; - _minDelayBetweensounds = _args select 4; - _maxDelayBetweenSounds = _args select 5; - _lastTimePlayed = _args select 8; + private ["_newPos", "_allUnits", "_targetUnit"]; + params ["_args", "_pfhHandle"]; + _args params ["_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers", "_lastTimePlayed"]; if (!alive _logic) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_pfhHandle] call CBA_fnc_removePerFrameHandler; }; if (ACE_time - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then { - _ambianceSounds = _args select 1; - _minimalDistance = _args select 2; - _maximalDistance = _args select 3; - - _volume = _args select 6; - _followPlayers = _args select 7; // Find all players in session. _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]}; @@ -87,7 +83,7 @@ if (_activated && local _logic) then { if (count _allUnits > 0) then { // Select a target unit at random. - _targetUnit = _allUnits select (round(random((count _allUnits)-1))); + _targetUnit = _allUnits call BIS_fnc_selectRandom; // find the position from which we are going to play this sound from. _newPos = (getPos _targetUnit); @@ -112,7 +108,7 @@ if (_activated && local _logic) then { // If no unit is to close to this position, we will play the sound. if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { - playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000]; + playSound3D [_ambianceSounds call BIS_fnc_selectRandom, objNull, false, _newPos, _volume, 1, 1000]; _args set [8, ACE_time]; }; }; diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp index b351e440b4..481687f89f 100644 --- a/addons/mk6mortar/CfgVehicles.hpp +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -52,6 +52,7 @@ class CfgVehicles { function = QFUNC(moduleInit); scope = 2; isGlobal = 0; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_mk6_ca.paa)); functionPriority = 0; class Arguments { diff --git a/addons/mk6mortar/RscInGameUI.hpp b/addons/mk6mortar/RscInGameUI.hpp index 740334886c..a114896044 100644 --- a/addons/mk6mortar/RscInGameUI.hpp +++ b/addons/mk6mortar/RscInGameUI.hpp @@ -9,8 +9,8 @@ class RscInGameUI { idc = 80085; colorText[] = {1, 1, 1, 1}; colorBackground[] = {0, 0, 0, 0.1}; - x = "(profilenamespace getvariable ['IGUI_GRID_WEAPON_X', ((safezoneX + safezoneW) - (12.4 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])"; - y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable ['IGUI_GRID_WEAPON_Y', (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])"; + x = "(profilenamespace getVariable ['IGUI_GRID_WEAPON_X', ((safezoneX + safezoneW) - (12.4 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])"; + y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getVariable ['IGUI_GRID_WEAPON_Y', (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])"; w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; }; diff --git a/addons/mk6mortar/functions/fnc_handleFired.sqf b/addons/mk6mortar/functions/fnc_handleFired.sqf index 6c2875d75e..d22b0efa47 100644 --- a/addons/mk6mortar/functions/fnc_handleFired.sqf +++ b/addons/mk6mortar/functions/fnc_handleFired.sqf @@ -59,8 +59,8 @@ if (_newMuzzleVelocityCoefficent != 1) then { PARAMS_2(_args,_pfID); EXPLODE_4_PVT(_args,_shell,_airFriction,_time,_relativeDensity); - if (isNull _shell || {!alive _shell}) exitwith { - [_pfID] call cba_fnc_removePerFrameHandler; + if (isNull _shell || {!alive _shell}) exitWith { + [_pfID] call CBA_fnc_removePerFrameHandler; }; _deltaT = ACE_time - _time; diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index 62d16f42ce..0b8cc67842 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -4,41 +4,46 @@ ["InitSettingsFromModules", { // TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it. // We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution. + + private _uniqueModulesHandled = []; { [_x] call { - private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"]; - _logic = _this select 0; - _logicType = typeof _logic; + params ["_logic"]; + private _logicType = typeOf _logic; _logic hideobject true; - if (_logic getvariable [QGVAR(initalized), false]) exitwith {}; - _config = (configFile >> "CfgVehicles" >> _logicType); - if !(isClass _config) exitwith {}; + if (_logic getVariable [QGVAR(initalized), false]) exitWith {}; + private _config = (configFile >> "CfgVehicles" >> _logicType); + if !(isClass _config) exitWith {}; - // isGlobal = 1; - _isGlobal = getNumber (_config >> "isGlobal") > 0; - _isDisposable = getNumber (_config >> "isDisposable") > 0; - _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; - _function = getText (_config >> "function"); - if (isnil _function) then { + private _isGlobal = getNumber (_config >> "isGlobal") > 0; + private _isDisposable = getNumber (_config >> "isDisposable") > 0; + private _isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1; + private _isSingular = getNumber (_config >> "isSingular") > 0; + private _function = getText (_config >> "function"); + if (isNil _function) then { _function = compile _function; } else { - _function = missionNamespace getvariable _function; + _function = missionNamespace getVariable _function; }; + if (_isSingular && {_logicType in _uniqueModulesHandled}) then { //ToDo: should this be an exit? + ACE_LOGWARNING_1("Module [%1] - More than 1 singular module placed", _logicType); + }; + if (_isSingular) then {_uniqueModulesHandled pushBack _logicType;}; if (_isGlobal || isServer) then { [_logic, (synchronizedObjects _logic), true] call _function; }; if !(_isPersistent) then { - _logic setvariable [QGVAR(initalized), true]; + _logic setVariable [QGVAR(initalized), true]; }; if (_isDisposable) then { deleteVehicle _logic; }; }; - }foreach GVAR(moduleInitCollection); + } forEach GVAR(moduleInitCollection); if (isServer) then { GVAR(serverModulesRead) = true; diff --git a/addons/modules/functions/fnc_moduleInit.sqf b/addons/modules/functions/fnc_moduleInit.sqf index 30d8046d81..5d42b4fa87 100644 --- a/addons/modules/functions/fnc_moduleInit.sqf +++ b/addons/modules/functions/fnc_moduleInit.sqf @@ -15,5 +15,5 @@ #include "script_component.hpp" if ((_this select 0) isKindOf "Module_F") then { - GVAR(moduleInitCollection) pushback (_this select 0); + GVAR(moduleInitCollection) pushBack (_this select 0); }; diff --git a/addons/movement/XEH_postInit.sqf b/addons/movement/XEH_postInit.sqf index ebe97e879d..108dc56792 100644 --- a/addons/movement/XEH_postInit.sqf +++ b/addons/movement/XEH_postInit.sqf @@ -32,4 +32,4 @@ if (!hasInterface) exitWith {}; true }, {false}, -[47, [false, true, false]], false] call cba_fnc_addKeybind; //DIK_V + CTRL//STRG +[47, [false, true, false]], false] call CBA_fnc_addKeybind; //DIK_V + CTRL//STRG diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index f6e28095b4..7ca13b5aeb 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { function = QFUNC(moduleNameTags); scope = 2; isGlobal = 1; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_NameTags_ca.paa)); class Arguments { class showPlayerNames { diff --git a/addons/nametags/RscTitles.hpp b/addons/nametags/RscTitles.hpp index 7f0ddc2135..f0d5678603 100644 --- a/addons/nametags/RscTitles.hpp +++ b/addons/nametags/RscTitles.hpp @@ -27,10 +27,10 @@ class RscTitles { size = 0.018; colorBackground[] = { 0, 0, 0, 0 }; colortext[] = { - "(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])", - "(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])", - "(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])", - "(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])" + "(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])", + "(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])", + "(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])", + "(profilenamespace getVariable ['IGUI_TEXT_RGB_A',0.8])" }; text = ""; class Attributes { diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index b828d70005..46d0e287d8 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -20,43 +20,7 @@ GVAR(showNamesTime) = -10; false }, {false}, -[29, [false, false, false]], false] call cba_fnc_addKeybind; //LeftControl Key - -// Monitor the assigned teams, and propegate them appropriately for the player -// This allows for assigned team colors to match across the entire group -[{ - private["_leader", "_playerIsLeader", "_unitTeam"]; - if (!(isNull ACE_player) && { alive ACE_player } ) then { - _leader = leader (group ACE_player); - _playerIsLeader = false; - - if(alive _leader) then { - if(_leader == ACE_player) then { - _playerIsLeader = true; - }; - }; - - if (_playerIsLeader) then { - { - if(alive _x) then { - _unitTeam = _x getVariable [QGVAR(teamAssignment),"MAIN"]; - if (_unitTeam != assignedTeam _x) then { - _x setVariable [QGVAR(teamAssignment), assignedTeam _x,true]; - }; - }; - } forEach units (group ACE_player); - } else { - { - if(alive _x) then { - _unitTeam = _x getVariable [QGVAR(teamAssignment),"MAIN"]; - if (_unitTeam != assignedTeam _x) then { - _x assignTeam _unitTeam; - }; - }; - } forEach units (group ACE_player); - }; - }; -}, 5, []] call CBA_fnc_addPerFrameHandler; +[29, [false, false, false]], false] call CBA_fnc_addKeybind; //LeftControl Key // Wait until the colors are defined before starting to draw the nametags ["SettingsInitialized", { diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index 7c98be16ed..8294a8db06 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -22,7 +22,7 @@ params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"]; -if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable +if ((_iconType == ICON_NONE) || {isObjectHidden _target}) exitWith {}; //Don't waste time if not visable private ["_position", "_color", "_name", "_size", "_icon", "_scale"]; @@ -30,7 +30,7 @@ private ["_position", "_color", "_name", "_size", "_icon", "_scale"]; _icon = ""; _size = 0; if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then { - _icon = QUOTE(PATHTOF(UI\soundwave)) + str (floor (random 10)) + ".paa"; + _icon = format ["%1%2%3",QUOTE(PATHTOF(UI\soundwave)), floor (random 10), ".paa"]; _size = 1; _alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking } else { @@ -57,20 +57,24 @@ if ((group _target) != (group _player)) then { _color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (assignedTeam _target)) max 0); }; +if (isNil "_color") then { + _color = [1, 1, 1, _alpha]; +}; + // Convert position to ASLW (expected by drawIcon3D) and add height offsets _position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)]); _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); drawIcon3D [ -_icon, -_color, -_position, -(_size * _scale), -(_size * _scale), -0, -_name, -2, -(0.05 * _scale), -"PuristaMedium" + _icon, + _color, + _position, + (_size * _scale), + (_size * _scale), + 0, + _name, + 2, + (0.05 * _scale), + "PuristaMedium" ]; diff --git a/addons/nametags/functions/fnc_initIsSpeaking.sqf b/addons/nametags/functions/fnc_initIsSpeaking.sqf index 3b8aea497a..7f9ced67f7 100644 --- a/addons/nametags/functions/fnc_initIsSpeaking.sqf +++ b/addons/nametags/functions/fnc_initIsSpeaking.sqf @@ -37,14 +37,14 @@ if (!hasInterface) exitWith {}; }] call EFUNC(common,addEventHandler); -if (isClass (configFile >> "cfgPatches" >> "acre_api")) then { +if (isClass (configFile >> "CfgPatches" >> "acre_api")) then { ACE_LOGINFO("ACRE Detected."); DFUNC(isSpeaking) = { params ["_unit"]; ([_unit] call acre_api_fnc_isSpeaking) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; } else { - if (isClass (configFile >> "cfgPatches" >> "task_force_radio")) then { + if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then { ACE_LOGINFO("TFR Detected."); DFUNC(isSpeaking) = { params ["_unit"]; diff --git a/addons/nightvision/ACE_Settings.hpp b/addons/nightvision/ACE_Settings.hpp new file mode 100644 index 0000000000..d6d52bab10 --- /dev/null +++ b/addons/nightvision/ACE_Settings.hpp @@ -0,0 +1,8 @@ +class ACE_Settings { + class GVAR(disableNVGsWithSights) { + displayName = CSTRING(DisableNVGsWithSights_DisplayName); + description = CSTRING(DisableNVGsWithSights_description); + typeName = "BOOL"; + value = 1; + }; +}; diff --git a/addons/nightvision/CfgVehicles.hpp b/addons/nightvision/CfgVehicles.hpp index 84e7105f0b..8b489ad64f 100644 --- a/addons/nightvision/CfgVehicles.hpp +++ b/addons/nightvision/CfgVehicles.hpp @@ -14,4 +14,28 @@ class CfgVehicles { MACRO_ADDITEM(ACE_NVG_Wide,6); }; }; + + class ACE_Module; + class GVAR(ModuleSettings): ACE_Module { + scope = 2; + displayName = CSTRING(Module_DisplayName); + icon = QUOTE(PATHTOF(UI\Icon_Module_ca.paa)); + category = "ACE"; + function = QUOTE(FUNC(initModule)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "BaerMitUmlaut"; + class Arguments { + class disableNVGsWithSights { + displayName = CSTRING(DisableNVGsWithSights_DisplayName); + description = CSTRING(DisableNVGsWithSights_Description); + typeName = "BOOL"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = CSTRING(Module_Description); + }; + }; }; diff --git a/addons/nightvision/UI/Icon_Module_ca.paa b/addons/nightvision/UI/Icon_Module_ca.paa new file mode 100644 index 0000000000..556adaf30c Binary files /dev/null and b/addons/nightvision/UI/Icon_Module_ca.paa differ diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index 2839f6e5f9..0df7270317 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -30,9 +30,15 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; // Setup the event handlers ["playerInventoryChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); -["playerVisionModeChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); +["playerVisionModeChanged", { + _this call FUNC(updatePPEffects); + _this call FUNC(onVisionModeChanged); +}] call EFUNC(common,addEventHandler); ["zeusDisplayChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); -["cameraViewChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); +["cameraViewChanged", { + _this call FUNC(updatePPEffects); + _this call FUNC(onCameraViewChanged); +}] call EFUNC(common,addEventHandler); ["playerVehicleChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); ["playerTurretChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); @@ -49,7 +55,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; true }, {false}, -[201, [false, false, true]], false] call cba_fnc_addKeybind; //PageUp + ALT +[201, [false, false, true]], false] call CBA_fnc_addKeybind; //PageUp + ALT ["ACE3 Equipment", QGVAR(DecreaseNVGBrightness), localize LSTRING(DecreaseNVGBrightness), { @@ -63,4 +69,4 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; true }, {false}, -[209, [false, false, true]], false] call cba_fnc_addKeybind; //PageDown + ALT +[209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT diff --git a/addons/nightvision/XEH_preInit.sqf b/addons/nightvision/XEH_preInit.sqf index 27f8ea7d48..ed02b9524e 100644 --- a/addons/nightvision/XEH_preInit.sqf +++ b/addons/nightvision/XEH_preInit.sqf @@ -4,6 +4,9 @@ ADDON = false; PREP(blending); PREP(changeNVGBrightness); +PREP(initModule); +PREP(onCameraViewChanged); +PREP(onVisionModeChanged); PREP(updatePPEffects); ADDON = true; diff --git a/addons/nightvision/config.cpp b/addons/nightvision/config.cpp index 4e6aa2e39a..1edeca6e5b 100644 --- a/addons/nightvision/config.cpp +++ b/addons/nightvision/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "ACE_Settings.hpp" diff --git a/addons/nightvision/functions/fnc_initModule.sqf b/addons/nightvision/functions/fnc_initModule.sqf new file mode 100644 index 0000000000..6831a29edf --- /dev/null +++ b/addons/nightvision/functions/fnc_initModule.sqf @@ -0,0 +1,21 @@ +/* + * Author: BaerMitUmlaut + * Initializes the settings for the disable NVGs in sight module. + * + * Arguments: + * 0: Module + * + * Return Value: + * None + * + * Example: + * [_module] call ace_nightvision_fnc_initModule + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_module"]; + +[_module, QGVAR(disableNVGsWithSights), "disableNVGsWithSights"] call EFUNC(common,readSettingFromModule); diff --git a/addons/nightvision/functions/fnc_onCameraViewChanged.sqf b/addons/nightvision/functions/fnc_onCameraViewChanged.sqf new file mode 100644 index 0000000000..5384d6924c --- /dev/null +++ b/addons/nightvision/functions/fnc_onCameraViewChanged.sqf @@ -0,0 +1,38 @@ +/* + * Author: BaerMitUmlaut + * Disables/re-enables NVGs when the player starts/stops aiming down his sight. + * + * Arguments: + * 0: Unit + * 1: New camera view + * + * Return Value: + * None + * + * Example: + * [player, "GUNNER"] call ace_nightvision_fnc_onCameraViewChanged + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_cameraView"]; + +if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then { + if ((vehicle _unit == _unit) + || {isTurnedOut _unit} + || {!([_unit] call EFUNC(common,hasHatch)) + && {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))} + }) then { + if ((_cameraView == "GUNNER") && {currentVisionMode _unit == 1}) then { + _unit action ["NVGogglesOff", _unit]; + _unit setVariable [QGVAR(reenableNVGs), true]; + } else { + if (_unit getVariable [QGVAR(reenableNVGs), false] && {_cameraView != "GUNNER"}) then { + _unit action ["NVGoggles", _unit]; + _unit setVariable [QGVAR(reenableNVGs), false]; + }; + }; + }; +}; diff --git a/addons/nightvision/functions/fnc_onVisionModeChanged.sqf b/addons/nightvision/functions/fnc_onVisionModeChanged.sqf new file mode 100644 index 0000000000..64f77a69bc --- /dev/null +++ b/addons/nightvision/functions/fnc_onVisionModeChanged.sqf @@ -0,0 +1,32 @@ +/* + * Author: BaerMitUmlaut + * Disables turning on NVGs while the player aims down his sight. + * + * Arguments: + * 0: Unit + * 1: New vision mode + * + * Return Value: + * None + * + * Example: + * [player, 1] call ace_nightvision_fnc_onVisionModeChanged + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_visionMode"]; + +if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then { + if ((vehicle _unit == _unit) + || {isTurnedOut _unit} + || {!([_unit] call EFUNC(common,hasHatch)) + && {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))} + }) then { + if ((cameraView == "GUNNER") && {_visionMode > 0}) then { + _unit action ["NVGogglesOff", _unit]; + }; + }; +}; diff --git a/addons/nightvision/stringtable.xml b/addons/nightvision/stringtable.xml index 050945d5d8..b6e35147f9 100644 --- a/addons/nightvision/stringtable.xml +++ b/addons/nightvision/stringtable.xml @@ -133,5 +133,21 @@ Diminuir Luminosidade do EVN Riduci la luminosità dell'NVG + + Nightvision + Nachtsicht + + + Settings for night vision. + Einstellungen für Nachtsichtgeräte. + + + Disable NVGs in scope + Deakt. NVGs mit Visier + + + Blocks the usage of night vision goggles whilst aiming down the sight. + Blockiert das Benutzen von Nachtsichtbrillen beim Benutzen des Visiers. + - \ No newline at end of file + diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index 6214178ac9..bed38a5ced 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -6,8 +6,8 @@ if (!hasInterface) exitWith {}; GVAR(camera) = objNull; 0 = 0 spawn { - waituntil {!isNull ACE_player}; - waituntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; + waitUntil {!isNull ACE_player}; + waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; camDestroy GVAR(camera); diff --git a/addons/optionsmenu/CfgVehicles.hpp b/addons/optionsmenu/CfgVehicles.hpp index 1357417add..cbe03a4cfb 100644 --- a/addons/optionsmenu/CfgVehicles.hpp +++ b/addons/optionsmenu/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QUOTE(DFUNC(moduleAllowConfigExport)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/optionsmenu/XEH_postInit.sqf b/addons/optionsmenu/XEH_postInit.sqf index a981c34e0b..4736d72623 100644 --- a/addons/optionsmenu/XEH_postInit.sqf +++ b/addons/optionsmenu/XEH_postInit.sqf @@ -2,10 +2,10 @@ #include "script_component.hpp" ["SettingsInitialized", { - GVAR(categories) pushback ""; //Ensure All Catagories is at top + GVAR(categories) pushBack ""; //Ensure All Catagories is at top { if !(_x select 8 in GVAR(categories)) then { - GVAR(categories) pushback (_x select 8); + GVAR(categories) pushBack (_x select 8); }; - }foreach EGVAR(common,settings); + }forEach EGVAR(common,settings); }] call EFUNC(common,addEventHandler); diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 755982e569..be771f7a3a 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -67,7 +67,7 @@ _text = format [" { _var = missionNamespace getVariable [_x, nil]; - if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { + if(!isnil "_var" && {_var isEqualType []} && {(count _var) > MIN_ARRAY_SIZE}) then { _text = format ["%1 - ARRAY SIZE: %2", _x, (count _var)]; [_text] call _outputText; }; @@ -77,7 +77,7 @@ _text = format [" _unit = _x; { _var = _unit getVariable [_x, nil]; - if(!isnil "_var" && {(typeName _var) == "ARRAY"} && {(count _var) > MIN_ARRAY_SIZE}) then { + if(!isnil "_var" && {_var isEqualType []} && {(count _var) > MIN_ARRAY_SIZE}) then { _text = format ["%1 on [%2] - ARRAY SIZE: %3", _x, _unit, (count _var)]; [_text] call _outputText; }; diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index 172a95808e..e798784871 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -39,7 +39,7 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize _defaultValue = _x select 6; if (GVAR(ClientSettingsExportIncluded) || !_isClientSetable) then { - _value = missionNamespace getvariable [_name, _defaultValue]; + _value = missionNamespace getVariable [_name, _defaultValue]; _formatedValue = switch (toLower _typeName) do { case ("scalar"): { format['value = %1;', _value]; @@ -48,8 +48,8 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize format['value = "%1";', _value]; }; case ("bool"): { - if (typeName _value != "BOOL") then {ERROR("weird bool typename??");}; - _value = if (((typeName _value) == "BOOL") && {_value}) then {1} else {0}; + if (!(_value isEqualType false)) then {ERROR("weird bool typename??");}; + _value = if ((_value isEqualType false) && {_value}) then {1} else {0}; format ['value = %1;', _value]; }; case ("color"): { diff --git a/addons/optionsmenu/functions/fnc_moduleAllowConfigExport.sqf b/addons/optionsmenu/functions/fnc_moduleAllowConfigExport.sqf index d756a0ef83..5b302a510d 100644 --- a/addons/optionsmenu/functions/fnc_moduleAllowConfigExport.sqf +++ b/addons/optionsmenu/functions/fnc_moduleAllowConfigExport.sqf @@ -16,9 +16,9 @@ private ["_logic"]; _logic = _this select 0; -if (isMultiplayer) exitwith {}; +if (isMultiplayer) exitWith {}; -if (_logic getvariable ["allowconfigurationExport", false]) then { +if (_logic getVariable ["allowconfigurationExport", false]) then { GVAR(serverConfigGeneration) = 1; } else { GVAR(serverConfigGeneration) = 0; diff --git a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf index 6c0cb56519..8e09608e07 100644 --- a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf @@ -18,7 +18,7 @@ private ["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_defaultValue", "_setting", "_menu", "_settingsMenu"]; -if (GVAR(serverConfigGeneration) == 0 || isMultiplayer) exitwith {closeDialog 145246;}; +if (GVAR(serverConfigGeneration) == 0 || isMultiplayer) exitWith {closeDialog 145246;}; // Filter only user setable setting GVAR(serverSideOptions) = []; @@ -57,7 +57,7 @@ GVAR(serverSideValues) = []; [{ [MENU_TAB_SERVER_OPTIONS] call FUNC(onServerListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame); disableSerialization; -_menu = uiNamespace getvariable "ACE_serverSettingsMenu"; +_menu = uiNamespace getVariable "ACE_serverSettingsMenu"; (_menu displayCtrl 1003) ctrlEnable false; if (GVAR(ClientSettingsExportIncluded)) then { diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index c71a26a6e7..104d8195cf 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -44,7 +44,7 @@ GVAR(clientSideColors) = []; [{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame); disableSerialization; -_menu = uiNamespace getvariable "ACE_settingsMenu"; +_menu = uiNamespace getVariable "ACE_settingsMenu"; (_menu displayCtrl 1002) ctrlEnable false; (_menu displayCtrl 1003) ctrlEnable false; diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf index 87532aaf86..dfffbca6a6 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf @@ -57,7 +57,7 @@ if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then { _settingsValue = [0, 1] select _settingsValue; } else { lbClear 400; - { lbAdd [400, _x]; } foreach _possibleValues; + { lbAdd [400, _x]; } forEach _possibleValues; }; (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf index fc745c37be..9718da3988 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf @@ -50,7 +50,7 @@ switch (GVAR(optionMenu_openTab)) do { _added = _ctrlList lnbAddRow [_settingName, _settingsText]; _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - }foreach GVAR(serverSideOptions); + }forEach GVAR(serverSideOptions); }; case (MENU_TAB_SERVER_COLORS): { { @@ -70,7 +70,7 @@ switch (GVAR(optionMenu_openTab)) do { _ctrlList lnbSetColor [[_added, 1], (_x select 9)]; _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - }foreach GVAR(serverSideColors); + }forEach GVAR(serverSideColors); }; case (MENU_TAB_SERVER_VALUES): { { @@ -81,13 +81,13 @@ switch (GVAR(optionMenu_openTab)) do { (_x select 0); }; _settingsValue = _x select 9; - if (typeName _settingsValue != "STRING") then { + if (!(_settingsValue isEqualType "")) then { _settingsValue = format["%1", _settingsValue]; }; _added = _ctrlList lnbAddRow [_settingName, _settingsValue]; _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - }foreach GVAR(serverSideValues); + }forEach GVAR(serverSideValues); }; }; if (_updateKeyView) then { diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 64f45121e5..defef99395 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -58,7 +58,7 @@ if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then { _settingsValue = [0, 1] select _settingsValue; } else { lbClear 400; - { lbAdd [400, _x]; } foreach _possibleValues; + { lbAdd [400, _x]; } forEach _possibleValues; }; (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index 96a45a1b83..4ab0bf83fa 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -38,12 +38,17 @@ switch (GVAR(optionMenu_openTab)) do { _settingsText = if ((_x select 1) == "BOOL") then { [(localize ELSTRING(common,No)), (localize ELSTRING(common,Yes))] select _settingsValue; } else { - (_x select 5) select _settingsValue; + private _values = _x select 5; + if !((!isNil "_values") && {_values isEqualType []} && {_settingsValue >= 0} && {_settingsValue < (count _values)}) exitWith { + ACE_LOGERROR_3("Setting (%1) has bad values (%2) for index (%3)", _settingName, _values, _settingsValue); + "ERROR" + }; + _values select _settingsValue; }; _added = _ctrlList lnbAddRow [_settingName, _settingsText]; _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - } foreach GVAR(clientSideOptions); + } forEach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { @@ -59,7 +64,7 @@ switch (GVAR(optionMenu_openTab)) do { _ctrlList lnbSetColor [[_added, 1], (_x select 9)]; _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - }foreach GVAR(clientSideColors); + }forEach GVAR(clientSideColors); }; }; if (_updateKeyView) then { diff --git a/addons/optionsmenu/functions/fnc_stringEscape.sqf b/addons/optionsmenu/functions/fnc_stringEscape.sqf index 1493f76445..09e1357a31 100644 --- a/addons/optionsmenu/functions/fnc_stringEscape.sqf +++ b/addons/optionsmenu/functions/fnc_stringEscape.sqf @@ -25,7 +25,7 @@ _isEven = { if (_forEachIndex <= _index && {_x == 39}) then { _count = _count + 1; }; - }foreach _array; + }forEach _array; _count %2 == 0; }; @@ -35,9 +35,9 @@ _isEven = { _array = toArray _str; { if (_x == 34) then { - _array set [_foreachIndex, 39]; + _array set [_forEachIndex, 39]; }; -}foreach _array; +}forEach _array; _maxIndex = count _array; for "_i" from 0 to _maxIndex /* step +1 */ do { @@ -52,8 +52,8 @@ for "_i" from 0 to _maxIndex /* step +1 */ do { { if (_x == 34) then { - _array set [_foreachIndex, 39]; + _array set [_forEachIndex, 39]; }; -}foreach _array; +}forEach _array; toString _array; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 25fa06c604..7374d1f2c1 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -38,7 +38,7 @@ switch (_type) do { } ; }; - } foreach GVAR(clientSideOptions); + } forEach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { @@ -46,7 +46,7 @@ switch (_type) do { _changed = true; _x set [9, _newValue]; }; - } foreach GVAR(clientSideColors); + } forEach GVAR(clientSideColors); }; case (MENU_TAB_SERVER_OPTIONS): { { @@ -62,7 +62,7 @@ switch (_type) do { } ; }; - } foreach GVAR(serverSideOptions); + } forEach GVAR(serverSideOptions); }; case (MENU_TAB_SERVER_COLORS): { { @@ -70,7 +70,7 @@ switch (_type) do { _changed = true; _x set [9, _newValue]; }; - } foreach GVAR(serverSideColors); + } forEach GVAR(serverSideColors); }; case (MENU_TAB_SERVER_VALUES): { { @@ -78,14 +78,14 @@ switch (_type) do { _changed = true; _x set [9, _newValue]; }; - } foreach GVAR(serverSideValues); + } forEach GVAR(serverSideValues); }; }; if (_changed) then { if (GVAR(serverConfigGeneration) > 0) then { if !(isMultiplayer) then { - missionNamespace setvariable [_name, _newValue]; + missionNamespace setVariable [_name, _newValue]; }; } else { profileNamespace setVariable [_name, _newValue]; diff --git a/addons/optionsmenu/gui/pauseMenu.hpp b/addons/optionsmenu/gui/pauseMenu.hpp index 513692eaab..3333c5476f 100644 --- a/addons/optionsmenu/gui/pauseMenu.hpp +++ b/addons/optionsmenu/gui/pauseMenu.hpp @@ -166,8 +166,8 @@ class RscDisplayMain: RscStandardDisplay { fontBold = "PuristaLight"; }; colorBold[] = {0.6,0.6,0.6,1}; - colorLink[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; - colorLinkActive[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorLink[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])",1}; + colorLinkActive[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])",1}; }; }; }; diff --git a/addons/optionsmenu/gui/settingsMenu.hpp b/addons/optionsmenu/gui/settingsMenu.hpp index cd65eb966d..37950b1c42 100644 --- a/addons/optionsmenu/gui/settingsMenu.hpp +++ b/addons/optionsmenu/gui/settingsMenu.hpp @@ -33,15 +33,15 @@ class ACE_settingsMenu { font = "PuristaMedium"; SizeEx = H_PART(1); colorText[] = {0.95, 0.95, 0.95, 0.75}; - colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; text = ""; }; class CenterBackground: HeaderBackground { y = Y_PART(2.1); h = H_PART(2.5); text = ""; - colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; - colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorText[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {0,0,0,"(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; }; class LeftBackground: CenterBackground { y = Y_PART(4.8); diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index 1b64d7f0b0..c1212af0e8 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -18,4 +18,4 @@ if (!hasInterface) exitWith {}; true }, {false}, -[19, [true, false, false]], false] call cba_fnc_addKeybind; //R Key +[19, [true, false, false]], false] call CBA_fnc_addKeybind; //R Key diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index fd3081f7eb..000cd44021 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -34,7 +34,7 @@ _fnc_stopCurrentBurst = { if (diag_frameno == _startFrame) exitWith {}; // Remove the PFH on the second execution - [_pfhId] call cba_fnc_removePerFrameHandler; + [_pfhId] call CBA_fnc_removePerFrameHandler; _unit setAmmo [_weapon, _ammo]; }; diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index d7f40c4d91..6680b759c4 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -161,7 +161,7 @@ if (stance _unit == "PRONE") then { }; }; -if ("Jam" in (missionNamespace getvariable ["ACE_Debug", []])) then { +if ("Jam" in (missionNamespace getVariable ["ACE_Debug", []])) then { _jamChance = 0.5; }; diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf index 1653fce9e1..02da9e9564 100644 --- a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf +++ b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf @@ -41,14 +41,14 @@ _var params["_backblastAngle","_backblastRange","_backblastDamage"]; // Damage to others private "_affected"; -_affected = getPos _projectile nearEntities ["CAManBase", _backblastRange]; +_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; // Let each client handle their own affected units -["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); +["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); // Damage to the firer private "_distance"; -_distance = [_position, _direction, _backblastRange] call FUNC(getDistance); +_distance = [_position, _direction, _backblastRange, _firer] call FUNC(getDistance); TRACE_1("Distance",_distance); @@ -62,7 +62,7 @@ if (_distance < _backblastRange) then { [_damage * 100] call BIS_fnc_bloodEffect; if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then { - [_firer, "body", ((_firer getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]) select 1) + _damage, _firer, "backblast", 0] call EFUNC(medical,handleDamage); + [_firer, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit); } else { _firer setDamage (damage _firer + _damage); }; diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf index 3068928ba4..02de0eb311 100644 --- a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf +++ b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf @@ -40,7 +40,7 @@ _var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; // Damage to others private "_affected"; -_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; +_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; // Let each client handle their own affected units ["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index 3b3103d951..cabdd267fa 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -7,60 +7,45 @@ * 0: Pos ASL of origin (ARRAY> * 1: Direction * 2: Max distance to search + * 3: Shooter * * Return value: - * Distance to intersection (+- 0.1 m) + * Distance to intersection (999 if distance is greater than max) + * + * Example: + * [[1823.41,5729.05,6.66627], [-0.953255,0.109689,-0.281554], 15, ace_player] call ace_overpressure_fnc_getDistance + * */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance); +params ["_posASL", "_direction", "_maxDistance", "_shooter"]; +TRACE_3("params",_posASL,_direction,_maxDistance); -private ["_distance", "_interval", "_line", "_intersections", "_terrainIntersect", "_lastTerrainIntersect"]; +private _intersections = lineIntersectsSurfaces [_posASL, _posASL vectorAdd (_direction vectorMultiply _maxDistance), _shooter, objNull, true, 99]; -_distance = _maxDistance; -_interval = _distance; -_line = [_posASL, []]; -_terrainIntersect = false; -_lastTerrainIntersect = false; +TRACE_1("lineIntersectsSurfaces",_intersections); -while { - _interval > 0.1 -} do { - _lastTerrainIntersect = _terrainIntersect; - _interval = _interval / 2; +private _distance = 999; - _line set [1, _posASL vectorAdd (_direction vectorMultiply _distance)]; +{ + _x params ["_intersectPosASL", "_surfaceNormal", "_intersectObject"]; - _intersections = { - _x isKindOf "Static" || {_x isKindOf "AllVehicles"} - } count (lineIntersectsWith _line); + //Hit something solid that can reflect - (Static covers Building) + if ((isNull _intersectObject) || {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}) exitWith { + _distance = _posASL vectorDistance _intersectPosASL; + TRACE_3("hit solid object",_distance,_intersectObject,typeOf _intersectObject); - _terrainIntersect = if (_intersections > 0) then { - false - } else { - terrainIntersectASL _line + if (isNull _intersectObject) then { //Terrain: + // Calculate the angle between the terrain and the back blast direction + _angle = 90 - acos (- (_surfaceNormal vectorDotProduct _direction)); + TRACE_3("Terrain Intersect",_surfaceNormal,_direction,_angle); + // Angles is below 25deg, no backblast at all + if (_angle < 25) exitWith {_distance = 999}; + // Angles is below 45deg the distance is increased according to the difference + if (_angle < 45) exitWith {_distance = _distance * (5 - 4 * sqrt ((_angle - 25)/20))}; + // Angles above 45degcreate full backblast + }; }; - - _distance = _distance + ([1, -1] select (_intersections > 0 || _terrainIntersect)) * _interval; - - if (_distance > _maxDistance) exitWith {_distance = 999}; -}; - -if (_distance > _maxDistance) exitWith {_distance}; - -// If the intersection was with the terrain, check slope -if (_terrainIntersect || _lastTerrainIntersect) exitWith { - private ["_slope","_angle"]; - _slope = surfaceNormal (_posASL vectorAdd (_direction vectorMultiply _distance)); - // Calculate the angle between the terrain and the back blast direction - _angle = 90 - acos (- (_slope vectorDotProduct _direction)); - - //systemChat format ["Angle: %1", _angle]; - // Angles is below 25º, no backblast at all - if (_angle < 25) exitWith {_distance = 999}; - // Angles is below 45º the distance is increased according to the difference - if (_angle < 45) exitWith {_distance = _distance * (5 - 4 * sqrt ((_angle - 25)/20))}; - // Angles above 45º create full backblast -}; +} forEach _intersections; _distance diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index a39aec3c14..b1c8a5c574 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -30,12 +30,6 @@ _var params["_overpressureAngle","_overpressureRange","_overpressureDamage"]; TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon); -private "_pos"; -_pos = _posASL; -if (!surfaceIsWater _pos) then { - _pos = ASLtoATL _pos; -}; - { if (local _x && {_x != _firer} && {vehicle _x == _x}) then { private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; @@ -62,10 +56,10 @@ if (!surfaceIsWater _pos) then { if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_x] call EFUNC(medical,hasMedicalEnabled))}) then { - [_x, "body", ((_x getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]) select 1) + _damage, _firer, "backblast", 0] call EFUNC(medical,handleDamage); + [_x, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit); } else { _x setDamage (damage _x + _damage); }; }; }; -} forEach (_pos nearEntities ["CAManBase", _overpressureRange]); +} forEach ((ASLtoAGL _posASL) nearEntities ["CAManBase", _overpressureRange]); diff --git a/addons/parachute/XEH_postInit.sqf b/addons/parachute/XEH_postInit.sqf index 46dd21b99c..598661a3da 100644 --- a/addons/parachute/XEH_postInit.sqf +++ b/addons/parachute/XEH_postInit.sqf @@ -30,7 +30,7 @@ if (!hasInterface) exitWith {}; true }, {false}, -[24, [false, false, false]], false] call cba_fnc_addKeybind; +[24, [false, false, false]], false] call CBA_fnc_addKeybind; GVAR(PFH) = false; ["playerVehicleChanged",{ diff --git a/addons/parachute/functions/fnc_checkCutParachute.sqf b/addons/parachute/functions/fnc_checkCutParachute.sqf index 8301007fa3..dfe22b4bc0 100644 --- a/addons/parachute/functions/fnc_checkCutParachute.sqf +++ b/addons/parachute/functions/fnc_checkCutParachute.sqf @@ -16,4 +16,4 @@ #include "script_component.hpp" private["_unit"]; _unit = _this select 0; -(vehicle _unit isKindOf 'ParachuteBase' && !(_unit getvariable [QGVAR(chuteIsCut),false]) && (_unit getvariable [QGVAR(hasReserve),false])) \ No newline at end of file +(vehicle _unit isKindOf 'ParachuteBase' && !(_unit getVariable [QGVAR(chuteIsCut),false]) && (_unit getVariable [QGVAR(hasReserve),false])) \ No newline at end of file diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf index 7a90a1f12c..cc32724e9d 100644 --- a/addons/parachute/functions/fnc_doLanding.sqf +++ b/addons/parachute/functions/fnc_doLanding.sqf @@ -22,6 +22,6 @@ _unit setVariable [QGVAR(chuteIsCut), false, true]; [{ if (ACE_time >= ((_this select 0) select 0) + 1) then { ((_this select 0) select 1) playActionNow "Crouch"; - [(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler); + [(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler); }; }, 1, [ACE_time,_unit]] call CALLSTACK(CBA_fnc_addPerFrameHandler); diff --git a/addons/parachute/functions/fnc_onEachFrame.sqf b/addons/parachute/functions/fnc_onEachFrame.sqf index dbfab16452..94d5a99748 100644 --- a/addons/parachute/functions/fnc_onEachFrame.sqf +++ b/addons/parachute/functions/fnc_onEachFrame.sqf @@ -16,16 +16,16 @@ #include "script_component.hpp" private "_player"; _player = ACE_player; -if (!GVAR(PFH)) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);}; -if (isNull _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; -if !((vehicle _player) isKindOf "ParachuteBase") exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; -if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; +if (!GVAR(PFH)) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);}; +if (isNull _player) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;}; +if !((vehicle _player) isKindOf "ParachuteBase") exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;}; +if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;}; private ["_pos"]; _pos = getPosASL (vehicle _player); if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then { - [(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler); + [(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler); GVAR(PFH) = false; // I believe this will not work for Zeus units. deleteVehicle (vehicle _player); diff --git a/addons/parachute/functions/fnc_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf index 6f4159e85d..466abfb77e 100644 --- a/addons/parachute/functions/fnc_showAltimeter.sqf +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -23,10 +23,10 @@ if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {} GVAR(AltimeterActive) = true; [{ - if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler)}; + if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CALLSTACK(CBA_fnc_removePerFrameEventHandler)}; disableSerialization; (_this select 0) params ["_display", "_unit", "_oldHeight", "_prevTime"]; - if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler); call FUNC(hideAltimeter)}; + if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CALLSTACK(CBA_fnc_removePerFrameEventHandler); call FUNC(hideAltimeter)}; private ["_height", "_hour", "_minute", "_descentRate","_HeightText", "_DecendRate", "_TimeText", "_curTime", "_timeDiff"]; diff --git a/addons/parachute/functions/fnc_storeParachute.sqf b/addons/parachute/functions/fnc_storeParachute.sqf index baa93bbae0..42ad18b304 100644 --- a/addons/parachute/functions/fnc_storeParachute.sqf +++ b/addons/parachute/functions/fnc_storeParachute.sqf @@ -18,7 +18,7 @@ private ["_unit","_backpack"]; _unit = _this select 0; _backpack = (_this select 1) select 6; -if ((vehicle _unit) isKindOf "ParachuteBase" && backpack _unit == "" && !(_unit getVariable [QGVAR(chuteIsCut),false]) && (_unit getvariable [QGVAR(hasReserve),false])) then { +if ((vehicle _unit) isKindOf "ParachuteBase" && backpack _unit == "" && !(_unit getVariable [QGVAR(chuteIsCut),false]) && (_unit getVariable [QGVAR(hasReserve),false])) then { _unit addBackpackGlobal (_unit getVariable[QGVAR(backpackClass),"ACE_NonSteerableParachute"]); } else { if ([false,true] select (getNumber(configFile >> "CfgVehicles" >> _backpack >> "ace_hasReserveParachute"))) then { diff --git a/addons/rearm/$PBOPREFIX$ b/addons/rearm/$PBOPREFIX$ new file mode 100644 index 0000000000..7acbc38009 --- /dev/null +++ b/addons/rearm/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\rearm \ No newline at end of file diff --git a/addons/rearm/ACE_Settings.hpp b/addons/rearm/ACE_Settings.hpp new file mode 100644 index 0000000000..f4d6562807 --- /dev/null +++ b/addons/rearm/ACE_Settings.hpp @@ -0,0 +1,9 @@ +class ACE_Settings { + class GVAR(level) { + displayName = CSTRING(RearmSettings_level_DisplayName); + description = CSTRING(RearmSettings_level_Description); + value = 0; + typeName = "SCALAR"; + values[] = {CSTRING(RearmSettings_vehicle), CSTRING(RearmSettings_magazine), CSTRING(RearmSettings_caliber)}; + }; +}; diff --git a/addons/rearm/CfgAmmo.hpp b/addons/rearm/CfgAmmo.hpp new file mode 100644 index 0000000000..2443ab91a5 --- /dev/null +++ b/addons/rearm/CfgAmmo.hpp @@ -0,0 +1,200 @@ +class CfgAmmo { + + class BombCore; + class BombBase : BombCore { + GVAR(caliber) = 250; // Default caliber for bombs + }; + class LaserBombCore : BombCore { + GVAR(caliber) = 250; // Default caliber for bombs + }; + class MissileCore; + class MissileBase : MissileCore { + GVAR(caliber) = 250; // Default caliber for missiles + }; + class Missile_AA_04_F : MissileBase { + GVAR(dummy) = QGVAR(Missile_AA_04_F); + }; + class Missile_AA_03_F : Missile_AA_04_F { + GVAR(dummy) = QGVAR(Missile_AA_03_F); + }; + + class Rocket_04_HE_F : MissileBase { + GVAR(caliber) = 70; + GVAR(dummy) = QGVAR(Rocket_04_HE_F); + }; + class Rocket_03_HE_F : Rocket_04_HE_F { + GVAR(dummy) = QGVAR(Rocket_03_HE_F); + }; + class Rocket_04_AP_F : Rocket_04_HE_F { + GVAR(dummy) = QGVAR(Rocket_04_AP_F); + }; + class Rocket_03_AP_F : Rocket_04_AP_F { + GVAR(dummy) = QGVAR(Rocket_03_AP_F); + }; + class M_PG_AT : MissileBase { + GVAR(caliber) = 70; + GVAR(dummy) = QGVAR(M_PG_AT); + }; + class Missile_AGM_02_F : MissileBase { + GVAR(dummy) = QGVAR(Missile_AGM_02_F); + }; + class Missile_AGM_01_F : Missile_AGM_02_F { + GVAR(dummy) = QGVAR(Missile_AGM_01_F); + }; + + class RocketCore; + class RocketBase : RocketCore { + GVAR(caliber) = 70; // Default caliber for rockets + }; + class R_80mm_HE : RocketBase { + GVAR(caliber) = 80; + GVAR(dummy) = QGVAR(R_80mm_HE); + }; + class R_60mm_HE : R_80mm_HE { + GVAR(caliber) = 60; + GVAR(dummy) = QGVAR(R_60mm_HE); + }; + class R_Hydra_HE : RocketBase { + GVAR(dummy) = QGVAR(R_Hydra_HE); + }; + + class BulletBase; + class B_19mm_HE : BulletBase { + GVAR(caliber) = 19; + }; + + class B_20mm : BulletBase { + GVAR(caliber) = 20; + }; + + class B_25mm : BulletBase { + GVAR(caliber) = 25; + }; + + class B_30mm_AP : BulletBase { + GVAR(caliber) = 30; + }; + class B_30mm_HE : B_19mm_HE { + GVAR(caliber) = 30; + }; + class Gatling_30mm_HE_Plane_CAS_01_F : BulletBase { + GVAR(caliber) = 30; + }; + + class B_35mm_AA : BulletBase { + GVAR(caliber) = 35; + }; + + class B_30mm_APFSDS; + class B_40mm_APFSDS : B_30mm_APFSDS { + GVAR(caliber) = 40; + }; + + class B_40mm_GPR : B_30mm_HE { + GVAR(caliber) = 40; + }; + + class GrenadeBase; + class G_40mm_HE : GrenadeBase { + GVAR(caliber) = 39; + }; + + class ShellBase; + class R_230mm_fly : ShellBase { + GVAR(dummy) = QGVAR(R_230mm_fly); + }; + + class Sh_120mm_APFSDS : Shellbase { + GVAR(caliber) = 120; + }; + class Sh_105mm_APFSDS : Sh_120mm_APFSDS { + GVAR(caliber) = 105; + }; + class Sh_125mm_APFSDS : Sh_120mm_APFSDS { + GVAR(caliber) = 125; + }; + + class Sh_120mm_HE : ShellBase { + GVAR(caliber) = 120; + }; + class Sh_125mm_HE : Sh_120mm_HE { + GVAR(caliber) = 125; + }; + class Sh_125mm_HEAT : Sh_125mm_HE { + GVAR(caliber) = 125; + }; + class Sh_105mm_HEAT_MP : Sh_125mm_HEAT { + GVAR(caliber) = 105; + }; + + class Sh_155mm_AMOS : ShellBase { + GVAR(caliber) = 155; + }; + class Sh_82mm_AMOS : Sh_155mm_AMOS { + GVAR(caliber) = 82; + }; + + class Sh_82mm_AMOS_LG; + class Sh_155mm_AMOS_LG : Sh_82mm_AMOS_LG { + GVAR(caliber) = 155; + }; + + class ShotDeployBase; + class Smoke_82mm_AMOS_White : ShotDeployBase { + GVAR(caliber) = 82; + }; + + class FlareCore; + class Flare_82mm_AMOS_White : FlareCore { + GVAR(caliber) = 82; + }; + + class SmokeLauncherAmmo : BulletBase { + GVAR(caliber) = 250; + }; + + class CMflareAmmo : BulletBase { + GVAR(caliber) = 39; + }; + + class SubmunitionBase; + class Sh_82mm_AMOS_guided : SubmunitionBase { + GVAR(caliber) = 82; + }; + class Sh_155mm_AMOS_guided : Sh_82mm_AMOS_guided { + GVAR(caliber) = 155; + }; + class R_230mm_HE : SubmunitionBase { + GVAR(caliber) = 230; + }; + class Mine_155mm_AMOS_range : SubmunitionBase { + GVAR(caliber) = 155; + }; + class Cluster_155mm_AMOS : SubmunitionBase { + GVAR(caliber) = 155; + }; + class Smoke_120mm_AMOS_White : SubmunitionBase { + GVAR(caliber) = 155; + }; + class AT_Mine_155mm_AMOS_range : SubmunitionBase { + GVAR(caliber) = 155; + }; + + class Bo_Mk82 : BombCore { + GVAR(dummy) = QGVAR(Bo_Mk82); + }; + + class Bo_GBU12_LGB : LaserBombCore { + GVAR(caliber) = 250; // Default caliber for bombs + GVAR(dummy) = QGVAR(Bo_GBU12_LGB); + }; + + class Bomb_04_F : LaserBombCore { + GVAR(caliber) = 250; // Default caliber for bombs + GVAR(dummy) = QGVAR(Bomb_04_F); + }; + + class Bomb_03_F : Bomb_04_F { + GVAR(dummy) = QGVAR(Bomb_03_F); + }; +}; diff --git a/addons/rearm/CfgEventHandlers.hpp b/addons/rearm/CfgEventHandlers.hpp new file mode 100644 index 0000000000..93371889e1 --- /dev/null +++ b/addons/rearm/CfgEventHandlers.hpp @@ -0,0 +1,36 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + + +class Extended_Init_EventHandlers { + class GVAR(defaultCarriedObject) { // TODO check if we need to add all subclasses + class ADDON { + init = QUOTE(_this call DEFUNC(cargo,initObject)); + }; + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); + }; + }; +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/rearm/CfgMagazines.hpp b/addons/rearm/CfgMagazines.hpp new file mode 100644 index 0000000000..a509377182 --- /dev/null +++ b/addons/rearm/CfgMagazines.hpp @@ -0,0 +1,56 @@ +class CfgMagazines { + class CA_Magazine; + class 60Rnd_CMFlareMagazine : CA_Magazine { + displayName = CSTRING(Mag_60Rnd_CMFlareMagazine); + }; + + class VehicleMagazine; + class SmokeLauncherMag : VehicleMagazine { + displayName = CSTRING(Mag_SmokeLauncherMag); + }; + class SmokeLauncherMag_boat : VehicleMagazine { + displayName = CSTRING(Mag_SmokeLauncherMag); + }; + + class 1000Rnd_Gatling_30mm_Plane_CAS_01_F : VehicleMagazine { + displayName = CSTRING(Mag_1000Rnd_Gatling_30mm_Plane_CAS_01_F); + }; + class 500Rnd_Cannon_30mm_Plane_CAS_02_F : 1000Rnd_Gatling_30mm_Plane_CAS_01_F { + displayName = CSTRING(Mag_500Rnd_Cannon_30mm_Plane_CAS_02_F); + }; + + class 2Rnd_Missile_AA_04_F : VehicleMagazine { + displayName = CSTRING(Mag_2Rnd_Missile_AA_04_F); + }; + class 2Rnd_Missile_AA_03_F : 2Rnd_Missile_AA_04_F { + displayName = CSTRING(Mag_2Rnd_Missile_AA_03_F); + }; + + class 6Rnd_Missile_AGM_02_F : VehicleMagazine { + displayName = CSTRING(Mag_6Rnd_Missile_AGM_02_F); + }; + class 4Rnd_Missile_AGM_01_F : 6Rnd_Missile_AGM_02_F { + displayName = CSTRING(Mag_4Rnd_Missile_AGM_01_F); + }; + + class 7Rnd_Rocket_04_HE_F : VehicleMagazine { + displayName = CSTRING(Mag_7Rnd_Rocket_04_HE_F); + }; + class 20Rnd_Rocket_03_HE_F : 7Rnd_Rocket_04_HE_F { + displayName = CSTRING(Mag_20Rnd_Rocket_03_HE_F); + }; + + class 7Rnd_Rocket_04_AP_F : 7Rnd_Rocket_04_HE_F { + displayName = CSTRING(Mag_7Rnd_Rocket_04_AP_F); + }; + class 20Rnd_Rocket_03_AP_F : 7Rnd_Rocket_04_AP_F { + displayName = CSTRING(Mag_20Rnd_Rocket_03_AP_F); + }; + + class 4Rnd_Bomb_04_F : VehicleMagazine { + displayName = CSTRING(Mag_4Rnd_Bomb_04_F); + }; + class 2Rnd_Bomb_03_F : 4Rnd_Bomb_04_F { + displayName = CSTRING(Mag_2Rnd_Bomb_03_F); + }; +}; diff --git a/addons/rearm/CfgVehicles.hpp b/addons/rearm/CfgVehicles.hpp new file mode 100644 index 0000000000..d7e8fafed4 --- /dev/null +++ b/addons/rearm/CfgVehicles.hpp @@ -0,0 +1,245 @@ +#define MACRO_REARM_ACTIONS \ + class ACE_Actions { \ + class ACE_MainActions { \ + class GVAR(Rearm) { \ + displayName = CSTRING(Rearm); \ + distance = REARM_ACTION_DISTANCE; \ + condition = QUOTE(_this call FUNC(canRearm)); \ + statement = QUOTE(_player call FUNC(rearm)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_rearm_interact.paa); \ + }; \ + }; \ + }; + +#define MACRO_REARM_TRUCK_ACTIONS \ + class ACE_Actions : ACE_Actions { \ + class ACE_MainActions : ACE_MainActions { \ + class GVAR(TakeAmmo) { \ + displayName = CSTRING(TakeAmmo); \ + distance = REARM_ACTION_DISTANCE; \ + condition = QUOTE(_this call FUNC(canTakeAmmo)); \ + insertChildren = QUOTE(_target call FUNC(addRearmActions)); \ + exceptions[] = {"isNotInside"}; \ + showDisabled = 0; \ + priority = 2; \ + icon = PATHTOF(ui\icon_rearm_interact.paa); \ + }; \ + class GVAR(StoreAmmo) { \ + displayName = CSTRING(StoreAmmo); \ + distance = REARM_ACTION_DISTANCE; \ + condition = QUOTE(_this call FUNC(canStoreAmmo)); \ + statement = QUOTE(_this call FUNC(storeAmmo)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_rearm_interact.paa); \ + }; \ + }; \ + }; + +class CfgVehicles { + class ACE_Module; + class ACE_moduleRearmSettings : ACE_Module { + scope = 2; + displayName = CSTRING(RearmSettings_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\icon_module_rearm.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleRearmSettings); + functionPriority = 1; + isGlobal = 0; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class level { + displayName = CSTRING(RearmSettings_level_DisplayName); + description = CSTRING(RearmSettings_level_Description); + typeName = "NUMBER"; + class values { + class vehicle { + name = CSTRING(RearmSettings_vehicle); + value = 0; + }; + class magazine { + name = CSTRING(RearmSettings_magazine); + value = 1; + }; + class caliber { + name = CSTRING(RearmSettings_caliber); + value = 2; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(RearmSettings_Module_Description); + }; + }; + + class LandVehicle; + class Car : LandVehicle { + MACRO_REARM_ACTIONS + }; + + class Tank : LandVehicle { + MACRO_REARM_ACTIONS + }; + + class StaticWeapon : LandVehicle { + MACRO_REARM_ACTIONS + }; + + class Air; + class Helicopter : Air { + MACRO_REARM_ACTIONS + }; + + class Plane : Air { + MACRO_REARM_ACTIONS + }; + + class Ship; + class Ship_F : Ship { + MACRO_REARM_ACTIONS + }; + + + // Ammo Vehicles (with full inheritance for granted ACE_Actions) + class Car_F : Car {}; + class Truck_F : Car_F {}; + + class Truck_03_base_F : Truck_F {}; + class O_Truck_03_ammo_F : Truck_03_base_F { + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + + class Truck_02_base_F : Truck_F {}; + class Truck_02_Ammo_base_F : Truck_02_base_F {}; + class I_Truck_02_ammo_F : Truck_02_Ammo_base_F { + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + class O_Truck_02_Ammo_F : Truck_02_Ammo_base_F { + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + + class Truck_01_base_F : Truck_F {}; + class B_Truck_01_transport_F : Truck_01_base_F {}; + class B_Truck_01_mover_F : B_Truck_01_transport_F {}; + class B_Truck_01_ammo_F : B_Truck_01_mover_F { + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + + class Helicopter_Base_F : Helicopter {}; + class Helicopter_Base_H : Helicopter_Base_F {}; + class Heli_Transport_04_base_F : Helicopter_Base_H {}; + class O_Heli_Transport_04_ammo_F : Heli_Transport_04_base_F { + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + + class Pod_Heli_Transport_04_base_F: StaticWeapon {}; + class Land_Pod_Heli_Transport_04_ammo_F: Pod_Heli_Transport_04_base_F { + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + + class Slingload_base_F; + class Slingload_01_Base_F: Slingload_base_F { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + selection = ""; + distance = 10; + condition = "true"; + }; + }; + }; + + class B_Slingload_01_Ammo_F : Slingload_01_Base_F { + XEH_ENABLED; + transportAmmo = 0; + MACRO_REARM_TRUCK_ACTIONS + }; + + + // Dummy Vehicles + class ThingX; + class GVAR(defaultCarriedObject) : ThingX { + XEH_ENABLED; + displayName = QGVAR(dummy_obj); + scope = 2; + scopeCurator = 2; + model = "\A3\Weapons_F\AmmoBoxes\AmmoBox_F.p3d"; + EGVAR(cargo,size) = 1; + class ACE_Actions { + class ACE_MainActions { + displayName = CSTRING(PickUpAmmo); + distance = REARM_ACTION_DISTANCE; + condition = QUOTE(_this call FUNC(canTakeAmmo)); + statement = QUOTE(_this call FUNC(grabAmmo)); + exceptions[] = {"isNotInside"}; + showDisabled = 0; + priority = 2; + icon = PATHTOF(ui\icon_rearm_interact.paa); + }; + }; + }; + class GVAR(Bo_GBU12_LGB) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F\Ammo\Bomb_01_F.p3d"; + }; + class GVAR(Bo_Mk82) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F\Ammo\Bomb_02_F"; + }; + class GVAR(Bomb_04_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Bomb_04_F.p3d"; + }; + class GVAR(Bomb_03_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Bomb_03_F.p3d"; + }; + class GVAR(Missile_AA_04_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Missile_AA_04_F.p3d"; + }; + class GVAR(Missile_AA_03_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Missile_AA_03_F.p3d"; + }; + class GVAR(Missile_AGM_02_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_02_F.p3d"; + }; + class GVAR(Missile_AGM_01_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_01_F.p3d"; + }; + class GVAR(R_230mm_fly) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F\Ammo\Missile_AT_02_F"; + }; + class GVAR(R_230mm_HE) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F\Ammo\Missile_AT_02_F"; + }; + class GVAR(M_PG_AT) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F\Ammo\Rocket_01_F"; + }; + class GVAR(Rocket_04_HE_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_HE_F.p3d"; + }; + class GVAR(Rocket_03_HE_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + class GVAR(Rocket_04_AP_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_AP_F.p3d"; + }; + class GVAR(Rocket_03_AP_F) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_AP_F.p3d"; + }; + // Using wrong model + class GVAR(R_80mm_HE) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + class GVAR(R_60mm_HE) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; + class GVAR(R_Hydra_HE) : GVAR(defaultCarriedObject) { + model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; + }; +}; diff --git a/addons/rearm/README.md b/addons/rearm/README.md new file mode 100644 index 0000000000..4d6dc966a1 --- /dev/null +++ b/addons/rearm/README.md @@ -0,0 +1,11 @@ +ace_rearm +=============== + +The Rearm module introduces ability to rearm vehicles on different realistic levels. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [GitHawk] (https://github.com/GitHawk) +- [Jonpas] (https://github.com/jonpas) diff --git a/addons/rearm/XEH_postInit.sqf b/addons/rearm/XEH_postInit.sqf new file mode 100644 index 0000000000..25a5d68523 --- /dev/null +++ b/addons/rearm/XEH_postInit.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +["medical_onUnconscious", {_this call FUNC(handleOnUnconscious)}] call EFUNC(common,addEventHandler); +["playerVehicleChanged", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}] call EFUNC(common,addEventHandler); diff --git a/addons/rearm/XEH_preInit.sqf b/addons/rearm/XEH_preInit.sqf new file mode 100644 index 0000000000..c52423f67f --- /dev/null +++ b/addons/rearm/XEH_preInit.sqf @@ -0,0 +1,30 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(addRearmActions); +PREP(canRearm); +PREP(canStoreAmmo); +PREP(canTakeAmmo); +PREP(createDummy); +PREP(dropAmmo); +PREP(getConfigMagazines); +PREP(getMaxMagazines); +PREP(getNeedRearmMagazines); +PREP(grabAmmo); +PREP(handleKilled); +PREP(handleUnconscious); +PREP(makeDummy); +PREP(moduleRearmSettings); +PREP(pickUpAmmo); +PREP(rearm); +PREP(rearmEntireVehicle); +PREP(rearmEntireVehicleSuccess); +PREP(rearmEntireVehicleSuccessLocal); +PREP(rearmSuccess); +PREP(rearmSuccessLocal); +PREP(storeAmmo); +PREP(takeAmmo); +PREP(takeSuccess); + +ADDON = true; diff --git a/addons/rearm/XEH_respawn.sqf b/addons/rearm/XEH_respawn.sqf new file mode 100644 index 0000000000..7f0d175d1c --- /dev/null +++ b/addons/rearm/XEH_respawn.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +private ["_unit"]; + +_unit = _this select 0; + +if !(local _unit) exitWith {}; + +_unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; +_unit setVariable [QGVAR(carriedMagazine), nil]; +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if !(isNull _dummy) then { + detach _dummy; + deleteVehicle _dummy; +}; +_unit setVariable [QGVAR(dummy), nil]; \ No newline at end of file diff --git a/addons/rearm/config.cpp b/addons/rearm/config.cpp new file mode 100644 index 0000000000..c15721c9df --- /dev/null +++ b/addons/rearm/config.cpp @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"GitHawk", "Jonpas"}; + authorUrl = "https://ace3mod.com"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" + +#include "CfgAmmo.hpp" +#include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/rearm/functions/fnc_addRearmActions.sqf b/addons/rearm/functions/fnc_addRearmActions.sqf new file mode 100644 index 0000000000..2011cc73de --- /dev/null +++ b/addons/rearm/functions/fnc_addRearmActions.sqf @@ -0,0 +1,98 @@ +/* + * Author: GitHawk + * Show the resupplyable ammunition of all surrounding vehicles. + * + * Argument: + * 0: Target + * + * Return value: + * ChildActions + * + * Example: + * [tank] call ace_rearm_fnc_addRearmActions + * + * Public: No + */ +#include "script_component.hpp" + +private ["_vehicleActions", "_actions", "_action", "_vehicles", "_vehicle", "_needToAdd", "_magazineHelper", "_turretPath", "_magazines", "_magazine", "_icon", "_cnt"]; +params ["_target"]; + +_vehicles = nearestObjects [_target, ["AllVehicles"], 20]; +if (count _vehicles < 2) exitWith {false}; // Rearming needs at least 2 vehicles + +_vehicleActions = []; +{ + _actions = []; + _vehicle = _x; + _needToAdd = false; + _action = []; + if !((_vehicle == _target) || (_vehicle isKindOf "CAManBase")) then { + _magazineHelper = []; + { + _turretPath = _x; + _magazines = []; + if (_turretPath isEqualTo [-1]) then { + _magazines = [_vehicle, _turretPath] call FUNC(getConfigMagazines); + } else { + _magazines = _vehicle magazinesTurret _turretPath; + }; + { + _magazine = _x; + _cnt = { _x == _magazine } count (_vehicle magazinesTurret _turretPath); + if ((_cnt < ([_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines))) && !(_magazine in _magazineHelper)) then { + _action = [_magazine, + getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), + getText(configFile >> "CfgMagazines" >> _magazine >> "picture"), + {_this call FUNC(takeAmmo)}, + {true}, + {}, + [_magazine, _vehicle]] call EFUNC(interact_menu,createAction); + _actions pushBack [_action, [], _target]; + _magazineHelper pushBack _magazine; + _needToAdd = true; + } else { + if (((_vehicle magazineTurretAmmo [_magazine, _turretPath]) < getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")) && !(_magazine in _magazineHelper)) then { + _action = [_magazine, + getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), + getText(configFile >> "CfgMagazines" >> _magazine >> "picture"), + {_this call FUNC(takeAmmo)}, + {true}, + {}, + [_magazine, _vehicle]] call EFUNC(interact_menu,createAction); + _actions pushBack [_action, [], _target]; + _magazineHelper pushBack _magazine; + _needToAdd = true; + }; + }; + } forEach _magazines; + } forEach REARM_TURRET_PATHS; + }; + if (_needToAdd && !(_vehicle getVariable [QGVAR(disabled), false])) then { + _icon = getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Icon"); + if !((_icon select [0, 1]) == "\") then { + _icon = ""; + }; + if (GVAR(level) == 0) then { + _action = [_vehicle, + getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"), + _icon, + {_this call FUNC(rearmEntireVehicle)}, + {true}, + {}, + _vehicle] call EFUNC(interact_menu,createAction); + _vehicleActions pushBack [_action, [], _target]; + } else { + _action = [_vehicle, + getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"), + _icon, + {}, + {true}, + {}, + []] call EFUNC(interact_menu,createAction); + _vehicleActions pushBack [_action, _actions, _target]; + }; + }; +} forEach _vehicles; + +_vehicleActions diff --git a/addons/rearm/functions/fnc_canRearm.sqf b/addons/rearm/functions/fnc_canRearm.sqf new file mode 100644 index 0000000000..834e6a9202 --- /dev/null +++ b/addons/rearm/functions/fnc_canRearm.sqf @@ -0,0 +1,29 @@ +/* + * Author: GitHawk, Jonpas + * Check if a unit can rearm. + * + * Arguments: + * 0: Target + * 1: Unit + * + * Return Value: + * Can Rearm + * + * Example: + * [player, tank] call ace_rearm_fnc_canRearm + * + * Public: No + */ +#include "script_component.hpp" + +private ["_dummy","_magazineClass"]; +params ["_target", "_unit"]; + +if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_target distance _unit > REARM_ACTION_DISTANCE} || {_target getVariable [QGVAR(disabled), false]}) exitWith {false}; + +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if (isNull _dummy) exitwith {false}; +_magazineClass = _dummy getVariable QGVAR(magazineClass); +if (isNil "_magazineClass") exitWith {false}; + +([_target, _magazineClass] call FUNC(getNeedRearmMagazines)) select 0 diff --git a/addons/rearm/functions/fnc_canStoreAmmo.sqf b/addons/rearm/functions/fnc_canStoreAmmo.sqf new file mode 100644 index 0000000000..4018775d43 --- /dev/null +++ b/addons/rearm/functions/fnc_canStoreAmmo.sqf @@ -0,0 +1,25 @@ +/* + * Author: GitHawk + * Check if a unit can store ammo in an ammo truck. + * + * Arguments: + * 0: Target + * 1: Unit + * + * Return Value: + * Can Store Ammo + * + * Example: + * [player, tank] call ace_rearm_fnc_canStoreAmmo + * + * Public: No + */ +#include "script_component.hpp" + +params ["_target", "_unit"]; + +!(isNull _unit || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_target distance _unit) > REARM_ACTION_DISTANCE} || + {isNull (_unit getVariable [QGVAR(dummy), objNull])}) diff --git a/addons/rearm/functions/fnc_canTakeAmmo.sqf b/addons/rearm/functions/fnc_canTakeAmmo.sqf new file mode 100644 index 0000000000..43a96515e5 --- /dev/null +++ b/addons/rearm/functions/fnc_canTakeAmmo.sqf @@ -0,0 +1,25 @@ +/* + * Author: GitHawk + * Check if a unit can pick up ammo. + * + * Arguments: + * 0: Target + * 1: Unit + * + * Return Value: + * Can Pick Up Ammo + * + * Example: + * [player, tank] call ace_rearm_fnc_canTakeAmmo + * + * Public: No + */ +#include "script_component.hpp" + +params ["_target", "_unit"]; + +!(isNull _unit || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_target distance _unit) > REARM_ACTION_DISTANCE} || + {!isNull (_unit getVariable [QGVAR(dummy), objNull])}) diff --git a/addons/rearm/functions/fnc_createDummy.sqf b/addons/rearm/functions/fnc_createDummy.sqf new file mode 100644 index 0000000000..f9d335c08a --- /dev/null +++ b/addons/rearm/functions/fnc_createDummy.sqf @@ -0,0 +1,33 @@ +/* + * Author: GitHawk + * Creates a carryable ammunition dummy object. + * + * Arguments: + * 0: Unit + * 1: Magazine Classname + * + * Return Value: + * Created Dummy + * + * Example: + * ["500Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_createDummy + * + * Public: No + */ +#include "script_component.hpp" + +private ["_ammo", "_dummyName", "_dummy"]; +params ["_unit", "_magazineClass"]; + +_ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo"); +_dummyName = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy)); +_dummy = objNull; +if !(_dummyName == "") then { + _dummy = _dummyName createVehicle (position _unit); +} else { + _dummy = QGVAR(defaultCarriedObject) createVehicle (position _unit); +}; +_dummy allowDamage false; +_dummy setVariable [QGVAR(magazineClass), _magazineClass, true]; + +_dummy diff --git a/addons/rearm/functions/fnc_dropAmmo.sqf b/addons/rearm/functions/fnc_dropAmmo.sqf new file mode 100644 index 0000000000..8fc9ba4945 --- /dev/null +++ b/addons/rearm/functions/fnc_dropAmmo.sqf @@ -0,0 +1,43 @@ +/* + * Author: GitHawk + * Drops a magazine, optionally deletes it and optionally unholsters the wepaon. + * + * Arguments: + * 0: Unit + * 1: Delete dummy object (optional) + * 2: Unholster Weapon (optional) + * + * Return Value: + * None + * + * Example: + * [player, true, true] call ace_rearm_fnc_dropAmmo + * + * Public: No + */ +#include "script_component.hpp" + +private ["_dummy", "_actionID"]; +params ["_unit", ["_delete", false], ["_unholster", true]]; + +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if !(isNull _dummy) then { + detach _dummy; + if (_delete) then { + deleteVehicle _dummy; + } else { + _dummy setVelocity [0,0,-0.1]; + }; + _unit setVariable [QGVAR(dummy), objNull]; + //_unit setVariable [QEGVAR(dragging,isCarrying), false, true]; // breaks things, since it hides interact menu on _target +}; +_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(ReleaseActionID), nil]; +}; +[_unit, QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus); + +if (_unholster) then { + REARM_UNHOLSTER_WEAPON +}; diff --git a/addons/rearm/functions/fnc_getConfigMagazines.sqf b/addons/rearm/functions/fnc_getConfigMagazines.sqf new file mode 100644 index 0000000000..9662f30ce7 --- /dev/null +++ b/addons/rearm/functions/fnc_getConfigMagazines.sqf @@ -0,0 +1,53 @@ +/* + * Author: GitHawk, Jonpas + * Returns all magazines a turret can hold according to config. + * + * Arguments: + * 0: Target + * 1: Turret Path + * + * Return Value: + * Magazine classes in TurretPath + * + * Example: + * [vehicle, [0]] call ace_rearm_fnc_getConfigMagazines + * + * Public: No + */ +#include "script_component.hpp" + +params ["_target", "_turretPath"]; + +if (isNull _target) exitWith {[]}; + +_cfg = configFile >> "CfgVehicles" >> (typeOf _target) >> "Turrets"; + +if (count _turretPath == 1) then { + _turretPath params ["_subPath"]; + + if (_subPath == -1) exitWith { + _cfg = configFile >> "CfgVehicles" >> (typeOf _target); + }; + + if (count _cfg > _subPath) then { + _cfg = _cfg select _subPath; + } else { + _cfg = nil; + }; +} else { + _turretPath params ["", "_subPath"]; + if (count _cfg > 0) then { + _cfg = (_cfg select 0) >> "Turrets"; + if (count _cfg > _subPath) then { + _cfg = _cfg select _subPath; + } else { + _cfg = nil; + }; + } else { + _cfg = nil; + }; +}; + +if !(isClass _cfg) exitWith {[]}; + +getArray (_cfg >> "magazines") diff --git a/addons/rearm/functions/fnc_getMaxMagazines.sqf b/addons/rearm/functions/fnc_getMaxMagazines.sqf new file mode 100644 index 0000000000..632b5e5918 --- /dev/null +++ b/addons/rearm/functions/fnc_getMaxMagazines.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk, Jonpas + * Calculates the maximum number of magazines a turret can hold according to config. + * + * Arguments: + * 0: Target + * 1: Turret Path + * 2: Magazine Classname + * + * Return Value: + * Number of magazines on the turret path + * + * Example: + * [vehicle, [0], "500Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_getMaxMagazines + * + * Public: No + */ +#include "script_component.hpp" + +private ["_count", "_cfg"]; +params ["_target", "_turretPath", "_magazineClass"]; + +if (isNull _target) exitWith {0}; + +_count = {_x == _magazineClass} count ([_target, _turretPath] call FUNC(getConfigMagazines)); +_count diff --git a/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf b/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf new file mode 100644 index 0000000000..7a591c6c32 --- /dev/null +++ b/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf @@ -0,0 +1,49 @@ +/* + * Author: GitHawk, Jonpas + * Get rearm return value. + * + * Arguments: + * 0: Target + * 1: Magazine Classname + * + * Return Value: + * Return Value + * 0: Can Rearm + * 1: TurretPath + * 2: Magazine Classname + * + * Example: + * [tank, "mag"] call ace_rearm_fnc_getNeedRearmMagazines + * + * Public: No + */ +#include "script_component.hpp" + +private ["_return", "_magazines", "_cnt"]; +params ["_target", "_magazineClass"]; + +_return = [false, [], 0]; +{ + _magazines = []; + if (_x isEqualTo [-1]) then { + _magazines = [_target, _x] call FUNC(getConfigMagazines); + } else { + _magazines = _target magazinesTurret _x; + }; + + if (_magazineClass in _magazines) then { + _cnt = {_x == _magazineClass} count (_target magazinesTurret _x); + + if ((_target magazineTurretAmmo [_magazineClass, _x]) < getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count")) exitWith { + _return = [true, _x, _cnt]; + }; + + if (_cnt < ([_target, _x, _magazineClass] call FUNC(getMaxMagazines))) exitWith { + _return = [true, _x, _cnt]; + }; + }; + + if (_return select 0) exitWith {}; +} forEach REARM_TURRET_PATHS; + +_return diff --git a/addons/rearm/functions/fnc_grabAmmo.sqf b/addons/rearm/functions/fnc_grabAmmo.sqf new file mode 100644 index 0000000000..9b09d1282d --- /dev/null +++ b/addons/rearm/functions/fnc_grabAmmo.sqf @@ -0,0 +1,53 @@ +/* + * Author: GitHawk + * Grabs an dummy ammo. + * + * Arguments: + * 0: Ammo Dummy + * 1: Unit + * + * Return Value: + * None + * + * Example: + * [dummy, player] call ace_rearm_fnc_grabAmmo + * + * Public: No + */ +#include "script_component.hpp" + +params ["_dummy", "_unit"]; + +REARM_HOLSTER_WEAPON +[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); + +[ + 5, + [_dummy, _unit], + { + private ["_actionID"]; + params ["_args"]; + _args params ["_dummy", "_unit"]; + [_dummy, _unit] call FUNC(pickUpAmmo); + + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + }; + _actionID = _unit addAction [ + format ["%1", localize ELSTRING(dragging,Drop)], + '(_this select 0) call FUNC(dropAmmo)', + nil, + 20, + false, + true, + "", + '!isNull (_target getVariable [QGVAR(dummy), objNull])' + ]; + _unit setVariable [QGVAR(ReleaseActionID), _actionID]; + }, + "", + localize LSTRING(GrabAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/rearm/functions/fnc_handleKilled.sqf b/addons/rearm/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..b0cdabaed5 --- /dev/null +++ b/addons/rearm/functions/fnc_handleKilled.sqf @@ -0,0 +1,23 @@ +/* + * Author: GitHawk, Jonpas + * Handles medical on set dead event. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [unit] call ace_rearm_fnc_handleKilled + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +if (!local _unit) exitWith {}; + +_unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; +[_unit, false, false] call FUNC(dropAmmo); diff --git a/addons/rearm/functions/fnc_handleUnconscious.sqf b/addons/rearm/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..f9d703f4ec --- /dev/null +++ b/addons/rearm/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,23 @@ +/* + * Author: GitHawk, Jonpas + * Handles medical on unconscious event. + * + * Arguments: + * 0: Unit + * 1: Is Unconscious + * + * Return Value: + * None + * + * Example: + * [unit] call ace_rearm_fnc_handleUnconscious + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_isUnconscious"]; + +if (!local _unit || {!_isUnconscious}) exitWith {}; + +[_unit, false, false] call FUNC(dropAmmo); diff --git a/addons/rearm/functions/fnc_makeDummy.sqf b/addons/rearm/functions/fnc_makeDummy.sqf new file mode 100644 index 0000000000..97ab46fdbc --- /dev/null +++ b/addons/rearm/functions/fnc_makeDummy.sqf @@ -0,0 +1,23 @@ +/* + * Author: GitHawk + * Make a dummy object by disabling collision and turning it. + * + * Arguments: + * 0: Object + * 1: Vector dirAndUp + * + * Return Value: + * None + * + * Example: + * [dummy, [[1,0,0],[0,0,1]]] call ace_rearm_fnc_makeDummy + * + * Public: No + */ +#include "script_component.hpp" + +params ["_obj", "_dirAndUp"]; + +_obj setVectorDirAndUp _dirAndUp; +_obj allowDamage false; +player disableCollisionWith _obj; diff --git a/addons/rearm/functions/fnc_moduleRearmSettings.sqf b/addons/rearm/functions/fnc_moduleRearmSettings.sqf new file mode 100644 index 0000000000..ec5edd1666 --- /dev/null +++ b/addons/rearm/functions/fnc_moduleRearmSettings.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk + * Module for adjusting the refuel settings. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example; + * function = "ace_rearm_fnc_moduleRearmSettings" + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "", "_activated"]; + +if (!_activated) exitWith {}; + +[_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule); + +diag_log text format ["[ACE]: Rearm Module Initialized on level: %1", GVAR(level)]; diff --git a/addons/rearm/functions/fnc_pickUpAmmo.sqf b/addons/rearm/functions/fnc_pickUpAmmo.sqf new file mode 100644 index 0000000000..eaaa55ade6 --- /dev/null +++ b/addons/rearm/functions/fnc_pickUpAmmo.sqf @@ -0,0 +1,31 @@ +/* + * Author: GitHawk + * Starts progress bar for picking up a specific kind of magazine from the ground. + * + * Arguments: + * 0: Ammo Dummy + * 1: Unit + * + * Return Value: + * None + * + * Example: + * [target, player] call ace_rearm_fnc_pickUpAmmo + * + * Public: No + */ +#include "script_component.hpp" + +private ["_magazineClass"]; +params ["_target", "_unit"]; + +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if !(isNull _dummy) exitWith {}; + +//_target attachTo [_unit, [0,0.7,0], "pelvis"]; +_target attachTo [_unit, [0,1,0], "pelvis"]; +{ + [[_target, [[-1,0,0],[0,0,1]]], QFUNC(makeDummy), _x] call EFUNC(common,execRemoteFnc); +} count (position _unit nearObjects ["CAManBase", 100]); +_unit setVariable [QGVAR(dummy), _target]; +//_unit setVariable [QEGVAR(dragging,isCarrying), true, true]; // breaks things, since it hides interact menu on _target diff --git a/addons/rearm/functions/fnc_rearm.sqf b/addons/rearm/functions/fnc_rearm.sqf new file mode 100644 index 0000000000..3208dbfb6f --- /dev/null +++ b/addons/rearm/functions/fnc_rearm.sqf @@ -0,0 +1,75 @@ +/* + * Author: GitHawk + * Starts progress bar for rearming a vehicle. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call ace_rearm_fnc_rearm + * + * Public: No + */ +#include "script_component.hpp" + +private ["_magazineClass", "_ammo", "_tmpCal", "_cal", "_idx", "_needRearmMags", "_magazineDisplayName"]; +params ["_unit"]; + +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if (isNull _dummy) exitwith {false}; +_magazineClass = _dummy getVariable QGVAR(magazineClass); +if (isNil "_magazineClass") exitWith {false}; + +_ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo"); +_tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_caliber"); +_cal = 8; +if (_tmpCal > 0) then { + _cal = _tmpCal; +} else { + _tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(caliber)); + if (_tmpCal > 0) then { + _cal = _tmpCal; + } else { + diag_log format ["[ACE] ERROR: Undefined Ammo [%1 : %2]", _ammo, inheritsFrom (configFile >> "CfgAmmo" >> _ammo)]; + if (_ammo isKindOf "BulletBase") then { + _cal = 8; + } else { + _cal = 100; + }; + }; +}; +_cal = round _cal; +_idx = REARM_CALIBERS find _cal; +if (_idx == -1) then { + _idx = 2; +}; + +// Get magazines that can be rearmed +_needRearmMags = [_target, _magazineClass] call FUNC(getNeedRearmMagazines); +_needRearmMags params ["_needRearm", "_turretPath", "_cnt"]; + +// Exit if no magazines need rearming +if (!_needRearm) exitWith { + diag_log format ["[ACE] ERROR: Could not find turret for %1 in %2", _magazineClass, typeOf _target]; +}; + +//hint format ["Magazine: %1\nAmmo: %2\nCaliber: %3\nIndex: %4\nTurretPath: %5\nREARM_DURATION_REARM: %6\nCount: %7", _magazine, _ammo, _cal, _idx, _turretPath, (REARM_DURATION_REARM select _idx), (REARM_COUNT select _idx)]; + +_magazineDisplayName = getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"); +if (_magazineDisplayName == "") then { + _magazineDisplayName = _magazineClass; + diag_log format ["[ACE] ERROR: Magazine is missing display name [%1]", _magazineClass]; +}; + +[ + (REARM_DURATION_REARM select _idx), + [_target, _unit, _turretPath, _cnt, _magazineClass, (REARM_COUNT select _idx)], + FUNC(rearmSuccess), + "", + format [localize LSTRING(RearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName"), _magazineDisplayName], + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/rearm/functions/fnc_rearmEntireVehicle.sqf b/addons/rearm/functions/fnc_rearmEntireVehicle.sqf new file mode 100644 index 0000000000..c1c08dce52 --- /dev/null +++ b/addons/rearm/functions/fnc_rearmEntireVehicle.sqf @@ -0,0 +1,30 @@ +/* + * Author: GitHawk + * Starts progress bar for rearming an entire vehicle. + * + * Arguments: + * 0: Ammo Truck + * 1: Unit + * 2: Vehicle to be armed + * + * Return Value: + * None + * + * Example: + * [ammo_truck, player, tank] call ace_rearm_fnc_rearmEntireVehicle + * + * Public: No + */ +#include "script_component.hpp" + +params ["_target", "_unit", "_vehicle"]; // _target is for future possible finite ammo, _unit placeholder + +[ + 10, + _vehicle, + FUNC(rearmEntireVehicleSuccess), + "", + format [localize LSTRING(BasicRearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf new file mode 100644 index 0000000000..cddce3ac3a --- /dev/null +++ b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf @@ -0,0 +1,33 @@ +/* + * Author: GitHawk + * Rearm an entire vehicle. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * None + * + * Example: + * [tank] call ace_rearm_fnc_rearmEntireVehicleSuccess + * + * Public: No + */ +#include "script_component.hpp" + +private ["_turretPath", "_magazines", "_magazine", "_currentMagazines", "_maxMagazines", "_maxRounds", "_currentRounds"]; +params ["_vehicle"]; + +if (isServer) then { + { + _turretOwnerID = _vehicle turretOwner _x; + if (_turretOwnerID == 0) then { + [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), _target] call EFUNC(common,execRemoteFnc); + } else { + EGVAR(common,remoteFnc) = [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), 0]; + _turretOwnerID publicVariableClient QEGVAR(common,remoteFnc); + }; + } count REARM_TURRET_PATHS; +} else { + [_this, QFUNC(rearmEntireVehicleSuccess), 1] call EFUNC(common,execRemoteFnc); +}; diff --git a/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf new file mode 100644 index 0000000000..962ffa4c0a --- /dev/null +++ b/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf @@ -0,0 +1,48 @@ +/* + * Author: GitHawk + * Rearm an entire turret locally. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * None + * + * Example: + * [tank, [0]] call ace_rearm_fnc_rearmEntireVehicleSuccessLocal + * + * Public: No + */ +#include "script_component.hpp" + +private ["_magazines", "_magazine", "_currentMagazines", "_maxMagazines", "_maxRounds", "_currentRounds"]; +params ["_vehicle", "_turretPath"]; + +_magazines = []; +if (_turretPath isEqualTo [-1]) then { + _magazines = [_vehicle, _turretPath] call FUNC(getConfigMagazines); +} else { + _magazines = _vehicle magazinesTurret _turretPath; +}; +{ + _magazine = _x; + _currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath); + _maxMagazines = [_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines); + _maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count"); + _currentRounds = _vehicle magazineTurretAmmo [_magazine, _turretPath]; + + TRACE_7("Rearmed Turret",_vehicle,_turretPath,_currentMagazines,_maxMagazines,_currentRounds,_maxRounds,_magazine); + + if (_turretPath isEqualTo [-1] && _currentMagazines == 0) then { + // On driver, the empty magazine is still there, but is not returned by magazinesTurret + _currentMagazines = _currentMagazines + 1; + }; + if (_currentMagazines < _maxMagazines) then { + _vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath]; + for "_idx" from 1 to (_maxMagazines - _currentMagazines) do { + _vehicle addMagazineTurret [_magazine, _turretPath]; + }; + } else { + _vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath]; + }; +} foreach _magazines; diff --git a/addons/rearm/functions/fnc_rearmSuccess.sqf b/addons/rearm/functions/fnc_rearmSuccess.sqf new file mode 100644 index 0000000000..7c9b151a39 --- /dev/null +++ b/addons/rearm/functions/fnc_rearmSuccess.sqf @@ -0,0 +1,44 @@ +/* + * Author: GitHawk + * Rearms a vehicle. + * + * Arguments: + * 0: Params + * 0: Target + * 1: Unit + * 2: Turret Path + * 3: Number of magazines + * 4: Magazine Classname + * 5: Number of rounds + * + * Return Value: + * None + * + * Example: + * [[vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500]] call ace_rearm_fnc_rearmSuccess + * + * Public: No + */ +#include "script_component.hpp" + +private ["_dummy", "_weaponSelect", "_turretOwnerID"]; +params ["_args"]; +_args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"]; + +//hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _target, _turretPath, _numMagazines, _magazineClass, _numRounds]; + +if (local _unit) then { + [_unit, true, true] call FUNC(dropAmmo); +}; + +if (isServer) then { + _turretOwnerID = _target turretOwner _turretPath; + if (_turretOwnerID == 0) then { + [_this, QFUNC(rearmSuccessLocal), _target] call EFUNC(common,execRemoteFnc); + } else { + EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0]; + _turretOwnerID publicVariableClient QEGVAR(common,remoteFnc); + }; +} else { + [_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc); +}; diff --git a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf new file mode 100644 index 0000000000..f869690808 --- /dev/null +++ b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf @@ -0,0 +1,82 @@ +/* + * Author: GitHawk + * Rearms a vehicle on the turret owner. + * + * Arguments: + * 0: Params + * 0: Target + * 1: Unit + * 2: Turret Path + * 3: Number of magazines + * 4: Magazine Classname + * 5: Number of rounds + * + * Return Value: + * None + * + * Example: + * [[vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500]] call ace_rearm_fnc_rearmSuccess + * + * Public: No + */ +#include "script_component.hpp" + +private ["_rounds", "_currentRounds", "_maxMagazines", "_dummy", "_weaponSelect"]; +params ["_args"]; +_args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"]; + +//hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5\nUnit: %6", _target, _turretPath, _numMagazines, _magazineClass, _numRounds, _unit]; + +_rounds = getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count"); +_currentRounds = 0; + +_maxMagazines = [_target, _turretPath, _magazineClass] call FUNC(getMaxMagazines); +if (_maxMagazines == 1) then { + if (GVAR(level) == 1) then { + // Fill magazine completely + _target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath]; + ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _rounds, + getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + } else { + // Fill only at most _numRounds + _target setMagazineTurretAmmo [_magazineClass, ((_target magazineTurretAmmo [_magazineClass, _turretPath]) + _numRounds) min _rounds, _turretPath]; + ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _numRounds, + getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + }; +} else { + for "_idx" from 1 to _maxMagazines do { + _currentRounds = _target magazineTurretAmmo [_magazineClass, _turretPath]; + if (_currentRounds > 0) exitWith { + if (GVAR(level) == 2) then { + //hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMaxMagazines %4\nMagazine: %5\nNumRounds: %6\nMagazine: %7", _target, _turretPath, _numMagazines, _maxMagazines, _currentRounds, _numRounds, _magazineClass]; + // Fill only at most _numRounds + if ((_currentRounds + _numRounds) > _rounds) then { + _target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath]; + if (_numMagazines < _maxMagazines) then { + _target addMagazineTurret [_magazineClass, _turretPath]; + _target setMagazineTurretAmmo [_magazineClass, _currentRounds + _numRounds - _rounds, _turretPath]; + }; + } else { + _target setMagazineTurretAmmo [_magazineClass, _currentRounds + _numRounds, _turretPath]; + }; + ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _numRounds, + getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + } else { + // Fill current magazine completely and fill next magazine partially + _target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath]; + if (_numMagazines < _maxMagazines) then { + _target addMagazineTurret [_magazineClass, _turretPath]; + _target setMagazineTurretAmmo [_magazineClass, _currentRounds, _turretPath]; + }; + ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _rounds, + getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + }; + }; + _target removeMagazineTurret [_magazineClass, _turretPath]; + _numMagazines = _numMagazines - 1; + }; +}; diff --git a/addons/rearm/functions/fnc_storeAmmo.sqf b/addons/rearm/functions/fnc_storeAmmo.sqf new file mode 100644 index 0000000000..e23efe0d7c --- /dev/null +++ b/addons/rearm/functions/fnc_storeAmmo.sqf @@ -0,0 +1,34 @@ +/* + * Author: GitHawk + * Stores ammo in an ammo truck. + * + * Arguments: + * 0: Target + * 1: Unit + * + * Return Value: + * None + * + * Example: + * [player, dummy] call ace_rearm_fnc_storeAmmo + * + * Public: No + */ +#include "script_component.hpp" + +private "_dummy"; +params ["_target", "_unit"]; + +_dummy = _unit getVariable [QGVAR(dummy), objNull]; +if (isNull _dummy) exitwith {}; + + +[ + 5, + _unit, + {params ["_unit"]; [_unit, true, true] call FUNC(dropAmmo)}, + "", + format [localize LSTRING(StoreAmmoAction), getText(configFile >> "CfgMagazines" >> (_dummy getVariable QGVAR(magazineClass)) >> "displayName"), getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/rearm/functions/fnc_takeAmmo.sqf b/addons/rearm/functions/fnc_takeAmmo.sqf new file mode 100644 index 0000000000..4f3ef7c9ef --- /dev/null +++ b/addons/rearm/functions/fnc_takeAmmo.sqf @@ -0,0 +1,61 @@ +/* + * Author: GitHawk + * Starts progress bar for picking up a specific kind of magazine from an ammo truck. + * + * Arguments: + * 0: Ammo Truck + * 1: Unit + * 2: Params + * 0: Magazine Classname + * 1: Vehicle to be armed + * + * Return Value: + * None + * + * Example: + * [ammo_truck, player, ["500Rnd_127x99_mag_Tracer_Red", tank]] call ace_rearm_fnc_takeAmmo + * + * Public: No + */ +#include "script_component.hpp" + +private ["_ammo", "_tmpCal", "_cal", "_idx"]; + +params ["_target", "_unit", "_args"]; +_args params ["_magazineClass", "_vehicle"]; + +_ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo"); +_tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_caliber"); +_cal = 8; +if (_tmpCal > 0) then { + _cal = _tmpCal; +} else { + _tmpCal = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(caliber)); + if (_tmpCal > 0) then { + _cal = _tmpCal; + } else { + diag_log format ["[ACE] ERROR: Undefined Ammo [%1 : %2]", _ammo, inheritsFrom (configFile >> "CfgAmmo" >> _ammo)]; + if (_ammo isKindOf "BulletBase") then { + _cal = 8; + } else { + _cal = 100; + }; + }; +}; +_cal = round _cal; +_idx = REARM_CALIBERS find _cal; +if (_idx == -1 ) then { + _idx = 2; +}; + +REARM_HOLSTER_WEAPON + +[ + (REARM_DURATION_TAKE select _idx), + [_unit, _magazineClass, _target], + FUNC(takeSuccess), + "", + format [localize LSTRING(TakeAction), getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/rearm/functions/fnc_takeSuccess.sqf b/addons/rearm/functions/fnc_takeSuccess.sqf new file mode 100644 index 0000000000..952cfdee08 --- /dev/null +++ b/addons/rearm/functions/fnc_takeSuccess.sqf @@ -0,0 +1,39 @@ +/* + * Author: GitHawk + * Takes a magazine from an ammo truck. + * + * Arguments: + * 0: Params + * 0: Unit + * 1: Magazine Classname + * 2: Ammo Truck + * + * Return Value: + * None + * + * Example: + * [[player, "500Rnd_127x99_mag_Tracer_Red"]] call ace_rearm_fnc_takeSuccess + * + * Public: No + */ +#include "script_component.hpp" + +private ["_ammo", "_dummyName", "_dummy", "_actionID"]; +params ["_args"]; +_args params ["_unit", "_magazineClass", "_target"]; // _target is for future possible finite ammo + +[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); +_dummy = [_unit, _magazineClass] call FUNC(createDummy); +[_dummy, _unit] call FUNC(pickUpAmmo); + +_actionID = _unit addAction [ + format ["%1", localize ELSTRING(dragging,Drop)], + '(_this select 0) call FUNC(dropAmmo)', + nil, + 20, + false, + true, + "", + '!isNull (_target getVariable [QGVAR(dummy), objNull])' +]; +_unit setVariable [QGVAR(ReleaseActionID), _actionID]; diff --git a/addons/rearm/functions/script_component.hpp b/addons/rearm/functions/script_component.hpp new file mode 100644 index 0000000000..515b56ddc7 --- /dev/null +++ b/addons/rearm/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\rearm\script_component.hpp" diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp new file mode 100644 index 0000000000..e90e87a422 --- /dev/null +++ b/addons/rearm/script_component.hpp @@ -0,0 +1,31 @@ +#define COMPONENT rearm +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_REARM + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_REARM + #define DEBUG_SETTINGS DEBUG_SETTINGS_REARM +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + + +#define REARM_ACTION_DISTANCE 7 +#define REARM_TURRET_PATHS [[-1], [0], [0,0], [0,1], [1], [2], [0,2]] + +#define REARM_CALIBERS [ 6, 7, 8, 13, 19, 20, 25, 30, 35, 39, 40, 60, 70, 80, 82, 100, 105, 120, 122, 125, 155, 230, 250] +#define REARM_DURATION_TAKE [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 13, 10] +#define REARM_DURATION_REARM [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 7, 7, 7, 8, 10, 10, 10, 10, 27, 20] +#define REARM_COUNT [500, 500, 400, 100, 50, 50, 40, 25, 34, 24, 10, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1] + + +#define REARM_HOLSTER_WEAPON \ + _unit setVariable [QGVAR(selectedWeaponOnRearm), currentWeapon _unit]; \ + _unit action ["SwitchWeapon", _unit, _unit, 99]; + +#define REARM_UNHOLSTER_WEAPON \ + _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \ + _unit selectWeapon _weaponSelect; \ + _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml new file mode 100644 index 0000000000..1dd33d19d7 --- /dev/null +++ b/addons/rearm/stringtable.xml @@ -0,0 +1,173 @@ + + + + + Rearm Settings + Aufmunitioniereinstellungen + Ustawienia przezbrajania + + + This module allows you to tweak rearm system settings. + Ten moduł pozwala dostosować ustawienia przezbrajania. + + + Rearm Amount + Aufmunitioniermenge + Szybkość przezbrajania + + + How fast should a vehicle be rearmed? + Wie schnell soll ein Fahrzeug aufmunitioniert werden? + Jak szybko pojazd zostanie przezbrojony? + + + Entire Vehicle + Gesamtes Fahrzeug + Cały pojazd + + + Entire Magazine + Gesamtes Magazin + Cały magazynek + + + Amount based on caliber + Kaliberbasierte Anzahl + Ilość zależna od kalibru + + + Rearm + Aufmunitionieren + Przezbrój + + + Rearming %1 with %2 ... + Munitioniere %1 auf mit %2 ... + Przezbrajanie %1 przy pomocy %2 ... + + + Rearming %1 ... + Munitioniere %1 auf ... + Przezbrajanie %1 ... + + + Taking %1 for %2 ... + Nehme %1 für %2 ... + Pobieranie %1 dla %2 ... + + + Take ammo + Munition nehmen + Pobierz amunicję + + + Pick up ammo + Munition aufnehmen + Podnieś amunicję + + + Store ammo + Munition verstauen + Przechowaj amunicję + + + Storing %1 in %2 ... + Verstaue %1 in %2 ... + Przechowywanie %1 w %2 ... + + + Picking up ammo ... + Nehme Munition ... + Podnoszenie amunicji ... + + + Rearmed %1 rounds of %2 on %3 + %1 Schuss %2 an %3 aufmunitioniert + Przezbrojono %1 pocisków %2 na %3 + + + Smoke Screen + Smoke Screen + Kouřová clona + Écran de fumée + Rauchwand + Cortina fumogena + Zasłona dymna + Cortina de fumaça + Дым. завеса + Pantalla de humo + + + Flares + Flares + Světlice + Fusées + Leuchtkörper + Razzi luminosi + Flary + Sinalizadores + ЛТЦ + Bengalas + + + 30mm HEI + 30mm HEI + 30mm HEI + + + 30mm HEI-T + 30mm HEI-T + 30mm HEI-T + + + AIM-9 Sidewinder + AIM-9 Sidewinder + AIM-9 Sidewinder + + + Wympel R-73 + Wympel R-73 + Wympel R-73 + + + AGM-65 Maverick + AGM-65 Maverick + AGM-65 Maverick + + + Kh-25MTP + Kh-25MTP + Ch-25MTP + + + Hydra 70 HE + Hydra 70 HE + Hydra 70 HE + + + S-8 HE + S-8 HE + S-8 HE + + + Hydra 70 AP + Hydra 70 AP + Hydra 70 AP + + + S-8 AP + S-8 AP + S-8 AP + + + GBU-12 + GBU-12 + GBU-12 + + + FAB-250M-54 + FAB-250M-54 + FAB-250M-54 + + + \ No newline at end of file diff --git a/addons/rearm/ui/icon_module_rearm.paa b/addons/rearm/ui/icon_module_rearm.paa new file mode 100644 index 0000000000..173e3eaff7 Binary files /dev/null and b/addons/rearm/ui/icon_module_rearm.paa differ diff --git a/addons/rearm/ui/icon_rearm_interact.paa b/addons/rearm/ui/icon_rearm_interact.paa new file mode 100644 index 0000000000..fe2a9a1235 Binary files /dev/null and b/addons/rearm/ui/icon_rearm_interact.paa differ diff --git a/addons/refuel/$PBOPREFIX$ b/addons/refuel/$PBOPREFIX$ new file mode 100644 index 0000000000..2a68bfaf74 --- /dev/null +++ b/addons/refuel/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\refuel \ No newline at end of file diff --git a/addons/refuel/ACE_Settings.hpp b/addons/refuel/ACE_Settings.hpp new file mode 100644 index 0000000000..0ae0accaad --- /dev/null +++ b/addons/refuel/ACE_Settings.hpp @@ -0,0 +1,8 @@ +class ACE_Settings { + class GVAR(rate) { + displayName = CSTRING(RefuelSettings_speed_DisplayName); + description = CSTRING(RefuelSettings_speed_Description); + value = 1; + typeName = "SCALAR"; + }; +}; diff --git a/addons/refuel/CfgEventHandlers.hpp b/addons/refuel/CfgEventHandlers.hpp new file mode 100644 index 0000000000..f1a9f1a3c8 --- /dev/null +++ b/addons/refuel/CfgEventHandlers.hpp @@ -0,0 +1,27 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); + }; + }; +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; \ No newline at end of file diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp new file mode 100644 index 0000000000..33ddddb8b0 --- /dev/null +++ b/addons/refuel/CfgVehicles.hpp @@ -0,0 +1,631 @@ +#define MACRO_REFUEL_ACTIONS \ + class ACE_Actions: ACE_Actions { \ + class ACE_MainActions: ACE_MainActions { \ + class GVAR(Refuel) { \ + displayName = CSTRING(Refuel); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = "true"; \ + statement = ""; \ + showDisabled = 0; \ + priority = 2; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + class GVAR(TakeNozzle) { \ + displayName = CSTRING(TakeNozzle); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ + statement = QUOTE([ARR_3(_player,_target,objNull)] call FUNC(TakeNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(CheckFuelCounter) { \ + displayName = CSTRING(CheckFuelCounter); \ + condition = "true"; \ + statement = QUOTE([ARR_2(_player,_target)] call FUNC(readFuelCounter)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(CheckFuel) { \ + displayName = CSTRING(CheckFuel); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \ + statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(Connect) { \ + displayName = CSTRING(Connect); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(Return) { \ + displayName = CSTRING(Return); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canReturnNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; \ + }; \ + }; + +#define MACRO_CONNECT_ACTIONS \ + class ACE_Actions { \ + class ACE_MainActions { \ + class GVAR(Refuel) { \ + displayName = CSTRING(Refuel); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = "true"; \ + statement = ""; \ + showDisabled = 0; \ + priority = 2; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + class GVAR(Connect) { \ + displayName = CSTRING(Connect); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; \ + }; \ + }; + +#define MACRO_NOZZLE_ACTIONS \ + class ACE_Actions { \ + class ACE_MainActions { \ + displayName = CSTRING(Refuel); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = "true"; \ + statement = ""; \ + showDisabled = 0; \ + priority = 2; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + class GVAR(PickUpNozzle) { \ + displayName = CSTRING(TakeNozzle); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ + statement = QUOTE([ARR_3(_player,objNull,_target)] call FUNC(TakeNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(TurnOn) { \ + displayName = CSTRING(TurnOn); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOn)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(TurnOff) { \ + displayName = CSTRING(TurnOff); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(Disconnect) { \ + displayName = CSTRING(Disconnect); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; \ + }; + +class CfgVehicles { + class ACE_Module; + class ACE_moduleRefuelSettings : ACE_Module { + scope = 2; + displayName = CSTRING(RefuelSettings_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleRefuelSettings); + functionPriority = 1; + isGlobal = 0; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class rate { + displayName = CSTRING(RefuelSettings_speed_DisplayName); + description = CSTRING(RefuelSettings_speed_Description); + typeName = "NUMBER"; + defaultValue = 10; + }; + }; + }; + + class ThingX; + class ACE_refuel_fuelNozzle : ThingX { + XEH_ENABLED; + MACRO_NOZZLE_ACTIONS + displayName = QGVAR(fuelNozzle); + scope = 2; + scopeCurator = 2; + model = "\A3\Structures_F_Heli\VR\Helpers\Sign_sphere10cm_F.p3d"; + }; + + class All; + + class Static : All {}; + + class Building : Static {}; + + class NonStrategic : Building {}; + + class HouseBase: NonStrategic {}; + + class House: HouseBase {}; + + class House_F : House {}; + + class House_Small_F : House_F { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + selection = ""; + distance = 10; + condition = "true"; + }; + }; + }; + + class AllVehicles : All { + GVAR(flowRate) = 1; + }; + class Land : AllVehicles {}; + class LandVehicle : Land {}; + class Car : LandVehicle { + MACRO_CONNECT_ACTIONS + }; + + class Tank : LandVehicle { + MACRO_CONNECT_ACTIONS + GVAR(flowRate) = 4; + }; + + class StaticWeapon : LandVehicle { + MACRO_CONNECT_ACTIONS + }; + + class Air : AllVehicles { + GVAR(flowRate) = 8; + }; + + class Helicopter : Air { + MACRO_CONNECT_ACTIONS + GVAR(fuelCapacity) = 1500; + }; + + class Helicopter_Base_F : Helicopter {}; + + class Helicopter_Base_H : Helicopter_Base_F { + GVAR(fuelCapacity) = 3000; + }; + + class Plane : Air { + MACRO_CONNECT_ACTIONS + GVAR(fuelCapacity) = 2000; + GVAR(flowRate) = 16; + }; + + class Plane_Base_F : Plane {}; + + class Ship : AllVehicles {}; + + class Ship_F : Ship { + MACRO_CONNECT_ACTIONS + GVAR(fuelCapacity) = 2000; + GVAR(flowRate) = 4; + }; + + class Boat_Civil_01_base_F : Ship_F { + GVAR(fuelCapacity) = 200; + }; + + class Boat_F : Ship_F { + GVAR(flowRate) = 1; + }; + + class Boat_Armed_01_base_F : Boat_F { + GVAR(fuelCapacity) = 300; + }; + class Rubber_duck_base_F : Boat_F { + GVAR(fuelCapacity) = 30; + }; + class SDV_01_base_F : Boat_F { + // SDV is using electrical propulsion + GVAR(fuelCapacity) = 0; + }; + + class Car_F : Car { + // Assuming large vehicle tank + GVAR(fuelCapacity) = 60; + }; + + class Kart_01_Base_F : Car_F { + GVAR(fuelCapacity) = 8; + }; + + class Offroad_01_base_F: Car_F {}; + + class Wheeled_APC_F: Car_F { + // Assuming average APC tank + GVAR(fuelCapacity) = 300; + }; + + class Hatchback_01_base_F: Car_F { + // Assume normal vehicle tank + GVAR(fuelCapacity) = 50; + }; + + class Quadbike_01_base_F : Car_F { + // Assuming usual Yamaha quad + GVAR(fuelCapacity) = 10; + }; + + class MRAP_01_base_F: Car_F { + // M-ATV + // No data, assuming similar to Fennek + GVAR(fuelCapacity) = 230; + }; + + class MRAP_02_base_F: Car_F { + // Punisher + // No data, assuming similar to Fennek + GVAR(fuelCapacity) = 230; + }; + + class MRAP_03_base_F: Car_F { + // Fennek + GVAR(fuelCapacity) = 230; + }; + + class APC_Wheeled_01_base_F: Wheeled_APC_F { + // Patria = LAV + GVAR(fuelCapacity) = 269; + }; + + class Truck_F : Car_F { + GVAR(fuelCapacity) = 400; + GVAR(flowRate) = 2; + }; + + class Truck_01_base_F: Truck_F { + // HEMTT + GVAR(fuelCapacity) = 583; + }; + + class B_Truck_01_transport_F : Truck_01_base_F {}; + + class B_Truck_01_mover_F: B_Truck_01_transport_F {}; + + class Truck_02_base_F: Truck_F { + // KamAZ + // Assuming similar to Ural + GVAR(fuelCapacity) = 400; + }; + + class Truck_03_base_F: Truck_F { + // Tempest + // Assuming heavier than KamAZ + GVAR(fuelCapacity) = 600; + }; + + class Van_01_base_F : Truck_F { + // Small Truck + // Assuming 80L as in Ford Transit + GVAR(fuelCapacity) = 80; + }; + + class Van_01_fuel_base_F: Van_01_base_F { + transportFuel = 0; //1k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; + GVAR(fuelCargo) = 2000; + }; + + class Tank_F: Tank { + GVAR(fuelCapacity) = 1200; + }; + + class APC_Tracked_01_base_F: Tank_F { + // Namer + // Assuming Merkava fuel + GVAR(fuelCapacity) = 1400; + }; + + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; + + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{-1.08,-4.81,-.8}}; + GVAR(fuelCargo) = 1000; + }; + + class APC_Tracked_02_base_F : Tank_F { + // BM-2T + // Assuming 1 L/km + GVAR(fuelCapacity) = 1000; + }; + + class APC_Tracked_03_base_F: Tank_F { + // FV 510 + // Assuming 1 L/km + GVAR(fuelCapacity) = 660; + }; + + class MBT_01_base_F: Tank_F { + // Merkava IV + GVAR(fuelCapacity) = 1400; + }; + + class MBT_02_base_F: Tank_F { + // T100 Black Eagle + // Assuming T80 + GVAR(fuelCapacity) = 1100; + }; + + class MBT_03_base_F: Tank_F { + // Leopard + GVAR(fuelCapacity) = 1160; + }; + + class MBT_01_arty_base_F : MBT_01_base_F { + // Assuming similar 2S3 + GVAR(fuelCapacity) = 830; + }; + + class MBT_02_arty_base_F : MBT_02_base_F { + // Assuming similar 2S3 + GVAR(fuelCapacity) = 830; + }; + + class Heli_Attack_01_base_F : Helicopter_Base_F { + // Commanche + }; + + class Heli_Attack_02_base_F : Helicopter_Base_F { + // Mi-48 Kajman + }; + + class Heli_Light_01_base_F : Helicopter_Base_H { + // MH-6 + GVAR(fuelCapacity) = 242; + }; + + class Heli_Light_02_base_F : Helicopter_Base_H { + // Ka-60 Kasatka + GVAR(fuelCapacity) = 1450; + }; + + class Heli_light_03_base_F : Helicopter_Base_F { + // AW159 + GVAR(fuelCapacity) = 1004; + }; + + class Heli_Transport_01_base_F : Helicopter_Base_H { + // Ghost Hawk + // Assuming similar UH60 + GVAR(fuelCapacity) = 1360; + }; + + class Heli_Transport_02_base_F : Helicopter_Base_H { + // AW101 + GVAR(fuelCapacity) = 3222; + }; + + class Heli_Transport_03_base_F : Helicopter_Base_H { + // Chinook 47I + GVAR(fuelCapacity) = 3914; + }; + + class Heli_Transport_04_base_F : Helicopter_Base_H { + // Mi-290 Taru + GVAR(fuelCapacity) = 3914; + }; + + class Plane_CAS_01_base_F : Plane_Base_F { + // Assuming similar to A10 + GVAR(fuelCapacity) = 6223; + }; + + class Plane_CAS_02_base_F : Plane_Base_F { + // Yak-130 + GVAR(fuelCapacity) = 2099; + }; + + class UAV_01_base_F : Helicopter_Base_F { + // Darter is electrical + GVAR(fuelCapacity) = 0; + }; + + class UAV : Plane {}; + + class UAV_02_base_F : UAV { + // Assuming similar YAHBON-R2 + GVAR(fuelCapacity) = 270; + }; + + class UGV_01_base_F : Car_F { + // Stomper + GVAR(fuelCapacity) = 100; + }; + + class Plane_Fighter_03_base_F : Plane_Base_F { + // L-159 ALCA + GVAR(fuelCapacity) = 1914; + }; + + // Vanilla fuel vehicles + class Truck_02_fuel_base_F : Truck_02_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}}; + GVAR(fuelCargo) = 10000; + }; + + class B_Truck_01_fuel_F : B_Truck_01_mover_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{.28,-4.99,-.3},{-.25,-4.99,-.3}}; + GVAR(fuelCargo) = 10000; + }; + + class O_Truck_03_fuel_F : Truck_03_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}}; + GVAR(fuelCargo) = 10000; + }; + + class Slingload_base_F; + class Slingload_01_Base_F: Slingload_base_F { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + selection = ""; + distance = 10; + condition = "true"; + }; + }; + }; + + class B_Slingload_01_Fuel_F : Slingload_01_Base_F { + XEH_ENABLED; + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}}; + GVAR(fuelCargo) = 10000; + }; + + class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{-1.52,1.14,-1.18}}; + GVAR(fuelCargo) = 10000; + }; + + class Pod_Heli_Transport_04_base_F: StaticWeapon {}; + class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{-1.49,1.41,-.3}}; + GVAR(fuelCargo) = 10000; + }; + + // Vanilla buildings + class Land_Fuelstation_Feed_F : House_Small_F { + XEH_ENABLED; + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{0,0,-0.5}}; + GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; + }; + + class Land_fs_feed_F : House_Small_F { + XEH_ENABLED; + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{-0.4,0.022,-.23}}; + GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; + }; + + /* // Barrels found in config \ + BarrelHelper : Misc_thing 100 + BarrelBase : BarrelHelper 100 + Barrels : BarrelBase 400 + Barrel1 : BarrelBase 100 + Barrel2 : BarrelBase 100 + Barrel3 : BarrelBase 100 + Barrel4 : BarrelBase 100 + Barrel5 : BarrelBase 100 + Barrel6 : BarrelBase 100 + Wooden_barrel : BarrelBase 100 + Wooden_barrels : Wooden_barrel 400 + */ + + // Trucks + // Src: HEMTT http://www.inetres.com/gp/military/cv/eng/M977.html 583L > 483km + // Src: https://en.wikipedia.org/wiki/Heavy_Expanded_Mobility_Tactical_Truck 587L > 483km + // Src: https://en.wikipedia.org/wiki/Kamaz_Typhoon ? > 1200km + // Src: https://en.wikipedia.org/wiki/Humvee 95L + // Src: https://en.wikipedia.org/wiki/RG-33 80 gal = 302 + // Src: MTVR http://oshkoshdefense.com/wp-content/uploads/2013/08/MTVR_StndCargo_SS_6-13-11.pdf 295L + // Src: M1078 http://tarakia.weebly.com/ta-vehicles.html 219L + // Src: https://en.wikipedia.org/wiki/Ural-4320 360L + // Src: http://www.automobile-catalog.com/car/2012/1024400/gaz_233011_tigr.html 138L + // Src: https://en.wikipedia.org/wiki/UAZ-469 78L + // Src: https://en.wikipedia.org/wiki/GAZ-66 210L + + // Tracked IFV + // Src: https://en.wikipedia.org/wiki/Marder_%28IFV%29 652L > 520km + // Src: https://en.wikipedia.org/wiki/Tanque_Argentino_Mediano ~250L > 500km (200L additional tank for 400km range boost) + // Src: https://en.wikipedia.org/wiki/ACEC_Cobra 309L > 600km + // Src: https://en.wikipedia.org/wiki/Egyptian_Infantry_Fighting_Vehicle 454L > 482km + // Src: https://en.wikipedia.org/wiki/Lazika 400L > 400-450km + // Src: https://en.wikipedia.org/wiki/Type_73_Armored_Personnel_Carrier 450L > 300km + // Src: https://en.wikipedia.org/wiki/BMP-1 462L > 500-600km + // Src: http://www.inetres.com/gp/military/cv/inf/BMP-1.html 460L > 600km + // Src: http://www.inetres.com/gp/military/cv/inf/BMP-2.html 460L > 600km + // Src: http://www.inetres.com/gp/military/cv/inf/M2.html 662L > 483-402km + // Src: https://en.wikipedia.org/wiki/2T_Stalker ? > 1000km + // Src: https://en.wikipedia.org/wiki/Namer ? > 500km + // Src: https://en.wikipedia.org/wiki/Warrior_tracked_armoured_vehicle ? > 660km + // Src: http://www.globalsecurity.org/military/systems/ground/m113-specs.htm 360L + // Src: http://afvdb.50megs.com/usa/m2bradley.html 746L + // Src: https://en.wikipedia.org/wiki/BMD-1 300L + // Trend: 1-2 L/km + + // Wheeled IFV/APC + // Src: https://en.wikipedia.org/wiki/BTR-60 290L > 500km + // Src: http://www.inetres.com/gp/military/cv/inf/BTR-70.html 350L > 600km + // Src: http://www.inetres.com/gp/military/cv/inf/BTR-80.html 300L > 600km + // Src: https://en.wikipedia.org/wiki/Mowag_Piranha 4x4 200L > 700km + // Src: https://en.wikipedia.org/wiki/Mowag_Piranha 6x6 200L > 500km + // Src: https://en.wikipedia.org/wiki/ERC_90_Sagaie 242L > 700km + // Src: https://en.wikipedia.org/wiki/V%C3%A9hicule_de_l%27Avant_Blind%C3%A9 310L > 1200km + // Src: https://en.wikipedia.org/wiki/Panhard_M3 165L > 600km + // Src: https://fr.wikipedia.org/wiki/V%C3%A9hicule_blind%C3%A9_de_combat_d%27infanterie 400L > 750km + // Src: https://de.wikipedia.org/wiki/Sp%C3%A4hwagen_Fennek 230L > 460-1000km + // Src: http://www.inetres.com/gp/military/cv/inf/LAV.html 269L > 660km + // Src: http://www.inetres.com/gp/military/cv/inf/M1126.html 200L > 531km + // Src: https://en.wikipedia.org/wiki/Patria_AMV ? > 600-850km + // Src: https://en.wikipedia.org/wiki/Otokar_Arma ? > 700km + // Trend: 0.3-0.6 L/km + + // MBT + // Src: http://www.inetres.com/gp/military/cv/tank/Leopard2.html 1200L > 550km + // Src: http://www.inetres.com/gp/military/cv/tank/M1.html 1909L > 479km + // Src: https://en.wikipedia.org/wiki/T-80 1100L > 335km + // Src: https://en.wikipedia.org/wiki/T-72 1200L > 490km + // Trend: 2-4 L/km + + // Artillery + // Src: http://www.inetres.com/gp/military/cv/arty/M109.html 511L > 349km + // Src: https://en.wikipedia.org/wiki/2S3_Akatsiya 830L > 500km + + // Other + // https://en.wikipedia.org/wiki/ZSU-23-4 515L + + // Helicopter + // Src: http://www.bga-aeroweb.com/Defense/UH-1Y-Venom.html 1172kg / 0.81 kg/L = 1447L + // Src: http://www.bga-aeroweb.com/Defense/AH-1Z-Viper.html 1296kg / 0.81 kg/L = 1600L + // Src: http://www.army-technology.com/projects/black_hawk/ 1360L + // Src: http://www.bga-aeroweb.com/Defense/CH-47-Chinook.html 3914L + // Src: http://helicopters.axlegeeks.com/l/61/Boeing-AH-64-Apache 375 gal = 1420L + // Src: https://en.wikipedia.org/wiki/Mil_Mi-8 3700l + // Src: Google Ka-52 1870L + // Src: http://www.airforce-technology.com/projects/hind/ 1500kg / 0.81 L/kg = 1851L + // Src: https://en.wikipedia.org/wiki/MD_Helicopters_MH-6_Little_Bird 242L + // Src: http://www.globalsecurity.org/military/world/europe/aw159-specs.htm 1004L + // Src: https://en.wikipedia.org/wiki/AgustaWestland_AW101 3 * 1074L = 3222L + // Src: http://www.aviastar.org/helicopters_eng/ka-62.php 1450L + + // Planes + // Src: http://www.theaviationzone.com/factsheets/c130j.asp 20820kg / 0.81 kg/L = 25704L + // Src: http://www.avialogs.com/viewer/avialogs-documentviewer.php?id=3298 p29 1644 gal = 6223L + // Src: http://www.airforce-technology.com/projects/su25/ 3600L + // Src: http://www.thaitechnics.com/aircraft/L159.html 1551kg / 0.81 kg/L = 1914L + // Src: https://en.wikipedia.org/wiki/Yakovlev_Yak-130 1700kg / 0.81 kg/L = 2099L + // Src: http://www.adcom-systems.com/ENG/UAV/YAHBON-R2/Overview.html 270L +}; diff --git a/addons/refuel/README.md b/addons/refuel/README.md new file mode 100644 index 0000000000..6e3d226693 --- /dev/null +++ b/addons/refuel/README.md @@ -0,0 +1,11 @@ +ace_refuel +=============== + +The Refuel module introduces ability to refuel vehicles on different realistic levels. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [GitHawk] (https://github.com/GitHawk) +- [Jonpas] (https://github.com/jonpas) diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf new file mode 100644 index 0000000000..682ebaf094 --- /dev/null +++ b/addons/refuel/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["medical_onUnconscious", {_this call FUNC(handleOnUnconscious)}] call EFUNC(common,addEventHandler); diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf new file mode 100644 index 0000000000..691df0478d --- /dev/null +++ b/addons/refuel/XEH_preInit.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canCheckFuel); +PREP(canConnectNozzle); +PREP(canDisconnect); +PREP(canReturnNozzle); +PREP(canTakeNozzle); +PREP(canTurnOff); +PREP(canTurnOn); +PREP(checkFuel); +PREP(connectNozzle); +PREP(connectNozzleAction); +PREP(disconnect); +PREP(dropNozzle); +PREP(getFuel); +PREP(handleKilled); +PREP(handleUnconscious); +PREP(makeJerryCan); +PREP(moduleRefuelSettings); +PREP(readFuelCounter); +PREP(refuel); +PREP(reset); +PREP(resetLocal); +PREP(returnNozzle); +PREP(setFuel); +PREP(takeNozzle); +PREP(turnOff); +PREP(turnOn); + +ADDON = true; diff --git a/addons/refuel/XEH_respawn.sqf b/addons/refuel/XEH_respawn.sqf new file mode 100644 index 0000000000..39225f2521 --- /dev/null +++ b/addons/refuel/XEH_respawn.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +private ["_unit"]; + +_unit = _this select 0; + +if !(local _unit) exitWith {}; + +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; +_unit setVariable [QGVAR(isRefueling), false]; diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp new file mode 100644 index 0000000000..6140cefe8c --- /dev/null +++ b/addons/refuel/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {"ACE_refuel_fuelNozzle"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"GitHawk"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf new file mode 100644 index 0000000000..a1584ea333 --- /dev/null +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -0,0 +1,26 @@ +/* + * Author: Jonpas, GitHawk + * Checks if unit can check fuel. + * + * Arguments: + * 0: Unit + * 1: Fuel Truck/Station + * + * Return Value: + * Can Check Fuel + * + * Example: + * [player, truck] call ace_refuel_fnc_canCheckFuel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +!(isNull _unit || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {!alive _target} || + {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || + {(_target call FUNC(getFuel) == REFUEL_INFINITE_FUEL)}) diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf new file mode 100644 index 0000000000..812234818e --- /dev/null +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk + * Check if a unit can connect a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * Can Connect Nozzle + * + * Example: + * [player, tank] call ace_refuel_fnc_canConnectNozzle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_nozzle"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; + +!(isNull _nozzle || + {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || + {!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf new file mode 100644 index 0000000000..50d22702a0 --- /dev/null +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -0,0 +1,29 @@ +/* + * Author: GitHawk + * Check if a unit can disconnect a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Nozzle + * + * Return Value: + * Can disconnect + * + * Example: + * [player, nozzle] call ace_refuel_fnc_canDisconnect + * + * Public: No + */ +#include "script_component.hpp" + +private ["_sink"]; +params ["_unit", "_nozzle"]; + +if (isNull _unit || + {isNull _nozzle} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +_sink = _nozzle getVariable [QGVAR(sink), objNull]; +!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]}) diff --git a/addons/refuel/functions/fnc_canReturnNozzle.sqf b/addons/refuel/functions/fnc_canReturnNozzle.sqf new file mode 100644 index 0000000000..139c921d34 --- /dev/null +++ b/addons/refuel/functions/fnc_canReturnNozzle.sqf @@ -0,0 +1,24 @@ +/* + * Author: GitHawk + * Check if a unit can return a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Fuel truck + * + * Return Value: + * Can Return Nozzle + * + * Example: + * [player, fuelTruck] call ace_refuel_fnc_canReturnNozzle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_nozzle"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable QGVAR(nozzle); + +(_this call FUNC(canConnectNozzle)) && {_target == (_nozzle getVariable [QGVAR(source), objNull])} diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf new file mode 100644 index 0000000000..85f5b815a5 --- /dev/null +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -0,0 +1,27 @@ +/* + * Author: GitHawk + * Check if a unit can take a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Fuel Station or Nozzle + * + * Return Value: + * Can connect + * + * Example: + * [player, nozzle] call ace_refuel_fnc_canTakeNozzle + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +if (isNull _unit || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {!alive _target} || + {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +!(_target getVariable [QGVAR(isConnected), false]) && {!(_unit getVariable [QGVAR(isRefueling), false])} diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf new file mode 100644 index 0000000000..7d2d3652e0 --- /dev/null +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -0,0 +1,27 @@ +/* + * Author: GitHawk + * Check if a unit can turn off a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Nozzle + * + * Return Value: + * Can turn off + * + * Example: + * [player, nozzle] call ace_refuel_fnc_canTurnOff + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle"]; + +if (isNull _unit || + {isNull _nozzle} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +(_nozzle getVariable [QGVAR(isRefueling), false]) diff --git a/addons/refuel/functions/fnc_canTurnOn.sqf b/addons/refuel/functions/fnc_canTurnOn.sqf new file mode 100644 index 0000000000..3053e699a2 --- /dev/null +++ b/addons/refuel/functions/fnc_canTurnOn.sqf @@ -0,0 +1,30 @@ +/* + * Author: GitHawk + * Check if a unit can turn on a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Nozzle + * + * Return Value: + * Can turn on + * + * Example: + * [player, nozzle] call ace_refuel_fnc_canTurnOn + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle"]; + +if (isNull _unit || + {isNull _nozzle} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +!(_nozzle getVariable [QGVAR(isRefueling), false]) && + {[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0} && + {!isNull (_nozzle getVariable [QGVAR(sink), objNull])} && + {(fuel (_nozzle getVariable QGVAR(sink))) < 1} diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf new file mode 100644 index 0000000000..b50e9a8171 --- /dev/null +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -0,0 +1,40 @@ +/* + * Author: GitHawk + * Get the remaining fuel amount + * + * Arguments: + * 0: Unit + * 1: Fuel Truck + * + * Return Value: + * None + * + * Example: + * [player, fuelTruck] call ace_refuel_fnc_checkFuel + * + * Public: No + */ +#include "script_component.hpp" +private ["_fuel"]; +params ["_unit", "_target"]; + +_fuel = [_target] call FUNC(getFuel); + +[ + 5, + [_unit, _target, _fuel], + { + params ["_args"]; + _args params ["_unit", "_target", "_fuel"]; + if (_fuel > 0 ) then { + ["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent); + } else { + ["displayTextStructured", [_unit], [LSTRING(Hint_Empty), 2, _unit]] call EFUNC(common,targetEvent); + }; + true + }, + {true}, + localize LSTRING(CheckFuelAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf new file mode 100644 index 0000000000..f5d8d35759 --- /dev/null +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -0,0 +1,65 @@ +/* + * Author: GitHawk et.al. + * Connect a fuel nozzle. + * With code from ace_attach + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * None + * + * Example: + * [player, tank] call ace_refuel_fnc_connectNozzle + * + * Public: No + */ +#include "script_component.hpp" + +#define PLACE_WAITING -1 +#define PLACE_CANCEL 0 +#define PLACE_APPROVE 1 + +private ["_nozzle", "_actionID"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +if (isNull _nozzle) exitWith {}; + +GVAR(placeAction) = PLACE_WAITING; + +[{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); +_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; + +_actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; + +[{ + private["_virtualPos", "_virtualPosASL", "_lineInterection"]; + params ["_args","_pfID"]; + _args params ["_unit", "_target", "_nozzle", "_actionID"]; + + _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); + if (cameraView == "EXTERNAL") then { + _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); + }; + _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); + _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; + + //Don't allow placing in a bad position: + if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; + + if ((GVAR(placeAction) != PLACE_WAITING) || + {_unit != ace_player} || + {!([_unit, _target, []] call EFUNC(common,canInteractWith))}) then { + + [_pfID] call CBA_fnc_removePerFrameHandler; + [] call EFUNC(interaction,hideMouseHint); + [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); + _unit removeAction _actionID; + + if (GVAR(placeAction) == PLACE_APPROVE) then { + [_unit, _target, _virtualPos, _nozzle] call FUNC(ConnectNozzleAction); + }; + }; // TODO add model like in attach/functions/fnc_attach +}, 0, [_unit, _target, _nozzle, _actionID] ] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf new file mode 100644 index 0000000000..42190aacc6 --- /dev/null +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -0,0 +1,106 @@ +/* + * Author: GitHawk et.al. + * Calculates a connection for refueling. + * With code from ace_attach + * + * Arguments: + * 0: Unit + * 1: Target + * 2: Visual Position + * 3: Nozzle + * + * Return Value: + * None + * + * Example: + * [player, tank, [0,0,0], nozzle] call ace_refuel_fnc_connectNozzleAction + * + * Public: No + */ +#include "script_component.hpp" +private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"]; + +params ["_unit", "_target", "_startingPosition", "_nozzle"]; +_startingOffset = _target worldToModel _startingPosition; + +_startDistanceFromCenter = vectorMagnitude _startingOffset; +_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); + +_closeInMax = _startDistanceFromCenter; +_closeInMin = 0; + +while {(_closeInMax - _closeInMin) > 0.01} do { + _closeInDistance = (_closeInMax + _closeInMin) / 2; + _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); + _endPosTestOffset set [2, (_startingOffset select 2)]; + _endPosTest = _target modelToWorldVisual _endPosTestOffset; + + _doesIntersect = false; + { + if (_doesIntersect) exitWith {}; + _startingPosShifted = _startingPosition vectorAdd _x; + _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; + { + _endPosShifted = _endPosTest vectorAdd _x; + _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; + + //Uncomment to see the lazor show, and see how the scanning works: + // drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; + if (_target in lineIntersectsWith [_startASL, _endASL, _unit]) exitWith {_doesIntersect = true}; + } forEach [[0,0,0.045], [0,0,-0.045], [0,0.045,0], [0,-0.045,0], [0.045,0,0], [-0.045,0,0]]; + } forEach [[0,0,0], [0,0,0.05], [0,0,-0.05]]; + + if (_doesIntersect) then { + _closeInMax = _closeInDistance; + } else { + _closeInMin = _closeInDistance; + }; +}; + +_closeInDistance = (_closeInMax + _closeInMin) / 2; + +//Checks (too close to center or can't attach) +if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_target, _unit, _itemClassname] call FUNC(canAttach))}) exitWith { + TRACE_2("no valid spot found",_closeInDistance,_startDistanceFromCenter); + [localize LSTRING(Failed)] call EFUNC(common,displayTextStructured); +}; + +//Move it out slightly, for visibility sake (better to look a little funny than be embedded//sunk in the hull and be useless) +_closeInDistance = (_closeInDistance - 0.0085); + +_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); +_endPosTestOffset set [2, (_startingOffset select 2)]; + +[ + 2, + [_unit, _nozzle, _target, _endPosTestOffset], + { + private "_actionID"; + params ["_args"]; + _args params ["_unit", "_nozzle", "_target", "_endPosTestOffset"]; + _unit setVariable [QGVAR(nozzle), nil]; + _unit setVariable [QGVAR(isRefueling), false]; + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + REFUEL_UNHOLSTER_WEAPON + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(ReleaseActionID), nil]; + }; + + detach _nozzle; + _nozzle attachTo [_target, _endPosTestOffset]; + _nozzle setVariable [QGVAR(sink), _target, true]; + _nozzle setVariable [QGVAR(isConnected), true, true]; + _target setVariable [QGVAR(nozzle), _nozzle, true]; + + _source = _nozzle getVariable QGVAR(source); + _source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel), true]; + + [_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); + }, + "", + localize LSTRING(ConnectAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf new file mode 100644 index 0000000000..e007ddf05f --- /dev/null +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -0,0 +1,30 @@ +/* + * Author: GitHawk + * Disconnect a fuel nozzle. + * + * Arguments: + * 0: Unit + * 1: Nozzle + * + * Return Value: + * None + * + * Example: + * [player, nozzle] call ace_refuel_fnc_disconnect + * + * Public: No + */ +#include "script_component.hpp" + +private ["_sink"]; +params ["_unit", "_nozzle"]; + +_sink = _nozzle getVariable [QGVAR(sink), objNull]; +if (isNull _sink) exitWith {}; + +_sink setVariable [QGVAR(nozzle), objNull, true]; +_nozzle setVariable [QGVAR(sink), objNull, true]; +_nozzle setVariable [QGVAR(isConnected), false, true]; +[objNull, _nozzle, true] call FUNC(dropNozzle); + +[_unit, objNull, _nozzle] call FUNC(takeNozzle); diff --git a/addons/refuel/functions/fnc_dropNozzle.sqf b/addons/refuel/functions/fnc_dropNozzle.sqf new file mode 100644 index 0000000000..c44c20c059 --- /dev/null +++ b/addons/refuel/functions/fnc_dropNozzle.sqf @@ -0,0 +1,32 @@ +/* + * Author: GitHawk + * Detaches the fuel nozzle, drops it and removes player variables. + * + * Arguments: + * 0: Unit (optional) + * 1: Nozzle + * 2: Disconnect Only + * + * Return Value: + * None + * + * Example: + * [player, nozzle, false] call ace_refuel_fnc_dropNozzle + * [objNull, nozzle, false] call ace_refuel_fnc_dropNozzle + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle", ["_disconnectOnly", false]]; + +detach _nozzle; +_nozzle setVariable [QGVAR(isRefueling), false, true]; + +if (_disconnectOnly) exitWith {}; +_nozzle setVelocity [0, 0, 0]; +_nozzle setPosATL [(getPosATL _nozzle) select 0, (getPosATL _nozzle) select 1, 0.05]; + +if (isNull _unit) exitWith {}; +_unit setVariable [QGVAR(isRefueling), false, true]; +_unit setVariable [QGVAR(nozzle), objNull, true]; diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf new file mode 100644 index 0000000000..9bbb4987be --- /dev/null +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -0,0 +1,28 @@ +/* + * Author: GitHawk, Jonpas + * Get the remaining fuel amount. + * + * Arguments: + * 0: Target + * + * Return Value: + * Fuel left (in liters) + * + * Example: + * [fuelTruck] call ace_refuel_fnc_getFuel + * + * Public: No + */ +#include "script_component.hpp" + +private ["_fuel"]; +params ["_target"]; + +_fuel = _target getVariable QGVAR(currentFuelCargo); + +if (isNil "_fuel") then { + _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); + _target setVariable [QGVAR(currentFuelCargo), _fuel, true]; +}; + +_fuel diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..897337c062 --- /dev/null +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk, Jonpas + * Handles medical on set dead event. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call ace_refuel_fnc_handleKilled + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +if (!local _unit) exitWith {}; + +_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +if !(isNull _nozzle) then { + [_unit, _nozzle] call FUNC(dropNozzle); +}; diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..6a6e561230 --- /dev/null +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,29 @@ +/* + * Author: GitHawk, Jonpas + * Handles medical on unconscious event. + * + * Arguments: + * 0: Unit + * 1: Is Unconscious + * + * Return Value: + * None + * + * Example: + * [player, true] call ace_refuel_fnc_handleUnconscious + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_isUnconscious"]; + +if (!local _unit || {!_isUnconscious}) exitWith {}; + +private "_nozzle"; + +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +if !(isNull _nozzle) then { + [_unit, _nozzle] call FUNC(dropNozzle); +}; diff --git a/addons/refuel/functions/fnc_makeJerryCan.sqf b/addons/refuel/functions/fnc_makeJerryCan.sqf new file mode 100644 index 0000000000..3df209196d --- /dev/null +++ b/addons/refuel/functions/fnc_makeJerryCan.sqf @@ -0,0 +1,89 @@ +/* + * Author: GitHawk + * Makes an object into a jerry can. + * + * Arguments: + * 0: Target + * 1: Fuel amount (in liters) + * + * Return Value: + * None + * + * Example: + * [can] call ace_refuel_fnc_makeJerryCan + * + * Public: No + */ +#include "script_component.hpp" + +private ["_actions", "_action"]; +params ["_target", ["_fuelAmount", 20]]; + +if (isNull _target || + {_target isKindOf "AllVehicles"}) exitWith {}; + +[_target, _fuelAmount] call FUNC(setFuel); +_target setVariable [QGVAR(source), _target, true]; + +_actions = []; +// Add pickup +_action = [QGVAR(PickUpNozzle), + localize LSTRING(TakeNozzle), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, objNull, _target] call FUNC(TakeNozzle)}, + {[_player, _target] call FUNC(canTakeNozzle)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Add turnOn +_action = [QGVAR(TurnOn), + localize LSTRING(TurnOn), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(turnOn)}, + {[_player, _target] call FUNC(canTurnOn)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Add turnOff +_action = [QGVAR(TurnOff), + localize LSTRING(TurnOff), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(turnOff)}, + {[_player, _target] call FUNC(canTurnOff)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Add disconnect +_action = [QGVAR(Disconnect), + localize LSTRING(Disconnect), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(disconnect)}, + {[_player, _target] call FUNC(canDisconnect)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Main Action +_action = [QGVAR(Refuel), + localize LSTRING(Refuel), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {}, + {true}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); + +[_target, 0] call EFUNC(interact_menu,addMainAction); +[_target, 0, ["ACE_MainActions"], [_action, _actions, _target]] call EFUNC(interact_menu,addActionToObject); diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf new file mode 100644 index 0000000000..6cdc78b9f7 --- /dev/null +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -0,0 +1,24 @@ +/* + * Author: GitHawk + * Module for adjusting the refuel settings. + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); + +diag_log text format ["[ACE]: Refuel Module Initialized with flow rate: %1", GVAR(rate)]; diff --git a/addons/refuel/functions/fnc_readFuelCounter.sqf b/addons/refuel/functions/fnc_readFuelCounter.sqf new file mode 100644 index 0000000000..af95c044e3 --- /dev/null +++ b/addons/refuel/functions/fnc_readFuelCounter.sqf @@ -0,0 +1,37 @@ +/* + * Author: GitHawk + * Reads the fuel counter. + * + * Arguments: + * 0: Unit + * 1: Fuel Truck + * + * Return Value: + * None + * + * Example: + * [player, fuelTruck] call ace_refuel_fnc_readFuelCounter + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +[ + 2, + [_unit, _target], + { + private ["_currentFuel", "_fuelCounter"]; + params ["_args"]; + _args params ["_unit", "_target"]; + + _currentFuel = [_target] call FUNC(getFuel); + _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel)); + [[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured); + }, + "", + localize LSTRING(CheckFuelCounterAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf new file mode 100644 index 0000000000..ed6eb257cf --- /dev/null +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -0,0 +1,99 @@ +/* + * Author: GitHawk + * Refuels the vehicle. + * + * Arguments: + * 0: Unit + * 1: Target + * 2: Nozzle + * 3: Connection Point + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +#define PFH_STEPSIZE 0.1 + +private ["_rate", "_maxFuel"]; +params ["_unit", "_target", "_nozzle", "_connectToPoint"]; + +_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE; +_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); + +[{ + private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; + params ["_args", "_pfID"]; + _args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"]; + + _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; + if (!alive _source || {!alive _sink}) exitWith { + [objNull, _nozzle] call FUNC(dropNozzle); + _nozzle setVariable [QGVAR(isConnected), false, true]; + _nozzle setVariable [QGVAR(sink), objNull, true]; + _sink setVariable [QGVAR(nozzle), objNull, true]; + [_pfID] call cba_fnc_removePerFrameHandler; + }; + _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); + if (_tooFar) exitWith { + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + + [objNull, _nozzle] call FUNC(dropNozzle); + _nozzle setVariable [QGVAR(isConnected), false, true]; + _nozzle setVariable [QGVAR(sink), objNull, true]; + _sink setVariable [QGVAR(nozzle), objNull, true]; + [_pfID] call cba_fnc_removePerFrameHandler; + }; + + _finished = false; + if (_fueling) then { + _fuelInSource = [_source] call FUNC(getFuel); + if (_fuelInSource == 0) exitWith { + [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); + _nozzle setVariable [QGVAR(isRefueling), false, true]; + }; + if !(_fuelInSource == REFUEL_INFINITE_FUEL) then { + _fuelInSource = _fuelInSource - _rate; + }; + if (_fuelInSource < 0 && {_fuelInSource > -1}) then { + _fuelInSource = 0; + _finished = true; + [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); + }; + + _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel); + if (_fuelInSink > 1) then { + _fuelInSink = 1; + _finished = true; + [LSTRING(Hint_Completed), 2, _unit] call EFUNC(common,displayTextStructured); + }; + _unit setVariable [QGVAR(tempFuel), _fuelInSink]; + + if !(local _sink) then { + [[_sink, _fuelInSink], "{(_this select 0) setFuel (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); + } else { + _sink setFuel _fuelInSink; + }; + [_source, _fuelInSource] call FUNC(setFuel); + } else { + _unit setVariable [QGVAR(tempFuel), fuel _sink]; + }; + + if (_finished) exitWith { + _nozzle setVariable [QGVAR(isRefueling), false, true]; + }; +}, +PFH_STEPSIZE, +[_nozzle getVariable QGVAR(source), + _target, + _unit, + _nozzle, + _rate, + fuel _target, + _maxFuel, + _nozzle getVariable [QGVAR(attachPos), [0,0,0]], + _connectToPoint] +] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf new file mode 100644 index 0000000000..f235180b0e --- /dev/null +++ b/addons/refuel/functions/fnc_reset.sqf @@ -0,0 +1,50 @@ +/* + * Author: GitHawk + * Resets a fuel vehicle in case is got bugged + * + * Arguments: + * 0: Fuel truck + * + * Return Value: + * None + * + * Example: + * [truck] call ace_refuel_fnc_reset + * + * Public: No + */ +#include "script_component.hpp" + +private ["_nozzle", "_nozzleTarget", "_rope"]; +params ["_target"]; + +if (local _target) then { + _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; +} else { + [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _target] call EFUNC(common,execRemoteFnc); +}; +_target setVariable [QGVAR(engineHit), nil, true]; +_target setVariable [QGVAR(isConnected), false, true]; + +_nozzle = _target getVariable [QGVAR(ownedNozzle), nil]; +if !(isNil "_nozzle") then { + _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; + if !(isNil "_nozzleTarget") then { + _nozzleTarget setVariable [QGVAR(nozzle), nil, true]; + }; + + _rope = _nozzle getVariable [QGVAR(rope), nil]; + if !(isNil "_rope") then { + ropeDestroy _rope; + }; + + { + if (local _x) then { + [_x, _nozzle] call FUNC(resetLocal); + } else { + [[_x, _nozzle], "{_this call FUNC(resetLocal)}", _x] call EFUNC(common,execRemoteFnc); + }; + } count allPlayers; + deleteVehicle _nozzle; +}; +_target setVariable [QGVAR(ownedNozzle), nil, true]; diff --git a/addons/refuel/functions/fnc_resetLocal.sqf b/addons/refuel/functions/fnc_resetLocal.sqf new file mode 100644 index 0000000000..a8b0c184cc --- /dev/null +++ b/addons/refuel/functions/fnc_resetLocal.sqf @@ -0,0 +1,37 @@ +/* + * Author: GitHawk + * Resets a player + * + * Arguments: + * 0: Fuel nozzle + * + * Return Value: + * None + * + * Example: + * [nozzle] call ace_refuel_fnc_resetLocal + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle"]; + + +if (isNull _unit || + {isNull _nozzle} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit}) exitWith {}; +private ["_attachedNozzle", "_actionID"]; +_attachedNozzle = _unit getVariable [QGVAR(nozzle), nil]; +if (isNil "_attachedNozzle") exitWith {}; + +if (_nozzle != _attachedNozzle) exitWith {}; + +_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(isRefueling), false, true]; + _unit setVariable [QGVAR(ReleaseActionID), nil]; + _unit setVariable [QGVAR(nozzle), nil]; +}; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf new file mode 100644 index 0000000000..d3fca33021 --- /dev/null +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -0,0 +1,63 @@ +/* + * Author: GitHawk, Jonpas + * Returns the nozzle back to source vehicle. + * + * Arguments: + * 0: Unit + * 1: Fuel Truck + * + * Return Value: + * Returned Nozzle + * + * Example: + * [player, fuelTruck] call ace_refuel_fnc_returnNozzle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_nozzle", "_dummy", "_actionID"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +_source = _nozzle getVariable QGVAR(source); + +if (isNull _nozzle || {_source != _target}) exitWith {false}; + +[ + 2, + [_unit, _nozzle, _target], + { + private "_actionID"; + params ["_args"]; + _args params ["_unit", "_nozzle", "_target"]; + _unit setVariable [QGVAR(nozzle), nil]; + detach _nozzle; + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + REFUEL_UNHOLSTER_WEAPON + _unit setVariable [QGVAR(isRefueling), false]; + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(ReleaseActionID), nil]; + }; + + _target setVariable [QGVAR(isConnected), false, true]; + _target setVariable [QGVAR(ownedNozzle), nil, true]; + ropeDestroy (_nozzle getVariable QGVAR(rope)); + deleteVehicle _nozzle; + + if !(local _target) then { + [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); + } else { + _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; + }; + _target setVariable [QGVAR(engineHit), nil, true]; + }, + "", + localize LSTRING(ReturnAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); + +true diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf new file mode 100644 index 0000000000..a182d463ae --- /dev/null +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -0,0 +1,24 @@ +/* + * Author: GitHawk + * Set the remaining fuel amount. + * + * Arguments: + * 0: Fuel Truck + * 1: Amount (in liters) + * + * Return Value: + * None + * + * Example: + * [fuelTruck, 42] call ace_refuel_fnc_setFuel + * + * Public: No + */ +#include "script_component.hpp" +private ["_maxFuel"]; +params ["_target", "_fuel"]; + +if (isNull _target || + {isNil "_fuel"}) exitWith {}; + +_target setVariable [QGVAR(currentFuelCargo), _fuel, true]; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf new file mode 100644 index 0000000000..f6d953cecc --- /dev/null +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -0,0 +1,141 @@ +/* + * Author: GitHawk + * Take a fuel nozzle either from a fuel truck/station or from the ground. + * + * Arguments: + * 0: Unit + * 1: Fuel Truck + * 2: Nozzle (optional) + * + * Return Value: + * None + * + * Example: + * [player, fuelTruck] call ace_refuel_fnc_takeNozzle + * [player, objNull, nozzle] call ace_refuel_fnc_takeNozzle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_endPosOffset"], +params ["_unit", "_target", ["_nozzle", objNull]]; + +[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + +REFUEL_HOLSTER_WEAPON + +_endPosOffset = [0, 0, 0]; +if (isNull _nozzle) then { // func is called on fuel truck + _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; + if !(local _target) then { + [[_target, ["HitEngine", 1]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); + } else { + _target setHitPointDamage ["HitEngine", 1]; + }; + + _target setVariable [QGVAR(isConnected), true, true]; + _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks"); + if (count _endPosOffset == 2) then { + if (_unit distance (_target modelToWorld (_endPosOffset select 0)) < _unit distance (_target modelToWorld (_endPosOffset select 1))) then { + _endPosOffset = _endPosOffset select 0; + } else { + _endPosOffset = _endPosOffset select 1; + }; + } else { + _endPosOffset = _endPosOffset select 0; + }; + [ + 2, + [_unit, _target, _endPosOffset], + { + private ["_newNozzle", "_rope", "_actionID"]; + params ["_args"]; + _args params ["_unit", "_target", "_endPosOffset"]; + + _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; + _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + _unit setVariable [QGVAR(nozzle), _newNozzle]; + + _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], REFUEL_HOSE_LENGTH]; + _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; + _newNozzle setVariable [QGVAR(source), _target, true]; + _newNozzle setVariable [QGVAR(rope), _rope, true]; + _target setVariable [QGVAR(ownedNozzle), _newNozzle, true]; + + _unit setVariable [QGVAR(isRefueling), true]; + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + }; + _actionID = _unit addAction [ + format ["%1", localize ELSTRING(dragging,Drop)], + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', + nil, + 20, + false, + true, + "", + '!isNull (_target getVariable [QGVAR(nozzle), objNull])' + ]; + _unit setVariable [QGVAR(ReleaseActionID), _actionID]; + }, + "", + localize LSTRING(TakeNozzleAction), + {true}, + ["isnotinside"] + ] call EFUNC(common,progressBar); +} else { // func is called in muzzle either connected or on ground + [ + 2, + [_unit, _nozzle], + { + private ["_actionID"]; + params ["_args"]; + _args params ["_unit", "_nozzle"]; + _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + _unit setVariable [QGVAR(nozzle), _nozzle]; + + _unit setVariable [QGVAR(isRefueling), true]; + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + }; + _actionID = _unit addAction [ + format ["%1", localize ELSTRING(dragging,Drop)], + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', + nil, + 20, + false, + true, + "", + '!isNull (_target getVariable [QGVAR(nozzle), objNull])' + ]; + _unit setVariable [QGVAR(ReleaseActionID), _actionID]; + }, + "", + localize LSTRING(TakeNozzleAction), + {true}, + ["isnotinside"] + ] call EFUNC(common,progressBar); + + _target = _nozzle getVariable QGVAR(source); + _endPosOffset = _nozzle getVariable QGVAR(attachPos); +}; +[{ + private ["_nozzle"]; + params ["_args", "_pfID"]; + _args params ["_unit", "_source", "_endPosOffset"]; + + if (_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)) exitWith { + _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; + if !(isNull _nozzle) then { + [_unit, _nozzle] call FUNC(dropNozzle); + REFUEL_UNHOLSTER_WEAPON + + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + }; + [_pfID] call cba_fnc_removePerFrameHandler; + }; +}, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf new file mode 100644 index 0000000000..115c1eabe2 --- /dev/null +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -0,0 +1,34 @@ +/* + * Author: GitHawk + * Turn off a fuel nozzle. + * + * Arguments: + * 0: Unit + * 1: Nozzle + * + * Return Value: + * None + * + * Example: + * [nozzle] call ace_refuel_fnc_turnOff + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle"]; + +[ + 2, + [_unit, _nozzle], + { + params ["_args"]; + _args params ["_unit", "_nozzle"]; + _nozzle setVariable [QGVAR(isRefueling), false, true]; + [LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); + }, + "", + localize LSTRING(TurnOffAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf new file mode 100644 index 0000000000..017a8ee021 --- /dev/null +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -0,0 +1,35 @@ +/* + * Author: GitHawk + * Turn on a fuel nozzle. + * + * Arguments: + * 0: Unit + * 1: Nozzle + * + * Return Value: + * None + * + * Example: + * [player, nozzle] call ace_refuel_fnc_turnOn + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle"]; + +[ + 2, + [_unit, _nozzle], + { + private "_source"; + params ["_args"]; + _args params ["_unit", "_nozzle"]; + _nozzle setVariable [QGVAR(isRefueling), true, true]; + [LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); + }, + "", + localize LSTRING(TurnOnAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/script_component.hpp b/addons/refuel/functions/script_component.hpp new file mode 100644 index 0000000000..167c1e614a --- /dev/null +++ b/addons/refuel/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\refuel\script_component.hpp" diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp new file mode 100644 index 0000000000..28e6fb7931 --- /dev/null +++ b/addons/refuel/script_component.hpp @@ -0,0 +1,25 @@ +#define COMPONENT refuel +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_REFUEL + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_REFUEL + #define DEBUG_SETTINGS DEBUG_ENABLED_REFUEL +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define REFUEL_INFINITE_FUEL -1 +#define REFUEL_ACTION_DISTANCE 37 +#define REFUEL_HOSE_LENGTH 12 + +#define REFUEL_HOLSTER_WEAPON \ + _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; \ + _unit action ["SwitchWeapon", _unit, _unit, 99]; + +#define REFUEL_UNHOLSTER_WEAPON \ + _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); \ + _unit selectWeapon _weaponSelect; \ + _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml new file mode 100644 index 0000000000..908fad6d91 --- /dev/null +++ b/addons/refuel/stringtable.xml @@ -0,0 +1,160 @@ + + + + + Refuel Settings + Betankungseinst. + Ustawienia tankowania + + + Flow Rate + Fließrate + Szybkość przepływu + + + How fast should a vehicle be refueled? + Wie schnell soll ein Fahrzeug aufgetankt sein? + Jak szybko pojazd powinien zostać zatankowany? + + + Refuel + Betankung + Zatankuj + + + Take fuel nozzle + Zapfpistole nehmen + Weź nalewak + + + Taking fuel nozzle ... + Nehme Zapfpistole ... + Pobieranie nalewaka ... + + + Connect fuel nozzle + Zapfpistole anschließen + Podłącz nalewak + + + Connecting fuel nozzle ... + Zapfpistole anschließen ... + Podłączanie nalewaka ... + + + Disconnect fuel nozzle + Zapfpistole entfernen + Odepnij nalewak + + + Connect + Anschließen + Podłącz + + + Check remaining fuel + Verbleibenden Kraftstoff überprüfen + Sprawdź ilość paliwa + + + Checking remaining fuel ... + Überprüfe verbleibenden Kraftstoff ... + Sprawdzanie ilości paliwa ... + + + There are %1 liters left. + Es sind noch %1 Liter übrig. + Zostało %1 litrów. + + + There is no fuel left. + Es ist kein Kraftstoff übrig. + W zbiorniku nie ma paliwa. + + + Cancel + Abbrechen + Anuluj + + + Failed + Gescheitert + Porażka + + + Stop fueling + Betankung stoppen + Zatrzymaj tankowanie + + + Stopping fueling ... + Stoppe Betankung ... + Zatrzymywanie tankowania ... + + + Start fueling + Betankung beginnen + Rozpocznij tankowanie + + + Starting fueling ... + Beginne Betankung ... + Rozpoczynanie tankowania ... + + + %1 Liters fueled + %1 Liters getankt + Zatankowano %1 litrów + + + The fuel source is empty. + Die Treibstoffquelle ist leer. + Źródło paliwa jest puste. + + + Maximum fuel hose length reached. + Maximale Schlauchlänge erreicht. + Osiągnięto maksymalną długość przewodu paliwowego. + + + Fueling completed + Betankung abgeschlossen + Tankowanie ukończone + + + Fueling stopped + Betankung angehalten + Tankowanie zatrzymane + + + Fueling started + Betankung begonnen + Tankowanie rozpoczęte + + + Return fuel nozzle + Zapfpistole zurückstecken + Zwróć nalewak + + + Returning fuel nozzle ... + Stecke Zapfpistole zurück ... + Zwracanie nalewaka ... + + + Check fuel counter + Tankuhr ansehen + Sprawdź wskaźnik paliwa + + + Checking fuel counter ... + Betrachte Tankuhr ... + Sprawdzanie wskaźnika paliwa ... + + + %1 liters have been fueled. + %1 Liter wurden getankt. + %1 litrów zostało zatankowane. + + + \ No newline at end of file diff --git a/addons/refuel/ui/icon_module_refuel.paa b/addons/refuel/ui/icon_module_refuel.paa new file mode 100644 index 0000000000..84704c13d7 Binary files /dev/null and b/addons/refuel/ui/icon_module_refuel.paa differ diff --git a/addons/refuel/ui/icon_refuel_interact.paa b/addons/refuel/ui/icon_refuel_interact.paa new file mode 100644 index 0000000000..2cc1a9320d Binary files /dev/null and b/addons/refuel/ui/icon_refuel_interact.paa differ diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index e1dc9e8d51..bd26583668 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -16,7 +16,7 @@ if (!hasInterface) exitWith {}; true }, {false}, -[19, [false, true, false]], false] call cba_fnc_addKeybind; +[19, [false, true, false]], false] call CBA_fnc_addKeybind; ["setAmmoSync", { //To propagate the setAmmo change, do it on all clients diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf index ce08fbd062..993283ca56 100644 --- a/addons/reload/functions/fnc_displayAmmo.sqf +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -43,7 +43,7 @@ if (_target isKindOf "StaticWeapon") then { if (_magazine == "") exitWith {}; if (_weapon == "") exitWith {}; -if (typeName _muzzle != "STRING") then {_muzzle = _weapon}; +if (!( _muzzle isEqualType "")) then {_muzzle = _weapon}; _showNumber = false; _ammo = 0; diff --git a/addons/repair/ACE_Repair.hpp b/addons/repair/ACE_Repair.hpp index a8aac18690..251302a93a 100644 --- a/addons/repair/ACE_Repair.hpp +++ b/addons/repair/ACE_Repair.hpp @@ -4,14 +4,15 @@ class ACE_Repair { displayName = CSTRING(ReplaceWheel); displayNameProgress = CSTRING(ReplacingWheel); - locations[] = {"All"}; + repairLocations[] = {"All"}; requiredEngineer = QGVAR(engineerSetting_Wheel); repairingTime = 10; repairingTimeSelfCoef = 1; items = QGVAR(wheelRepairRequiredItems); condition = QUOTE(call FUNC(canReplaceWheel)); itemConsumed = 0; - + claimObjects[] = {{"ACE_Wheel"}}; + callbackSuccess = QUOTE(call FUNC(doReplaceWheel)); callbackFailure = ""; callbackProgress = ""; @@ -27,6 +28,7 @@ class ACE_Repair { displayNameProgress = CSTRING(RemovingWheel); condition = QUOTE(call FUNC(canRemove)); callbackSuccess = QUOTE(call FUNC(doRemoveWheel)); + claimObjects[] = {}; }; class MiscRepair: ReplaceWheel { displayName = CSTRING(Repairing); // let's make empty string an auto generated string @@ -36,6 +38,7 @@ class ACE_Repair { repairingTime = 15; callbackSuccess = QUOTE(call FUNC(doRepair)); items[] = {"ToolKit"}; + claimObjects[] = {}; }; class RepairTrack: MiscRepair { displayName = CSTRING(Repairing); @@ -43,6 +46,7 @@ class ACE_Repair { condition = QUOTE(call FUNC(canRepairTrack)); callbackSuccess = QUOTE(call FUNC(doRepairTrack)); requiredEngineer = QGVAR(engineerSetting_Wheel); + claimObjects[] = {{"ACE_Track"}}; }; class RemoveTrack: MiscRepair { displayName = CSTRING(RemoveTrack); @@ -57,6 +61,7 @@ class ACE_Repair { condition = QUOTE(call FUNC(canReplaceTrack)); callbackSuccess = QUOTE(call FUNC(doReplaceTrack)); requiredEngineer = QGVAR(engineerSetting_Wheel); + claimObjects[] = {{"ACE_Track"}}; }; class FullRepair: MiscRepair { displayName = CSTRING(fullRepair); diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index ee31e2c873..0b370bd2d3 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -25,6 +25,7 @@ class CfgVehicles { function = QFUNC(moduleRepairSettings); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(Common,ACETeam); class Arguments { @@ -354,12 +355,26 @@ class CfgVehicles { transportRepair = 0; }; + class Heli_Transport_02_base_F; + class I_Heli_Transport_02_F: Heli_Transport_02_base_F { + GVAR(hitpointPositions[]) = {{"HitVRotor", {-1,-9.4,1.8}}, {"HitHRotor", {0,1.8,1.3}}}; + }; + + class Helicopter_Base_F; + class Heli_light_03_base_F: Helicopter_Base_F { + GVAR(hitpointPositions[]) = {{"HitVRotor", {-0.5,-5.55,1.2}}, {"HitHRotor", {0,1.8,1.5}}}; + }; + class B_APC_Tracked_01_base_F; class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { GVAR(canRepair) = 1; transportRepair = 0; }; + class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { + GVAR(hitpointPositions[]) = {{"HitTurret", {0,-2,0}}}; + }; + class Car_F; class Offroad_01_base_F: Car_F { GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2"}} }; @@ -403,4 +418,7 @@ class CfgVehicles { class B_Quadbike_01_F: Quadbike_01_base_F { GVAR(hitpointPositions[]) = { {"HitEngine", {0, 0.5, -0.7}}, {"HitFuel", {0, 0, -0.5}} }; }; + class Hatchback_01_base_F: Car_F { + GVAR(hitpointPositions[]) = {{"HitBody", {0, 0.7, -0.5}}, {"HitFuel", {0, -1.75, -0.75}}}; + }; }; diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf index f94c230f29..8efa47e7b3 100644 --- a/addons/repair/XEH_preInit.sqf +++ b/addons/repair/XEH_preInit.sqf @@ -17,6 +17,7 @@ PREP(doRepair); PREP(doRepairTrack); PREP(doReplaceTrack); PREP(doReplaceWheel); +PREP(getClaimObjects); PREP(getHitPointString); PREP(getPostRepairDamage); PREP(getWheelHitPointsWithSelections); diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 7ebf978088..c46eb66e75 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -1,5 +1,5 @@ /* - * Author: commy2 + * Author: commy2, SilentSpike * Checks if the vehicles class already has the actions initialized, otherwise add all available repair options. Calleed from init EH. * * Arguments: @@ -15,10 +15,12 @@ */ #include "script_component.hpp" -params ["_vehicle"]; -TRACE_1("params", _vehicle); +if (!hasInterface) exitWith {}; -private ["_type", "_initializedClasses", "_condition", "_statement", "_action"]; +params ["_vehicle"]; +TRACE_2("params", _vehicle,typeOf _vehicle); + +private["_action", "_childHitPoint", "_condition", "_groupsConfig", "_hitPoint", "_hitPointsAddedAmount", "_hitPointsAddedNames", "_hitPointsAddedStrings", "_icon", "_initializedClasses", "_name", "_position", "_positionsConfig", "_processedHitPoints", "_selection", "_statement", "_target", "_type"]; _type = typeOf _vehicle; @@ -28,143 +30,141 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]); if (_type in _initializedClasses) exitWith {}; // get all hitpoints and selections -([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitPoints", "_hitPointsSelections"]; +(getAllHitPointsDamage _vehicle) params [["_hitPoints", []], ["_hitSelections", []]]; + +if (_hitSelections isEqualTo []) exitWith { ACE_LOGERROR_1("No hit selections (%1)", _type); }; // get hitpoints of wheels with their selections -([_vehicle] call FUNC(getWheelHitPointsWithSelections)) params ["_wheelHitPoints", "_wheelHitPointSelections"]; +([_vehicle] call FUNC(getWheelHitPointsWithSelections)) params ["_wheelHitPoints", "_wheelHitSelections"]; - -private ["_hitPointsAddedNames", "_hitPointsAddedStrings", "_hitPointsAddedAmount"]; _hitPointsAddedNames = []; _hitPointsAddedStrings = []; _hitPointsAddedAmount = []; +_processedHitpoints = []; -// add repair events to this vehicle class { - if (_x in _wheelHitPoints) then { - // add wheel repair action + _selection = _x; + _hitpoint = _hitPoints select _forEachIndex; - private ["_icon", "_selection", "_name", "_text"]; + if (_selection in _wheelHitSelections) then { + // Wheels should always be unique + if (_hitpoint in _processedHitpoints) exitWith {TRACE_3("Duplicate Wheel",_hitpoint,_forEachIndex,_selection);}; - _icon = QUOTE(PATHTOF(ui\tire_ca.paa)); _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; - // textDefault = ""; - _selection = _wheelHitPointSelections select (_wheelHitPoints find _x); - // remove wheel action - _name = format ["Remove_%1", _x]; + _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _selection]; + + TRACE_3("Adding Wheel Actions",_hitpoint,_forEachIndex,_selection); + + // An action to remove the wheel is required + _name = format ["Remove_%1_%2", _forEachIndex, _hitpoint]; _text = localize LSTRING(RemoveWheel); - _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(repair)}; - - _action = [_name, _text, _icon, _statement, _condition, {}, [_x], _selection, 2] call EFUNC(interact_menu,createAction); + _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 2] call EFUNC(interact_menu,createAction); [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); - // replace wheel action - _name = format ["Replace_%1", _x]; + // An action to replace the wheel is required + _name = format ["Replace_%1_%2", _forEachIndex, _hitpoint]; _text = localize LSTRING(ReplaceWheel); - _condition = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(canRepair)}; _statement = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(repair)}; - - _action = [_name, _text, _icon, _statement, _condition, {}, [_x], _selection, 2] call EFUNC(interact_menu,createAction); + _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 2] call EFUNC(interact_menu,createAction); [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); - } else { - // exit if the hitpoint is in the blacklist, e.g. glasses - if (_x in IGNORED_HITPOINTS) exitWith {}; - - private ["_hitpointGroupConfig", "_inHitpointSubGroup", "_currentHitpoint"]; - - // Get hitpoint groups if available - _hitpointGroupConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); - _inHitpointSubGroup = false; - if (isArray _hitpointGroupConfig) then { - // Set variable if current hitpoint is in a sub-group (to be excluded from adding action) - _currentHitpoint = _x; - { - { - if (_x == _currentHitpoint) exitWith { - _inHitpointSubGroup = true; - }; - } forEach (_x select 1); - } forEach (getArray _hitpointGroupConfig); + //Skip glass hitpoints + if (((toLower _hitPoint) find "glass") != -1) exitWith { + TRACE_3("Skipping Glass",_hitpoint,_forEachIndex,_selection); + }; + // Empty selections don't exist + // Empty hitpoints don't contain enough information + if (_selection isEqualTo "") exitWith { TRACE_3("Selection Empty",_hitpoint,_forEachIndex,_selection); }; + if (_hitpoint isEqualTo "") exitWith { TRACE_3("Hitpoint Empty",_hitpoint,_forEachIndex,_selection); }; + //Depends hitpoints shouldn't be modified directly (will be normalized) + if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "depends")) exitWith { + TRACE_3("Skip Depends",_hitpoint,_forEachIndex,_selection); }; - // Exit if current hitpoint is in sub-group (only main hitpoints get actions) - if (_inHitpointSubGroup) exitWith {}; + // Associated hitpoints can be grouped via config to produce a single repair action + _groupsConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); + _childHitPoint = false; + if (isArray _groupsConfig) then { + { + { + if (_hitpoint == _x) exitWith { + _childHitPoint = true; + }; + } forEach (_x select 1); + } forEach (getArray _groupsConfig); + }; + // If the current selection is associated with a child hitpoint, then skip + if (_childHitPoint) exitWith { TRACE_3("childHitpoint",_hitpoint,_forEachIndex,_selection); }; - // exit if the hitpoint is virtual - if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "depends")) exitWith {}; + // Find the action position + _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _selection]; - // add misc repair action - private ["_name", "_icon", "_selection", "_customSelectionsConfig"]; + // Custom position can be defined via config for associated hitpoint + _positionsConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointPositions); + if (isArray _positionsConfig) then { + { + _x params ["_hit", "_pos"]; + if (_hitpoint == _hit) exitWith { + if (_pos isEqualType []) exitWith { + _position = _pos; // Position in model space + }; + if (_pos isEqualType "") exitWith { + _position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _pos]; + }; + ACE_LOGERROR_3("Invalid custom position %1 of hitpoint %2 in vehicle %3.",_position,_hitpoint,_type); + }; + } forEach (getArray _positionsConfig); + }; - _name = format ["Repair_%1", _x]; + // Prepair the repair action + _name = format ["Repair_%1_%2", _forEachIndex, _selection]; + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; // Find localized string and track those added for numerization - ([_x, "%1", _x, [_hitPointsAddedNames, _hitPointsAddedStrings, _hitPointsAddedAmount]] call FUNC(getHitPointString)) params ["_text", "_trackArray"]; + ([_hitpoint, "%1", _hitpoint, [_hitPointsAddedNames, _hitPointsAddedStrings, _hitPointsAddedAmount]] call FUNC(getHitPointString)) params ["_text", "_trackArray"]; _hitPointsAddedNames = _trackArray select 0; _hitPointsAddedStrings = _trackArray select 1; _hitPointsAddedAmount = _trackArray select 2; - _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; - - _selection = ""; - - // Get custom position if available - _customSelectionsConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointPositions); - if (isArray _customSelectionsConfig) then { - // Loop through custom hitpoint positions array - _currentHitpoint = _x; - { - _x params ["_hitpoint", "_position"]; - // Exit with supplied custom position when same hitpoint name found or print RPT error if it's invalid - if (_hitpoint == _currentHitpoint) exitWith { - if (typeName _position == "ARRAY") exitWith { - _selection = _position; // Position in model space - }; - if (typeName _position == "STRING") exitWith { - _selection = _vehicle selectionPosition _position; // Selection name - }; - ACE_LOGERROR_3("Invalid custom position %1 of hitpoint %2 in vehicle %3.",_position,_hitpoint,_vehicle); - }; - } forEach (getArray _customSelectionsConfig); - }; - - // If position still empty (not a position array or selection name) try extracting from model - if (typeName _selection == "STRING" && {_selection == ""}) then { - _selection = _vehicle selectionPosition (_hitPointsSelections select (_hitPoints find _x)); - }; - - _condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; - _statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; - - if (_x in TRACK_HITPOINTS) then { - if (_x == "HitLTrack") then { - _selection = [-1.75, 0, -1.75]; + if (_hitpoint in TRACK_HITPOINTS) then { + // Tracks should always be unique + if (_hitpoint in _processedHitpoints) exitWith {TRACE_3("Duplicate Track",_hitpoint,_forEachIndex,_selection);}; + if (_hitpoint == "HitLTrack") then { + _position = [-1.75, 0, -1.75]; } else { - _selection = [1.75, 0, -1.75]; + _position = [1.75, 0, -1.75]; }; - _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "RepairTrack"], _selection, 4] call EFUNC(interact_menu,createAction); + TRACE_4("Adding RepairTrack",_hitpoint,_forEachIndex,_selection,_text); + _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RepairTrack"] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RepairTrack"] call DFUNC(repair)}; + _action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 4] call EFUNC(interact_menu,createAction); [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); } else { - _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "MiscRepair"], _selection, 4] call EFUNC(interact_menu,createAction); + TRACE_4("Adding MiscRepair",_hitpoint,_forEachIndex,_selection,_text); + _condition = {[_this select 1, _this select 0, _this select 2 select 0, "MiscRepair"] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, "MiscRepair"] call DFUNC(repair)}; + _action = [_name, _text, _icon, _statement, _condition, {}, [_forEachIndex], _position, 5] call EFUNC(interact_menu,createAction); // Put inside main actions if no other position was found above - if (_selection isEqualTo [0, 0, 0]) then { + if (_position isEqualTo [0,0,0]) then { [_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); } else { [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); }; }; - }; -} forEach _hitPoints; -_condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; -_statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; -_action = [QGVAR(fullRepair), localize LSTRING(fullRepair), "A3\ui_f\data\igui\cfg\actions\repair_ca.paa", _statement, _condition, {}, ["", "fullRepair"], "", 4] call EFUNC(interact_menu,createAction); + _processedHitPoints pushBack _hitPoint; + }; +} forEach _hitSelections; + +_condition = {[_this select 1, _this select 0, "", "fullRepair"] call DFUNC(canRepair)}; +_statement = {[_this select 1, _this select 0, "", "fullRepair"] call DFUNC(repair)}; +_action = [QGVAR(fullRepair), localize LSTRING(fullRepair), "A3\ui_f\data\igui\cfg\actions\repair_ca.paa", _statement, _condition, {}, [], "", 4] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); + // set class as initialized _initializedClasses pushBack _type; diff --git a/addons/repair/functions/fnc_addSpareParts.sqf b/addons/repair/functions/fnc_addSpareParts.sqf index 4d3197c8e8..74ea0d4c10 100644 --- a/addons/repair/functions/fnc_addSpareParts.sqf +++ b/addons/repair/functions/fnc_addSpareParts.sqf @@ -18,7 +18,6 @@ */ #include "script_component.hpp" -private ["_part"]; params ["_vehicle", ["_amount", 1], ["_part", ""], ["_force", false]]; TRACE_2("params",_vehicle,_amount); diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf index 0533f9f4fc..7ebfb5c5a8 100644 --- a/addons/repair/functions/fnc_canMiscRepair.sqf +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -5,38 +5,51 @@ * Arguments: * 0: Unit that does the repairing * 1: Vehicle to repair - * 2: Selected hitpoint + * 2: Selected hitpoint INDEX * * Return Value: * Can Misc Repair * * Example: - * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_canMiscRepair + * [unit, vehicle, 5] call ace_repair_fnc_canMiscRepair * * Public: No */ + #include "script_component.hpp" -private ["_hitpointGroupConfig", "_hitpointGroup", "_postRepairDamage", "_return"]; -params ["_caller", "_target", "_hitPoint"]; +private ["_hitpointGroupConfig", "_hitpointGroup", "_postRepairDamage", "_return", "_hitPointClassname", "_subHitIndex"]; +params ["_caller", "_target", "_hitPointIndex"]; -if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; +(getAllHitPointsDamage _target) params ["_allHitPoints", "", "_allHitPointDamages"]; + +if !([_caller, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Get hitpoint groups if available _hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroups); _hitpointGroup = []; if (isArray _hitpointGroupConfig) then { + _hitPointClassname = _allHitPoints select _hitPointIndex; + // Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group { + _x params ["_masterHitpoint", "_subHitArray"]; // Exit using found hitpoint group if this hitpoint is leader of any - if (_x select 0 == _hitPoint) exitWith { - _hitpointGroup = _x select 1; + if (_masterHitpoint == _hitPointClassname) exitWith { + { + _subHitIndex = _allHitPoints find _x; + if (_subHitIndex == -1) then { + ERROR("Hitpoint Not Found"); + } else { + _hitpointGroup pushBack _subHitIndex; + }; + } forEach _subHitArray; }; } forEach (getArray _hitpointGroupConfig); }; // Add current hitpoint to the group -_hitpointGroup pushBack _hitPoint; +_hitpointGroup pushBack _hitPointIndex; // Get post repair damage _postRepairDamage = [_caller] call FUNC(getPostRepairDamage); @@ -44,7 +57,7 @@ _postRepairDamage = [_caller] call FUNC(getPostRepairDamage); // Return true if damage can be repaired on any hitpoint in the group, else false _return = false; { - if ((_target getHitPointDamage _x) > _postRepairDamage) exitWith { + if ((_allHitPointDamages select _x) > _postRepairDamage) exitWith { _return = true; }; } forEach _hitpointGroup; diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf index 8fb2a4938e..f7c3f60a8a 100644 --- a/addons/repair/functions/fnc_canRepair.sqf +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -5,14 +5,14 @@ * Arguments: * 0: Unit that does the repairing * 1: Vehicle to repair - * 2: Selected hitpoint + * 2: Selected hitpoint or hitpointIndex or * 3: Repair Action Classname * * Return Value: * Can Repair * * Example: - * ["something", player] call ace_repair_fnc_canRepair + * [player, car, "HitHull", "MiscRepair"] call ace_repair_fnc_canRepair * * Public: Yes */ @@ -21,22 +21,22 @@ params ["_caller", "_target", "_hitPoint", "_className"]; TRACE_4("params",_caller,_target,_hitPoint,_className); -private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition", "_settingName", "_settingItemsArray"]; +private ["_config", "_engineerRequired", "_items", "_return", "_condition", "_vehicleStateCondition", "_settingName", "_settingItemsArray"]; _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); -if !(isClass _config) exitwith {false}; // or go for a default? -if(isEngineOn _target) exitwith {false}; +if !(isClass _config) exitWith {false}; // or go for a default? +if(isEngineOn _target) exitWith {false}; _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { getNumber (_config >> "requiredEngineer"); } else { // Check for required class - if (isText (_config >> "requiredEngineer")) exitwith { + if (isText (_config >> "requiredEngineer")) exitWith { missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; }; 0; }; -if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false}; //Items can be an array of required items or a string to a ACE_Setting array _items = if (isArray (_config >> "items")) then { @@ -49,56 +49,64 @@ _items = if (isArray (_config >> "items")) then { }; _settingItemsArray select (missionNamespace getVariable _settingName); }; -if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false}; _return = true; if (getText (_config >> "condition") != "") then { _condition = getText (_config >> "condition"); - if (isnil _condition) then { + if (isNil _condition) then { _condition = compile _condition; } else { _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _hitPoint, _className] call _condition; }; }; -if (!_return) exitwith {false}; +if (!_return) exitWith {false}; -_vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { - missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] -} else { - getNumber(_config >> "vehicleStateCondition") -}; -// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; +// _vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { + // missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] +// } else { + // getNumber(_config >> "vehicleStateCondition") +// }; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitWith {false}; -_locations = getArray (_config >> "repairLocations"); -if ("All" in _locations) exitwith {true}; - -private ["_repairFacility", "_repairVeh"]; -_repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; -_repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; - -{ - if (_x == "field") exitwith {_return = true;}; - if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; - if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; - if !(isnil _x) exitwith { - private "_val"; - _val = missionNamespace getVariable _x; - if (typeName _val == "SCALAR") then { - _return = switch (_val) do { - case 0: {true}; //useAnywhere - case 1: {call _repairVeh}; //repairVehicleOnly - case 2: {call _repairFacility}; //repairFacilityOnly - case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility - default {false}; //Disabled +private _repairLocations = getArray (_config >> "repairLocations"); +if (!("All" in _repairLocations)) then { + private _repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; + private _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + { + if (_x == "field") exitWith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitWith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;}; + if !(isNil _x) exitWith { + private _val = missionNamespace getVariable _x; + if (_val isEqualType 0) then { + _return = switch (_val) do { + case 0: {true}; //useAnywhere + case 1: {call _repairVeh}; //repairVehicleOnly + case 2: {call _repairFacility}; //repairFacilityOnly + case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility + default {false}; //Disabled + }; }; }; - }; -} forEach _locations; + } forEach _repairLocations; +}; +if (!_return) exitWith {false}; -_return && alive _target; +//Check that there are required objects nearby +private _requiredObjects = getArray (_config >> "claimObjects"); +if (!(_requiredObjects isEqualTo [])) then { + private _objectsAvailable = [_caller, 5, _requiredObjects] call FUNC(getClaimObjects); + if (_objectsAvailable isEqualTo []) then { + TRACE_2("Missing Required Objects",_requiredObjects,_objectsAvailable); + _return = false + }; +}; + +_return && {alive _target}; diff --git a/addons/repair/functions/fnc_canRepairTrack.sqf b/addons/repair/functions/fnc_canRepairTrack.sqf index 0ba01afb87..e1ff4a5628 100644 --- a/addons/repair/functions/fnc_canRepairTrack.sqf +++ b/addons/repair/functions/fnc_canRepairTrack.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 - * Check if the unit can replace given wheel of the vehicle. + * Check if the unit can replace given track of the vehicle. * * Arguments: * 0: Unit that does the repairing @@ -17,27 +17,11 @@ */ #include "script_component.hpp" -params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; -TRACE_4("params",_unit,_target,_hitPoint,_wheel); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; -if (typeName _wheel == "OBJECT") then { - // not near interpret as objNull - if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then { - _wheel = objNull; - }; -} else { - _wheel = objNull; +//check for a near track is handled by claimObjects[] config - { - if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { - _wheel = _x; - }; - } forEach nearestObjects [_unit, ["ACE_Track"], 5]; -}; - -if (isNull _wheel || damage _wheel >= 1) exitWith {false}; - -alive _target && {_target getHitPointDamage _hitPoint > 0} +(_target getHitPointDamage _hitPoint > 0) diff --git a/addons/repair/functions/fnc_canReplaceTrack.sqf b/addons/repair/functions/fnc_canReplaceTrack.sqf index aec3a9f062..a272a0d176 100644 --- a/addons/repair/functions/fnc_canReplaceTrack.sqf +++ b/addons/repair/functions/fnc_canReplaceTrack.sqf @@ -1,12 +1,11 @@ /* * Author: commy2 - * Check if the unit can replace given wheel of the vehicle. + * Check if the unit can replace given track of the vehicle. * * Arguments: * 0: Unit that does the repairing * 1: Vehicle to repair * 2: Selected hitpoint - * 3: Track / (default: false) * * Return Value: * None @@ -18,27 +17,11 @@ */ #include "script_component.hpp" -params ["_unit", "_target", "_hitPoint", ["_track", false]]; -TRACE_4("params",_unit,_target,_hitPoint,_track); -// TODO [_unit, _track] call EFUNC(common,claim); on start of action +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; -if (typeName _track == "OBJECT") then { - // not near interpret as objNull - if !(_track in nearestObjects [_unit, ["ACE_Track"], 5]) then { - _track = objNull; - }; -} else { - _track = objNull; +//check for a near track object is handled by claimObjects[] config - { - if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { - _track = _x; - }; - } forEach nearestObjects [_unit, ["ACE_Track"], 5]; -}; - -if (isNull _track) exitWith {false}; - -alive _target && {_target getHitPointDamage _hitPoint >= 1} +(_target getHitPointDamage _hitPoint >= 1) diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf index cf7a047f19..0b7f7ad4e7 100644 --- a/addons/repair/functions/fnc_canReplaceWheel.sqf +++ b/addons/repair/functions/fnc_canReplaceWheel.sqf @@ -6,7 +6,6 @@ * 0: Unit that does the repairing * 1: Vehicle to repair * 2: Selected hitpoint - * 3: Wheel / (default: false) * * Return Value: * None @@ -18,31 +17,12 @@ */ #include "script_component.hpp" -params ["_unit", "_target", "_hitPoint", ["_wheel", false]]; -TRACE_4("params",_unit,_target,_hitPoint,_wheel); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action -//if !([_unit, _target, _hitpoint, "ReplaceWheel"] call FUNC(canRepair)) exitwith {false}; +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; -//if !([_unit, GVAR(engineerSetting_Wheel)] call FUNC(isEngineer)) exitWith {false}; +//check for GVAR(engineerSetting_Wheel) is handeled by requiredEngineer config +//check for a near wheel object is handled by claimObjects[] config -// check for a near wheel -if (typeName _wheel == "OBJECT") then { - // not near interpret as objNull - if !(_wheel in nearestObjects [_unit, ["ACE_Wheel"], 5]) then { - _wheel = objNull; - }; -} else { - _wheel = objNull; - - { - if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { - _wheel = _x; - }; - } forEach nearestObjects [_unit, ["ACE_Wheel"], 5]; -}; - -if (isNull _wheel) exitWith {false}; - -alive _target && {_target getHitPointDamage _hitPoint >= 1} +(_target getHitPointDamage _hitPoint >= 1) diff --git a/addons/repair/functions/fnc_doFullRepair.sqf b/addons/repair/functions/fnc_doFullRepair.sqf index 6beec4c4c7..ed67a69e99 100644 --- a/addons/repair/functions/fnc_doFullRepair.sqf +++ b/addons/repair/functions/fnc_doFullRepair.sqf @@ -1,23 +1,22 @@ /* * Author: Glowbal - * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * Fully repairs vehicle * * Arguments: - * 0: Unit that does the repairing + * 0: Unit that does the repairing (not used) * 1: Vehicle to repair - * 2: Selected hitpoint * * Return Value: * None * * Example: - * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doFullRepair + * [unit, vehicle] call ace_repair_fnc_doFullRepair * * Public: No */ #include "script_component.hpp" -params ["_unit", "_vehicle", "_hitPoint"]; -TRACE_3("params",_unit,_vehicle,_hitPoint); +params ["", "_vehicle"]; +TRACE_1("params",_vehicle); _vehicle setDamage 0; diff --git a/addons/repair/functions/fnc_doRemoveTrack.sqf b/addons/repair/functions/fnc_doRemoveTrack.sqf index 68755658ca..d36407b197 100644 --- a/addons/repair/functions/fnc_doRemoveTrack.sqf +++ b/addons/repair/functions/fnc_doRemoveTrack.sqf @@ -19,10 +19,9 @@ params ["_unit", "_vehicle", "_hitPoint"]; TRACE_3("params",_unit,_vehicle,_hitPoint); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + // get current hitpoint damage -private "_hitPointDamage"; -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't remove destroyed or already removed wheel if (_hitPointDamage >= 1) exitWith {}; @@ -30,10 +29,9 @@ if (_hitPointDamage >= 1) exitWith {}; // don't die by spawning / moving the wheel ["fixCollision", _unit] call EFUNC(common,localEvent); -// spawn wheel -private "_wheel"; -_wheel = ["ACE_Track", getPosASL _unit] call FUNC(spawnObject); -_wheel setdamage _hitPointDamage; +// spawn track +private _newTrack = ["ACE_Track", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject); +TRACE_2("new track created",_newTrack,damage _newTrack); // raise event to set the new hitpoint damage ["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf index 0ffeb7ad23..21a152c597 100644 --- a/addons/repair/functions/fnc_doRemoveWheel.sqf +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -19,10 +19,9 @@ params ["_unit", "_vehicle", "_hitPoint"]; TRACE_3("params",_unit,_vehicle,_hitPoint); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + // get current hitpoint damage -private "_hitPointDamage"; -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't remove destroyed or already removed wheel if (_hitPointDamage >= 1) exitWith {}; @@ -31,9 +30,8 @@ if (_hitPointDamage >= 1) exitWith {}; ["fixCollision", _unit] call EFUNC(common,localEvent); // spawn wheel -private "_wheel"; -_wheel = ["ACE_Wheel", getPosASL _unit] call FUNC(spawnObject); -_wheel setdamage _hitPointDamage; +private _newWheel = ["ACE_Wheel", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject); +TRACE_2("new wheel created",_newWheel,damage _newWheel); // raise event to set the new hitpoint damage ["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 1cf3f77bca..4c063c6c73 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -5,61 +5,70 @@ * Arguments: * 0: Unit that does the repairing * 1: Vehicle to repair - * 2: Selected hitpoint + * 2: Selected hitpointIndex * * Return Value: * None * * Example: - * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRepair + * [unit, vehicle, 6, "MiscRepair"] call ace_repair_fnc_doRepair * * Public: No */ #include "script_component.hpp" -private ["_hitPointDamage", "_text", "_hitpointGroup"]; -params ["_unit", "_vehicle", "_hitPoint"]; -TRACE_3("params",_unit,_vehicle,_hitPoint); +params ["_unit", "_vehicle", "_hitPointIndex"]; +TRACE_3("params",_unit,_vehicle,_hitPointIndex); + +private _postRepairDamageMin = [_unit] call FUNC(getPostRepairDamage); + +(getAllHitPointsDamage _vehicle) params ["_allHitPoints"]; +private _hitPointClassname = _allHitPoints select _hitPointIndex; // get current hitpoint damage -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointCurDamage = _vehicle getHitIndex _hitPointIndex; -_hitPointDamage = _hitPointDamage - 0.5; -// don't use negative values for damage -_hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); +// repair a max of 0.5, don't use negative values for damage +private _hitPointNewDamage = (_hitPointCurDamage - 0.5) max _postRepairDamageMin; -// raise event to set the new hitpoint damage -["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); +if (_hitPointNewDamage < _hitPointCurDamage) then { + // raise event to set the new hitpoint damage + TRACE_3("repairing main point", _vehicle, _hitPointIndex, _hitPointNewDamage); + ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPointIndex, _hitPointNewDamage]] call EFUNC(common,targetEvent); + _hitPointCurDamage = _hitPointNewDamage; +}; // Get hitpoint groups if available -_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); -_hitpointGroup = []; +private _hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); if (isArray _hitpointGroupConfig) then { - // Retrieve group if current hitpoint is leader of any + // Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group { - if (_x select 0 == _hitPoint) exitWith { - ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; - // Set all sub-group hitpoints' damage to 0, if a hitpoint is invalid print RPT error + _x params ["_masterHitpoint", "_subHitArray"]; + // Exit using found hitpoint group if this hitpoint is leader of any + if (_masterHitpoint == _hitPointClassname) exitWith { { - if (_x in _hitpoints) then { - ["setVehicleHitPointDamage", _vehicle, [_vehicle, _x, 0]] call EFUNC(common,targetEvent); + private _subHitIndex = _allHitPoints find _x; //convert hitpoint classname to index + if (_subHitIndex == -1) then { + ACE_LOGERROR_2("Invalid hitpoint %1 in hitpointGroups of %2",_x,_vehicle); } else { - diag_log text format ["[ACE] ERROR: Invalid hitpoint %1 in hitpointGroups of %2", _x, _vehicle]; + private _subPointCurDamage = _vehicle getHitIndex _hitPointIndex; + private _subPointNewDamage = (_subPointCurDamage - 0.5) max _postRepairDamageMin; + if (_subPointNewDamage < _subPointCurDamage) then { + TRACE_3("repairing sub point", _vehicle, _subHitIndex, _subPointNewDamage); + ["setVehicleHitPointDamage", _vehicle, [_vehicle, _subHitIndex, _subPointNewDamage]] call EFUNC(common,targetEvent); + }; }; - - } forEach (_x select 1); + } forEach _subHitArray; }; } forEach (getArray _hitpointGroupConfig); }; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { - private ["_textLocalized", "_textDefault"]; - // Find localized string - _textLocalized = localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)); - _textDefault = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0)); - ([_hitPoint, _textLocalized, _textDefault] call FUNC(getHitPointString)) params ["_text"]; + private _textLocalized = localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointCurDamage > 0)); + private _textDefault = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointCurDamage > 0)); + ([_hitPointClassname, _textLocalized, _textDefault] call FUNC(getHitPointString)) params ["_text"]; // Display text [_text] call EFUNC(common,displayTextStructured); diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf index de04e71920..46c94c29f9 100644 --- a/addons/repair/functions/fnc_doRepairTrack.sqf +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -6,43 +6,39 @@ * 0: Unit that does the repairing * 1: Vehicle to repair * 2: Selected hitpoint - * 3: Repair Action Classname + * 3: Repair Action Classname (Not used) + * 4: (Not used) + * 5: (Not used) + * 6: Required Repair Objects * * Return Value: * None * * Example: - * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doRepairTrack + * [unit, vehicle, "hitpoint", "RepairTrack", [], [], [aTrack]] call ace_repair_fnc_doRepairTrack * * Public: No */ #include "script_component.hpp" -params ["_unit", "_vehicle", "_hitPoint", "_classname"]; -TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +params ["_unit", "_vehicle", "_hitPoint", "", "", "", "_claimedObjects"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects); -private ["_hitPointDamage", "_newDamage", "_wheel"]; +_claimedObjects params [["_track", objNull]]; +if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith { + ACE_LOGERROR_1("Bad Track", _claimedObjects); +}; -_wheel = objNull; - -{ - if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { - _wheel = _x; - }; -} forEach nearestObjects [_unit, ["ACE_Track"], 5]; -if (isNull _wheel) exitwith {}; +// can't use a destroyed track +if ((damage _track) >= 1) exitWith {}; // get current hitpoint damage +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _damageRepaired = (1 - (damage _track)) / 4; // require 4 tracks to fully replace one side -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; -_newDamage = (1 - (damage _wheel)) / 4; // require 4 tracks to fully replace one side - -// can't replace a destroyed wheel -if ((damage _wheel) >= 1) exitWith {}; // don't die by spawning / moving the wheel -_hitPointDamage = (_hitPointDamage - _newDamage) min 0; -deleteVehicle _wheel; +_hitPointDamage = (_hitPointDamage - _damageRepaired) min 0; +deleteVehicle _track; // raise event to set the new hitpoint damage ["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf index a95a669159..9eafe68c9e 100644 --- a/addons/repair/functions/fnc_doReplaceTrack.sqf +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -1,54 +1,50 @@ /* * Author: commy2 - * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * Replaces a track. * * Arguments: * 0: Unit that does the repairing * 1: Vehicle to repair * 2: Selected hitpoint - * 3: Repair Action Classname + * 3: Repair Action Classname (Not used) + * 4: (Not used) + * 5: (Not used) + * 6: Required Repair Objects * * Return Value: * None * * Example: - * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceTrack + * [unit, vehicle, "hitpoint", "ReplaceTrack", [], [], [aTrack]] call ace_repair_fnc_doReplaceTrack * * Public: No */ #include "script_component.hpp" -params ["_unit", "_vehicle", "_hitPoint", "_classname"]; -TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +params ["_unit", "_vehicle", "_hitPoint", "", "", "", "_claimedObjects"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects); -private["_hitPointDamage", "_wheel"]; - -_wheel = objNull; - -{ - if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { - _wheel = _x; - }; -} forEach nearestObjects [_unit, ["ACE_Track"], 5]; -if (isNull _wheel) exitwith {}; +_claimedObjects params [["_track", objNull]]; +if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith { + ACE_LOGERROR_1("Bad Track", _claimedObjects); +}; // get current hitpoint damage -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't replace not destroyed wheel if (_hitPointDamage < 1) exitWith {}; -// don't die by spawning / moving the wheel -_hitPointDamage = damage _wheel; +// get track's damage +private _newHitPointDamage = damage _track; -// can't replace a destroyed wheel -if (_hitPointDamage >= 1) exitWith {}; +// can't replace with a destroyed wheel +if (_newHitPointDamage >= 1) exitWith {}; -deleteVehicle _wheel; +deleteVehicle _track; // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _newHitPointDamage]] call EFUNC(common,targetEvent); // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index f10712d65d..ce5e9220dd 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -1,54 +1,50 @@ /* * Author: commy2 - * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * Repairs a vehicle's wheel with a ACE_wheel spare part object. * * Arguments: * 0: Unit that does the repairing * 1: Vehicle to repair * 2: Selected hitpoint - * 3: Repair Action Classname + * 3: Repair Action Classname (Not used) + * 4: (Not used) + * 5: (Not used) + * 6: Required Repair Objects * * Return Value: * None * * Example: - * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceWheel + * [unit, vehicle, "hitpoint", "ReplaceWheel", [], [], [aWheel]] call ace_repair_fnc_doReplaceWheel * * Public: No */ #include "script_component.hpp" -params ["_unit", "_vehicle", "_hitPoint", "_classname"]; -TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); -// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +params ["_unit", "_vehicle", "_hitPoint", "", "", "", "_claimedObjects"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects); -private ["_hitPointDamage", "_wheel"]; - -_wheel = objNull; - -{ - if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { - _wheel = _x; - }; -} forEach nearestObjects [_unit, ["ACE_Wheel"], 5]; -if (isNull _wheel) exitwith {}; +_claimedObjects params [["_wheel", objNull]]; +if ((isNull _wheel) || {!([_unit, _wheel, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith { + ACE_LOGWARNING_1("Bad Claimed Wheel", _claimedObjects); +}; // get current hitpoint damage -_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; // can't replace not destroyed wheel if (_hitPointDamage < 1) exitWith {}; -// don't die by spawning / moving the wheel -_hitPointDamage = damage _wheel; +// get replacement wheel's damage +private _newHitPointDamage = damage _wheel; // can't replace a destroyed wheel -if (_hitPointDamage >= 1) exitWith {}; +if (_newHitPointDamage >= 1) exitWith {}; deleteVehicle _wheel; // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _newHitPointDamage]] call EFUNC(common,targetEvent); // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_getClaimObjects.sqf b/addons/repair/functions/fnc_getClaimObjects.sqf new file mode 100644 index 0000000000..bc15975d1c --- /dev/null +++ b/addons/repair/functions/fnc_getClaimObjects.sqf @@ -0,0 +1,45 @@ +/* + * Author: PabstMirror + * Returns array of required nearby repair objects (wheels/tracks) + * + * Arguments: + * 0: Unit that does the repairing + * 1: Max range to seach from unit (meters) + * 2: Array of arrays of classnames + * + * Return Value: + * Array of objects, or [] if not all available + * + * Example: + * [player, 5, [["Ace_Track"]]] call ace_repair_fnc_getClaimObjects + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_maxRange", "_objectsToClaim"]; +TRACE_3("params",_unit,_maxRange,_objectsToClaim); + +private _return = []; + +{ + private _requiredList = _x; //eg ["ace_track", "ace_track"] + private _ableToAquire = []; //will be array of ojbects + { + private _nearObjects = nearestObjects [_unit, [_x], _maxRange]; + private _canClaimObject = objNull; + { + if ((!(_x in _ableToAquire)) + && {[_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)} + &&{(damage _x) < 1} + ) exitWith { _canClaimObject = _x; }; + } forEach _nearObjects; + if (isNull _canClaimObject) exitWith {}; + _ableToAquire pushBack _canClaimObject; + } forEach _x; + TRACE_2("Check required equals available",_requiredList,_ableToAquire); + if ((count _ableToAquire) == (count _requiredList)) exitWith {_return = _ableToAquire}; + false +} count _objectsToClaim; + +_return diff --git a/addons/repair/functions/fnc_getHitPointString.sqf b/addons/repair/functions/fnc_getHitPointString.sqf index 1358e99595..fd108e4b1f 100644 --- a/addons/repair/functions/fnc_getHitPointString.sqf +++ b/addons/repair/functions/fnc_getHitPointString.sqf @@ -13,15 +13,16 @@ * 1: Added Hitpoint (default: []) * * Example: - * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getHitPointString + * ["HitFuel", "Repairing %1 ...", "Repairing HitFuel"] call ace_repair_fnc_getHitPointString * * Public: No */ #include "script_component.hpp" -private ["_track", "_trackNames", "_trackStrings", "_trackAmount", "_text", "_toFind", "_trackIndex", "_combinedString"]; params ["_hitPoint", "_textLocalized", "_textDefault", ["_trackArray", []]]; +private ["_track", "_trackNames", "_trackStrings", "_trackAmount", "_text", "_toFind", "_trackIndex", "_combinedString"]; + _track = if (count _trackArray > 0) then {true} else {false}; _trackNames = []; _trackStrings = []; @@ -37,7 +38,7 @@ if (_track) then { _text = LSTRING(Hit); // Remove "Hit" from hitpoint name if one exists -_toFind = if (_hitPoint find "Hit" == 0) then { +_toFind = if ((toLower _hitPoint) find "hit" == 0) then { [_hitPoint, 3] call CBA_fnc_substr } else { _hitPoint @@ -83,6 +84,7 @@ for "_i" from 0 to (count _hitPoint) do { // Don't display part name if no string is found in stringtable if (_text == LSTRING(Hit)) then { + if (_hitPoint != "") then { ACE_LOGWARNING_1("Hitpoint [%1] - could not be localized", _hitPoint); }; _text = _textDefault; }; diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf index 797f7a4f22..36e4bf39ae 100644 --- a/addons/repair/functions/fnc_getPostRepairDamage.sqf +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -19,7 +19,7 @@ params ["_unit"]; TRACE_1("params",_unit); // TODO when near repair station, full repair? -if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitwith {0}; +if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitWith {0}; if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)}; if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)}; diff --git a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf index 182c6f54f0..2611d10b38 100644 --- a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf +++ b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf @@ -10,7 +10,7 @@ * 1: Wheel hitpoint selections in model coordinates * * Example: - * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getWheelHitPointsWithSelections + * [car1] call ace_repair_fnc_getWheelHitPointsWithSelections * * Public: No */ @@ -19,64 +19,80 @@ params ["_vehicle"]; TRACE_1("params",_vehicle); +private["_bestDist", "_bestIndex", "_wheelBone", "_wheelBoneNameResized", "_wheelCenter", "_wheelCenterPos", "_wheelHitPoint", "_wheelHitPointSelection", "_wheelHitPointSelections", "_wheelHitPoints", "_wheelName", "_xDist", "_xPos"]; + // get the vehicles wheel config private "_wheels"; -_wheels = configfile >> "CfgVehicles" >> typeOf _vehicle >> "Wheels"; +_wheels = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Wheels"; // exit with nothing if the vehicle has no wheels class -if !(isClass _wheels) exitWith {[[],[]]}; +if !(isClass _wheels) exitWith {TRACE_1("No Wheels",_wheels); [[],[]]}; + +// get all hitpoints and selections +(getAllHitPointsDamage _vehicle) params ["_hitPoints", "_hitPointSelections"]; // get all wheels and read selections from config -private ["_selections", "_bones"]; - _wheels = "true" configClasses _wheels; -_selections = []; -_bones = []; -{ - _selections pushBack getText (_x >> "center"); - - private "_bone"; - _bone = getText (_x >> "boneName"); - - _bone = toArray _bone; - _bone resize count "wheel_X_Y"; // this is a requirement for physx. Should work for all addon vehicles. - _bone = toString _bone; - - _bones pushBack _bone; -} forEach _wheels; - -// get hitpoints with their fire geometry selections -private ["_hitPointsWithSelections", "_hitPoints", "_hitPointSelections"]; - -_hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitPointsWithSelections); - -_hitPoints = _hitPointsWithSelections select 0; -_hitPointSelections = _hitPointsWithSelections select 1; - -// assign hitpoints to correct wheel selection by comparing bone name and fire geometry selection -private ["_wheelHitPoints", "_wheelHitPointSelections"]; - _wheelHitPoints = []; _wheelHitPointSelections = []; + { - private "_bone"; - _bone = _x; + _wheelName = configName _x; + _wheelCenter = getText (_x >> "center"); + _wheelBone = getText (_x >> "boneName"); + _wheelBoneNameResized = _wheelBone select [0, 9]; //ount "wheel_X_Y"; // this is a requirement for physx. Should work for all addon vehicles. - private "_index"; + TRACE_4("",_wheelName,_wheelCenter,_wheelBone,_wheelBoneNameResized); - _index = -1; + _wheelHitPoint = ""; + _wheelHitPointSelection = ""; + + //Commy's orginal method { - if (_bone != "" && {_x find _bone == 0}) exitWith { // same as above. Requirement for physx. - _index = _forEachIndex; + if ((_wheelBoneNameResized != "") && {_x find _wheelBoneNameResized == 0}) exitWith { // same as above. Requirement for physx. + _wheelHitPoint = _hitPoints select _forEachIndex; + _wheelHitPointSelection = _hitPointSelections select _forEachIndex; + TRACE_2("wheel found [Orginal]", _wheelName, _wheelHitPoint); }; } forEach _hitPointSelections; - if (_index != -1) then { - _wheelHitPoints pushBack (_hitPoints select _index); - _wheelHitPointSelections pushBack (_selections select _forEachIndex); + + if (_vehicle isKindOf "Car") then { + //Backup method, search for the closest hitpoint to the wheel's center selection pos. + //Ref #2742 - RHS's HMMWV + if (_wheelHitPoint == "") then { + _wheelCenterPos = _vehicle selectionPosition _wheelCenter; + if (_wheelCenterPos isEqualTo [0,0,0]) exitWith {TRACE_1("no center?",_wheelCenter);}; + + + _bestDist = 99; + _bestIndex = -1; + { + if (_x != "") then { + _xPos = _vehicle selectionPosition _x; + if (_xPos isEqualTo [0,0,0]) exitWith {}; + _xDist = _wheelCenterPos distance _xPos; + if (_xDist < _bestDist) then { + _bestIndex = _forEachIndex; + _bestDist = _xDist; + }; + }; + } forEach _hitPointSelections; + + TRACE_2("closestPoint",_bestDist,_bestIndex); + if (_bestIndex != -1) then { + _wheelHitPoint = _hitPoints select _bestIndex; + _wheelHitPointSelection = _hitPointSelections select _bestIndex; + TRACE_2("wheel found [Backup]", _wheelName, _wheelHitPoint); + }; + }; }; -} forEach _bones; + if ((_wheelHitPoint != "") && {_wheelHitPointSelection != ""}) then { + _wheelHitPoints pushBack _wheelHitPoint; + _wheelHitPointSelections pushBack _wheelHitPointSelection; + }; +} forEach _wheels; [_wheelHitPoints, _wheelHitPointSelections] diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf index 2f070c8bb6..3af9316256 100644 --- a/addons/repair/functions/fnc_hasItems.sqf +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -23,10 +23,10 @@ private ["_return"]; _return = true; { - if (typeName _x == "ARRAY" && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { + if ((_x isEqualType []) && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitWith { _return = false; }; - if (typeName _x == "STRING" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitwith { + if ((_x isEqualType "") && {!([_unit, _x] call EFUNC(common,hasItem))}) exitWith { _return = false; }; } forEach _items; diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index 9d6af3a1ff..485a300260 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -24,6 +24,6 @@ _class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehic // This if statement is here for copmatability with the common variant of isEngineer, which requires a bool. // We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. -if (typeName _class == "BOOL") then {_class = 1}; +if (_class isEqualType false) then {_class = [0, 1] select _class}; _class >= (_engineerN min GVAR(engineerSetting_Repair)); diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf index 0c062ff0b3..b72d8a5985 100644 --- a/addons/repair/functions/fnc_isInRepairFacility.sqf +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -26,7 +26,7 @@ _repairFacility = []; _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]); { - if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitWith { _isInBuilding = true; }; } forEach _objects; @@ -34,7 +34,7 @@ _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position sel if (!_isInBuilding) then { _objects = position _object nearObjects 7.5; { - if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitWith { _isInBuilding = true; }; } forEach _objects; diff --git a/addons/repair/functions/fnc_isNearRepairVehicle.sqf b/addons/repair/functions/fnc_isNearRepairVehicle.sqf index 677f489a88..463e281faa 100644 --- a/addons/repair/functions/fnc_isNearRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isNearRepairVehicle.sqf @@ -24,7 +24,7 @@ _nearObjects = nearestObjects [_unit, ["Air","LandVehicle"], 20]; _return = false; { - if ([_x] call FUNC(isRepairVehicle)) exitwith {_return = true;}; + if ([_x] call FUNC(isRepairVehicle)) exitWith {_return = true;}; } forEach _nearObjects; _return; diff --git a/addons/repair/functions/fnc_isRepairVehicle.sqf b/addons/repair/functions/fnc_isRepairVehicle.sqf index 121bda0fe3..2c0b5a1e21 100644 --- a/addons/repair/functions/fnc_isRepairVehicle.sqf +++ b/addons/repair/functions/fnc_isRepairVehicle.sqf @@ -18,6 +18,6 @@ params ["_vehicle"]; TRACE_1("params",_vehicle); -if (_vehicle isKindOf "CAManBase") exitwith {false}; +if (_vehicle isKindOf "CAManBase") exitWith {false}; ((_vehicle getVariable ["ACE_isRepairVehicle", getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canRepair))]) > 0); diff --git a/addons/repair/functions/fnc_moduleAddSpareParts.sqf b/addons/repair/functions/fnc_moduleAddSpareParts.sqf index cceb62e10c..bc2502c0f4 100644 --- a/addons/repair/functions/fnc_moduleAddSpareParts.sqf +++ b/addons/repair/functions/fnc_moduleAddSpareParts.sqf @@ -11,7 +11,7 @@ * None * * Example: - * function = "ace_repair_fnc_moduleAddSpareParts" + * [logic] call ace_repair_fnc_moduleAddSpareParts * * Public: No */ @@ -41,5 +41,6 @@ if (!isNull _logic) then { // Add spare parts { [_x, _amount, _part, true] call FUNC(addSpareParts); + false } count _list; }; diff --git a/addons/repair/functions/fnc_moduleAssignEngineer.sqf b/addons/repair/functions/fnc_moduleAssignEngineer.sqf index 240a8c3b62..d64573130c 100644 --- a/addons/repair/functions/fnc_moduleAssignEngineer.sqf +++ b/addons/repair/functions/fnc_moduleAssignEngineer.sqf @@ -11,7 +11,7 @@ * None * * Example: - * function = "ace_repair_fnc_moduleAssignEngineer" + * [logic] call ace_repair_fnc_moduleAssignEngineer * * Public: No */ diff --git a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf index 7150d0226b..9f01a06afc 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf @@ -11,7 +11,7 @@ * None * * Example: - * function = "ace_repair_fnc_moduleAssignRepairFacility" + * [logic] call ace_repair_fnc_moduleAssignRepairFacility * * Public: No */ diff --git a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf index 647b5fe52c..f5df8d58e2 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf @@ -11,7 +11,7 @@ * None * * Example: - * function = "ace_repair_fnc_moduleAssignRepairVehicle" + * [logic] call ace_repair_fnc_moduleAssignRepairVehicle * * Public: No */ diff --git a/addons/repair/functions/fnc_moduleRepairSettings.sqf b/addons/repair/functions/fnc_moduleRepairSettings.sqf index 98ff354662..770af07449 100644 --- a/addons/repair/functions/fnc_moduleRepairSettings.sqf +++ b/addons/repair/functions/fnc_moduleRepairSettings.sqf @@ -4,14 +4,12 @@ * * Arguments: * 0: The module logic - * 1: Synchronized units - * 2: Activated * * Return Value: * None * * Example: - * function = "ace_repair_fnc_moduleRepairSettings" + * [logic] call ace_repair_fnc_moduleRepairSettings * * Public: No */ diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf index 88c72f4de8..a73dfcfe0d 100644 --- a/addons/repair/functions/fnc_normalizeHitPoints.sqf +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -16,33 +16,45 @@ #include "script_component.hpp" params ["_vehicle"]; -TRACE_1("params",_vehicle); +TRACE_2("params",_vehicle, typeOf _vehicle); // Can't execute all commands if the vehicle isn't local, exit if that's so -if !(local _vehicle) exitWith {}; +if !(local _vehicle) exitWith {ACE_LOGERROR_1("Vehicle Not Local %1", _vehicle);}; -private ["_hitPoints", "_config", "_dependentHitPoints", "_dependentHitPointScripts", "_damage"]; +(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]]; -_hitPoints = [_vehicle] call EFUNC(common,getHitPoints); -_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; -// define global variables. Needed to parse the depends config entries. Also find dependent hitpoints. +private _realHitPoints = []; +private _dependentHitPoints = []; +private _dependentHitPointScripts = []; -_dependentHitPoints = []; -_dependentHitPointScripts = []; +// Find dependent hitpoints +{ + if ((_x != "") && {isClass (_config >> _x)} && {!(_x in _realHitPoints)}) then { + _realHitPoints pushBack _x; + if (isText (_config >> _x >> "depends")) then { + _dependentHitPoints pushBack _x; + _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); + }; + }; +} forEach _allHitPoints; +TRACE_2("",_realHitPoints,_dependentHitPoints); + +// Don't bother setting variables if no depends on vehicle: +if (_dependentHitPoints isEqualTo []) exitWith {}; + + +// Define global variables Total = damage _vehicle; - { missionNamespace setVariable [_x, _vehicle getHitPointDamage _x]; - if (isText (_config >> _x >> "depends")) then { - _dependentHitPoints pushBack _x; - _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); - }; -} forEach _hitPoints; +} forEach _realHitPoints; // apply normalized damage to all dependand hitpoints { - _damage = call (_dependentHitPointScripts select _forEachIndex); + private _damage = call (_dependentHitPointScripts select _forEachIndex); + TRACE_2("setting depend hitpoint", _x, _damage); _vehicle setHitPointDamage [_x, _damage]; } forEach _dependentHitPoints; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index fd3b4f032b..304a804814 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -4,8 +4,8 @@ * * Arguments: * 0: Unit that does the repairing - * 1: Vehicle to repair + * 1: Vehicle to repair + * 2: Selected hitpoint or hitpointIndex or * 3: Repair Action Classname * * Return Value: @@ -21,22 +21,22 @@ params ["_caller", "_target", "_hitPoint", "_className"]; TRACE_4("params",_calller,_target,_hitPoint,_className); -private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_locations", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn", "_settingName", "_settingItemsArray"]; +private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn", "_settingName", "_settingItemsArray", "_hitPointClassname"]; _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); -if !(isClass _config) exitwith {false}; // or go for a default? +if !(isClass _config) exitWith {false}; // or go for a default? _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { getNumber (_config >> "requiredEngineer"); } else { // Check for required class - if (isText (_config >> "requiredEngineer")) exitwith { + if (isText (_config >> "requiredEngineer")) exitWith { missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; }; 0; }; -if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; -if (isEngineOn _target) exitwith {false}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false}; +if (isEngineOn _target) exitWith {false}; //Items can be an array of required items or a string to a ACE_Setting array _items = if (isArray (_config >> "items")) then { @@ -49,64 +49,78 @@ _items = if (isArray (_config >> "items")) then { }; _settingItemsArray select (missionNamespace getVariable _settingName); }; -if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false}; _return = true; if (getText (_config >> "condition") != "") then { _condition = getText (_config >> "condition"); - if (isnil _condition) then { + if (isNil _condition) then { _condition = compile _condition; } else { _condition = missionNamespace getVariable _condition; }; - if (typeName _condition == "BOOL") then { + if (_condition isEqualType false) then { _return = _condition; } else { _return = [_caller, _target, _hitPoint, _className] call _condition; }; }; -if (!_return) exitwith {false}; +if (!_return) exitWith {false}; -_vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { - missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] -} else { - getNumber(_config >> "vehicleStateCondition") -}; -// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; +// _vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { + // missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] +// } else { + // getNumber(_config >> "vehicleStateCondition") +// }; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitWith {false}; -_locations = getArray (_config >> "repairLocations"); -if ("All" in _locations) exitwith {true}; - -private ["_repairFacility", "_repairVeh"]; -_repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; -_repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; - -{ - if (_x == "field") exitwith {_return = true;}; - if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; - if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; - if !(isnil _x) exitwith { - private "_val"; - _val = missionNamespace getVariable _x; - if (typeName _val == "SCALAR") then { - _return = switch (_val) do { - case 0: {true}; //useAnywhere - case 1: {call _repairVeh}; //repairVehicleOnly - case 2: {call _repairFacility}; //repairFacilityOnly - case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility - default {false}; //Disabled +private _repairLocations = getArray (_config >> "repairLocations"); +if (!("All" in _repairLocations)) then { + private _repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; + private _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + { + if (_x == "field") exitWith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitWith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitWith {_return = true;}; + if !(isNil _x) exitWith { + private _val = missionNamespace getVariable _x; + if (_val isEqualType 0) then { + _return = switch (_val) do { + case 0: {true}; //useAnywhere + case 1: {call _repairVeh}; //repairVehicleOnly + case 2: {call _repairFacility}; //repairFacilityOnly + case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility + default {false}; //Disabled + }; }; }; - }; -} forEach _locations; + } forEach _repairLocations; +}; -if !(_return && alive _target) exitwith {false}; +private _requiredObjects = getArray (_config >> "claimObjects"); +private _claimObjectsAvailable = []; +if (!(_requiredObjects isEqualTo [])) then { + _claimObjectsAvailable = [_caller, 5, _requiredObjects] call FUNC(getClaimObjects); + if (_claimObjectsAvailable isEqualTo []) then { + TRACE_2("Missing Required Objects",_requiredObjects,_claimObjectsAvailable); + _return = false + }; +}; + +if !(_return && alive _target) exitWith {false}; +//Last exitWith: repair_success or repair_failure will be run + +//Claim required objects +{ + TRACE_2("Claiming", _x, (typeOf _x)); + [_caller, _x, false] call EFUNC(common,claim); +} forEach _claimObjectsAvailable; _consumeItems = if (isNumber (_config >> "itemConsumed")) then { getNumber (_config >> "itemConsumed"); } else { // Check for required class - if (isText (_config >> "itemConsumed")) exitwith { + if (isText (_config >> "itemConsumed")) exitWith { missionNamespace getVariable [(getText (_config >> "itemConsumed")), 0]; }; 0; @@ -131,7 +145,7 @@ if (isNil _callbackProgress) then { // Player Animation _callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); -_caller setvariable [QGVAR(selectedWeaponOnrepair), currentWeapon _caller]; +_caller setVariable [QGVAR(selectedWeaponOnrepair), currentWeapon _caller]; // Cannot use secondairy weapon for animation if (currentWeapon _caller == secondaryWeapon _caller) then { @@ -149,9 +163,9 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { }; if (stance _caller == "STAND") then { - _caller setvariable [QGVAR(repairPrevAnimCaller), "amovpknlmstpsraswrfldnon"]; + _caller setVariable [QGVAR(repairPrevAnimCaller), "amovpknlmstpsraswrfldnon"]; } else { - _caller setvariable [QGVAR(repairPrevAnimCaller), animationState _caller]; + _caller setVariable [QGVAR(repairPrevAnimCaller), animationState _caller]; }; [_caller, _callerAnim] call EFUNC(common,doAnimation); }; @@ -160,14 +174,14 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { _repairTime = if (isNumber (_config >> "repairingTime")) then { getNumber (_config >> "repairingTime"); } else { - if (isText (_config >> "repairingTime")) exitwith { + if (isText (_config >> "repairingTime")) exitWith { _repairTimeConfig = getText(_config >> "repairingTime"); - if (isnil _repairTimeConfig) then { + if (isNil _repairTimeConfig) then { _repairTimeConfig = compile _repairTimeConfig; } else { _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; }; - if (typeName _repairTimeConfig == "SCALAR") exitwith { + if (_repairTimeConfig isEqualType 0) exitWith { _repairTimeConfig; }; [_caller, _target, _hitPoint, _className] call _repairTimeConfig; @@ -177,13 +191,21 @@ _repairTime = if (isNumber (_config >> "repairingTime")) then { private ["_processText"]; // Find localized string +_hitPointClassname = if ((typeName _hitPoint) == "STRING") then { + _hitPoint +} else { + ((getAllHitPointsDamage _target) select 0) select _hitPoint +}; _processText = getText (_config >> "displayNameProgress"); -([_hitPoint, _processText, _processText] call FUNC(getHitPointString)) params ["_text"]; +private _backupText = format [localize LSTRING(RepairingHitPoint), _hitPointClassname]; +([_hitPointClassname, _processText, _backupText] call FUNC(getHitPointString)) params ["_text"]; + +TRACE_4("display",_hitPoint,_hitPointClassname,_processText,_text); // Start repair [ _repairTime, - [_caller, _target, _hitPoint, _className, _items, _usersOfItems], + [_caller, _target, _hitPoint, _className, _items, _usersOfItems, _claimObjectsAvailable], DFUNC(repair_success), DFUNC(repair_failure), _text, diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf index 6e27ab07a7..3fabb58e80 100644 --- a/addons/repair/functions/fnc_repair_failure.sqf +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -6,23 +6,24 @@ * 0: Arguments * 0: Unit that does the repairing * 1: Vehicle to repair + * 2: Selected hitpoint or hitpointIndex or * 3: Repair Action Classname * 4: None * 5: Items available + * 6: Claimed Repair Objects * * Return Value: * None * * Example: - * [[unit, vehicle, "hitpoint", "classname", nil, [items]]] call ace_repair_fnc_repair_failure + * [[unit, vehicle, "hitpoint", "classname", nil, [items], [aWheel]]] call ace_repair_fnc_repair_failure * * Public: No */ #include "script_component.hpp" params ["_args"]; -_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems"]; +_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems", "_claimedObjects"]; TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems); private ["_config","_callback", "_usersOfItems", "_weaponSelect"]; @@ -33,7 +34,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { if (vehicle _caller == _caller) then { [_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); }; -_caller setvariable [QGVAR(repairPrevAnimCaller), nil]; +_caller setVariable [QGVAR(repairPrevAnimCaller), nil]; _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); if (_weaponSelect != "") then { @@ -46,6 +47,13 @@ if (_weaponSelect != "") then { (_x select 0) addItem (_x select 1); } forEach _usersOfItems; +//Unclaim repair objects: +{ + TRACE_2("Releasing", _x, (typeOf _x)); + [objNull, _x, false] call EFUNC(common,claim); +} forEach _claimedObjects; + + // Record specific callback _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); @@ -58,4 +66,4 @@ if (isNil _callback) then { _args call _callback; -// _args call FUNC(createLitter); +//todo: repair litter? diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf index ccad93663f..9625dad1df 100644 --- a/addons/repair/functions/fnc_repair_success.sqf +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -6,21 +6,24 @@ * 0: Arguments * 0: Unit that does the repairing * 1: Vehicle to repair + * 2: Selected hitpoint or hitpointIndex or * 3: Repair Action Classname + * 4: Items + * 5: User of Items + * 6: Claimed Repair Objects * * Return Value: * None * * Example: - * [[unit, vehicle, "hitpoint", "classname"]] call ace_repair_fnc_repair_success + * [[unit, vehicle, "hitpoint", "classname", [], [], [aWheel]]] call ace_repair_fnc_repair_success * * Public: No */ #include "script_component.hpp" params ["_args"]; -_args params ["_caller", "_target","_selectionName","_className"]; +_args params ["_caller", "_target","_selectionName","_className","","","_claimedObjects"]; TRACE_4("params",_caller,_target,_selectionName,_className); private ["_config","_callback", "_weaponSelect"]; @@ -31,7 +34,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { if (vehicle _caller == _caller) then { [_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); }; -_caller setvariable [QGVAR(repairPrevAnimCaller), nil]; +_caller setVariable [QGVAR(repairPrevAnimCaller), nil]; _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); if (_weaponSelect != "") then { @@ -40,6 +43,12 @@ if (_weaponSelect != "") then { _caller action ["SwitchWeapon", _caller, _caller, 99]; }; +//Unclaim repair objects: +{ + TRACE_2("Releasing", _x, (typeOf _x)); + [objNull, _x, false] call EFUNC(common,claim); +} forEach _claimedObjects; + // Record specific callback _config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); @@ -51,4 +60,4 @@ if (isNil _callback) then { }; _args call _callback; -// _args call FUNC(createLitter); +//todo: repair litter? diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index a8b4cd347b..ba04cdb7eb 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -1,86 +1,83 @@ /* * Author: commy2 * Set the hitpoint damage and change the structural damage acordingly, requires local vehicle. + * Handles the "setVehicleHitPointDamage" event * * Arguments: * 0: Local Vehicle to Damage - * 1: Selected hitpoint + * 1: Selected hitpoint INDEX * 2: Total Damage * * Return Value: * None * * Example: - * [vehicle, "hitpoint", 0.5] call ace_repair_fnc_setHitPointDamage + * [vehicle, 1, 0.5] call ace_repair_fnc_setHitPointDamage * * Public: No */ #include "script_component.hpp" -params ["_vehicle", "_hitPoint", "_hitPointDamage"]; -TRACE_3("params",_vehicle,_hitPoint,_hitPointDamage); +params ["_vehicle", "_hitPointIndex", "_hitPointDamage"]; +TRACE_4("params",_vehicle,typeOf _vehicle,_hitPointIndex,_hitPointDamage); + +private["_damageNew", "_damageOld", "_hitPointDamageRepaired", "_hitPointDamageSumOld", "_realHitpointCount", "_selectionName"]; // can't execute all commands if the vehicle isn't local. exit here. -if !(local _vehicle) exitWith {}; +if !(local _vehicle) exitWith {ACE_LOGERROR_1("Vehicle Not Local %1", _vehicle);}; -// get all valid hitpoints -private ["_hitPoints", "_hitPointsWithSelections"]; +//Check for bad typeName (changed from orignal v3.3 that took string) +if (_hitPointIndex isEqualType "") then { + ACE_DEPRECATED("repair-setHitPointDamage (hit point name ","3.5.0","hit index "); + _hitPointIndex = _allHitPoints find _hitPointIndex; +}; -_hitPoints = [_vehicle] call EFUNC(common,getHitpoints); -_hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitpointsWithSelections) select 0; +// get all hitpoints and selections and damages +(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]]; // exit if the hitpoint is not valid -if !(_hitPoint in _hitPoints) exitWith {systemChat format["NOT A VALID HITPOINT: %1",_hitpoint]}; - -// save array with damage values of all hitpoints -private "_hitPointDamages"; -_hitPointDamages = []; - -{ - _hitPointDamages set [_forEachIndex, (_vehicle getHitPointDamage _x)]; -} forEach _hitPoints; +if ((_hitPointIndex < 0) || {_hitPointIndex >= (count _allHitPoints)}) exitWith {ACE_LOGERROR_2("NOT A VALID HITPOINT: %1-%2", _hitPointIndex,_vehicle);}; // save structural damage and sum of hitpoint damages -private ["_damageOld", "_hitPointDamageSumOld"]; _damageOld = damage _vehicle; +_realHitpointCount = 0; _hitPointDamageSumOld = 0; +_hitPointDamageRepaired = 0; //positive for repairs : newSum = (oldSum - repaired) { - if (!(_x in IGNORED_HITPOINTS) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { - _hitPointDamageSumOld = _hitPointDamageSumOld + (_hitPointDamages select (_hitPoints find _x)); + _selectionName = _allHitPointsSelections select _forEachIndex; + //Filter out all the bad hitpoints (HitPoint="" or no selection) + if ((!isNil {_vehicle getHit _selectionName}) && {_x != ""}) then { + _realHitpointCount = _realHitpointCount + 1; + + if ((((toLower _x) find "glass") == -1) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { + _hitPointDamageSumOld = _hitPointDamageSumOld + (_allHitPointDamages select _forEachIndex); + if (_forEachIndex == _hitPointIndex) then { + _hitPointDamageRepaired = (_allHitPointDamages select _forEachIndex) - _hitPointDamage; + }; + }; }; -} forEach _hitPointsWithSelections; +} forEach _allHitPoints; -// set new damage in array -_hitPointDamages set [_hitPoints find _hitPoint, _hitPointDamage]; - -// save sum of new hitpoint damages -private "_hitPointDamageSumNew"; - -_hitPointDamageSumNew = 0; -{ - if (!(_x in IGNORED_HITPOINTS) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { - _hitPointDamageSumNew = _hitPointDamageSumNew + (_hitPointDamages select (_hitPoints find _x)); - }; -} forEach _hitPointsWithSelections; - -// calculate new strctural damage -private "_damageNew"; -_damageNew = _hitPointDamageSumNew / count _hitPoints; +// calculate new structural damage +_damageNew = (_hitPointDamageSumOld - _hitPointDamageRepaired) / _realHitpointCount; if (_hitPointDamageSumOld > 0) then { - _damageNew = _damageOld * (_hitPointDamageSumNew / _hitPointDamageSumOld); + _damageNew = _damageOld * ((_hitPointDamageSumOld - _hitPointDamageRepaired) / _hitPointDamageSumOld); }; +TRACE_5("structuralDamage",_damageOld,_damageNew,_hitPointDamageRepaired,_hitPointDamageSumOld,_realHitpointCount); // set new structural damage value _vehicle setDamage _damageNew; -// set the new damage for that hit point +//Repair the hitpoint in the damages array: +_allHitPointDamages set [_hitPointIndex, _hitPointDamage]; +//Set the new damage for all hitpoints { - _vehicle setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; -} forEach _hitPoints; + _vehicle setHitIndex [_forEachIndex, _x]; +} forEach _allHitPointDamages; // normalize hitpoints -// [_vehicle] call FUNC(normalizeHitPoints); +[_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf index 1ea4b7363a..86d0b563ac 100644 --- a/addons/repair/functions/fnc_spawnObject.sqf +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -4,11 +4,11 @@ * * Arguments: * 0: Item classname - * 1: Position + * 1: Position ASL * 2: Damage * * Return Value: - * None + * The new object * * Example: * ["classname", [0, 0, 0], 1] call ace_repair_fnc_spawnObject @@ -23,10 +23,12 @@ TRACE_3("params",_item,_position,_damage); // randomized end position _position = _position vectorAdd [1 - random 2, 1 - random 2, 0]; -_item = createVehicle [_item, _position, [], 0, "NONE"]; -_item setPosASL _position; +private _newObject = createVehicle [_item, _position, [], 0, "NONE"]; +_newObject setPosASL _position; -["fixCollision", _item] call EFUNC(common,localEvent); -["fixPosition", _item] call EFUNC(common,localEvent); +_newObject setDamage _damage; -_item setDamage _damage; +["fixCollision", _newObject] call EFUNC(common,localEvent); +["fixPosition", _newObject] call EFUNC(common,localEvent); + +_newObject diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf index 218a7a1ee4..024ee76c29 100644 --- a/addons/repair/functions/fnc_useItem.sqf +++ b/addons/repair/functions/fnc_useItem.sqf @@ -4,10 +4,10 @@ * * Arguments: * 0: Unit - * 2: Item classname + * 1: Item classname * * ReturnValue: - * None + * [Had Item to Use , Unit ] * * Example: * [unit, "classname"] call ace_repair_fnc_useItem @@ -19,8 +19,9 @@ params ["_unit", "_item"]; TRACE_2("params",_unit,_item); -if ([_unit, _item] call EFUNC(common,hasItem)) exitwith { +if ([_unit, _item] call EFUNC(common,hasItem)) exitWith { [[_unit, _item], QUOTE(EFUNC(common,useItem)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [true, _unit]; }; + [false, objNull]; diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf index f8aa176018..14dcb6223c 100644 --- a/addons/repair/functions/fnc_useItems.sqf +++ b/addons/repair/functions/fnc_useItems.sqf @@ -7,7 +7,7 @@ * 1: Item classnames * * ReturnValue: - * None + * [Had Item to Use , Array of units that used the items ] * * Example: * [unit, ["classname1", "classname2"]] call ace_repair_fnc_useItems @@ -24,17 +24,17 @@ private ["_itemUsedInfo", "_itemsUsedBy"]; _itemsUsedBy = []; { // handle a one of type use item - if (typeName _x == "ARRAY") then { + if (_x isEqualType []) then { { _itemUsedInfo = [_unit, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; } forEach _x; }; // handle required item - if (typeName _x == "STRING") then { + if (_x isEqualType "") then { _itemUsedInfo = [_unit, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; } forEach _items; diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index a6aa1db61f..ff5d40a6ae 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -13,6 +13,4 @@ #include "\z\ace\addons\main\script_macros.hpp" - -#define IGNORED_HITPOINTS ["HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6", "HitGlass7", "HitGlass8", "HitGlass9", "HitGlass10", "HitGlass11", "HitGlass12", "HitGlass13", "HitGlass14", "HitGlass15", "HitRGlass", "HitLGlass", "Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"] #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] diff --git a/addons/respawn/functions/fnc_restoreGear.sqf b/addons/respawn/functions/fnc_restoreGear.sqf index a0ca2aa35e..af3acb7fb4 100644 --- a/addons/respawn/functions/fnc_restoreGear.sqf +++ b/addons/respawn/functions/fnc_restoreGear.sqf @@ -27,7 +27,7 @@ _activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponM if ( (_activeMuzzle != "") && {_activeMuzzle != _activeWeapon} && - {_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles")} + {_activeMuzzle in getArray (configFile >> "CfgWeapons" >> _activeWeapon >> "muzzles")} ) then { _unit selectWeapon _activeMuzzle; } else { diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf index 9fe429a49b..4d4b89759a 100644 --- a/addons/safemode/functions/fnc_lockSafety.sqf +++ b/addons/safemode/functions/fnc_lockSafety.sqf @@ -61,7 +61,7 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then { ] call EFUNC(common,addActionEventHandler)]; }; -if (typeName _muzzle == "STRING") then { +if (_muzzle isEqualType "") then { _unit selectWeapon _muzzle; }; diff --git a/addons/safemode/functions/fnc_unlockSafety.sqf b/addons/safemode/functions/fnc_unlockSafety.sqf index ef01766872..b1c2fda540 100644 --- a/addons/safemode/functions/fnc_unlockSafety.sqf +++ b/addons/safemode/functions/fnc_unlockSafety.sqf @@ -48,7 +48,7 @@ if (inputAction "nextWeapon" > 0) then { _modes pushBack _weapon; }; nil - } count getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); + } count getArray (configFile >> "CfgWeapons" >> _weapon >> "modes"); // select last mode _mode = _modes select (count _modes - 1); diff --git a/addons/sandbag/functions/fnc_canDeploy.sqf b/addons/sandbag/functions/fnc_canDeploy.sqf index d26569f4ab..b9bd025dff 100644 --- a/addons/sandbag/functions/fnc_canDeploy.sqf +++ b/addons/sandbag/functions/fnc_canDeploy.sqf @@ -24,6 +24,6 @@ if !("ACE_Sandbag_empty" in items _unit) exitWith {false}; private ["_surfaceClass", "_surfaceType"]; _surfaceClass = (surfaceType getPosASL _unit) select [1]; -_surfaceType = getText (configfile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); +_surfaceType = getText (configFile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); !(_surfaceType in SURFACE_BLACKLIST) diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index bd81a0935b..41e7d53e17 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -25,7 +25,7 @@ if (!hasInterface) exitWith {}; if !(isNil QGVAR(fadePFH)) then { - [GVAR(fadePFH)] call cba_fnc_removePerFrameHandler; + [GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler; GVAR(fadePFH) = nil; }; }; @@ -44,7 +44,7 @@ if (!hasInterface) exitWith {}; [ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[201, [false, false, false]], true] call cba_fnc_addKeybind; +[201, [false, false, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), { @@ -57,7 +57,7 @@ if (!hasInterface) exitWith {}; [ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[209, [false, false, false]], true] call cba_fnc_addKeybind; +[209, [false, false, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor), { @@ -70,7 +70,7 @@ if (!hasInterface) exitWith {}; [ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[209, [false, true, false]], true] call cba_fnc_addKeybind; +[209, [false, true, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), { @@ -83,7 +83,7 @@ if (!hasInterface) exitWith {}; [ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[201, [false, true, false]], true] call cba_fnc_addKeybind; +[201, [false, true, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), { @@ -96,7 +96,7 @@ if (!hasInterface) exitWith {}; [ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[201, [true, false, false]], true] call cba_fnc_addKeybind; +[201, [true, false, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor), { @@ -109,7 +109,7 @@ if (!hasInterface) exitWith {}; [ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[209, [true, false, false]], true] call cba_fnc_addKeybind; +[209, [true, false, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor), { @@ -122,7 +122,7 @@ if (!hasInterface) exitWith {}; [ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[209, [true, true, false]], true] call cba_fnc_addKeybind; +[209, [true, true, false]], true] call CBA_fnc_addKeybind; ["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor), { @@ -135,4 +135,4 @@ if (!hasInterface) exitWith {}; [ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope); }, {false}, -[201, [true, true, false]], true] call cba_fnc_addKeybind; +[201, [true, true, false]], true] call CBA_fnc_addKeybind; diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index 562bf731b4..c40ca3f8b4 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -35,7 +35,7 @@ _newOptics = [_player] call FUNC(getOptics); { if (_newOptics select _forEachIndex != _x) then { // The optic for this weapon changed, set adjustment to zero - if (!((_adjustment select _foreachindex) isEqualTo [0, 0, 0])) then { + if (!((_adjustment select _forEachIndex) isEqualTo [0, 0, 0])) then { _adjustment set [_forEachIndex, [0, 0, 0]]; [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); }; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index dd302ff333..43595bde87 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -58,6 +58,6 @@ GVAR(fadePFH) = [{ _layer cutFadeOut 2; GVAR(fadePFH) = nil; - [_pfhId] call cba_fnc_removePerFrameHandler; + [_pfhId] call CBA_fnc_removePerFrameHandler; }; }, 0.1, []] call CBA_fnc_addPerFrameHandler diff --git a/addons/sitting/CfgVehicles.hpp b/addons/sitting/CfgVehicles.hpp index 4ac0d0edb7..cb2422bd6d 100644 --- a/addons/sitting/CfgVehicles.hpp +++ b/addons/sitting/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { function = QFUNC(moduleInit); scope = 2; isGlobal = 1; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_Sitting_ca.paa)); class Arguments { class enable { diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index e8bc6c210f..392cd9a43d 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -184,14 +184,14 @@ class GVAR(interface) { colorBorder[] = {0,0,0,0}; colorBackground[] = {COL_BACK}; colorSelect[] = { - "profilenamespace getvariable ['GUI_BCG_RGB_R',0.77]", - "profilenamespace getvariable ['GUI_BCG_RGB_G',0.51]", - "profilenamespace getvariable ['GUI_BCG_RGB_B',0.08]", + "profilenamespace getVariable ['GUI_BCG_RGB_R',0.77]", + "profilenamespace getVariable ['GUI_BCG_RGB_G',0.51]", + "profilenamespace getVariable ['GUI_BCG_RGB_B',0.08]", 1 }; multiselectEnabled = 0; + maxHistoryDelay = 10e10; onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface)); - onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface)); }; class unitFrame: RscFrame { x = 0; diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index 35b463837f..a9737868a0 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -8,3 +8,6 @@ GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes); GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions); }] call EFUNC(common,addEventHandler); + +// Should prevent unending spectator on mission end +addMissionEventHandler ["Ended",{ [false] call FUNC(setSpectator) }]; diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index e26dc27d07..13f2ba1708 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -35,7 +35,7 @@ GVAR(camDistance) = 10; GVAR(camMode) = 0; GVAR(camPan) = 0; GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20]; -GVAR(camSpeed) = 2.5; +GVAR(camSpeed) = 1.5; GVAR(camTilt) = -10; GVAR(camUnit) = objNull; GVAR(camVision) = -2; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 7c961071c3..ee71685fa2 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -45,37 +45,36 @@ switch (toLower _mode) do { }; } forEach [ [localize LSTRING(uiControls),""], - [localize LSTRING(uiToggleUnits),"1"], - [localize LSTRING(uiToggleHelp),"2"], - [localize LSTRING(uiToggleTools),"3"], - [localize LSTRING(uiToggleCompass),"4"], - [localize LSTRING(uiToggleIcons),"5"], - [localize LSTRING(uiToggleMap),"M"], - [localize LSTRING(uiToggleInterface),"Backspace"], + [localize LSTRING(uiToggleUnits),keyName 2], + [localize LSTRING(uiToggleHelp),keyName 3], + [localize LSTRING(uiToggleTools),keyName 4], + [localize LSTRING(uiToggleCompass),keyName 5], + [localize LSTRING(uiToggleIcons),keyName 6], + [localize LSTRING(uiToggleMap),keyName 50], + [localize LSTRING(uiToggleInterface),keyName 14], [localize LSTRING(freeCamControls),""], - [localize LSTRING(freeCamForward),"W"], - [localize LSTRING(freeCamBackward),"S"], - [localize LSTRING(freeCamLeft),"A"], - [localize LSTRING(freeCamRight),"D"], - [localize LSTRING(freeCamUp),"Q"], - [localize LSTRING(freeCamDown),"Z"], + [localize LSTRING(freeCamForward),keyName 17], + [localize LSTRING(freeCamBackward),keyName 31], + [localize LSTRING(freeCamLeft),keyName 30], + [localize LSTRING(freeCamRight),keyName 32], + [localize LSTRING(freeCamUp),keyName 16], + [localize LSTRING(freeCamDown),keyName 44], [localize LSTRING(freeCamPan),"RMB (Hold)"], [localize LSTRING(freeCamDolly),"LMB (Hold)"], [localize LSTRING(freeCamBoost),"Shift (Hold)"], - [localize LSTRING(freeCamFocus),"F"], [localize LSTRING(attributeControls),""], - [localize LSTRING(nextCam),"Up Arrow"], - [localize LSTRING(prevCam),"Down Arrow"], - [localize LSTRING(nextUnit),"Right Arrow"], - [localize LSTRING(prevUnit),"Left Arrow"], - [localize LSTRING(nextVis),"N"], - [localize LSTRING(prevVis),"Ctrl + N"], + [localize LSTRING(nextCam),keyName 200], + [localize LSTRING(prevCam),keyName 208], + [localize LSTRING(nextUnit),keyName 205], + [localize LSTRING(prevUnit),keyName 203], + [localize LSTRING(nextVis),keyName 49], + [localize LSTRING(prevVis),format["%1 + %2",keyName 29,keyname 49]], [localize LSTRING(adjZoom),"Scrollwheel"], - [localize LSTRING(adjSpeed),"Ctrl + Scrollwheel"], - [localize LSTRING(incZoom),"Num-/Num+"], - [localize LSTRING(incSpeed),"Ctrl + Num-/Num+"], - [localize LSTRING(reZoom),"Alt + Num-"], - [localize LSTRING(reSpeed),"Alt + Num+"] + [localize LSTRING(adjSpeed),format["%1 + Scrollwheel",keyName 29]], + [localize LSTRING(incZoom),format["%1/%2",keyName 74,keyName 78]], + [localize LSTRING(incSpeed),format["%1 + %2/%3",keyName 29,keyName 74,keyName 78]], + [localize LSTRING(reZoom),format["%1 + %2",keyName 56,keyName 74]], + [localize LSTRING(reSpeed),format["%1 + %2",keyName 56,keyName 78]] ]; // Handle support for BI's respawn counter @@ -126,7 +125,6 @@ switch (toLower _mode) do { GVAR(heldKeys) resize 255; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; - GVAR(treeSel) = objNull; }; // Mouse events case "onmousebuttondown": { @@ -179,7 +177,7 @@ switch (toLower _mode) do { }; // Handle held keys (prevent repeat calling) - if (GVAR(heldKeys) param [_dik,false]) exitwith {}; + if (GVAR(heldKeys) param [_dik,false]) exitWith {}; // Exclude movement/adjustment keys so that speed can be adjusted on fly if !(_dik in [16,17,30,31,32,44,74,78]) then { GVAR(heldKeys) set [_dik,true]; @@ -226,19 +224,11 @@ switch (toLower _mode) do { case 32: { // D GVAR(camDolly) set [0, GVAR(camSpeed) * ([1, 2] select _shift)]; }; - case 33: { // F - private ["_sel","_vector"]; - _sel = GVAR(treeSel); - if ((GVAR(camMode) == 0) && {!isNull _sel} && {_sel in GVAR(unitList)}) then { - _vector = (positionCameraToWorld [0,0,0]) vectorDiff (positionCameraToWorld [0,0,25]); - [nil,nil,nil,(getPosATL _sel) vectorAdd _vector] call FUNC(setCameraAttributes); - }; - }; case 44: { // Z GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift); }; case 49: { // N - if (GVAR(camMode) == 0) then { + if (GVAR(camMode) != 1) then { if (_ctrl) then { [nil,nil,-1] call FUNC(cycleCamera); } else { @@ -250,7 +240,7 @@ switch (toLower _mode) do { [_display,nil,nil,nil,true] call FUNC(toggleInterface); }; case 57: { // Spacebar - // Freecam attachment here, if in external then set cam pos and attach + // Switch between unit and freecam here }; case 74: { // Num - if (_alt) exitWith { [nil,nil,nil,nil,nil,nil, 1.25] call FUNC(setCameraAttributes); }; @@ -261,7 +251,7 @@ switch (toLower _mode) do { }; }; case 78: { // Num + - if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 2.5] call FUNC(setCameraAttributes); }; + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 1.5] call FUNC(setCameraAttributes); }; if (_ctrl) then { [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + 0.05] call FUNC(setCameraAttributes); } else { @@ -335,15 +325,6 @@ switch (toLower _mode) do { [_newMode,_newUnit] call FUNC(transitionCamera); }; }; - case "ontreeselchanged": { - _args params ["_tree","_sel"]; - - if (count _sel == 3) then { - GVAR(treeSel) = objectFromNetId (_tree tvData _sel); - } else { - GVAR(treeSel) = objNull; - }; - }; case "onunitsupdate": { _args params ["_tree"]; private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"]; diff --git a/addons/spectator/functions/fnc_handleMap.sqf b/addons/spectator/functions/fnc_handleMap.sqf index fd084f9967..b83ccdcd7d 100644 --- a/addons/spectator/functions/fnc_handleMap.sqf +++ b/addons/spectator/functions/fnc_handleMap.sqf @@ -18,12 +18,32 @@ #include "script_component.hpp" params ["_map"]; -private ["_cachedVehicles","_unit","_color","_icon","_txt"]; +private ["_center","_radius","_scaled","_drawVehicles","_leader","_color","_cachedVehicles","_unit","_icon","_txt"]; if (GVAR(camMode) == 0) then { _map drawIcon ["\A3\UI_F\Data\GUI\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa",[0,0,0,1],GVAR(freeCamera),20,20,GVAR(camPan)]; }; +_center = _map ctrlMapScreenToWorld [0.5,0.5]; +_radius = (_map ctrlMapScreenToWorld [safeZoneX,safeZoneY]) distance2D _center; +_scaled = (ctrlMapScale _map) > 0.2; + +// Draw only group icons when scaled out +_drawVehicles = []; +{ + _leader = leader _x; + if (_scaled) then { + _color = GETVAR(_x,GVAR(gColor),[ARR_4(0,0,0,0)]); + _map drawIcon ["\A3\ui_f\data\map\markers\nato\b_inf.paa", _color, _leader, 20, 20, 0, "", 0, 0]; + } else { + if ((_leader distance2D _center) < _radius) then { + _drawVehicles append (units _x); + }; + }; + nil +} count GVAR(groupList); + +// Draw units when group leader is within screen bounds _cachedVehicles = []; { _unit = vehicle _x; @@ -41,7 +61,7 @@ _cachedVehicles = []; _icon = GETVAR(_unit,GVAR(uIcon),""); _txt = ["", GETVAR(_x,GVAR(uName),"")] select (isPlayer _x); - _map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.03]; + _map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.04]; }; - false -} count GVAR(unitList); + nil +} count (_drawVehicles arrayIntersect GVAR(unitList)); diff --git a/addons/spectator/functions/fnc_handleToolbar.sqf b/addons/spectator/functions/fnc_handleToolbar.sqf index 878f3e46de..4e79c172bd 100644 --- a/addons/spectator/functions/fnc_handleToolbar.sqf +++ b/addons/spectator/functions/fnc_handleToolbar.sqf @@ -26,8 +26,13 @@ private ["_name","_vision","_fov","_speed","_mode","_time","_toolbar"]; _toolbar = _display displayCtrl IDC_TOOL; // Find all tool values +if (GVAR(camVision) >= 0) then { + _vision = localize LSTRING(VisionThermal); +} else { + _vision = [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1); +}; + if (GVAR(camMode) == 0) then { - _vision = if (GVAR(camVision) >= 0) then {localize LSTRING(VisionThermal)} else { [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1) }; _fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01]; _speed = format ["%1 m/s", floor(GVAR(camSpeed) * 100) * 0.01]; } else { diff --git a/addons/spectator/functions/fnc_interrupt.sqf b/addons/spectator/functions/fnc_interrupt.sqf index 48cca7d102..72bb3eaa32 100644 --- a/addons/spectator/functions/fnc_interrupt.sqf +++ b/addons/spectator/functions/fnc_interrupt.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Reason - * 1: Interrupting + * 1: Interrupting (default: true) * * Return Value: * None diff --git a/addons/spectator/functions/fnc_respawnTemplate.sqf b/addons/spectator/functions/fnc_respawnTemplate.sqf index d903e3ecc4..4584a1fc3c 100644 --- a/addons/spectator/functions/fnc_respawnTemplate.sqf +++ b/addons/spectator/functions/fnc_respawnTemplate.sqf @@ -34,7 +34,7 @@ _pos = (getPosATL _unit) vectorAdd [0,0,5]; // Enter/exit spectator based on the respawn type and whether killed/respawned if (alive _unit) then { if (_respawn == 1) then { - [_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit); + [_unit] call FUNC(stageSpectator); [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); [true] call FUNC(setSpectator); } else { diff --git a/addons/spectator/functions/fnc_setCameraAttributes.sqf b/addons/spectator/functions/fnc_setCameraAttributes.sqf index dd8dd3ef6a..f908b30b76 100644 --- a/addons/spectator/functions/fnc_setCameraAttributes.sqf +++ b/addons/spectator/functions/fnc_setCameraAttributes.sqf @@ -1,23 +1,24 @@ /* * Author: SilentSpike * Sets the spectator camera attributes as desired + * All values are optional and default to whatever the current value is * * Arguments: - * 0: Camera mode + * 0: Camera mode * - 0: Free * - 1: Internal * - 2: External - * 1: Camera unit (objNull for random) - * 2: Camera vision + * 1: Camera unit (objNull for random) + * 2: Camera vision * - -2: Normal * - -1: Night vision * - 0: Thermal white hot * - 1: Thermal black hot - * 3: Camera position (ATL) - * 4: Camera pan (0 - 360) - * 5: Camera tilt (-90 - 90) - * 6: Camera zoom (0.01 - 2) - * 7: Camera speed in m/s (0.05 - 10) + * 3: Camera position (ATL) + * 4: Camera pan (0 - 360) + * 5: Camera tilt (-90 - 90) + * 6: Camera zoom (0.01 - 2) + * 7: Camera speed in m/s (0.05 - 10) * * Return Value: * None diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index efa7000b8f..333dc023c9 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -7,7 +7,8 @@ * The spectator interface will be opened/closed * * Arguments: - * 0: Spectator state of local client + * 0: Spectator state of local client (default: true) + * 1: Force interface (default: true) * * Return Value: * None @@ -20,16 +21,19 @@ #include "script_component.hpp" -params [["_set",true,[true]]]; +params [["_set",true,[true]], ["_force",true,[true]]]; // Only clients can be spectators if (!hasInterface) exitWith {}; // Exit if no change -if (_set isEqualTo GVAR(isSet)) exitwith {}; +if (_set isEqualTo GVAR(isSet)) exitWith {}; // Handle common addon audio -if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableVolumeUpdate) = _set}; +if (["ace_hearing"] call EFUNC(common,isModLoaded)) then { + EGVAR(hearing,disableVolumeUpdate) = _set; + EGVAR(hearing,deafnessDV) = 0; +}; if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator}; if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator}; @@ -45,7 +49,6 @@ if (_set) then { GVAR(heldKeys) resize 255; GVAR(mouse) = [false,false]; GVAR(mousePos) = [0.5,0.5]; - GVAR(treeSel) = objNull; // Update units before opening to support pre-set camera unit [] call FUNC(updateUnits); @@ -75,7 +78,17 @@ if (_set) then { [{ // Create the display (findDisplay 46) createDisplay QGVAR(interface); - }, []] call EFUNC(common,execNextFrame); + + // If not forced, make esc end spectator + if (_this) then { + (findDisplay 12249) displayAddEventHandler ["KeyDown", { + if (_this select 1 == 1) then { + [false] call ace_spectator_fnc_setSpectator; + true + }; + }]; + }; + }, !_force] call EFUNC(common,execNextFrame); // Cache and disable nametag settings if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { @@ -119,7 +132,6 @@ if (_set) then { GVAR(heldKeys) = nil; GVAR(mouse) = nil; GVAR(mousePos) = nil; - GVAR(treeSel) = nil; // Reset nametag settings if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 7f0d862719..87b2faffa8 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -7,8 +7,8 @@ * Upon unstage, units will be moved to the position they were in upon staging * * Arguments: - * 0: Unit to put into spectator stage - * 1: Spectator stage + * 0: Unit to put into spectator stage (default: player) + * 1: Unit should be staged (default: true) * * Return Value: * None @@ -26,7 +26,7 @@ params [["_unit",player,[objNull]], ["_set",true,[true]]]; // No change, no service (but allow spectators to be reset) if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {}; -if !(local _unit) exitwith { +if !(local _unit) exitWith { [[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); }; diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index edc7fa23a2..0f6eb3ffc7 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -49,7 +49,6 @@ if (_newMode == 0) then { // Free // Preserve camUnit value for consistency when manually changing view _camera cameraEffect ["internal", "back"]; - showCinemaBorder false; // Apply the camera zoom _camera camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]); @@ -63,23 +62,6 @@ if (_newMode == 0) then { // Free GVAR(camAgent) switchCamera "internal"; clearRadio; - - // If new vision isn't available then keep current (unless current also isn't) - if !(_newVision in GVAR(availableVisions)) then { - _newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0); - }; - - // Vision mode only applies to free cam - if (_newVision < 0) then { - false setCamUseTi 0; - camUseNVG (_newVision >= -1); - } else { - true setCamUseTi _newVision; - }; - GVAR(camVision) = _newVision; - - // Handle camera movement - if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; } else { _camera = GVAR(unitCamera); @@ -103,10 +85,6 @@ if (_newMode == 0) then { // Free } else { // Switch to the camera _camera cameraEffect ["internal", "back"]; - showCinemaBorder false; - - // Handle camera orbit movement - if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; }; // Clear radio if group changed @@ -117,4 +95,27 @@ if (_newMode == 0) then { // Free GVAR(camUnit) = _newUnit; }; +if (_newMode in [0,2]) then { + // Set up camera UI + showCinemaBorder false; + cameraEffectEnableHUD true; + + // Handle camera movement + if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; + + // If new vision isn't available then keep current (unless current also isn't) + if !(_newVision in GVAR(availableVisions)) then { + _newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0); + }; + + // Vision mode applies to free and external cam + if (_newVision < 0) then { + false setCamUseTi 0; + camUseNVG (_newVision >= -1); + } else { + true setCamUseTi _newVision; + }; + GVAR(camVision) = _newVision; +}; + GVAR(camMode) = _newMode; diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf index 0297b31b8d..e5b15b6bc1 100644 --- a/addons/spectator/functions/fnc_updateUnits.sqf +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Units to add to the whitelist - * 1: Use blacklist + * 1: Use blacklist (default: false) * * Return Value: * None diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 00d50e4704..d8c7cd1310 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -344,14 +344,6 @@ Ускорение камеры Aumento de velocidad - - Focus on Unit - Skup na jednostce - Focar na unidade - Фокус на юните - Zaměřit se na Jednotku - Centrarse en la unidad - Interface Interfejs diff --git a/addons/spottingscope/CfgVehicles.hpp b/addons/spottingscope/CfgVehicles.hpp index 2c8159fbb1..434c1c96ca 100644 --- a/addons/spottingscope/CfgVehicles.hpp +++ b/addons/spottingscope/CfgVehicles.hpp @@ -56,7 +56,7 @@ class CfgVehicles { side = 1; typicalCargo[] = {"Soldier"}; displayName = CSTRING(DisplayName); - model = PATHTOF(data\spottingscope.p3d); + model = PATHTOF(data\ace_spottingscope.p3d); mapSize = 0.5; transportSoldier = 0; getInAction = "GetInLow"; @@ -89,9 +89,9 @@ class CfgVehicles { initAngleY = 0; minAngleY = -100; maxAngleY = 100; - initFov = 0.7; - minFov = 0.7; - maxFov = 0.7; + initFov = 0.75; + minFov = 0.25; + maxFov = 1.25; }; class ViewOptics { initAngleX = 0; @@ -100,9 +100,9 @@ class CfgVehicles { initAngleY = 0; minAngleY = -100; maxAngleY = 100; - initFov = 0.014812; - minFov = 0.014812; - maxFov = 0.014812; + minFov = 0.0025; + maxFov = 0.05; + initFov= 0.05; }; }; }; diff --git a/addons/spottingscope/CfgWeapons.hpp b/addons/spottingscope/CfgWeapons.hpp index 4ba078c057..9b5825572b 100644 --- a/addons/spottingscope/CfgWeapons.hpp +++ b/addons/spottingscope/CfgWeapons.hpp @@ -8,7 +8,7 @@ class CfgWeapons { displayName = CSTRING(DisplayName); descriptionShort = ""; picture = PATHTOF(UI\w_spottingscope_ca.paa); - model = PATHTOF(data\w_spottingscope.p3d); + model = PATHTOF(data\ace_spottingscope.p3d); class ItemInfo: InventoryItem_Base_F { mass = 40; diff --git a/addons/spottingscope/config.cpp b/addons/spottingscope/config.cpp index 157e430868..c3541eed39 100644 --- a/addons/spottingscope/config.cpp +++ b/addons/spottingscope/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {"ACE_SpottingScope"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl", "ace_interaction"}; - author[] = {"Rocko", "Scubaman3D", "Ruthberg", "commy2"}; + author[] = {"Rocko", "Scubaman3D", "Ruthberg", "commy2", "p1nga"}; VERSION_CONFIG; }; }; diff --git a/addons/spottingscope/data/ace_spottingscope.p3d b/addons/spottingscope/data/ace_spottingscope.p3d new file mode 100644 index 0000000000..fc6bc45354 Binary files /dev/null and b/addons/spottingscope/data/ace_spottingscope.p3d differ diff --git a/addons/spottingscope/data/ace_spottingscope_as.paa b/addons/spottingscope/data/ace_spottingscope_as.paa new file mode 100644 index 0000000000..a7e517e4ff Binary files /dev/null and b/addons/spottingscope/data/ace_spottingscope_as.paa differ diff --git a/addons/spottingscope/data/ace_spottingscope_co.paa b/addons/spottingscope/data/ace_spottingscope_co.paa new file mode 100644 index 0000000000..669d94f4ae Binary files /dev/null and b/addons/spottingscope/data/ace_spottingscope_co.paa differ diff --git a/addons/spottingscope/data/ace_spottingscope_glass.rvmat b/addons/spottingscope/data/ace_spottingscope_glass.rvmat new file mode 100644 index 0000000000..bce3c40b59 --- /dev/null +++ b/addons/spottingscope/data/ace_spottingscope_glass.rvmat @@ -0,0 +1,96 @@ +class StageTI +{ + texture="a3\data_f\Default_ti_ca.paa"; +}; +ambient[]={0.301,0.63999999,0.68000001,1}; +diffuse[]={0.301,0.63999999,0.68000001,1}; +forcedDiffuse[]={0.2,0.34999999,0.2,0}; +emmisive[]={0,0,0,1}; +specular[]={0.67450982,0.64313728,0.50196081,1}; +specularPower=550; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_nohq.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 +{ + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform + { + aside[]={6,0,0}; + up[]={0,6,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 +{ + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_as.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage5 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_smdi.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 +{ + texture="#(ai,32,128,1)fresnel(4.01,2.86)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage7 +{ + texture="a3\data_f\env_land_co.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/spottingscope/data/ace_spottingscope_item.p3d b/addons/spottingscope/data/ace_spottingscope_item.p3d new file mode 100644 index 0000000000..d2de0edf1c Binary files /dev/null and b/addons/spottingscope/data/ace_spottingscope_item.p3d differ diff --git a/addons/spottingscope/data/ace_spottingscope_metal.rvmat b/addons/spottingscope/data/ace_spottingscope_metal.rvmat new file mode 100644 index 0000000000..54cfcafeb8 --- /dev/null +++ b/addons/spottingscope/data/ace_spottingscope_metal.rvmat @@ -0,0 +1,92 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.2,0.2,0.2,0}; +specularPower=100; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_nohq.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 +{ + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform + { + aside[]={6,0,0}; + up[]={0,6,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 +{ + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_as.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage5 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_smdi.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 +{ + texture="#(ai,32,128,1)fresnel(4.01,2.86)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage7 +{ + texture="a3\data_f\env_land_co.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/spottingscope/data/ace_spottingscope_nohq.paa b/addons/spottingscope/data/ace_spottingscope_nohq.paa new file mode 100644 index 0000000000..5cc7f00dfd Binary files /dev/null and b/addons/spottingscope/data/ace_spottingscope_nohq.paa differ diff --git a/addons/spottingscope/data/ace_spottingscope_rubber.rvmat b/addons/spottingscope/data/ace_spottingscope_rubber.rvmat new file mode 100644 index 0000000000..c31f850e7d --- /dev/null +++ b/addons/spottingscope/data/ace_spottingscope_rubber.rvmat @@ -0,0 +1,85 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.25,0.25,0.25,1}; +specularPower=90; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_nohq.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 +{ + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform + { + aside[]={6,0,0}; + up[]={0,6,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 +{ + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_as.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage5 +{ + texture="z\ace\addons\spottingscope\data\ace_spottingscope_smdi.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 +{ + texture="#(ai,64,64,1)fresnel(1.5,1.22)"; + uvSource="none"; +}; +class Stage7 +{ + texture="a3\data_f\env_land_co.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/spottingscope/data/ace_spottingscope_smdi.paa b/addons/spottingscope/data/ace_spottingscope_smdi.paa new file mode 100644 index 0000000000..844626c0af Binary files /dev/null and b/addons/spottingscope/data/ace_spottingscope_smdi.paa differ diff --git a/addons/spottingscope/data/m144_ca.paa b/addons/spottingscope/data/m144_ca.paa index 4d7a63ba0a..a2d299d937 100644 Binary files a/addons/spottingscope/data/m144_ca.paa and b/addons/spottingscope/data/m144_ca.paa differ diff --git a/addons/spottingscope/data/model.cfg b/addons/spottingscope/data/model.cfg index e7beb2f2c1..71eb918bf7 100644 --- a/addons/spottingscope/data/model.cfg +++ b/addons/spottingscope/data/model.cfg @@ -9,8 +9,11 @@ class CfgSkeletons isDiscrete = 1; skeletonInherit = "Default"; skeletonBones[] = { - "otocvez","", - "otochlaven","otocvez" + "main_turret","", + "main_gun","main_turret", + "leg_01","", + "leg_02","", + "leg_03","" }; }; }; @@ -20,15 +23,15 @@ class CfgModels { sections[] = {}; skeletonName = ""; }; - class spottingscope: Default { + class ace_spottingscope: Default { skeletonName = "ace_spottingscope_skeleton"; sectionsInherit = "Default"; class animations { class mainTurret { type = "rotationY"; source = "mainTurret"; - selection = "otocvez"; - axis = "osaveze"; + selection = "main_turret"; + axis = "main_turret_axis"; minValue = "rad -360"; maxValue = "rad +360"; angle0 = "rad -360"; @@ -37,13 +40,31 @@ class CfgModels { class mainGun { type = "rotationX"; source = "mainGun"; - selection = "otochlaven"; - axis = "osahlavne"; + selection = "main_gun"; + axis = "main_gun_axis"; minValue = "rad -360"; maxValue = "rad +360"; angle0 = "rad -360"; angle1 = "rad +360"; }; + class leg_01 { + type = "rotation"; + source = "fold_legs"; + selection = "leg_01"; + axis="leg_01_axis"; + minValue = 0; + maxValue = 1; + angle0="rad +00"; + angle1="rad +55"; + }; + class leg_02: leg_01 { + selection = "leg_02"; + axis="leg_02_axis"; + }; + class leg_03: leg_01 { + selection = "leg_03"; + axis="leg_03_axis"; + }; }; }; }; diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index c3cb99588a..5aab2c9aee 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -32,6 +32,6 @@ params ["_originalPlayerUnit"]; _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; _layer cuttext ["","plain"]; - [_pfhId] call cba_fnc_removePerFrameHandler; + [_pfhId] call CBA_fnc_removePerFrameHandler; }; }, 0.2, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index 793e72bb71..49c3e97e42 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -76,6 +76,6 @@ if (_leave) exitWith { [localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured); - [_pfhId] call cba_fnc_removePerFrameHandler; + [_pfhId] call CBA_fnc_removePerFrameHandler; }; }, 0.2, [_unit, player]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/vector/functions/fnc_convertToTexturesFOS.sqf b/addons/vector/functions/fnc_convertToTexturesFOS.sqf index 3ce09e3c6c..6141e40fa8 100644 --- a/addons/vector/functions/fnc_convertToTexturesFOS.sqf +++ b/addons/vector/functions/fnc_convertToTexturesFOS.sqf @@ -237,7 +237,7 @@ switch (_coordinate) do { }; // trap errors -if ({typeName _x == "STRING"} count [_digit0, _digit1, _digit2, _digit3, _digit4] < 5) exitWith { +if !([_digit0, _digit1, _digit2, _digit3, _digit4] isEqualTypeAll "") exitWith { [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return }; diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp index 9e6f155616..873c875f09 100644 --- a/addons/vehiclelock/CfgVehicles.hpp +++ b/addons/vehiclelock/CfgVehicles.hpp @@ -74,6 +74,7 @@ class CfgVehicles { function = QFUNC(moduleInit); scope = 2; isGlobal = 0; + isSingular = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_VehicleLock_ca.paa)); functionPriority = 0; class Arguments { diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index 5c0e04ee0b..3435af24bf 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -35,7 +35,7 @@ if ((locked _veh) == 0) exitWith {false}; if (!("ACE_key_lockpick" in (items _unit))) exitWith {false}; _vehLockpickStrenth = _veh getVariable[QGVAR(lockpickStrength), GVAR(DefaultLockpickStrength)]; -if (typeName _vehLockpickStrenth != "SCALAR") exitWith {ERROR("ACE_vehicleLock_LockpickStrength invalid"); false}; +if (!(_vehLockpickStrenth isEqualType 0)) exitWith {ERROR("ACE_vehicleLock_LockpickStrength invalid"); false}; //-1 indicates unpickable lock if (_vehLockpickStrenth < 0) exitWith {false}; diff --git a/addons/vehiclelock/README.md b/addons/vehiclelock/readme.md similarity index 76% rename from addons/vehiclelock/README.md rename to addons/vehiclelock/readme.md index c31402c6e3..64ae01a99c 100644 --- a/addons/vehiclelock/README.md +++ b/addons/vehiclelock/readme.md @@ -5,10 +5,11 @@ Adds keys as an item, to lock and unlock vehicles. Primary target would be role play or TVT, but has uses in all game types, even co-ops (e.g.: DAC AI will steal unlocked vehicles) Two key modes (can be used together): -- Simple Side based keys (e.g. "ACE_key_west" works on any [WEST] vehicle like the M-ATV//hunter) -- Custom keys (one key will only open a specific vehicle and nothing else) +* Simple Side based keys (e.g. "ACE_key_west" works on any [WEST] vehicle like the M-ATV//hunter) +* Custom keys (one key will only open a specific vehicle and nothing else) #### Items Added: + `ACE_key_lockpick` `ACE_key_master` `ACE_key_west` @@ -19,21 +20,19 @@ Two key modes (can be used together): #### Magazine added: `ACE_key_customKeyMagazine` (should never be manualy added, needs to be "programed" to work on a vehicle, see `ACE_VehicleLock_fnc_addKeyForVehicle`) - ## For Mission Makers: #### Modules: -- Vehicle Lock Setup - Settings for locking inventory of locked vehicles, default lockpick time, and initial vehicle lock state. -- Vehicle Key Assign - Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Will NOT work for JIP units. +* Vehicle Lock Setup - Settings for locking inventory of locked vehicles, default lockpick time, and initial vehicle lock state. +* Vehicle Key Assign - Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Will NOT work for JIP units. #### Vehicle setVariables: -- `ACE_VehicleLock_lockSide` - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys -- `ACE_vehicleLock_lockpickStrength` - NUMBER: secons, determines how long lockpicking with take, overrides ACE_VehicleLock_DefaultLockpickStrength +* `ACE_VehicleLock_lockSide` - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys +* `ACE_vehicleLock_lockpickStrength` - NUMBER: secons, determines how long lockpicking with take, overrides ACE_VehicleLock_DefaultLockpickStrength #### Public Functions: `[bob, car1, true] call ACE_VehicleLock_fnc_addKeyForVehicle;` - will add a `ACE_key_customKeyMagazine` to bob and program it to work on car1 - ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/vehicles/XEH_postInit.sqf b/addons/vehicles/XEH_postInit.sqf index a8ec2fb75f..c55fcf2544 100644 --- a/addons/vehicles/XEH_postInit.sqf +++ b/addons/vehicles/XEH_postInit.sqf @@ -2,20 +2,31 @@ #include "script_component.hpp" if (!hasInterface) exitWith {}; - +GVAR(isSpeedLimiter) = false; // Add keybinds ["ACE3 Vehicles", QGVAR(speedLimiter), localize LSTRING(SpeedLimiter), { - // Conditions: canInteract - if !([ACE_player, objNull, ["isnotinside"]] call EFUNC(common,canInteractWith)) exitWith {false}; - // Conditions: specific - if !(ACE_player == driver vehicle ACE_player && - {vehicle ACE_player isKindOf 'Car' || - {vehicle ACE_player isKindOf 'Tank'}}) exitWith {false}; + private _connectedUAV = getConnectedUAV ACE_player; + private _uavControll = UAVControl _connectedUAV; + if ((_uavControll select 1) == "DRIVER") then { + if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false}; + GVAR(isUAV) = true; + [_uavControll select 0, _connectedUAV] call FUNC(speedLimiter); + true + } else { + // Conditions: canInteract + if !([ACE_player, objNull, ["isnotinside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + // Conditions: specific + if !(ACE_player == driver vehicle ACE_player && + {vehicle ACE_player isKindOf 'Car' || + {vehicle ACE_player isKindOf 'Tank'}}) exitWith {false}; + + GVAR(isUAV) = false; + // Statement + [ACE_player, vehicle ACE_player] call FUNC(speedLimiter); + true + }; - // Statement - [ACE_player, vehicle ACE_player] call FUNC(speedLimiter); - true }, {false}, -[211, [false, false, false]], false] call cba_fnc_addKeybind; //DELETE Key +[211, [false, false, false]], false] call CBA_fnc_addKeybind; //DELETE Key diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 151c02fd8a..5f5d8a2914 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -20,7 +20,7 @@ private "_maxSpeed"; params ["_driver", "_vehicle"]; -if (GETGVAR(isSpeedLimiter,false)) exitWith { +if (GVAR(isSpeedLimiter)) exitWith { [localize LSTRING(Off)] call EFUNC(common,displayTextStructured); playSound "ACE_Sound_Click"; GVAR(isSpeedLimiter) = false; @@ -36,8 +36,18 @@ _maxSpeed = speed _vehicle max 10; params ["_args", "_idPFH"]; _args params ["_driver", "_vehicle", "_maxSpeed"]; - if (!GVAR(isSpeedLimiter) || {_driver != driver _vehicle}) exitWith { - GVAR(isSpeedLimiter) = false; + if (GVAR(isUAV)) then { + private _uavControll = UAVControl _vehicle; + if ((_uavControll select 0) != _driver || _uavControll select 1 != "DRIVER") then { + GVAR(isSpeedLimiter) = false; + }; + } else { + if (_driver != driver _vehicle) then { + GVAR(isSpeedLimiter) = false; + }; + }; + + if (!GVAR(isSpeedLimiter)) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/viewdistance/ACE_Settings.hpp b/addons/viewdistance/ACE_Settings.hpp index 28ed7471ca..1499626b7f 100644 --- a/addons/viewdistance/ACE_Settings.hpp +++ b/addons/viewdistance/ACE_Settings.hpp @@ -9,7 +9,7 @@ class ACE_Settings { typeName = "SCALAR"; isClientSettable = 1; value = 0; // index, NOT value // Can set it to client's actual viewdistance in the init function once ACE_Settings supports numbers (if ever). - values[] = {CSTRING(videosettings),"500","1000","1500","2000","2500","3000","3500","4000","5000","6000","7000","8000","9000","10000"}; // Values also need to be changed in functions/fnc_returnValue.sqf + values[] = {CSTRING(videosettings), "500", "1000", "1500", "2000", "2500", "3000", "3500", "4000", "5000", "6000", "7000", "8000", "9000", "10000"}; // Values also need to be changed in functions/fnc_returnValue.sqf displayName = CSTRING(onFoot_DisplayName); description = CSTRING(onFoot_Description); }; @@ -17,7 +17,7 @@ class ACE_Settings { typeName = "SCALAR"; isClientSettable = 1; value = 0; // index, NOT value - values[] = {CSTRING(videosettings),"500","1000","1500","2000","2500","3000","3500","4000","5000","6000","7000","8000","9000","10000"}; // Values also need to be changed in functions/fnc_returnValue.sqf + values[] = {CSTRING(videosettings), "500", "1000", "1500", "2000", "2500", "3000", "3500", "4000", "5000", "6000", "7000", "8000", "9000", "10000"}; // Values also need to be changed in functions/fnc_returnValue.sqf displayName = CSTRING(landVehicle_DisplayName); description = CSTRING(landVehicle_Description); }; @@ -25,7 +25,7 @@ class ACE_Settings { typeName = "SCALAR"; isClientSettable = 1; value = 0; // index, NOT value - values[] = {CSTRING(videosettings),"500","1000","1500","2000","2500","3000","3500","4000","5000","6000","7000","8000","9000","10000"}; // Values also need to be changed in functions/fnc_returnValue.sqf + values[] = {CSTRING(videosettings), "500", "1000", "1500", "2000", "2500", "3000", "3500", "4000", "5000", "6000", "7000", "8000", "9000", "10000"}; // Values also need to be changed in functions/fnc_returnValue.sqf displayName = CSTRING(airVehicle_DisplayName); description = CSTRING(airVehicle_Description); }; @@ -39,7 +39,7 @@ class ACE_Settings { typeName = "SCALAR"; isClientSettable = 1; value = 0; // index. Actual coefficient is given by functions/fnc_returnObjectCoeff.sqf - values[] = {CSTRING(object_off),CSTRING(object_verylow),CSTRING(object_low),CSTRING(object_medium),CSTRING(object_high),CSTRING(object_veryhigh)}; + values[] = {CSTRING(object_off), CSTRING(object_verylow), CSTRING(object_low), CSTRING(object_medium),CSTRING(object_high), CSTRING(object_veryhigh), CSTRING(object_fovBased)}; displayName = CSTRING(object_DisplayName); description = CSTRING(object_Description); }; diff --git a/addons/viewdistance/CfgEventHandlers.hpp b/addons/viewdistance/CfgEventHandlers.hpp index 0f1d8878ba..423993f757 100644 --- a/addons/viewdistance/CfgEventHandlers.hpp +++ b/addons/viewdistance/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -7,6 +6,6 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); + clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); }; -}; \ No newline at end of file +}; diff --git a/addons/viewdistance/CfgVehicles.hpp b/addons/viewdistance/CfgVehicles.hpp index 8e4e30d266..86d906bfce 100644 --- a/addons/viewdistance/CfgVehicles.hpp +++ b/addons/viewdistance/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { displayName = CSTRING(Module_DisplayName); scope = 2; isGlobal = 1; + isSingular = 1; //icon = ""; // needs an icon class Arguments { class moduleViewDistanceEnabled { diff --git a/addons/viewdistance/README.md b/addons/viewdistance/README.md index 67860b1ad0..2f0b14dbeb 100644 --- a/addons/viewdistance/README.md +++ b/addons/viewdistance/README.md @@ -1,7 +1,7 @@ ace_viewdistance =========== -Adds various View Distance settings and allows limiting maximum view distance that can be set by players. +Adds various View Distance settings, including Field of View based Object View Distance, and allows limiting maximum view distance that can be set by players. ## Maintainers @@ -9,3 +9,4 @@ Adds various View Distance settings and allows limiting maximum view distance th The people responsible for merging changes to this component or answering potential questions. - [Winter](https://github.com/Winter259) +- [Jonpas](https://github.com/jonpas) diff --git a/addons/viewdistance/XEH_postInit.sqf b/addons/viewdistance/XEH_clientInit.sqf similarity index 75% rename from addons/viewdistance/XEH_postInit.sqf rename to addons/viewdistance/XEH_clientInit.sqf index a30befaa81..45b86d944d 100644 --- a/addons/viewdistance/XEH_postInit.sqf +++ b/addons/viewdistance/XEH_clientInit.sqf @@ -11,10 +11,11 @@ if (!hasInterface) exitWith {}; // Set the EH which waits for any of the view distance settings to be changed, so that the effect is show immediately ["SettingChanged",{ - if ((_this select 0 == QGVAR(viewDistanceOnFoot)) || - (_this select 0 == QGVAR(viewDistanceLandVehicle)) || - (_this select 0 == QGVAR(viewDistanceAirVehicle)) || - (_this select 0 == QGVAR(objectViewDistanceCoeff))) then { + params ["_name"]; + if ((_name == QGVAR(viewDistanceOnFoot)) || + (_name == QGVAR(viewDistanceLandVehicle)) || + (_name == QGVAR(viewDistanceAirVehicle)) || + (_name == QGVAR(objectViewDistanceCoeff))) then { [true] call FUNC(adaptViewDistance); }; diff --git a/addons/viewdistance/XEH_preInit.sqf b/addons/viewdistance/XEH_preInit.sqf index a68416cada..8237a97cb9 100644 --- a/addons/viewdistance/XEH_preInit.sqf +++ b/addons/viewdistance/XEH_preInit.sqf @@ -2,10 +2,11 @@ ADDON = false; -PREP(initModule); -PREP(returnValue); -PREP(returnObjectCoeff); -PREP(changeViewDistance); PREP(adaptViewDistance); +PREP(changeViewDistance); +PREP(initModule); +PREP(returnObjectCoeff); +PREP(returnValue); +PREP(setFovBasedOvdPFH); -ADDON = true; \ No newline at end of file +ADDON = true; diff --git a/addons/viewdistance/config.cpp b/addons/viewdistance/config.cpp index a1afbcc93f..2de8b2c954 100644 --- a/addons/viewdistance/config.cpp +++ b/addons/viewdistance/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Winter"}; + author[] = {"Winter", "Jonpas", "Arkhir"}; authorUrl = "https://github.com/Winter259"; VERSION_CONFIG; }; @@ -14,4 +14,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "ACE_Settings.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" diff --git a/addons/viewdistance/functions/fnc_adaptViewDistance.sqf b/addons/viewdistance/functions/fnc_adaptViewDistance.sqf index ca03758df5..f1ea7121b2 100644 --- a/addons/viewdistance/functions/fnc_adaptViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_adaptViewDistance.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [] call ace_viewdistance_fnc_adaptViewDistance; + * [] call ace_viewdistance_fnc_adaptViewDistance * * Public: No */ @@ -36,4 +36,4 @@ if (_land_vehicle) exitWith { if (_air_vehicle) exitWith { [GVAR(viewDistanceAirVehicle),_show_prompt] call FUNC(changeViewDistance); -}; \ No newline at end of file +}; diff --git a/addons/viewdistance/functions/fnc_changeViewDistance.sqf b/addons/viewdistance/functions/fnc_changeViewDistance.sqf index 30dc4f8144..1e887e9538 100644 --- a/addons/viewdistance/functions/fnc_changeViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_changeViewDistance.sqf @@ -2,7 +2,6 @@ * Author: Winter * Sets the player's current view distance according to allowed values. * - * * Arguments: * 0: View Distance setting INDEX * 1: Show Prompt @@ -11,14 +10,13 @@ * None * * Example: - * [] call ace_viewdistance_fnc_changeViewDistance; + * [] call ace_viewdistance_fnc_changeViewDistance * * Public: No */ - #include "script_component.hpp" -private ["_text","_new_view_distance","_view_distance_limit","_object_view_distance_coeff"]; +private ["_text", "_new_view_distance", "_view_distance_limit", "_object_view_distance_coeff"]; params ["_index_requested", "_show_prompt"]; @@ -29,19 +27,34 @@ _view_distance_limit = GVAR(limitViewDistance); // Grab the limit TRACE_2("Limit",_new_view_distance,_view_distance_limit); setViewDistance (_new_view_distance min _view_distance_limit); -if (_object_view_distance_coeff > 0) then { - setObjectViewDistance (_object_view_distance_coeff * viewDistance); +if (typeName _object_view_distance_coeff == "SCALAR") then { + if (_object_view_distance_coeff > 0) then { + setObjectViewDistance (_object_view_distance_coeff * viewDistance); + } else { + // Restore correct view distance when changing from FoV Based to Off + // Restoring directly inside PFH's self-exit resulted in the need of selecting another option to take effect + setObjectViewDistance GVAR(fovBasedPFHminimalViewDistance); + }; +} else { + if (isNil QGVAR(fovBasedPFHminimalViewDistance)) then { + GVAR(fovBasedPFHminimalViewDistance) = getObjectViewDistance select 0; // Minimal view distance holder and PFH isRunning variable + [FUNC(setFovBasedOvdPFH), 0, []] call CBA_fnc_addPerFrameHandler; + }; }; if (_show_prompt) then { - _text = if (_new_view_distance <= _view_distance_limit) then { - format ["%1 %2m", (localize "STR_ACE_ViewDistance_infotext"), str(viewDistance)]; - } else { - format ["%1 %2m", (localize "STR_ACE_ViewDistance_invalid"), str(viewDistance)]; - }; - if (GVAR(objectViewDistanceCoeff) > 0) then { - _text = _text + format ["
%1 %2%3", (localize "STR_ACE_ViewDistance_objectinfotext"), str(_object_view_distance_coeff * 100),"%"]; + // FoV Based or % + if (GVAR(objectViewDistanceCoeff) == 6) then { + _text = format ["%1 %2
Min. %3
Max. %4
", localize LSTRING(objectinfotext), localize LSTRING(object_fovBased), GVAR(fovBasedPFHminimalViewDistance), viewDistance]; + } else { + _text = if (_new_view_distance <= _view_distance_limit) then { + format ["%1 %2m", localize LSTRING(infotext), viewDistance]; + } else { + format ["%1 %2m", localize LSTRING(invalid), viewDistance]; + }; + _text = _text + format ["
%1 %2%3", localize LSTRING(objectinfotext), _object_view_distance_coeff * 100, "%"]; + }; + [parseText _text, 2] call EFUNC(common,displayTextStructured); }; - [parseText _text,2] call EFUNC(common,displayTextStructured); }; diff --git a/addons/viewdistance/functions/fnc_initModule.sqf b/addons/viewdistance/functions/fnc_initModule.sqf index 47cf27025e..231cd74c7b 100644 --- a/addons/viewdistance/functions/fnc_initModule.sqf +++ b/addons/viewdistance/functions/fnc_initModule.sqf @@ -1,7 +1,6 @@ /* * Author: Winter - * Initialises the view distance limiter module - * + * Initializes the view distance limiter module. * * Arguments: * 0: logic @@ -10,7 +9,6 @@ * * Return Value: * None - * */ #include "script_component.hpp" diff --git a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf index 71a23d7b54..e9838a0c8d 100644 --- a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf +++ b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf @@ -2,7 +2,6 @@ * Author: Winter * Returns the object view distance coefficient according to the given index * - * * Arguments: * 0: Object View Distance setting Index * @@ -28,6 +27,7 @@ _return = switch (_index) do { case 3: {0.60}; // Medium case 4: {0.80}; // High case 5: {1.00}; // Very High + case 6: {"fov"}; // FoV Based default {0.50}; // something broke if this returns }; diff --git a/addons/viewdistance/functions/fnc_returnValue.sqf b/addons/viewdistance/functions/fnc_returnValue.sqf index 7e0c41f1be..2e4263fa08 100644 --- a/addons/viewdistance/functions/fnc_returnValue.sqf +++ b/addons/viewdistance/functions/fnc_returnValue.sqf @@ -1,7 +1,6 @@ /* * Author: Winter - * Returns the view distance value according to the given index - * + * Returns the view distance value according to the given index. * * Arguments: * 0: View Distance Index @@ -10,7 +9,7 @@ * View Distance * * Example: - * [2] call ace_viewdistance_fnc_returnViewDistanceValue; + * [2] call ace_viewdistance_fnc_returnViewDistanceValue * * Public: No */ diff --git a/addons/viewdistance/functions/fnc_setFovBasedOvdPFH.sqf b/addons/viewdistance/functions/fnc_setFovBasedOvdPFH.sqf new file mode 100644 index 0000000000..007c967da9 --- /dev/null +++ b/addons/viewdistance/functions/fnc_setFovBasedOvdPFH.sqf @@ -0,0 +1,53 @@ +/* + * Author: Jonpas + * Sets Object View Distance dynamically based on current Field of View, between Object View Distance (minimal value) and View Distance (maximum value) set before this PFH starts. + * + * Arguments: + * 0: PFH Arguments + * 1: PFH Handle + * + * Return Value: + * PFH Handle + * + * Example: + * [] call ace_viewdistance_fnc_setFovBasedOvdPFH + * + * Public: No + */ + +#include "script_component.hpp" + +#define VD_ZOOM_NORMAL 1.00041 +#define VD_ZOOM_DIVISION 35 +#define VD_ZOOM_DIVISION_AIR 10 + +params ["", "_idPFH"]; + +// Remove PFH and set Object View Distance back to what it was before +if (GVAR(objectViewDistanceCoeff) < 6) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + GVAR(fovBasedPFHminimalViewDistance) = nil; +}; + +private ["_zoom"]; +_zoom = (call CBA_fnc_getFov) select 1; + +// Air +if ((vehicle ACE_player) isKindOf "Air") exitWith { + if (_zoom > VD_ZOOM_NORMAL) then { + // Dynamically set Object View Distance based on player's Zoom Level and View Distance + setObjectViewDistance ((_zoom / VD_ZOOM_DIVISION_AIR * (viewDistance - GVAR(fovBasedPFHminimalViewDistance))) + GVAR(fovBasedPFHminimalViewDistance)); + } else { + setObjectViewDistance (GVAR(fovBasedPFHminimalViewDistance) + viewDistance / 10); + }; + TRACE_2("FoV Based",getObjectViewDistance select 0,_zoom); +}; + +// Land +if (_zoom > VD_ZOOM_NORMAL) then { + // Dynamically set Object View Distance based on player's Zoom Level and View Distance + setObjectViewDistance ((_zoom / VD_ZOOM_DIVISION * (viewDistance - GVAR(fovBasedPFHminimalViewDistance))) + GVAR(fovBasedPFHminimalViewDistance)); +} else { + setObjectViewDistance GVAR(fovBasedPFHminimalViewDistance); +}; +TRACE_2("FoV Based",getObjectViewDistance select 0,_zoom); diff --git a/addons/viewdistance/functions/script_component.hpp b/addons/viewdistance/functions/script_component.hpp index 4b7df89f37..f6c83ec54d 100644 --- a/addons/viewdistance/functions/script_component.hpp +++ b/addons/viewdistance/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\viewdistance\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\viewdistance\script_component.hpp" diff --git a/addons/viewdistance/script_component.hpp b/addons/viewdistance/script_component.hpp index 79e0e488cc..53c4d76390 100644 --- a/addons/viewdistance/script_component.hpp +++ b/addons/viewdistance/script_component.hpp @@ -9,4 +9,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_VIEWDISTANCE #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/viewdistance/stringtable.xml b/addons/viewdistance/stringtable.xml index b3058bc29e..9d92c58332 100644 --- a/addons/viewdistance/stringtable.xml +++ b/addons/viewdistance/stringtable.xml @@ -1,6 +1,6 @@ - + View Distance Limiter Ogranicznik zasięgu widzenia @@ -156,7 +156,7 @@ Динамич. дальность отрисовки объектов - Sets the object view distance as a coefficient of the view distance. + Sets the object view distance as a coefficient of the view distance or based on field of view. FoV Based's lowest and highest value is the value which is set when enabling the option. Zmienia zasięg rysowania obiektów jako mnożnik zasięgu widzenia. Establece la distancia de visión de objetos como un coeficiente de la distancia de visión. Nastaví objekt dohlednosti jako koeficient dohlednosti. @@ -232,6 +232,9 @@ Maximális Очень высокая + + FoV Based + View Distance: Zasięg widzenia: diff --git a/addons/weaponselect/XEH_preInit.sqf b/addons/weaponselect/XEH_preInit.sqf index 1f324f7fb0..fe40d33523 100644 --- a/addons/weaponselect/XEH_preInit.sqf +++ b/addons/weaponselect/XEH_preInit.sqf @@ -25,13 +25,13 @@ private ["_magazines", "_ammo", "_explosive"]; GVAR(GrenadesAll) append _magazines; { - _ammo = getText (configfile >> "CfgMagazines" >> _x >> "ammo"); - _explosive = getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive"); + _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); ([GVAR(GrenadesFrag), GVAR(GrenadesNonFrag)] select (_explosive == 0)) pushBack _x; false } count _magazines; false -} count getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles"); +} count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles"); ADDON = true; diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 6ae945e2fd..4ab09a105f 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -if !(GVAR(DisplayText)) exitwith {}; +if !(GVAR(DisplayText)) exitWith {}; params ["_magazine", "_numberofGrenades"]; diff --git a/addons/weather/CfgVehicles.hpp b/addons/weather/CfgVehicles.hpp index ebdd65c30d..f37a62449a 100644 --- a/addons/weather/CfgVehicles.hpp +++ b/addons/weather/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 44a5b0696c..98d9026c1c 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -33,7 +33,7 @@ GVAR(WindInfo) = true; if !(GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player) exitWith { GVAR(WindInfo) = false; 0 cutText ["", "PLAIN"]; - [_this select 1] call cba_fnc_removePerFrameHandler; + [_this select 1] call CBA_fnc_removePerFrameHandler; }; _windIndex = 12; diff --git a/addons/winddeflection/CfgVehicles.hpp b/addons/winddeflection/CfgVehicles.hpp index 2694bb1b34..c52949e1fc 100644 --- a/addons/winddeflection/CfgVehicles.hpp +++ b/addons/winddeflection/CfgVehicles.hpp @@ -8,6 +8,7 @@ class CfgVehicles { function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index 6c668a8033..a3c51054ee 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -32,6 +32,6 @@ if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exit if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false}; -GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")]; +GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; true; \ No newline at end of file diff --git a/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf b/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf index baff39516d..393a5cd757 100644 --- a/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf +++ b/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf @@ -34,8 +34,7 @@ _bulletSpeed = vectorMagnitude _bulletVelocity; if ((!alive _bullet) || {(_bullet isKindOf "BulletBase") && {_bulletSpeed < 100}}) then { - GVAR(trackedBullets) deleteAt (_forEachIndex - _deleted); - _deleted = _deleted + 1; + GVAR(trackedBullets) deleteAt (GVAR(trackedBullets) find _x); } else { if (_isWind) then { _trueVelocity = _bulletVelocity vectorDiff ACE_wind; @@ -51,7 +50,7 @@ }; _bullet setVelocity _bulletVelocity; }; - - } forEach GVAR(trackedBullets); + nil + } count +GVAR(trackedBullets); // END_COUNTER(pfeh); }, GVAR(simulationInterval), [ACE_time]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 35c43b0e84..f5144e60e6 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -23,6 +23,7 @@ class CfgVehicles { function = QFUNC(moduleZeusSettings); functionPriority = 1; isGlobal = 1; + isSingular = 1; isTriggerActivated = 0; author = "SilentSpike"; class Arguments { diff --git a/addons/zeus/functions/fnc_addObjectToCurator.sqf b/addons/zeus/functions/fnc_addObjectToCurator.sqf index be814266ab..897f51532d 100644 --- a/addons/zeus/functions/fnc_addObjectToCurator.sqf +++ b/addons/zeus/functions/fnc_addObjectToCurator.sqf @@ -13,12 +13,12 @@ #include "script_component.hpp" -if (!isServer) exitwith {}; +if (!isServer) exitWith {}; params ["_object"]; -if (!(_object getvariable [QGVAR(addObject), GVAR(autoAddObjects)])) exitwith {}; +if (!(_object getVariable [QGVAR(addObject), GVAR(autoAddObjects)])) exitWith {}; { _x addCuratorEditableObjects [[_object], true]; -}foreach allCurators; +}forEach allCurators; diff --git a/addons/zeus/functions/fnc_bi_moduleCurator.sqf b/addons/zeus/functions/fnc_bi_moduleCurator.sqf index a36d8dd458..fc21fe11e7 100644 --- a/addons/zeus/functions/fnc_bi_moduleCurator.sqf +++ b/addons/zeus/functions/fnc_bi_moduleCurator.sqf @@ -24,13 +24,13 @@ _activated = _this select 2; if (_activated) then { //--- Terminate when not created on the server - if (!isserver && local _logic && isnull (getassignedcuratorunit _logic)) exitwith { + if (!isserver && local _logic && isnull (getassignedcuratorunit _logic)) exitWith { [format ["%1 is trying to create curator logic ModuleCurator_F",profilename],"bis_fnc_error",false] call bis_fnc_mp; deletevehicle _logic; }; //--- Get curator owner - _ownerVar = _logic getvariable ["owner",""]; + _ownerVar = _logic getVariable ["owner",""]; _ownerUID = parsenumber _ownerVar; if (cheatsenabled) then { _ownerVarArray = toarray _ownerVar; @@ -47,7 +47,7 @@ if (_activated) then { _isAdmin = _ownerVar == "#adminLogged" || _ownerVar == "#adminVoted"; //--- Wipe out the variable so clients can't access it - _logic setvariable ["owner",nil]; + _logic setVariable ["owner",nil]; //--- Server if (isserver) then { @@ -58,17 +58,17 @@ if (_activated) then { _letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]; _adminVar = "admin_"; for "_i" from 0 to 9 do {_adminVar = _adminVar + (_letters call bis_fnc_selectrandom);}; - _logic setvariable ["adminVar",_adminVar,true]; + _logic setVariable ["adminVar",_adminVar,true]; }; //--- Get allowed addons - _addonsType = _logic getvariable ["Addons",0]; + _addonsType = _logic getVariable ["Addons",0]; _addons = []; switch _addonsType do { //--- All (including unofficial ones) case 3: { - _cfgPatches = configfile >> "cfgpatches"; + _cfgPatches = configFile >> "Cfgpatches"; for "_i" from 0 to (count _cfgPatches - 1) do { _class = _cfgPatches select _i; if (isclass _class) then {_addons set [count _addons,configname _class];}; @@ -85,8 +85,8 @@ if (_activated) then { case 1: { _addonsList = []; { - _addonsList = _addonsList + (unitaddons typeof _x); - } foreach (entities "all"); + _addonsList = _addonsList + (unitaddons typeOf _x); + } forEach (entities "all"); removeallcuratoraddons _logic; _logic addcuratoraddons _addonsList; }; @@ -108,12 +108,12 @@ if (_activated) then { if (_adminVar != "") then {_ownerVar = _adminVar;}; - _forced = _logic getvariable ["forced",0] > 0; - _name = _logic getvariable ["name",""]; + _forced = _logic getVariable ["forced",0] > 0; + _name = _logic getVariable ["name",""]; if (_name == "") then {_name = localize "STR_A3_curator";}; //--- Wait until mission starts - waituntil {time > 0}; // NOTE: DO NOT CHANGE TO ACE_TIME, IT BREAKS THE MODULE + waitUntil {time > 0}; // NOTE: DO NOT CHANGE TO ACE_TIME, IT BREAKS THE MODULE //--- Refresh addon list, so it's broadcasted to clients _addons = curatoraddons _logic; @@ -124,38 +124,38 @@ if (_activated) then { //--- Wait for player to become Zeus switch true do { case (_ownerUID > 0): { - waituntil { + waitUntil { sleep 0.01; {getplayeruid _x == _ownerVar} count playableunits > 0 || isnull _logic }; }; default { - waituntil {isplayer (missionnamespace getvariable [_ownerVar,objnull]) || isnull _logic}; + waitUntil {isplayer (missionnamespace getVariable [_ownerVar,objnull]) || isnull _logic}; }; }; - if (isnull _logic) exitwith {}; + if (isnull _logic) exitWith {}; //--- Assign _player = objnull; switch true do { case (_ownerUID > 0): { { - if (getplayeruid _x == _ownerVar) exitwith {_player = _x;}; - } foreach playableunits; + if (getplayeruid _x == _ownerVar) exitWith {_player = _x;}; + } forEach playableunits; }; default { - _player = missionnamespace getvariable [_ownerVar,objnull]; + _player = missionnamespace getVariable [_ownerVar,objnull]; }; }; - waituntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; - waituntil {_player assignCurator _logic; getassignedcuratorunit _logic == _player || isnull _logic}; - if (isnull _logic) exitwith {}; + waitUntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; + waitUntil {_player assignCurator _logic; getassignedcuratorunit _logic == _player || isnull _logic}; + if (isnull _logic) exitWith {}; //--- Add radio channels { _x radiochanneladd [_player]; - } foreach (_logic getvariable ["channels",[]]); + } forEach (_logic getVariable ["channels",[]]); // Added by ace_zeus to delay ascension message at mission start [{ @@ -163,12 +163,12 @@ if (_activated) then { _player = _this select 1; //--- Sent notification to all assigned players - if ((_logic getvariable ["showNotification",true]) && GVAR(zeusAscension)) then { + if ((_logic getVariable ["showNotification",true]) && GVAR(zeusAscension)) then { { if (isplayer _x) then { [["CuratorAssign",[_name,name _player]],"bis_fnc_showNotification",_x] call bis_fnc_mp; }; - } foreach (curatoreditableobjects _logic); + } forEach (curatoreditableobjects _logic); }; },[_logic,_player]] call EFUNC(common,execNextFrame); @@ -185,41 +185,41 @@ if (_activated) then { //--- Wait for player to stop being Zeus switch true do { case (_ownerUID > 0): { - waituntil { + waitUntil { sleep 0.01; {getplayeruid _x == _ownerVar} count playableunits == 0 || isnull _logic }; }; default { - waituntil {_player != missionnamespace getvariable [_ownerVar,objnull] || isnull _logic}; + waitUntil {_player != missionnamespace getVariable [_ownerVar,objnull] || isnull _logic}; }; }; - if (isnull _logic) exitwith {}; + if (isnull _logic) exitWith {}; //--- Add radio channels { _x radiochannelremove [_player]; - } foreach (_logic getvariable ["channels",[]]); + } forEach (_logic getVariable ["channels",[]]); //--- Unassign - waituntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; - if (isnull _logic) exitwith {}; + waitUntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; + if (isnull _logic) exitWith {}; }; }; //--- Activated all future addons _addons = []; { - if (typeof _x == "ModuleCuratorAddAddons_F") then { - _paramAddons = call compile ("[" + (_x getvariable ["addons",""]) + "]"); + if (typeOf _x == "ModuleCuratorAddAddons_F") then { + _paramAddons = call compile ("[" + (_x getVariable ["addons",""]) + "]"); { if !(_x in _addons) then {_addons set [count _addons,_x];}; { if !(_x in _addons) then {_addons set [count _addons,_x];}; - } foreach (unitaddons _x); - } foreach _paramAddons; + } forEach (unitaddons _x); + } forEach _paramAddons; }; - } foreach (synchronizedobjects _logic); + } forEach (synchronizedobjects _logic); _addons call bis_fnc_activateaddons; // Added by ace_zeus to delay bird code @@ -228,10 +228,10 @@ if (_activated) then { if (GVAR(zeusBird)) then { //--- Create bird - _birdType = _logic getvariable ["birdType","eagle_f"]; + _birdType = _logic getVariable ["birdType","eagle_f"]; if (_birdType != "") then { _bird = createvehicle [_birdType,[100,100,100],[],0,"none"]; - _logic setvariable ["bird",_bird,true]; + _logic setVariable ["bird",_bird,true]; }; //--- Locality changed @@ -239,7 +239,7 @@ if (_activated) then { "local", { _logic = _this select 0; - _bird = _logic getvariable ["bird",objnull]; + _bird = _logic getVariable ["bird",objnull]; _bird setowner owner _logic; } ]; @@ -249,11 +249,11 @@ if (_activated) then { //--- Player if (hasinterface) then { - waituntil {local player}; + waitUntil {local player}; _serverCommand = if (_ownerVar == "#adminLogged") then {"#shutdown"} else {"#kick"}; //--- Black effect until the interface is open - _forced = _logic getvariable ["forced",0] > 0; + _forced = _logic getVariable ["forced",0] > 0; if (_forced) then { _isCurator = switch true do { case (_ownerUID > 0): { @@ -263,7 +263,7 @@ if (_activated) then { isserver || servercommandavailable _serverCommand }; default { - player == missionnamespace getvariable [_ownerVar,objnull] + player == missionnamespace getVariable [_ownerVar,objnull] }; }; if (_isCurator) then { @@ -274,11 +274,11 @@ if (_activated) then { //--- Check if player is server admin if (_isAdmin) then { - _adminVar = _logic getvariable ["adminVar",""]; - _logic setvariable ["adminVar",nil]; + _adminVar = _logic getVariable ["adminVar",""]; + _logic setVariable ["adminVar",nil]; if (isserver) then { //--- Host - missionnamespace setvariable [_adminVar,player]; + missionnamespace setVariable [_adminVar,player]; } else { //--- Client [_logic,_adminVar,_serverCommand] spawn { @@ -288,13 +288,13 @@ if (_activated) then { _adminVar = _this select 1; _serverCommand = _this select 2; while {true} do { - waituntil {sleep 0.1; servercommandavailable _serverCommand}; - missionnamespace setvariable [_adminVar,player]; + waitUntil {sleep 0.1; servercommandavailable _serverCommand}; + missionnamespace setVariable [_adminVar,player]; publicvariable _adminVar; _respawn = player addeventhandler ["respawn",format ["%1 = _this select 0; publicvariable '%1';",_adminVar]]; - waituntil {sleep 0.1; !servercommandavailable _serverCommand}; - missionnamespace setvariable [_adminVar,objnull]; + waitUntil {sleep 0.1; !servercommandavailable _serverCommand}; + missionnamespace setVariable [_adminVar,objnull]; publicvariable _adminVar; player removeeventhandler ["respawn",_respawn]; }; @@ -305,7 +305,7 @@ if (_activated) then { [_logic] spawn { _logic = _this select 0; sleep 1; - waituntil {alive player}; + waitUntil {alive player}; //--- Show warning when Zeus key is not assigned if (count (actionkeys "curatorInterface") == 0) then { @@ -319,7 +319,7 @@ if (_activated) then { //--- Show hint about pinging for players if ( - isnil {profilenamespace getvariable "bis_fnc_curatorPinged_done"} + isNil {profilenamespace getVariable "bis_fnc_curatorPinged_done"} && {isTutHintsEnabled} && diff --git a/addons/zeus/functions/fnc_bi_moduleMine.sqf b/addons/zeus/functions/fnc_bi_moduleMine.sqf index 8f60531b34..2f863ac5b9 100644 --- a/addons/zeus/functions/fnc_bi_moduleMine.sqf +++ b/addons/zeus/functions/fnc_bi_moduleMine.sqf @@ -21,7 +21,7 @@ _units = _this select 1; _activated = _this select 2; if (_activated) then { - _explosive = gettext (configfile >> "cfgvehicles" >> typeof _logic >> "explosive"); + _explosive = gettext (configFile >> "CfgVehicles" >> typeOf _logic >> "explosive"); if (_explosive != "") then { _explosive = createvehicle [_explosive,position _logic,[],0,"none"]; _explosive attachto [_logic]; @@ -32,7 +32,7 @@ if (_activated) then { { _side = (getassignedcuratorunit _x) call bis_fnc_objectSide; _side revealmine _explosive; - } foreach (objectcurators _logic); + } forEach (objectcurators _logic); if (GVAR(revealMines) > 1) then { //--- Mark minefields in the map @@ -43,7 +43,7 @@ if (_activated) then { //--- Show hint to curator who placed the object [[["Curator","PlaceMines"],nil,nil,nil,nil,nil,nil,true],"bis_fnc_advHint",_logic] call bis_fnc_mp; - waituntil {sleep 0.1; isnull _explosive || isnull _logic || !alive _logic}; + waitUntil {sleep 0.1; isnull _explosive || isnull _logic || !alive _logic}; if (isnull _logic) then {deletevehicle _explosive;} else {_explosive setdamage 1;}; deletevehicle _logic; }; diff --git a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf index 7150856154..05d2e2d096 100644 --- a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf +++ b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" -_fnc_scriptNameParentTemp = if !(isnil '_fnc_scriptName') then {_fnc_scriptName} else {'BIS_fnc_moduleProjectile'}; +_fnc_scriptNameParentTemp = if !(isNil '_fnc_scriptName') then {_fnc_scriptName} else {'BIS_fnc_moduleProjectile'}; private ['_fnc_scriptNameParent']; _fnc_scriptNameParent = _fnc_scriptNameParentTemp; _fnc_scriptNameParentTemp = nil; @@ -36,20 +36,20 @@ if ({local _x} count (objectcurators _logic) > 0) then { _logic hideobject false; _logic setpos position _logic; }; -if !(isserver) exitwith {}; +if !(isserver) exitWith {}; if (_activated) then { - _ammo = _logic getvariable ["type",gettext (configfile >> "cfgvehicles" >> typeof _logic >> "ammo")]; + _ammo = _logic getVariable ["type",gettext (configFile >> "CfgVehicles" >> typeOf _logic >> "ammo")]; if (_ammo != "") then { - _cfgAmmo = configfile >> "cfgammo" >> _ammo; - //if !(isclass _cfgAmmo) exitwith {["CfgAmmo class '%1' not found.",_ammo] call bis_fnc_error;}; - _dirVar = _fnc_scriptname + typeof _logic; - _logic setdir (missionnamespace getvariable [_dirVar,direction _logic]); //--- Restore custom direction + _CfgAmmo = configFile >> "CfgAmmo" >> _ammo; + //if !(isclass _CfgAmmo) exitWith {["CfgAmmo class '%1' not found.",_ammo] call bis_fnc_error;}; + _dirVar = _fnc_scriptname + typeOf _logic; + _logic setdir (missionnamespace getVariable [_dirVar,direction _logic]); //--- Restore custom direction _pos = getposatl _logic; _posAmmo = +_pos; _posAmmo set [2,0]; _dir = direction _logic; - _simulation = tolower gettext (configfile >> "cfgammo" >> _ammo >> "simulation"); + _simulation = tolower gettext (configFile >> "CfgAmmo" >> _ammo >> "simulation"); _altitude = 0; _velocity = []; _attach = false; @@ -65,7 +65,7 @@ if (_activated) then { _altitude = 1000; _velocity = [0,0,-100]; _radio = "SentGenIncoming"; - _sounds = if (getnumber (_cfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]}; + _sounds = if (getnumber (_CfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]}; _sound = _sounds call bis_fnc_selectrandom; _hint = ["Curator","PlaceOrdnance"]; _shakeStrength = 0.01; @@ -104,21 +104,21 @@ if (_activated) then { _side = side group _x; if (_side in [east,west,resistance,civilian]) then { //--- Play radio (only if it wasn't played recently) - if (ACE_time > _x getvariable ["BIS_fnc_moduleProjectile_radio",-_delay]) then { + if (ACE_time > _x getVariable ["BIS_fnc_moduleProjectile_radio",-_delay]) then { [[_side,_radio,"side"],"bis_fnc_sayMessage",_x] call bis_fnc_mp; - _x setvariable ["BIS_fnc_moduleProjectile_radio",ACE_time + _delay]; + _x setVariable ["BIS_fnc_moduleProjectile_radio",ACE_time + _delay]; }; }; }; - } foreach _entities; + } forEach _entities; }; }; if (count _hint > 0) then { [[_hint,nil,nil,nil,nil,nil,nil,true],"bis_fnc_advHint",objectcurators _logic] call bis_fnc_mp; }; if (count _velocity == 3) then { - _altitude = (_logic getvariable ["altitude",_altitude]) call bis_fnc_parsenumber; - _radio = _logic getvariable ["radio",_radio]; + _altitude = (_logic getVariable ["altitude",_altitude]) call bis_fnc_parsenumber; + _radio = _logic getVariable ["radio",_radio]; //--- Create projectile _posAmmo set [2,_altitude]; @@ -128,7 +128,7 @@ if (_activated) then { if (_attach) then {_projectile attachto [_logic,[0,0,_altitude]];}; // Added by ace_zeus for ace_frag compatibility - if (!isnil QEFUNC(frag,addPfhRound)) then { + if (!isNil QEFUNC(frag,addPfhRound)) then { [objNull, _ammo, _projectile, true] call EFUNC(frag,addPfhRound); }; @@ -146,13 +146,13 @@ if (_activated) then { //--- Update if (_attach) then { - waituntil { + waitUntil { _soundSource setposatl getposatl _projectile; sleep 1; isnull _projectile || isnull _logic }; } else { - waituntil { + waitUntil { _soundSource setposatl getposatl _projectile; if (getposatl _logic distance _pos > 0 || direction _logic != _dir) then { @@ -164,7 +164,7 @@ if (_activated) then { _projectile setposasl _posNew; _pos = getposatl _logic; _dir = direction _logic; - missionnamespace setvariable [_dirVar,_dir]; + missionnamespace setVariable [_dirVar,_dir]; }; sleep 0.1; isnull _projectile || isnull _logic @@ -183,7 +183,7 @@ if (_activated) then { } else { //--- Repeat to achieve permanent effect - _repeat = _logic getvariable ["repeat",0] > 0; + _repeat = _logic getVariable ["repeat",0] > 0; if (_repeat) then { [_logic,_units,_activated] call bis_fnc_moduleprojectile; } else { @@ -194,6 +194,6 @@ if (_activated) then { deletevehicle _logic; }; } else { - ["Cannot create projectile, 'ammo' config attribute is missing in %1",typeof _logic] call bis_fnc_error; + ["Cannot create projectile, 'ammo' config attribute is missing in %1",typeOf _logic] call bis_fnc_error; }; }; diff --git a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf index a9e1f35080..7eec86bb7d 100644 --- a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf +++ b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf @@ -23,11 +23,11 @@ _activated = _this select 2; if (_activated && local _logic && !isnull curatorcamera) then { //--- Terminate when remote control is already in progress - if !(isnull (missionnamespace getvariable ["bis_fnc_moduleRemoteControl_unit",objnull])) exitwith {}; + if !(isnull (missionnamespace getVariable ["bis_fnc_moduleRemoteControl_unit",objnull])) exitWith {}; //--- Get unit under cursor _unit = objnull; - _mouseOver = missionnamespace getvariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]]; + _mouseOver = missionnamespace getVariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]]; if ((_mouseOver select 0) == typename objnull) then {_unit = _mouseOver select 1;}; _unit = effectivecommander _unit; @@ -37,7 +37,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { if (isplayer _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer";}; if !(alive _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorDestroyed";}; if (isnull _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorNull";}; - if !(isnull (_unit getvariable ["bis_fnc_moduleRemoteControl_owner",objnull])) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";}; + if !(isnull (_unit getVariable ["bis_fnc_moduleRemoteControl_owner",objnull])) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";}; if (_error == "") then { _unit spawn { @@ -47,7 +47,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { _vehicleRole = str assignedvehiclerole _unit; bis_fnc_moduleRemoteControl_unit = _unit; - _unit setvariable ["bis_fnc_moduleRemoteControl_owner",player,true]; + _unit setVariable ["bis_fnc_moduleRemoteControl_owner",player,true]; // Added by ace_zeus to toggle remote control wind sound if (GVAR(remoteWind)) then { @@ -76,7 +76,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { //--- Wait for interface to close (finddisplay 312) closedisplay 2; - waituntil {isnull curatorcamera}; + waitUntil {isnull curatorcamera}; //--- Switch player remotecontrol _unit; @@ -106,7 +106,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { _vehicle = vehicle _unit; _vehicleRole = str assignedvehiclerole _unit; _rating = rating player; - waituntil { + waitUntil { //--- Refresh when vehicle or vehicle role changes if ((vehicle _unit != _vehicle || str assignedvehiclerole _unit != _vehicleRole) && {alive _unit}) then { player remotecontrol _unit; @@ -125,12 +125,12 @@ if (_activated && local _logic && !isnull curatorcamera) then { || {isnull getassignedcuratorlogic player} //|| - //{_unit getvariable ["bis_fnc_moduleRemoteControl_owner",objnull] != player} //--- Another curator stole the unit + //{_unit getVariable ["bis_fnc_moduleRemoteControl_owner",objnull] != player} //--- Another curator stole the unit }; player addrating (-rating player + _rating); objnull remotecontrol _unit; - _unit setvariable ["bis_fnc_moduleRemoteControl_owner",nil,true]; + _unit setVariable ["bis_fnc_moduleRemoteControl_owner",nil,true]; //--- Death screen if ( @@ -142,7 +142,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { && {!isnull getassignedcuratorlogic player} //&& - //{(_unit getvariable ["bis_fnc_moduleRemoteControl_owner",objnull] == player)} + //{(_unit getVariable ["bis_fnc_moduleRemoteControl_owner",objnull] == player)} ) then { sleep 2; ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black out",1]; @@ -152,14 +152,14 @@ if (_activated && local _logic && !isnull curatorcamera) then { _camPos = [_unitPos,10,direction _unit + 180] call bis_fnc_relpos; _camPos set [2,(_unitPos select 2) + (getterrainheightasl _unitPos) - (getterrainheightasl _camPos) + 10]; //[_camPos,_unit] call bis_fnc_setcuratorcamera; - (getassignedcuratorlogic player) setvariable ["bis_fnc_modulecuratorsetcamera_params",[_camPos,_unit]]; + (getassignedcuratorlogic player) setVariable ["bis_fnc_modulecuratorsetcamera_params",[_camPos,_unit]]; sleep 0.1; //--- Engine needs a delay in case controlled unit was deleted ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black in",1e10]; opencuratorinterface; ppeffectdestroy _color; - waituntil {!isnull curatorcamera}; + waitUntil {!isnull curatorcamera}; player switchcamera cameraview; bis_fnc_moduleRemoteControl_unit = nil; ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black in",1]; diff --git a/addons/zeus/functions/fnc_moduleSetMedic.sqf b/addons/zeus/functions/fnc_moduleSetMedic.sqf index 661e33f907..d4acda3f54 100644 --- a/addons/zeus/functions/fnc_moduleSetMedic.sqf +++ b/addons/zeus/functions/fnc_moduleSetMedic.sqf @@ -41,7 +41,7 @@ if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { } else { _medicN = GETVAR(_unit,EGVAR(medical,medicClass),0); if (_medicN < 1) then { - _unit setvariable [QEGVAR(medical,medicClass), 1, true]; + _unit setVariable [QEGVAR(medical,medicClass), 1, true]; }; }; }; diff --git a/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf b/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf index 22826108e7..1e710bf41b 100644 --- a/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf +++ b/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf @@ -40,7 +40,7 @@ if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); } else { if (!(GETVAR(_unit,EGVAR(medical,isMedicalFacility),false))) then { - _unit setvariable [QEGVAR(medical,isMedicalFacility), true, true]; + _unit setVariable [QEGVAR(medical,isMedicalFacility), true, true]; }; }; }; diff --git a/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf b/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf index 9e5e788461..4ffec3460e 100644 --- a/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf +++ b/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf @@ -41,7 +41,7 @@ if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { } else { _medicN = GETVAR(_unit,EGVAR(medical,medicClass),0); if (_medicN < 1) then { - _unit setvariable [QEGVAR(medical,medicClass), 1, true]; + _unit setVariable [QEGVAR(medical,medicClass), 1, true]; }; }; }; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index b885e1cec1..da8e2ac3d2 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -215,21 +215,25 @@ Add Spare Wheel Adicionar roda sobressalente + Dodaj koło zapasowe Добавить запасное колесо Adds a Spare Wheel to the vehicle Adiciona uma roda sobressalente ao veículo + Dodaje koło zapasowe do pojazdu Добавляет запасное колесо в транспорт Add Spare Track Adicionar esteira sobressalente + Dodaj zapasową gąsienicę Дабавить запасную гусеницу Adds a Spare Track to the vehicle Adiciona uma esteira sobressalente ao veículo + Dodaje zapasową gąsienicę do pojazdu Добавляет запасную гусеницу в транспорт @@ -273,11 +277,13 @@ Unit must be a vehicle with cargo space Unidade deve ser um veículo com espaço em carga + Jednostka musi być pojazdem z wolną przestrzenią cargo Юнит должен быть транспортом с грузовым отсеком Unit must have cargo space left Unidade deve conter espaço sobressalente + Jednostka musi mieć wolną przestrzeń cargo Юнит должен иметь свободное место в грузовом отсеке @@ -329,4 +335,4 @@ Añadir cualquier objeto creado a todos los directores en la misión - \ No newline at end of file + diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index 43bd59abaf..299a9f4a5b 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -20,7 +20,7 @@ option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON) if(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "-std=c++11 -march=i686 -m32 -O2 -s -fPIC -fpermissive") + SET(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -pedantic-errors -march=i686 -m32 -O2 -s -fPIC -fpermissive") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index c5c0a6c7a3..203243cd9d 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -5,7 +5,6 @@ #include #include -#define M_PI 3.14159265358979323846f #define GRAVITY 9.80665f #define ABSOLUTE_ZERO_IN_CELSIUS -273.15f #define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS) diff --git a/extensions/break_line/ace_break_line.cpp b/extensions/break_line/ace_break_line.cpp index 8bb5af9572..7644748378 100644 --- a/extensions/break_line/ace_break_line.cpp +++ b/extensions/break_line/ace_break_line.cpp @@ -21,7 +21,7 @@ extern "C" { EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); -}; +} std::vector splitString(const std::string & input) { std::istringstream ss(input); diff --git a/extensions/clipboard/ace_clipboard.cpp b/extensions/clipboard/ace_clipboard.cpp index 61960598ec..cdd5f7c423 100644 --- a/extensions/clipboard/ace_clipboard.cpp +++ b/extensions/clipboard/ace_clipboard.cpp @@ -15,7 +15,7 @@ extern "C" { EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); -}; +} std::string gClipboardData; diff --git a/extensions/common/p3d/animation.cpp b/extensions/common/p3d/animation.cpp index f47a40fe5a..07f5922f49 100644 --- a/extensions/common/p3d/animation.cpp +++ b/extensions/common/p3d/animation.cpp @@ -67,5 +67,5 @@ namespace ace { animation::~animation() { } - }; -}; + } +} diff --git a/extensions/common/p3d/animation.hpp b/extensions/common/p3d/animation.hpp index b53bee6a68..430f3aed6d 100644 --- a/extensions/common/p3d/animation.hpp +++ b/extensions/common/p3d/animation.hpp @@ -65,5 +65,5 @@ namespace ace { //ace::vector3 axis_dir; }; typedef std::shared_ptr animation_p; - }; -}; \ No newline at end of file + } +} diff --git a/extensions/common/p3d/model.hpp b/extensions/common/p3d/model.hpp index bd3cafe60c..a26a8cfbb8 100644 --- a/extensions/common/p3d/model.hpp +++ b/extensions/common/p3d/model.hpp @@ -53,5 +53,5 @@ namespace ace { }; typedef std::shared_ptr model_p; - }; -}; \ No newline at end of file + } +} diff --git a/extensions/common/p3d/model_info.hpp b/extensions/common/p3d/model_info.hpp index 195e925a5a..f785574411 100644 --- a/extensions/common/p3d/model_info.hpp +++ b/extensions/common/p3d/model_info.hpp @@ -70,5 +70,5 @@ namespace ace { }; typedef std::shared_ptr model_info_p; - }; -}; \ No newline at end of file + } +} diff --git a/extensions/common/p3d/parser.hpp b/extensions/common/p3d/parser.hpp index b3f584a017..76a2d2f8e1 100644 --- a/extensions/common/p3d/parser.hpp +++ b/extensions/common/p3d/parser.hpp @@ -13,5 +13,5 @@ namespace ace { model_p load(const std::string &); }; - }; -}; \ No newline at end of file + } +} diff --git a/extensions/common/p3d/skeleton.hpp b/extensions/common/p3d/skeleton.hpp index 86fa71c49c..2b66c4fc6c 100644 --- a/extensions/common/p3d/skeleton.hpp +++ b/extensions/common/p3d/skeleton.hpp @@ -32,5 +32,5 @@ namespace ace { std::vector all_bones; }; typedef std::shared_ptr skeleton_p; - }; -}; \ No newline at end of file + } +} diff --git a/extensions/common/transform_matrix.hpp b/extensions/common/transform_matrix.hpp index f9c3056dc9..73dad45019 100644 --- a/extensions/common/transform_matrix.hpp +++ b/extensions/common/transform_matrix.hpp @@ -31,4 +31,4 @@ namespace ace { }; typedef transform_matrix_base transform_matrix; -}; \ No newline at end of file +} diff --git a/extensions/common/vector.hpp b/extensions/common/vector.hpp index 0eb348f312..3f786a964f 100644 --- a/extensions/common/vector.hpp +++ b/extensions/common/vector.hpp @@ -168,4 +168,4 @@ namespace ace { T _x; T _y; }; -}; +} diff --git a/extensions/fcs/ace_fcs.cpp b/extensions/fcs/ace_fcs.cpp index 178711f54c..5bc750235e 100644 --- a/extensions/fcs/ace_fcs.cpp +++ b/extensions/fcs/ace_fcs.cpp @@ -27,7 +27,7 @@ extern "C" { EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); -}; +} std::vector splitString(std::string input) { std::istringstream ss(input); diff --git a/extensions/medical/medical.cpp b/extensions/medical/medical.cpp index 78517b99d4..5f999caaa2 100644 --- a/extensions/medical/medical.cpp +++ b/extensions/medical/medical.cpp @@ -14,7 +14,7 @@ extern "C" { EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); -}; +} std::vector parseExtensionInput(const std::string& input) { diff --git a/extensions/parse_imagepath/ace_parse_imagepath.cpp b/extensions/parse_imagepath/ace_parse_imagepath.cpp index 051535e473..56d503cbaf 100644 --- a/extensions/parse_imagepath/ace_parse_imagepath.cpp +++ b/extensions/parse_imagepath/ace_parse_imagepath.cpp @@ -18,7 +18,7 @@ extern "C" { __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); -}; +} std::string getImagePathFromStructuredText(const std::string & input) { std::string returnValue = ""; diff --git a/extras/assets/icons/Icon_Module_png/Icon_Module_Nightvision_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Nightvision_ca.png new file mode 100644 index 0000000000..975a4126f3 Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icon_Module_Nightvision_ca.png differ diff --git a/extras/assets/icons/Icon_Module_png/Icons_Modules_Rearm.png b/extras/assets/icons/Icon_Module_png/Icons_Modules_Rearm.png new file mode 100644 index 0000000000..b564992d5f Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icons_Modules_Rearm.png differ diff --git a/extras/assets/icons/Icon_Module_png/Icons_Modules_Refuel.png b/extras/assets/icons/Icon_Module_png/Icons_Modules_Refuel.png new file mode 100644 index 0000000000..da50b92caf Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icons_Modules_Refuel.png differ diff --git a/optionals/compat_bwa3/CfgVehicles.hpp b/optionals/compat_bwa3/CfgVehicles.hpp new file mode 100644 index 0000000000..bdcebdab9d --- /dev/null +++ b/optionals/compat_bwa3/CfgVehicles.hpp @@ -0,0 +1,11 @@ +class CfgVehicles { + class Tank_F; + class BWA3_Puma_base: Tank_F { + // Assuming 1 L/km + EGVAR(refuel,fuelCapacity) = 700; + }; + + class BWA3_Leopard_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 1160; + }; +}; diff --git a/optionals/compat_rhs_afrf3/CfgAmmo.hpp b/optionals/compat_rhs_afrf3/CfgAmmo.hpp index 541437458e..41c0f333ce 100644 --- a/optionals/compat_rhs_afrf3/CfgAmmo.hpp +++ b/optionals/compat_rhs_afrf3/CfgAmmo.hpp @@ -122,4 +122,8 @@ class CfgAmmo ACE_muzzleVelocities[]={298, 330, 350}; ACE_barrelLengths[]={96.52, 127.0, 228.6}; }; -}; \ No newline at end of file + class SubmunitionBase; + class rhs_ammo_127x108mm_x5: SubmunitionBase { + ACE_rearm_caliber=13; + }; +}; diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index e9c71f4da7..963913d74d 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -28,6 +28,7 @@ class cfgVehicles { class CommanderOptics; }; class rhs_bmd_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 300; class Turrets: Turrets { class CommanderOptics: NewTurret { ace_fcs_Enabled = 0; @@ -41,6 +42,7 @@ class cfgVehicles { }; }; class rhs_bmp1tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 460; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -57,13 +59,14 @@ class cfgVehicles { class MainTurret: MainTurret { class Turrets: Turrets { class CommanderOptics : CommanderOptics { - ace_fcs_Enabled = 0; + ace_fcs_Enabled = 0; }; }; }; }; }; class rhs_bmp3tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 460; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -79,6 +82,7 @@ class cfgVehicles { }; }; class rhs_btr_base: Wheeled_APC_F { + EGVAR(refuel,fuelCapacity) = 300; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -89,6 +93,7 @@ class cfgVehicles { }; }; class rhs_a3spruttank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 400; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -105,6 +110,7 @@ class cfgVehicles { }; }; class rhs_a3t72tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 1200; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -133,6 +139,7 @@ class cfgVehicles { }; }; class rhs_tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 1200; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -153,4 +160,71 @@ class cfgVehicles { { ace_gforcecoef = 0.55; }; -}; \ No newline at end of file + + class O_Plane_CAS_02_F; + class RHS_su25_base : O_Plane_CAS_02_F { + EGVAR(refuel,fuelCapacity) = 3600; + }; + + class Heli_Light_02_base_F; + class RHS_Mi8_base : Heli_Light_02_base_F { + EGVAR(refuel,fuelCapacity) = 3700; + }; + + class Heli_Attack_02_base_F; + class RHS_Ka52_base : Heli_Attack_02_base_F { + EGVAR(refuel,fuelCapacity) = 1870; + }; + + class RHS_Mi24_base : Heli_Attack_02_base_F { + EGVAR(refuel,fuelCapacity) = 1851; + }; + + class rhs_t80b : rhs_tank_base { + EGVAR(refuel,fuelCapacity) = 1100; + }; + + class Truck_F; + class RHS_Ural_BaseTurret : Truck_F { + EGVAR(refuel,fuelCapacity) = 360; + }; + + class rhs_truck : Truck_F { + EGVAR(refuel,fuelCapacity) = 210; + }; + + class MRAP_02_base_F; + class rhs_tigr_base : MRAP_02_base_F { + EGVAR(refuel,fuelCapacity) = 138; + }; + + class Offroad_01_base_f; + class RHS_UAZ_Base : Offroad_01_base_f { + EGVAR(refuel,fuelCapacity) = 78; + }; + + class APC_Tracked_02_base_F; + class rhs_zsutank_base : APC_Tracked_02_base_F { + EGVAR(refuel,fuelCapacity) = 515; + }; + + class rhs_btr60_base : rhs_btr_base { + EGVAR(refuel,fuelCapacity) = 290; + }; + class rhs_btr70_vmf : rhs_btr_base { + EGVAR(refuel,fuelCapacity) = 350; + }; + + class rhs_btr70_msv : rhs_btr70_vmf {}; + class rhs_btr80_msv : rhs_btr70_msv { + EGVAR(refuel,fuelCapacity) = 300; + }; + + class rhs_2s3tank_base : Tank_F { + EGVAR(refuel,fuelCapacity) = 830; + }; + + class OTR21_Base : Truck_F { + EGVAR(refuel,fuelCapacity) = 500; + }; +}; diff --git a/optionals/compat_rhs_afrf3/config.cpp b/optionals/compat_rhs_afrf3/config.cpp index 123f80b566..aa9d6bed95 100644 --- a/optionals/compat_rhs_afrf3/config.cpp +++ b/optionals/compat_rhs_afrf3/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops"}; - author[]={"Ruthberg"}; + author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; }; }; @@ -14,4 +14,4 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" #include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" diff --git a/optionals/compat_rhs_usf3/CfgVehicles.hpp b/optionals/compat_rhs_usf3/CfgVehicles.hpp index 2be7a8076e..3c56b91aa9 100644 --- a/optionals/compat_rhs_usf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_usf3/CfgVehicles.hpp @@ -15,6 +15,7 @@ class cfgVehicles { class MBT_01_base_F: Tank_F {}; class rhsusf_m1a1tank_base: MBT_01_base_F { + EGVAR(refuel,fuelCapacity) = 1909; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -29,4 +30,67 @@ class cfgVehicles { }; }; }; -}; \ No newline at end of file + + class Heli_light_03_base_F; + class RHS_UH1_Base : Heli_light_03_base_F { + EGVAR(refuel,fuelCapacity) = 1447; + }; + + class Heli_Transport_01_base_F; + class RHS_UH60_Base : Heli_Transport_01_base_F { + EGVAR(refuel,fuelCapacity) = 1360; + }; + + class Heli_Transport_02_base_F; + class RHS_CH_47F_base : Heli_Transport_02_base_F { + EGVAR(refuel,fuelCapacity) = 3914; + }; + + class Heli_Attack_01_base_F; + class RHS_AH1Z_base : Heli_Attack_01_base_F { + EGVAR(refuel,fuelCapacity) = 1600; + }; + + class RHS_AH64_base : Heli_Attack_01_base_F { + EGVAR(refuel,fuelCapacity) = 1420; + }; + + class MBT_01_arty_base_F; + class rhsusf_m109tank_base : MBT_01_arty_base_F { + EGVAR(refuel,fuelCapacity) = 511; + }; + + class MRAP_01_base_F; + class rhsusf_hmmwe_base : MRAP_01_base_F { + EGVAR(refuel,fuelCapacity) = 95; + }; + + class rhsusf_rg33_base : MRAP_01_base_F { + EGVAR(refuel,fuelCapacity) = 302; + }; + + class Truck_01_base_F; + class rhsusf_fmtv_base : Truck_01_base_F { + EGVAR(refuel,fuelCapacity) = 219; + }; + + class APC_Tracked_02_base_F; + class rhsusf_m113_tank_base : APC_Tracked_02_base_F { + EGVAR(refuel,fuelCapacity) = 360; + }; + + class APC_Tracked_03_base_F; + class RHS_M2A2_Base : APC_Tracked_03_base_F { + EGVAR(refuel,fuelCapacity) = 746; + }; + + class Plane_CAS_01_base_F; + class RHS_A10 : Plane_CAS_01_base_F { + EGVAR(refuel,fuelCapacity) = 6223; + }; + + class Plane_Base_F; + class RHS_C130J_Base : Plane_Base_F { + EGVAR(refuel,fuelCapacity) = 25704; + }; +}; diff --git a/optionals/compat_rhs_usf3/config.cpp b/optionals/compat_rhs_usf3/config.cpp index 3e9aee6ec7..59517ed64f 100644 --- a/optionals/compat_rhs_usf3/config.cpp +++ b/optionals/compat_rhs_usf3/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_troops"}; - author[]={"Ruthberg"}; + author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; }; }; @@ -14,4 +14,4 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" #include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" diff --git a/tools/make.py b/tools/make.py index adaecf269e..82c7a881d6 100644 --- a/tools/make.py +++ b/tools/make.py @@ -489,7 +489,7 @@ def check_for_obsolete_pbos(addonspath, file): def backup_config(module): - #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: + #backup original $PBOPREFIX$ global work_drive global prefix @@ -503,52 +503,11 @@ def backup_config(module): except: print_error("Error creating backup of $PBOPREFIX$ for module {}.".format(module)) - try: - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) - os.chdir(work_drive) - except: - print_error("Error creating backup of config.cpp for module {}.".format(module)) - return True -def convert_config(module): - try: - global work_drive - global prefix - global arma3tools_path - - cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] - ret = subprocess.call(cmd) - if ret != 0: - print_error("CfgConvert -bin return code == {}. Usually means there is a syntax error within the config.cpp file.".format(str(ret))) - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - - cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] - ret = subprocess.call(cmd) - if ret != 0: - print_error("CfgConvert -txt return code == {}. Usually means there is a syntax error within the config.cpp file.".format(str(ret))) - os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) - shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) - except Exception as e: - print_error("Exception from convert_config=>CfgConvert: {}".format(e)) - return False - - return True - - def addon_restore(modulePath): - #PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp - #print_green("\Pabst! (restoring): {}".format(os.path.join(modulePath, "config.cpp"))) + #restore original $PBOPREFIX$ try: - if os.path.isfile(os.path.join(modulePath, "config.cpp")): - os.remove(os.path.join(modulePath, "config.cpp")) - if os.path.isfile(os.path.join(modulePath, "config.backup")): - os.rename(os.path.join(modulePath, "config.backup"), os.path.join(modulePath, "config.cpp")) - if os.path.isfile(os.path.join(modulePath, "config.bin")): - os.remove(os.path.join(modulePath, "config.bin")) - if os.path.isfile(os.path.join(modulePath, "texHeaders.bin")): - os.remove(os.path.join(modulePath, "texHeaders.bin")) if os.path.isfile(os.path.join(modulePath, "$PBOPREFIX$.backup")): if os.path.isfile(os.path.join(modulePath, "$PBOPREFIX$")): os.remove(os.path.join(modulePath, "$PBOPREFIX$")) @@ -1124,6 +1083,9 @@ See the make.cfg file for additional build options. print_error("\nFailed to delete {}".format(os.path.join(obsolete_check_path,file))) pass + amountOfBuildsFailed = 0 + namesOfBuildsFailed = [] + # For each module, prep files and then build. print_blue("\nBuilding...") for module in modules: @@ -1216,9 +1178,6 @@ See the make.cfg file for additional build options. nobinFilePath = os.path.join(work_drive, prefix, module, "$NOBIN$") backup_config(module) - if (not os.path.isfile(nobinFilePath)): - convert_config(module) - version_stamp_pboprefix(module,commit_id) if os.path.isfile(nobinFilePath): @@ -1266,6 +1225,8 @@ See the make.cfg file for additional build options. print_error("pboProject return code == {}".format(str(ret))) print_error("Module not successfully built/signed. Check your {}temp\{}_packing.log for more info.".format(work_drive,module)) print ("Resuming build...") + amountOfBuildsFailed += 1 + namesOfBuildsFailed.append("{}".format(module)) continue # Back to the root @@ -1432,8 +1393,14 @@ See the make.cfg file for additional build options. except: print_error("Could not copy files. Is Arma 3 running?") - print_green("\nDone.") + if amountOfBuildsFailed > 0: + print_error("Build failed. {} pbos failed.".format(amountOfBuildsFailed)) + for failedModuleName in namesOfBuildsFailed: + print("- {} failed.".format(failedModuleName)) + + else: + print_green("\Completed with 0 errors.") if __name__ == "__main__": start_time = timeit.default_timer()