Merged main

This commit is contained in:
johnb432 2024-02-05 22:38:39 +01:00
commit 0ec391a3a5
235 changed files with 900 additions and 558 deletions

View File

@ -191,3 +191,4 @@ YetheSamartaka
xrufix
Zakant <Zakant@gmx.de>
zGuba
Zman6258

View File

@ -53,7 +53,7 @@ INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldNa
private _gridCenter = [_x + 25, _y + 25];
private _gridHeight = round(getTerrainHeightASL _gridCenter);
private _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]);
private _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0};
private _gridSurfaceIsWater = parseNumber (surfaceIsWater _gridCenter);
"ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater];
GVAR(currentGrid) = GVAR(currentGrid) + 1;
if (GVAR(currentGrid) >= _gridCells) exitWith {};

View File

@ -21,7 +21,7 @@
private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist");
private _twistDirection = [0, 1] select (_barrelTwist != 0);
private _twistDirection = parseNumber (_barrelTwist != 0);
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then {

View File

@ -29,7 +29,10 @@ private _currentLoiterRadius = waypointLoiterRadius _waypoint;
private _currentLoiterType = waypointLoiterType _waypoint;
// Set pos to ATL
_pos set [2, if (_currentHeight >= 50) then { _currentHeight } else { 0 }];
_pos set [
2,
[0, _currentHeight] select (_currentHeight >= 50)
];
// [_group] call CBA_fnc_clearWaypoints;
_waypoint = _group addWaypoint [_pos, 0];

View File

@ -22,7 +22,8 @@ GVAR(lastSortDirectionRight) = DESCENDING;
params ["_object"];
// If the arsenal is already open, refresh arsenal display
if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object}) then {
// Deliberate == check, fail on objNull
if (!isNil QGVAR(currentBox) && {GVAR(currentBox) == _object}) then {
[true, true] call FUNC(refresh);
};
}] call CBA_fnc_addEventHandler;

View File

@ -109,11 +109,10 @@ private _tabToChange = [];
{
_x params ["_tab", "_tabSide"];
_tabToChange = if (_tabSide == "R") then {
_tabToChange = [
GVAR(statsListLeftPanel),
GVAR(statsListRightPanel)
} else {
GVAR(statsListLeftPanel)
};
] select (_tabSide == "R");
_stats = _tabToChange select _tab;

View File

@ -196,7 +196,7 @@ private _selectedItem = switch (true) do {
_lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _x];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]];
_ctrlPanel lbSetPictureRight [_lbAdd, _modPicture];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
} forEach (uiNamespace getVariable QGVAR(faceCache));
GVAR(currentFace)

View File

@ -87,7 +87,7 @@ private _fnc_fillRightContainer = {
_ctrlPanel lnbSetText [[_lbAdd, 1], _displayName];
_ctrlPanel lnbSetData [[_lbAdd, 0], _className];
_ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture];
_ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select _isUnique];
_ctrlPanel lnbSetValue [[_lbAdd, 2], parseNumber _isUnique];
_ctrlPanel lnbSetTooltip [[_lbAdd, 0], format ["%1\n%2", _displayName, _className]];
if ((toLower _className) in GVAR(favorites)) then {
_ctrlPanel lnbSetColor [[_lbAdd, 1], FAVORITES_COLOR];

View File

@ -147,7 +147,7 @@ if (!isNull _loadoutsDisplay) then {
// Right panel lnb + and - buttons
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
if (GVAR(rightTabLnBFocus)) then {
[_display, [1, 0] select (_keyPressed == DIK_LEFT)] call FUNC(buttonCargo);
[_display, parseNumber (_keyPressed != DIK_LEFT)] call FUNC(buttonCargo);
};
};
};

View File

@ -25,6 +25,11 @@ if (canSuspend) exitWith {
[{_this call FUNC(refresh)}, _this] call CBA_fnc_directCall;
};
private _display = findDisplay IDD_ace_arsenal;
// Exit quietly if no display found
if (isNull _display) exitWith {};
if (_updateItems) then {
// Update current item list
call FUNC(updateCurrentItemsList);
@ -65,6 +70,4 @@ if (!_animate) then {
[{GVAR(refreshing) = false}, nil, 3] call CBA_fnc_execAfterNFrames;
};
private _display = findDisplay IDD_ace_arsenal;
[_display, _display displayCtrl GVAR(currentLeftPanel), _animate] call FUNC(fillLeftPanel);

View File

@ -42,8 +42,14 @@ if (_global && {isMultiplayer} && {!isNil "_id"}) then {
};
// If the arsenal is already open and not ignoring content (see FUNC(openBox)), close arsenal display
if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object} && {isNil QGVAR(ignoredVirtualItems)}) then {
// Deliberate == check, fail on objNull
if (!isNil QGVAR(currentBox) && {GVAR(currentBox) == _object} && {isNil QGVAR(ignoredVirtualItems)}) then {
// Delay a frame in case this is running on display open/close
[{
private _display = findDisplay IDD_ace_arsenal;
if (isNull _display) exitWith {};
[LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText);
// Delay a frame in case this is running on display open
[{(findDisplay IDD_ace_arsenal) closeDisplay 0}] call CBA_fnc_execNextFrame;
_display closeDisplay 0;
}] call CBA_fnc_execNextFrame;
};

View File

@ -31,9 +31,9 @@ if (_allItems isEqualTo []) then { _allItems = [configName _config] };
|| {_illum && {([_xCfg >> "Flashlight" >> "irLight", "NUMBER", 0] call CBA_fnc_getConfigEntry) == 1}};
private _text = switch (true) do { // shorthand roughly based on PEQ-15
case (_laser && _illum): { if (_isIR) then { "IR-DUAL" } else { "VIS-DUAL" } };
case (_laser): { if (_isIR) then { "IR-AIM" } else { "VIS-AIM" } }; // AIM
case (_illum): { if (_isIR) then { "IR-ILM" } else { "VIS-ILM" } }; // ILLUMIATION
case (_laser && _illum): { ["VIS-DUAL", "IR-DUAL"] select _isIR }; // DUAL
case (_laser): { ["VIS-AIM", "IR-AIM"] select _isIR }; // AIM
case (_illum): { ["VIS-ILM", "IR-ILM"] select _isIR }; // ILLUMIATION
default { "_" }; // there are some purely cosmetic attachements
};
_allModes pushBackUnique _text;

View File

@ -46,11 +46,7 @@ private _fnc_toConfigCase = {
// If item doesn't exist in config, "" is returned
// Just return unaltered item name in that case, so it can be documented as being unavailable
if (_name != "") then {
_name
} else {
_x
};
[_x, _name] select (_name != "");
} else {
_x
};

View File

@ -65,7 +65,7 @@ GVAR(magModeData) = [];
{
_x params ["_xDisplayNameShort", "_xDisplayName", "_xInitSpeed", "_xAirFriction"];
if (_allSameCharge) then {
_ctrlChargeList lbAdd format ["%1", _xDisplayNameShort];
_ctrlChargeList lbAdd _xDisplayNameShort;
_ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1\n%2 m/s\n%3", _xDisplayName, _xInitSpeed toFixed 1, _xAirFriction]];
GVAR(magModeData) pushBack [_xInitSpeed, _xAirFriction];
} else {

View File

@ -90,7 +90,7 @@ if (GVAR(showWind2)) then {
_elevationAbs = Round(_elevationAbs * 100) / 100;
if (_elevationAbs > 0) then {
ctrlSetText [400, format["%1", abs(_elevationAbs)]];
ctrlSetText [400, str abs _elevationAbs];
} else {
if (_elevationAbs < 0) then {
ctrlSetText [400, format["%1D", abs(_elevationAbs)]];
@ -100,7 +100,7 @@ if (_elevationAbs > 0) then {
};
_elevationRel = Round(_elevationRel * 100) / 100;
if (_elevationRel > 0) then {
ctrlSetText [401, format["%1", abs(_elevationRel)]];
ctrlSetText [401, str abs _elevationRel];
} else {
if (_elevationRel < 0) then {
ctrlSetText [401, format["%1D", abs(_elevationRel)]];
@ -110,7 +110,7 @@ if (_elevationRel > 0) then {
};
_elevationCur = Round(_elevationCur * 100) / 100;
if (_elevationCur > 0) then {
ctrlSetText [402, format["%1", abs(_elevationCur)]];
ctrlSetText [402, str abs _elevationCur];
} else {
if (_elevationCur < 0) then {
ctrlSetText [402, format["%1D", abs(_elevationCur)]];

View File

@ -96,7 +96,7 @@
_object setVariable ["acre_sys_core_isDisabled", _set > 0, true];
};
if (["task_force_radio"] call FUNC(isModLoaded)) then {
_object setVariable ["tf_voiceVolume", [1, 0] select (_set > 0), true];
_object setVariable ["tf_voiceVolume", parseNumber (_set == 0), true];
};
}] call CBA_fnc_addEventHandler;

View File

@ -219,7 +219,7 @@ if (_state) then {
_keyPressedInfo set [1, ((_keyPressedInfo select 1) - 1) max 0];
if (_keyPressedInfo isEqualTo [false, 0]) then {
GVAR(keyboardInputMain) deleteAt _key,
GVAR(keyboardInputMain) deleteAt _key;
};
}, _key, 0.5] call CBA_fnc_waitAndExecute;
}];

View File

@ -5,10 +5,10 @@
*
* Arguments:
* 0: The Unit (usually the player) <OBJECT>
* 1: Force a return type <NUMBER, BOOLEAN>
* 1: Return imperial units <NUMBER, BOOLEAN>
*
* Return Value:
* The return value <NUMBER>
* Weight string <STRING>
*
* Example:
* [player] call ace_common_fnc_getWeight

View File

@ -31,7 +31,7 @@ if (isLocalized _requestMessage) then {
_requestMessage = format [_requestMessage, [_caller, false, true] call FUNC(getName)];
};
hint format ["%1", _requestMessage]; // @todo ?
hint str _requestMessage; // @todo ?
if (!isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT);

View File

@ -18,7 +18,7 @@
params ["_name"];
if !(_name in GVAR(syncedEvents)) exitWith {
ERROR_1("Synced event key [%1] not found (removeSyncedEventHandler).", _name);
ERROR_1("Synced event key [%1] not found (removeSyncedEventHandler)",_name);
false
};

View File

@ -20,7 +20,7 @@
params ["_name", "_args", ["_ttl", 0]];
if !(_name in GVAR(syncedEvents)) exitWith {
ERROR_1("Synced event key [%1] not found (syncedEvent).", _name);
ERROR_1("Synced event key [%1] not found (syncedEvent)",_name);
false
};

View File

@ -0,0 +1 @@
z\ace\addons\compat_cup_terrains

View File

@ -0,0 +1,5 @@
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};

View File

@ -0,0 +1,48 @@
class CfgVehicles {
class House;
class House_Small_F;
class Strategic;
class House_EP1: House {};
class Land_Benzina_schnell: House {
transportFuel = 0;
EGVAR(refuel,hooks)[] = {{-1.5,-3.93,-1.25}, {2.35,-3.93,-1.25}};
EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
position = "[0,-3.93,-1.25]";
distance = 5;
condition = "true";
};
};
};
class Land_A_FuelStation_Feed: Strategic {
transportFuel = 0;
EGVAR(refuel,hooks)[] = {{-0.34,0,0}, {0.34,0,0}};
EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL;
};
class Land_Ind_FuelStation_Feed_EP1: House_EP1 {
transportFuel = 0;
EGVAR(refuel,hooks)[] = {{-0.34,0,0}, {0.34,0,0}};
EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL;
};
class Land_FuelStation_Feed_PMC: Strategic {
transportFuel = 0;
EGVAR(refuel,hooks)[] = {{-0.34,0,0}, {0.34,0,0}};
EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL;
};
class FuelStation: House_Small_F {
transportFuel = 0;
EGVAR(refuel,hooks)[] = {{1.25, .2, -1.1}};
EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
position = "[1.25, .2, -1]";
distance = 5;
condition = "true";
};
};
};
};

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
if (["CUP_Terrains_ACE_compat"] call EFUNC(common,isModLoaded)) exitWith {
ERROR_WITH_TITLE("Duplicate CUP/ACE Compats","Compats are now part of ACE - Uninstall 'CUP ACE3 Compatibility Addon - Terrains'");
};

View File

@ -0,0 +1,27 @@
#include "script_component.hpp"
#include "\z\ace\addons\refuel\defines.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"CABuildings",
"CAStructuresHouse_A_FuelStation",
"CAStructures_E_Ind_Ind_FuelStation",
"CAStructures_PMC_FuelStation",
"CUP_Buildings_Config",
"ace_refuel" // not a sub-component because it's all this compat does
};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {"Community Upgrade Project", "Mike"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
#include "CfgVehicles.hpp"
#include "CfgEventHandlers.hpp"

View File

@ -0,0 +1,5 @@
#define COMPONENT compat_cup_terrains
#define COMPONENT_BEAUTIFIED CUP Terrains Compatibility
#include "\z\ace\addons\main\script_mod.hpp"
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -1,7 +1,14 @@
class CfgWeapons {
// Last update: RHSAFRF 0.5.6
class rhs_acc_perst3;
class rhs_acc_perst3_2dp: rhs_acc_perst3 {
baseWeapon = "rhs_acc_perst3_2dp";
class rhs_acc_perst3_2dp_light;
class rhs_acc_perst3_2dp_light_h: rhs_acc_perst3_2dp_light {
baseWeapon = "rhs_acc_perst3_2dp_h";
};
class acc_pointer_IR;
class rhs_acc_perst1ik: acc_pointer_IR {
MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat
MRT_SwitchItemNextClass = "";
MRT_SwitchItemPrevClass = "";
};
};

View File

@ -15,4 +15,4 @@ class CfgPatches {
};
};
//#include "CfgWeapons.hpp"
#include "CfgWeapons.hpp"

View File

@ -3,6 +3,9 @@ class CfgWeapons {
class acc_pointer_IR;
class rhsusf_acc_anpeq15: acc_pointer_IR {
baseWeapon = "rhsusf_acc_anpeq15";
MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat
MRT_SwitchItemNextClass = "";
MRT_SwitchItemPrevClass = "";
};
class rhsusf_acc_anpeq15_bk: rhsusf_acc_anpeq15 {
baseWeapon = "rhsusf_acc_anpeq15_bk";
@ -28,8 +31,12 @@ class CfgWeapons {
class rhsusf_acc_wmx_bk: rhsusf_acc_M952V {
baseWeapon = "rhsusf_acc_wmx_bk";
};
class rhsusf_acc_anpeq15A: acc_pointer_IR {
baseWeapon = "rhsusf_acc_anpeq15A";
MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat
MRT_SwitchItemNextClass = "";
MRT_SwitchItemPrevClass = "";
};
class rhsusf_acc_anpeq15_top: rhsusf_acc_anpeq15A {
baseWeapon = "rhsusf_acc_anpeq15_top";
@ -37,8 +44,12 @@ class CfgWeapons {
class rhsusf_acc_anpeq15_bk_top: rhsusf_acc_anpeq15_top {
baseWeapon = "rhsusf_acc_anpeq15_bk_top";
};
class rhsusf_acc_anpeq15side: acc_pointer_IR {
baseWeapon = "rhsusf_acc_anpeq15side";
MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat
MRT_SwitchItemNextClass = "";
MRT_SwitchItemPrevClass = "";
};
class rhsusf_acc_anpeq15side_bk: rhsusf_acc_anpeq15side {
baseWeapon = "rhsusf_acc_anpeq15side_bk";

View File

@ -541,7 +541,7 @@ GVAR(menuRun) = true;
};
case "options": {
(__dsp displayCtrl __Option0) ctrlSetText "Signal Delay";
(__dsp displayCtrl __Option1) ctrlSetText (if (GVAR(useDegrees)) then { "Direction: Deg" } else { "Direction: MIL" });
(__dsp displayCtrl __Option1) ctrlSetText (["Direction: MIL", "Direction: Deg"] select GVAR(useDegrees));
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa);
if (GVAR(SEL)) then {
GVAR(vectorConnected) = false;

View File

@ -65,10 +65,10 @@ GVAR(outputPFH) = [{
private _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
// Output
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _dagrSpeed];
__elevationControl ctrlSetText format ["%1", _dagrElevation];
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 <20>", _dagrHeading] });
__timeControl ctrlSetText format ["%1", _dagrTime];
__gridControl ctrlSetText _dagrGrid;
__speedControl ctrlSetText _dagrSpeed;
__elevationControl ctrlSetText _dagrElevation;
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _dagrHeading } else { format ["%1 <20>", _dagrHeading] });
__timeControl ctrlSetText _dagrTime;
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -89,8 +89,8 @@ private _dagrDist = str GVAR(LAZDIST) + "m";
GVAR(vectorGrid) = _dagrGrid;
// OUTPUT
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _dagrDist];
__elevationControl ctrlSetText format ["%1", _dagrElevation];
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
__timeControl ctrlSetText format ["%1", _dagrTime];
__gridControl ctrlSetText _dagrGrid;
__speedControl ctrlSetText _dagrDist;
__elevationControl ctrlSetText _dagrElevation;
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _bearing } else { format ["%1°", _bearing] });
__timeControl ctrlSetText _dagrTime;

View File

@ -85,10 +85,10 @@ GVAR(outputPFH) = [{
});
// Output
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _bearing];
__elevationControl ctrlSetText format ["%1", _dagrGrid2];
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
__timeControl ctrlSetText format ["%1", _dagrDistance];
__gridControl ctrlSetText _dagrGrid;
__speedControl ctrlSetText str _bearing;
__elevationControl ctrlSetText _dagrGrid2;
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _dagrHeading } else { format ["%1°", _dagrHeading] });
__timeControl ctrlSetText _dagrDistance;
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -55,7 +55,7 @@ params ["_listBoxCtrl", "_itemsCountArray"];
};
};
_listBoxCtrl lbAdd format ["%1", _displayName];
_listBoxCtrl lbAdd _displayName;
_listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname];
_listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture];
_listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count];

View File

@ -29,7 +29,7 @@ private _direction = getDir _object;
// Marker name unique to this object
private _markerNameStr = format [QGVAR(marker_%1), hashValue _object];
private _channel = if (GVAR(markObjectsOnMap) == 2) then { 0 } else { 1 };
private _channel = parseNumber (GVAR(markObjectsOnMap) != 2);
private _marker = createMarkerLocal [_markerNameStr, _object, _channel, _unit];
TRACE_2("created",_marker,_channel);

View File

@ -48,7 +48,7 @@ _caliber = call {
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 };
[_caliber, 6.5] select (_caliber <= 0);
};
private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;

View File

@ -27,7 +27,9 @@ params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"];
if (_weapon in ["Throw", "Put"]) exitWith {};
if (_distance > 50) exitWith {};
private _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)};
private _vehAttenuation = [GVAR(playerVehAttenuation), 1] select (
(ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}
);
private _distance = 1 max _distance;
private _silencer = switch (_weapon) do {
@ -78,7 +80,7 @@ if (isNil "_loudness") then {
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 };
[_caliber, 6.5] select (_caliber <= 0)
};
_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;

View File

@ -31,11 +31,10 @@ private _configLaunchHeightClear = getNumber (_attackConfig >> QGVAR(launchHeigh
private _startingStage = if (_configLaunchHeightClear > 0) then {
STAGE_LAUNCH; // LOAL-HI / LO
} else {
if (_seekerTargetPos isEqualTo [0,0,0]) then {
STAGE_SEEK_CRUISE; // LOAL-DIR
} else {
STAGE_ATTACK_CRUISE // LOBL
};
[
STAGE_ATTACK_CRUISE,
STAGE_SEEK_CRUISE
] select (_seekerTargetPos isEqualTo [0,0,0]);
};
// Set data in param array

View File

@ -145,7 +145,7 @@ GVAR(no_cams) sort true;
GVAR(cam) camCommit 0;
ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]];
ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]];
ctrlSetText [2, str (GVAR(cur_cam) + 1)];
private _cam_time = CBA_missionTime - (GVAR(huntIR) getVariable [QGVAR(startTime), CBA_missionTime]);
ctrlSetText [3, format["%1 s", round(_cam_time)]];
private _cam_pos = getPosVisual GVAR(huntIR);

View File

@ -49,7 +49,7 @@ _position = if (_position isEqualType "") then {
} else {
if (_position isEqualType []) then {
// If the action is set to a array position, create the suitable code
compile format ["%1", _position];
compile str _position;
} else {
_position;
};

View File

@ -30,6 +30,6 @@ _vehicles apply {
_name = format ["%1 (%2m)", _name, _distanceStr];
};
private _icon = [_x] call EFUNC(common,getVehicleIcon);
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
private _action = [str _x, _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
[_action, [], _target]
}

View File

@ -95,7 +95,7 @@ if (_useListMenu) then {
_scaleX = _textSize * 0.17 * 1.1;
_scaleY = 0.17 * 0.30 * 4/3;
} else {
private _textSize = if (GVAR(textSize) > 2) then {1.3} else {1};
private _textSIze = [1, 1.3] select (GVAR(textSize) > 2);
_scaleX = _textSize * 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5);
_scaleY = _textSize * 0.17 * 4/3 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5);
};

View File

@ -136,7 +136,7 @@ GVAR(isOpeningDoor) = false;
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);
private _shoulderNum = parseNumber (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180);
// Statement
[ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder);

View File

@ -43,7 +43,7 @@ private _icon = "";
_actions pushBack [
[
format ["%1", _unit],
str _unit,
[_unit, true] call EFUNC(common,getName),
[_icon, "#FFFFFF"],
{

View File

@ -71,7 +71,7 @@ GVAR(usedScrollWheel) = false;
// didn't use incremental opening. Just do animation normally.
if !(GVAR(usedScrollWheel)) then {
private _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
private _phase = parseNumber (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]; false} count _animations;
};

View File

@ -93,7 +93,7 @@ if (GVAR(referenceHeadingMenu) == 0) then {
};
case 1: { // Direction
if (!GVAR(MinAvgMax)) then {
_textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]];
_textCenterBig = format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)];
} else {
_textCenterLine1Left = "Min";
_textCenterLine2Left = "Avg";

View File

@ -22,7 +22,10 @@ TRACE_2("Fence cutting started",_unit,_fence);
if (_unit != ACE_player) exitWith {};
// Get cut time based on if unit is a engineer
private _cutTime = if (_unit call EFUNC(common,isEngineer)) then {CUT_TIME_ENGINEER} else {CUT_TIME_DEFAULT};
private _cutTime = [
CUT_TIME_DEFAULT,
CUT_TIME_ENGINEER
] select (_unit call EFUNC(common,isEngineer));
if !(_unit call EFUNC(common,isSwimming)) then {
[_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);

View File

@ -28,7 +28,7 @@ GVAR(dev_watchVariableRunning) = true;
_return pushBack format ["<t color='#%1'>State: %2</t>", _color, _targetState];
private _hasStableVitals = ["N", "Y"] select ([_unit] call EFUNC(medical_status,hasStableVitals));
private _hasStableCondition = ["N", "Y"] select ([_unit] call EFUNC(medical_status,isInStableCondition));
private _unconcFlag = if IS_UNCONSCIOUS(_unit) then {"[<t color='#BBFFBB'>U</t>]"} else {""};
private _unconcFlag = ["", "[<t color='#BBFFBB'>U</t>]"] select IS_UNCONSCIOUS(_unit);
private _timeLeft = _unit getVariable [QEGVAR(medical_statemachine,cardiacArrestTimeLeft), -1];
private _cardiactArrestFlag = if IN_CRDC_ARRST(_unit) then {format ["[<t color='#BBBBFF'>CA</t> %1]", _timeLeft toFixed 1]} else {""};
_return pushBack format ["[StableVitals: %1] [StableCon: %2] %3 %4", _hasStableVitals, _hasStableCondition, _unconcFlag, _cardiactArrestFlag];
@ -38,7 +38,7 @@ GVAR(dev_watchVariableRunning) = true;
private _woundBleeding = GET_WOUND_BLEEDING(_unit);
private _bloodLoss = GET_BLOOD_LOSS(_unit);
private _hemorrhage = GET_HEMORRHAGE(_unit);
private _isBleeding = if (IS_BLEEDING(_unit)) then {"<t color ='#FF9999'>Bleeding</t>"} else {""};
private _isBleeding = ["", "[<t color ='#FF9999'>Bleeding</t>]"] select IS_BLEEDING(_unit);
private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[<t color ='#FF9999'>Time Left:</t> %1 sec]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 0]} else {""};
_return pushBack format ["Blood: %1 [Hemorrhage: %2] %3", _bloodVolume toFixed 3, _hemorrhage, _isBleeding];
_return pushBack format [" - [W: %1 T: %2] %3", _woundBleeding toFixed 4, _bloodLoss toFixed 4, _secondsToHeartstop];
@ -60,7 +60,7 @@ GVAR(dev_watchVariableRunning) = true;
// Damage:
private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _limping = if (_unit getVariable [QEGVAR(medical,isLimping), false]) then {"[<t color ='#FFCC22'> Limping </t>]"} else {""};
private _limping = ["", "[<t color ='#FFCC22'> Limping </t>]"] select (_unit getVariable [QEGVAR(medical,isLimping), false]);
_return pushBack format ["BodyPartDamage: [H: %1] [B: %2]", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2];
_return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2];
@ -68,8 +68,8 @@ GVAR(dev_watchVariableRunning) = true;
_return pushBack format ["[HHnd:%1] [HLeg: %2] %3", (_unit getHitPointDamage "HitHands") toFixed 2, (_unit getHitPointDamage "HitLegs") toFixed 2, _limping];
private _fractures = GET_FRACTURES(_unit);
private _canSprint = if (isSprintAllowed _unit) then {""} else {"[<t color ='#FFCC22'>Sprint Blocked</t>]"};
private _forceWalk = if (isForcedWalk _unit) then {"[<t color ='#FF9922'>Forced Walking</t>]"} else {""};
private _canSprint = ["[<t color ='#FFCC22'>Sprint Blocked</t>]", ""] select (isSprintAllowed _unit);
private _forceWalk = ["", "[<t color ='#FF9922'>Forced Walking</t>]"] select (isForcedWalk _unit);
_return pushBack format ["Fractures: %1 %2%3", _fractures, _canSprint, _forceWalk];

View File

@ -13,7 +13,7 @@ private _itemHash = createHashMap;
private _items = getArray (configFile >> "ace_medical_treatment_actions" >> _x >> "items");
if (_items isEqualTo []) then { ERROR_1("bad action %1",_x); };
private _itemClassname = configName (configFile >> "CfgWeapons" >> _items # 0);
private _treatment = if ((count _treatments) > 1) then { _x } else { "" };
private _treatment = ["", _x] select ((count _treatments) > 1);
_typeHash set [_itemClassname, _treatment];
} forEach _treatments;
_itemHash set [_itemType, _typeHash];

View File

@ -31,5 +31,4 @@ if (_typeOfDamage in GVAR(damageTypeDetails)) then {
TRACE_1("Return invalid, terminating wound handling",_damageData);
};
} forEach _woundHandlers;
};

View File

@ -38,7 +38,7 @@ if (ACE_player != GVAR(target)) then {
// Vehicle
private _medicVehicle = objectParent ACE_player;
private _patientVehicle = objectParent GVAR(target);
private _vehicle = if (!isNull _medicVehicle) then {_medicVehicle} else {_patientVehicle};
private _vehicle = [_patientVehicle, _medicVehicle] select (!isNull _medicVehicle);
if (!isNull _vehicle) then {
_vehicleCount = 0;

View File

@ -19,15 +19,14 @@
if (!isNull findDisplay 312) exitWith {};
// Find new target to switch to
private _target = if (
private _target = [
ACE_player,
GVAR(previousTarget)
] select (
GVAR(target) == ACE_player
&& {[ACE_player, GVAR(previousTarget)] call EFUNC(common,canInteractWith)}
&& {[ACE_player, GVAR(previousTarget)] call FUNC(canOpenMenu)}
) then {
GVAR(previousTarget);
} else {
ACE_player;
};
);
// Exit if new target is same as old
if (GVAR(target) == _target) exitWith {};

Binary file not shown.

View File

@ -605,10 +605,13 @@ class ADDON {
incompatibleMedication[] = {};
};
class PainKillers {
painReduce = 0.1;
timeInSystem = 600;
painReduce = 0.35;
hrIncreaseLow[] = {-5, -10};
hrIncreaseNormal[] = {-5, -15};
hrIncreaseHigh[] = {-5, -17};
timeInSystem = 420;
timeTillMaxEffect = 60;
maxDose = 10;
maxDose = 6;
incompatibleMedication[] = {};
viscosityChange = 5;
};

View File

@ -141,6 +141,19 @@ class GVAR(actions) {
litter[] = {{"ACE_MedicalLitter_epinephrine"}};
};
// - Generic Medication ---------------------------------------------------
class Painkillers: Morphine {
displayName = CSTRING(Administer_Painkillers);
displayNameProgress = CSTRING(Administering_Painkillers);
icon = QPATHTOEF(medical_gui,ui\painkillers.paa);
allowedSelections[] = {"Head"};
medicRequired = 0;
items[] = {"ACE_painkillers"};
treatmentTime = 4;
sounds[] = {{QPATHTO_R(sounds\Pills.ogg),1,1,50}};
litter[] = {{"Land_PainKillers_F"}}; // just use BI's model as litter
};
// - IV Bags --------------------------------------------------------------
class BloodIV: BasicBandage {
displayName = CSTRING(Actions_Blood4_1000);

View File

@ -284,6 +284,16 @@ class CfgVehicles {
MACRO_ADDITEM(ACE_bodyBag,1);
};
};
class ACE_painkillersItem: Item_Base_F {
scope = 2;
scopeCurator = 2;
displayName = CSTRING(painkillers_Display);
author = "Alganthe";
vehicleClass = "Items";
class TransportItems {
MACRO_ADDITEM(ACE_painkillers,1);
};
};
// Medical supply crates
class ThingX;
@ -305,6 +315,7 @@ class CfgVehicles {
author = ECSTRING(common,ACETeam);
class TransportItems {
MACRO_ADDITEM(ACE_fieldDressing,50);
MACRO_ADDITEM(ACE_painkillers,25);
MACRO_ADDITEM(ACE_morphine,25);
MACRO_ADDITEM(ACE_epinephrine,25);
MACRO_ADDITEM(ACE_bloodIV,15);
@ -352,6 +363,7 @@ class CfgVehicles {
MACRO_ADDITEM(ACE_elasticBandage,25);
MACRO_ADDITEM(ACE_tourniquet,15);
MACRO_ADDITEM(ACE_splint,15);
MACRO_ADDITEM(ACE_painkillers,15);
MACRO_ADDITEM(ACE_morphine,15);
MACRO_ADDITEM(ACE_adenosine,15);
MACRO_ADDITEM(ACE_epinephrine,15);

View File

@ -310,4 +310,17 @@ class CfgWeapons {
hiddenSelectionsTextures[] = {QPATHTOF(data\bodybagItem_white_co.paa)};
GVAR(bodyBagObject) = "ACE_bodyBagObject_white";
};
class ACE_painkillers: ACE_ItemCore {
scope = 2;
author = "Alganthe";
displayName = CSTRING(painkillers_Display);
model = "\A3\Structures_F_EPA\Items\Medical\PainKillers_F.p3d";
picture = QPATHTOF(ui\painkillers_ca.paa);
descriptionShort = CSTRING(painkillers_Desc_Short);
descriptionUse = CSTRING(painkillers_Desc_Use);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
};
};

View File

@ -11,8 +11,8 @@ ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {"ACE_fieldDressingItem","ACE_packingBandageItem","ACE_elasticBandageItem","ACE_tourniquetItem","ACE_splintItem","ACE_morphineItem","ACE_adenosineItem","ACE_epinephrineItem","ACE_plasmaIVItem","ACE_bloodIVItem","ACE_salineIVItem","ACE_quikClotItem","ACE_personalAidKitItem","ACE_surgicalKitItem","ACE_sutureItem","ACE_bodyBagItem","ACE_medicalSupplyCrate","ACE_medicalSupplyCrate_advanced"};
weapons[] = {"ACE_fieldDressing","ACE_packingBandage","ACE_elasticBandage","ACE_tourniquet","ACE_splint","ACE_morphine","ACE_adenosine","ACE_epinephrine","ACE_plasmaIV","ACE_plasmaIV_500","ACE_plasmaIV_250","ACE_bloodIV","ACE_bloodIV_500","ACE_bloodIV_250","ACE_salineIV","ACE_salineIV_500","ACE_salineIV_250","ACE_quikclot","ACE_personalAidKit","ACE_surgicalKit","ACE_suture","ACE_bodyBag","ACE_bodyBag_blue","ACE_bodyBag_white"};
units[] = {"ACE_fieldDressingItem","ACE_packingBandageItem","ACE_elasticBandageItem","ACE_tourniquetItem","ACE_splintItem","ACE_painkillersItem","ACE_morphineItem","ACE_adenosineItem","ACE_epinephrineItem","ACE_plasmaIVItem","ACE_bloodIVItem","ACE_salineIVItem","ACE_quikClotItem","ACE_personalAidKitItem","ACE_surgicalKitItem","ACE_sutureItem","ACE_bodyBagItem","ACE_medicalSupplyCrate","ACE_medicalSupplyCrate_advanced"};
weapons[] = {"ACE_fieldDressing","ACE_packingBandage","ACE_elasticBandage","ACE_tourniquet","ACE_splint","ACE_painkillers","ACE_morphine","ACE_adenosine","ACE_epinephrine","ACE_plasmaIV","ACE_plasmaIV_500","ACE_plasmaIV_250","ACE_bloodIV","ACE_bloodIV_500","ACE_bloodIV_250","ACE_salineIV","ACE_salineIV_500","ACE_salineIV_250","ACE_quikclot","ACE_personalAidKit","ACE_surgicalKit","ACE_suture","ACE_bodyBag","ACE_bodyBag_blue","ACE_bodyBag_white"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_medical_status", "ace_medical_damage", "ace_apl"};
author = ECSTRING(common,ACETeam);

View File

@ -39,7 +39,7 @@ private _logOutput = LSTRING(Check_Pulse_None);
if (_heartRate > 1) then {
if (_medic call FUNC(isMedic)) then {
_heartRateOutput = LSTRING(Check_Pulse_Output_1);
_logOutput = format ["%1", round _heartRate];
_logOutput = str round _heartRate;
} else {
_heartRateOutput = LSTRING(Check_Pulse_Output_2);
_logOutput = LSTRING(Check_Pulse_Weak);

Binary file not shown.

View File

@ -4933,5 +4933,33 @@
<Japanese>Zeus操作中は、すべての治療時間にこの係数を掛けます。</Japanese>
<Korean>제우스일 때 모든 치료 시간에 이 계수를 곱합니다.</Korean>
</Key>
<Key ID="STR_ACE_Medical_Treatment_painkillers_Display">
<English>Painkillers</English>
<Czech>Léky proti bolesti</Czech>
<German>Schmerztabellen</German>
<Russian>Болеутоляющее</Russian>
<Polish>Środki przeciwbólowe</Polish>
<Italian>Antidolorifici</Italian>
<Spanish>Analgésicos</Spanish>
<French>Analgésiques</French>
<Chinese>止痛藥</Chinese>
<Japanese>鎮痛剤</Japanese>
<Korean>진통제</Korean>
<Portuguese>Analgésicos</Portuguese>
<Chinesesimp>止痛药</Chinesesimp>
<Turkish>Ağrı kesici</Turkish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_Administer_Painkillers">
<English>Administer Painkillers</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_Administering_Painkillers">
<English>Administering Painkillers...</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_painkillers_Desc_Short">
<English>Over-the-counter analgesic used to combat light to moderate pain experiences.</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_painkillers_Desc_Use">
<English>Over-the-counter analgesic used to combat light to moderate pain experiences.</English>
</Key>
</Package>
</Project>

Binary file not shown.

View File

@ -60,7 +60,7 @@ if (GVAR(currentApplicationPage) == 1) then {
_size = 32 * _mapSize;
{
_x params ["_wpName", "_wpPos"];
private _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5};
private _alpha = [0.5, 1] select (_forEachIndex == GVAR(currentWaypoint));
_theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ];
} forEach _waypoints;
};

View File

@ -80,11 +80,11 @@ if (_isPIP) then {
// Calculate lighting
private _dayOpacity = call EFUNC(common,ambientBrightness);
private _nightOpacity = [1, 0] select (_dayOpacity == 1);
private _nightOpacity = parseNumber (_dayOpacity == 1);
// Apply lighting and make layers visible
(_display displayCtrl 1713001) ctrlSetTextColor [1, 1, 1, 1];
(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, [0, 1] select (_dayOpacity < 0.5)];
(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, parseNumber (_dayOpacity < 0.5)];
(_display displayCtrl 1713005) ctrlSetTextColor [1, 1, 1, _dayOpacity];
(_display displayCtrl 1713006) ctrlSetTextColor [1, 1, 1, _nightOpacity];

View File

@ -53,8 +53,8 @@ private _TimeText = _display displayCtrl 1001;
};
_TimeText ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]);
_HeightText ctrlSetText (format ["%1", floor _height]);
_DecendRate ctrlSetText (format ["%1", _descentRate max 0]);
_HeightText ctrlSetText str floor _height;
_DecendRate ctrlSetText str (_descentRate max 0);
(_this select 0) set [1, _height];
(_this select 0) set [2, _curTime];

View File

@ -33,7 +33,7 @@ if (_ammoClass == "" || _magazineClass == "" || _weaponClass == "") exitWith {};
GVAR(controls) = [];
for "_row" from 0 to 49 do {
private _offset = if (_row < 5) then {0} else {0.003};
private _offset = [0.003, 0] select (_row < 5);
private _control = (__dsp ctrlCreate ["RangeCard_RscText", 790000 + _row]);
_control ctrlSetPosition [safeZoneX + 0.183, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.062, 0.025];
if (_row in [0, 8, 18, 28, 38, 48]) then {
@ -47,7 +47,7 @@ for "_row" from 0 to 49 do {
};
for "_column" from 0 to 8 do {
for "_row" from 0 to 49 do {
private _offset = if (_row < 5) then {0} else {0.003};
private _offset = [0.003, 0] select (_row < 5);
private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + _column * 100 + _row]);
_control ctrlSetPosition [safeZoneX + 0.249 + _column * 0.055, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.052, 0.025];
_control ctrlCommit 0;
@ -57,7 +57,7 @@ for "_column" from 0 to 8 do {
};
for "_column" from 0 to 2 do {
for "_row" from 0 to 49 do {
private _offset = if (_row < 5) then {0} else {0.003};
private _offset = [0.003, 0] select (_row < 5);
private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + (9 +_column) * 100 + _row]);
_control ctrlSetPosition [safeZoneX + 0.743 + _column * 0.049, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.047, 0.025];
_control ctrlCommit 0;
@ -67,7 +67,7 @@ for "_column" from 0 to 2 do {
};
for "_column" from 0 to 2 do {
for "_row" from 0 to 49 do {
private _offset = if (_row < 5) then {0} else {0.003};
private _offset = [0.003, 0] select (_row < 5);
private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + (12 +_column) * 100 + _row]);
_control ctrlSetPosition [safeZoneX + 0.892 + _column * 0.049, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.047, 0.025];
_control ctrlCommit 0;

View File

@ -54,7 +54,7 @@ private _maxMagazines = [_vehicle, _turretPath, _magazineClass] call FUNC(getMax
private _ammoCounts = [_vehicle, _turretPath, _magazineClass] call FUNC(getTurretMagazineAmmo);
TRACE_3("start",_magazineClass,_maxMagazines,_ammoCounts);
private _ammoToAdd = if (GVAR(level) == 2) then {_numRounds} else {_rounds};
private _ammoToAdd = [_rounds, _numRounds] select (GVAR(level) == 2);
private _ammoAdded = 0;
private _arrayModified = false; // skip needing to remove and re-add mags, if we are only adding new ones

View File

@ -22,7 +22,7 @@ private _class = _unit getVariable ["ACE_IsEngineer", _unit getUnitTrait "engine
// 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 (_class isEqualType false) then {_class = [0, 1] select _class};
if (_class isEqualType false) then {_class = parseNumber _class};
TRACE_3("isEngineer",_unit,_engineerN,_class);
if (_class >= _engineerN) exitWith {true};

View File

@ -19,9 +19,9 @@ params ["_newUnit"];
private _side = side group _newUnit;
((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west));
((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west));
((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east));
((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east));
((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent));
((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent));
((GETMVAR(ACE_Rallypoint_West,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == west));
((GETMVAR(ACE_Rallypoint_West_Base,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == west));
((GETMVAR(ACE_Rallypoint_East,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == east));
((GETMVAR(ACE_Rallypoint_East_Base,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == east));
((GETMVAR(ACE_Rallypoint_Independent,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == independent));
((GETMVAR(ACE_Rallypoint_Independent_Base,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == independent));

View File

@ -53,7 +53,7 @@ if (hasInterface) then {
private _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == "");
_marker setMarkerTypeLocal _type;
_marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init
_marker setMarkerAlphaLocal (parseNumber (_side == playerSide)); // playerSide to guarantee init
private _date = _rallypoint getVariable [QGVAR(markerDate), ""];

View File

@ -23,7 +23,7 @@ removeBackpack _unit;
private _pos = _unit modelToWorld [0,0,0];
private _offset = if ((_unit call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8};
private _offset = [0.8, 1] select (_unit call CBA_fnc_getUnitAnim select 0 == "prone");
_pos set [0, (_pos select 0) + (sin getDir _unit) * _offset];
_pos set [1, (_pos select 1) + (cos getDir _unit) * _offset];

View File

@ -1,56 +1,27 @@
#define TOW_ACTION \
#define CONCAT(a,b) a##b
#define TOW_ACTION(length) \
class GVAR(CONCAT(startTow,length)) {\
displayName = CSTRING(CONCAT(start,length));\
condition = QUOTE([ARR_2(_player,'CONCAT(ACE_rope,length)')] call DEFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'CONCAT(ACE_rope,length)')] call DFUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
}
#define TOW_ACTIONS \
class ACE_Actions {\
class ACE_MainActions {\
class ADDON {\
displayName = CSTRING(displayName);\
distance = TOW_ACTION_DISTANCE;\
condition = QUOTE([ARR_1(_target)] call FUNC(isSuitableSimulation));\
statement = "";\
condition = QUOTE(alive _target && {_target call DFUNC(isSuitableSimulation)});\
exceptions[] = { INTERACTION_EXCEPTIONS };\
showDisabled = 0;\
icon = "";\
class GVAR(startTow3) {\
displayName = CSTRING(start3);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope3')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope3')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
class GVAR(startTow6) {\
displayName = CSTRING(start6);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope6')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope6')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
class GVAR(startTow12) {\
displayName = CSTRING(start12);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope12')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope12')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
class GVAR(startTow15) {\
displayName = CSTRING(start15);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope15')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope15')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
class GVAR(startTow18) {\
displayName = CSTRING(start18);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope18')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope18')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
class GVAR(startTow27) {\
displayName = CSTRING(start27);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope27')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope27')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
class GVAR(startTow36) {\
displayName = CSTRING(start36);\
condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope36')] call EFUNC(common,hasItem));\
statement = QUOTE([ARR_3(_player,_target,'ACE_rope36')] call FUNC(startTow));\
exceptions[] = { INTERACTION_EXCEPTIONS };\
};\
insertChildren = QUOTE(_target call DFUNC(getDetachActions));\
TOW_ACTION(3);\
TOW_ACTION(6);\
TOW_ACTION(12);\
TOW_ACTION(15);\
TOW_ACTION(18);\
TOW_ACTION(27);\
TOW_ACTION(36);\
};\
};\
}
@ -58,27 +29,33 @@ class ACE_Actions {\
class CfgVehicles {
class LandVehicle;
class Car: LandVehicle {
TOW_ACTION;
TOW_ACTIONS;
};
class Tank: LandVehicle {
TOW_ACTION;
TOW_ACTIONS;
};
class Ship;
class Ship_F: Ship {
TOW_ACTIONS;
};
class ThingX;
class GVAR(hook): ThingX {
displayName = "hook"; // not publicly visible, no stringtable needed
class GVAR(helper): ThingX {
displayName = "helper"; // not publicly visible, no stringtable needed
scope = 1;
scopeCurator = 1;
model = "\a3\Structures_F_Orange\VR\Helpers\Sign_sphere10cm_Geometry_F.p3d";
model = "\A3\Weapons_f\empty";
destrType = "DestructNo";
};
class GVAR(hook): GVAR(helper) {
displayName = "hook";
class ACE_Actions {
class ACE_MainActions {
displayName = CSTRING(detach);
condition = "true";
statement = QUOTE(private _parent = _target getVariable [ARR_2(QQGVAR(parent),objNull)]; private _child = _target getVariable [ARR_2(QQGVAR(child),objNull)]; [ARR_3(_player,_parent,_child)] call FUNC(detach));
distance = 2;
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(detachRope));
distance = TOW_ACTION_DISTANCE;
};
};
};

View File

@ -1,7 +1,9 @@
PREP(addRopeToVehicle);
PREP(attachRopePFH);
PREP(canStartTow);
PREP(detach);
PREP(attachVehicles);
PREP(detachChild);
PREP(detachRope);
PREP(getDetachActions);
PREP(isSuitableSimulation);
PREP(onMouseButtonDown);
PREP(onMouseButtonUp);

View File

@ -1,14 +1,40 @@
#include "script_component.hpp"
["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler;
["MouseButtonUp", LINKFUNC(onMouseButtonUp)] call CBA_fnc_addDisplayHandler;
GVAR(mouseLeft) = false;
GVAR(mouseRight) = false;
GVAR(blockFireEHID) = -1;
GVAR(cancel) = false;
GVAR(canAttach) = false;
[QGVAR(setTowParent), {
params ["_parent", "_child"];
_child setTowParent _parent;
[QGVAR(ropeAttachTo), {
params ["_child", "_relativeAttachPos", "_rope", "_helper"];
TRACE_4("ropeAttachTo",_child,_relativeAttachPos,_rope,_helper);
_helper ropeDetach _rope;
[_child, _relativeAttachPos] ropeAttachTo _rope;
deleteVehicle _helper;
}] call CBA_fnc_addEventHandler;
[QGVAR(attachVehicles), LINKFUNC(attachVehicles)] call CBA_fnc_addEventHandler;
[QGVAR(detachChild), LINKFUNC(detachChild)] call CBA_fnc_addEventHandler;
if (!isServer) exitWith {};
[QGVAR(cleanupParent), {
params ["_parent"];
TRACE_1("cleanupParent",_parent);
_parent removeEventHandler ["RopeBreak", _parent getVariable [QGVAR(RopeBreakEHID), -1]];
_parent setVariable [QGVAR(RopeBreakEHID), -1];
private _parentParentHooks = _parent getVariable [QGVAR(parentHooks), []];
if (_parentParentHooks isEqualTo []) then {
TRACE_1("remove Deleted EH",_parent);
_parent removeEventHandler ["Deleted", _parent getVariable [QGVAR(DeletedEHID), -1]];
_parent setVariable [QGVAR(DeletedEHID), -1];
};
}] call CBA_fnc_addEventHandler;
addMissionEventHandler ["PlayerConnected", {
if (GVAR(allChildren) isEqualTo []) exitWith {};
params ["", "", "", "_jip", "_owner"];
if (!_jip) exitWith {};
TRACE_2("pushing children",_owner,GVAR(allChildren));
[QGVAR(setTowParentAllChildren), [GVAR(allChildren)], _owner] call CBA_fnc_ownerEvent;
}];

View File

@ -8,4 +8,20 @@ PREP_RECOMPILE_END;
#include "initSettings.inc.sqf"
// handle JIP
if (isServer) then {
GVAR(allChildren) = [];
} else {
// can't use CBA EH in postInit because too late for server PlayerConnected EH
[QGVAR(setTowParentAllChildren), {
params ["_children"];
TRACE_1("setTowParentAllChildren",_children);
{
private _parent = _x getVariable QGVAR(parent);
TRACE_2("setTowParent",_x,_parent);
_x setTowParent _parent;
} forEach _children;
}] call CBA_fnc_addEventHandler;
};
ADDON = true;

View File

@ -20,8 +20,8 @@ params ["_vehicle"];
if (0 == getNumber (configOf _vehicle >> QEGVAR(cargo,hasCargo))) exitWith {};
private _ropeType = if (
private _ropeType = ["ACE_rope6", "ACE_rope12"] select (
-1 < ["Tank", "Wheeled_APC_F", "Truck_F"] findIf {_vehicle isKindOf _x}
) then {"ACE_rope12"} else {"ACE_rope6"};
);
_vehicle addItemCargoGlobal [_ropeType, 1];

View File

@ -40,13 +40,32 @@ if (_intersections isNotEqualTo []) then {
_intersectionToUse params ["_intersectPosition", "", "_intersectObject"];
GVAR(canAttach) =
_intersectObject isNotEqualTo _ignoreParent
&& {
// if we have a target object, we assume we are attaching to the parent. If no target object, we are attaching to child
GVAR(canAttach) = (_intersectObject isNotEqualTo _ignoreParent) && { (!isNull _target && { _intersectObject isEqualTo _target }) || { isNull _target && { [_intersectObject] call FUNC(isSuitableSimulation) }}} && { !(_intersectObject getVariable [QGVAR(towing), false]) };
if (!isNull _target) then {
_intersectObject isEqualTo _target
} else {
[_intersectObject] call FUNC(isSuitableSimulation)
&& { // ignore _intersectObject which has parent != _ignoreParent
private _intersectObjectParent = _intersectObject getVariable [QGVAR(parent), objNull];
isNull _intersectObjectParent || {_intersectObjectParent == _ignoreParent}
} && { // arma prevents making rings (ropeAttachTo silently fails)
private _ancestor = _ignoreParent getVariable [QGVAR(parent), objNull];
while {!isNull _ancestor && {_ancestor != _intersectObject}} do {
_ancestor = _ancestor getVariable [QGVAR(parent), objNull];
};
isNull _ancestor
}
}
}
;
if (GVAR(canAttach)) then {
TRACE_4("can attach",_target,_intersectObject,_ignoreParent,_ignoreRope);
// TRACE_4("can attach",_target,_intersectObject,_ignoreParent,_ignoreRope);
GVAR(attachHelper) setPosASL _intersectPosition;
_hintLMB = localize LSTRING(attach);
_hintLMB = LLSTRING(attach);
GVAR(attachHelper) setVariable [QGVAR(object), _intersectObject];
};
@ -76,4 +95,3 @@ if (_hint isNotEqualTo (_unit getVariable [QGVAR(hint), []])) then {
_unit setVariable [QGVAR(hint), _hint];
_hint call EFUNC(interaction,showMouseHint);
};

View File

@ -0,0 +1,65 @@
#include "..\script_component.hpp"
/*
* Author: Dystopian
* Attaches child to parent vehicle.
* Run globally.
*
* Arguments:
* 0: Vehicle to tow from <OBJECT>
* 1: Vehicle to tow <OBJECT>
* 2: Rope End Position <ARRAY>
* 3: Rope <OBJECT>
* 4: Attached Helper Object <OBJECT>
*
* Return Value:
* None
*
* Example:
* [parent, cursorObject, [0,0,0], ropes parent select 0] call ace_towing_fnc_attachVehicles
*
* Public: No
*/
params ["_parent", "_child", "_relativeAttachPos", "_rope", "_helper"];
TRACE_5("attachVehicles",_parent,_child,_relativeAttachPos,_rope,_helper);
if (local _parent) then {
_helper ropeDetach _rope;
[_child, _relativeAttachPos] ropeAttachTo _rope;
deleteVehicle _helper;
};
_child setTowParent _parent;
if (!isServer) exitWith {};
_child setVariable [QGVAR(parent), _parent, true];
GVAR(allChildren) pushBack _child;
{
if (-1 == _x getVariable [QGVAR(DeletedEHID), -1]) then {
_x setVariable [QGVAR(DeletedEHID), _x addEventHandler ["Deleted", {
params ["_entity"];
private _childHooks = _entity getVariable [QGVAR(childHooks), []];
private _parentHooks = _entity getVariable [QGVAR(parentHooks), []];
TRACE_3("Deleted EH",_entity,_childHooks,_parentHooks);
{
[objNull, _x, _entity] call FUNC(detachRope);
} forEach (_childHooks + _parentHooks);
if (_childHooks isNotEqualTo []) then { // only for parent
// because deleting lasts for several frames we have to delete RB EH to fix double cleanup
_entity removeEventHandler ["RopeBreak", _entity getVariable QGVAR(RopeBreakEHID)];
};
}]];
};
} forEach [_parent, _child];
if (-1 == _parent getVariable [QGVAR(RopeBreakEHID), -1]) then {
_parent setVariable [QGVAR(RopeBreakEHID), _parent addEventHandler ["RopeBreak", {
params ["_parent", "_rope", "_child"];
if (isNull _rope) exitWith {}; // happens
private _hook = _rope getVariable [QGVAR(hook), objNull];
private _hookChild = _hook getVariable [QGVAR(vars), []] param [1, objNull];
if (isNull _hook || {_child != _hookChild}) exitWith {}; // handle helper detach
TRACE_4("RopeBreak EH",_parent,_rope,_child,_hook);
[objNull, _hook] call FUNC(detachRope);
}]];
};

View File

@ -1,21 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Condition for whether or not we can tow from this object
*
* Arguments:
* 0: Unit wanting to start towing <OBJECT>
* 1: Vehicle to tow from <OBJECT>
*
* Return Value:
* Whether or not we can start towing <BOOLEAN>
*
* Example:
* [player, cursorObject] call ace_towing_fnc_canStartTow
*
* Public: No
*/
params ["_unit", "_target"];
private _isTowing = _target getVariable [QGVAR(towing), false];
TRACE_1("is towing",_isTowing);
!_isTowing

View File

@ -1,48 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Detaches child from parent, and gives rope item back
*
* Arguments:
* 0: Parent <OBJECT>
* 1: Child <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject] call ace_towing_fnc_detach
*
* Public: No
*/
params ["_unit", "_parent", "_child"];
TRACE_3("detach",_unit,_parent,_child);
private _hook = _child getVariable [QGVAR(hook), objNull];
_parent removeEventHandler ["Deleted", _hook getVariable QGVAR(parentDeleteEventHandler)];
_hook setVariable [QGVAR(parentDeleteEventHandler), -1];
_child removeEventHandler ["Deleted", _hook getVariable QGVAR(childDeleteEventHandler)];
_hook setVariable [QGVAR(childDeleteEventHandler), -1];
_parent removeEventHandler ["RopeBreak", _parent getVariable QGVAR(ropeBreakEventHandler)];
_parent setVariable [QGVAR(ropeBreakEventHandler), -1];
private _rope = _child getVariable [QGVAR(rope), objNull];
ropeDestroy _rope;
private _ropeClass = _hook getVariable [QGVAR(ropeClass), ""];
deleteVehicle _hook;
TRACE_1("rope",_ropeClass);
if (_ropeClass isNotEqualTo "") then {
[_unit, _ropeClass, true] call CBA_fnc_addItem;
};
[QGVAR(setTowParent), [objNull, _child], _child] call CBA_fnc_targetEvent;
_child setVariable [QGVAR(towing), false, true];
_parent setVariable [QGVAR(towing), false, true];

View File

@ -0,0 +1,33 @@
#include "..\script_component.hpp"
/*
* Author: Dystopian
* Detaches child.
* Run globally.
*
* Arguments:
* 0: Child <OBJECT>
*
* Return Value:
* None
*
* Example:
* cursorObject call ace_towing_fnc_detachChild
*
* Public: No
*/
params ["_child"];
TRACE_1("detachChild",_child);
_child setTowParent objNull;
if (!isServer) exitWith {};
_child setVariable [QGVAR(parent), objNull, true];
GVAR(allChildren) = GVAR(allChildren) - [_child];
private _childChildHooks = _child getVariable [QGVAR(childHooks), []];
if (_childChildHooks isEqualTo []) then {
TRACE_1("remove Deleted EH",_child);
_child removeEventHandler ["Deleted", _child getVariable [QGVAR(DeletedEHID), -1]];
_child setVariable [QGVAR(DeletedEHID), -1];
};

View File

@ -0,0 +1,60 @@
#include "..\script_component.hpp"
/*
* Author: Dystopian
* Detaches rope of given hook and gives rope item back.
*
* Arguments:
* 0: Player <OBJECT>
* 1: Rope Hook <OBJECT>
* 2: Deleted object <OBJECT> (default: objNull)
*
* Return Value:
* None
*
* Example:
* [player, cursorObject] call ace_towing_fnc_detachRope
*
* Public: No
*/
params ["_unit", "_hook", ["_deletedObject", objNull]];
private _hookVars = _hook getVariable QGVAR(vars);
if (isNil "_hookVars") then { // this is hookParent
_hook = _hook getVariable QGVAR(hook);
_hookVars = _hook getVariable QGVAR(vars);
};
_hookVars params ["_parent", "_child", "_rope", "_ropeClass", "_hookParent"];
TRACE_8("detachRope",_unit,_parent,_child,_hook,_hookParent,_rope,_ropeClass,_deletedObject);
ropeDestroy _rope; // can run on client
if (!isNull _unit && {_ropeClass isNotEqualTo ""}) then {
[_unit, _ropeClass, true] call CBA_fnc_addItem;
};
{
detach _x;
deleteVehicle _x;
} forEach [_hook, _hookParent];
// cleanup object variables and EHs only if function isn't called from Deleted EH
if (isNull _deletedObject || {_parent isNotEqualTo _deletedObject}) then {
private _parentChildHooks = _parent getVariable [QGVAR(childHooks), []];
_parentChildHooks = _parentChildHooks - [_hook];
_parent setVariable [QGVAR(childHooks), _parentChildHooks, true];
if (_parentChildHooks isEqualTo []) then {
[QGVAR(cleanupParent), _parent] call CBA_fnc_serverEvent;
};
};
if (isNull _deletedObject || {_child isNotEqualTo _deletedObject}) then {
private _childParentHooks = _child getVariable [QGVAR(parentHooks), []];
_childParentHooks = _childParentHooks - [_hook];
_child setVariable [QGVAR(parentHooks), _childParentHooks, true];
if (_childParentHooks isEqualTo []) then {
[QGVAR(detachChild), _child] call CBA_fnc_globalEvent;
};
};

View File

@ -0,0 +1,40 @@
#include "..\script_component.hpp"
/*
* Author: Dystopian
* Creates vehicle detach actions for attached ropes.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* Detach actions <ARRAY>
*
* Example:
* cursorObject call ace_towing_fnc_getDetachActions
*
* Public: No
*/
params ["_vehicle"];
private _statement = {
params ["", "_player", "_hook"];
[_player, _hook] call FUNC(detachRope);
};
private _parentHooks = _vehicle getVariable [QGVAR(parentHooks), []];
private _childHooks = _vehicle getVariable [QGVAR(childHooks), []];
(_parentHooks + _childHooks) apply {
private _hook = _x;
_hook getVariable QGVAR(vars) params ["_hookParent", "_hookChild"];
private _partner = [_hookParent, _hookChild] select (_vehicle == _hookParent);
private _partnerName = getText (configOf _partner >> "displayName");
private _partnerOwnerName = [_partner, true] call EFUNC(common,getName);
if (_partnerOwnerName != "") then {
_partnerName = format ["%1, %2", _partnerName, _partnerOwnerName];
};
private _name = format ["%1 (%2)", LLSTRING(detach), _partnerName];
private _icon = [_partner] call EFUNC(common,getVehicleIcon);
private _action = [format ["%1", _hook], _name, _icon, _statement, {true}, {}, _hook] call EFUNC(interact_menu,createAction);
[_action, [], _vehicle]
}

View File

@ -19,8 +19,7 @@ params ["_target"];
// need toLower since apparently this isn't case sensitive
private _simulationType = getText ((configOf _target) >> "simulation");
TRACE_1("sim type",_simulationType);
// TRACE_1("sim type",_simulationType);
// Biki lies, you can both tow and tow as either TankX or CarX
(toLower _simulationType) in ["tankx", "carx"]
(toLower _simulationType) in ["tankx", "carx", "shipx"]

View File

@ -32,5 +32,6 @@ GVAR(isSwimming) = _unit call EFUNC(common,isSwimming);
GVAR(putWeaponAwayNextFrame) = false;
GVAR(cancel) = false;
GVAR(canAttach) = false;
GVAR(onMouseButtonDownEHID) = ["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler;
[LINKFUNC(towStateMachinePFH), 0, [TOW_STATE_ATTACH_PARENT, _unit, _target, objNull, _ropeLength, _ropeClass]] call CBA_fnc_addPerFrameHandler;
[QGVAR(ropeDeployed), [_unit, _target, _ropeClass]] call CBA_fnc_localEvent;

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Called per frame. Handles current unit state for attaching a rope to two vehicles
* Called per frame. Handles current unit state for attaching a rope to two vehicles.
*
* Arguments:
* 0: PFEH Args <ARRAY>
@ -62,14 +62,16 @@ if (_exitCondition && {_state < TOW_STATE_CANCEL}) then {
switch (_state) do {
case TOW_STATE_ATTACH_PARENT: {
TRACE_2("state attach parent",_unit,_parent);
// TRACE_2("state attach parent",_unit,_parent);
[_unit, _parent, objNull, objNull, [0, 0, 0], _length] call FUNC(attachRopePFH);
if (GVAR(canAttach) && { GVAR(mouseLeft) }) then {
_args set [0, TOW_STATE_ATTACH_CHILD];
_rope = ropeCreate [_parent, _parent worldToModelVisual ASLtoAGL getPosASLVisual GVAR(attachHelper), _length];
[GVAR(attachHelper), [0, 0, 0]] ropeAttachTo _rope;
// can't use unit hand because rope doesn't change position when hand moving
// can't use createVehicleLocal because rope can be non-local (like parent) and it must be attached to global vehicle
GVAR(helper) = createVehicle [QGVAR(helper), [0, 0, 0], [], 0, "CAN_COLLIDE"];
GVAR(helper) attachTo [_unit, [0, 0, 0], "LeftHand", true];
_rope = ropeCreate [_parent, _parent worldToModelVisual ASLtoAGL getPosASLVisual GVAR(attachHelper), GVAR(helper), [0, 0, 0], _length];
_args set [3, _rope];
};
@ -79,7 +81,7 @@ switch (_state) do {
};
};
case TOW_STATE_ATTACH_CHILD: {
TRACE_3("state attach child",_unit,_parent,_rope);
// TRACE_3("state attach child",_unit,_parent,_rope);
[_unit, objNull, _parent, _rope, getPosASLVisual _rope, _length] call FUNC(attachRopePFH);
if (GVAR(canAttach) && { GVAR(mouseLeft) }) then {
@ -108,60 +110,42 @@ switch (_state) do {
GVAR(cancel) = false;
};
[QGVAR(setTowParent), [_parent, _child], _parent] call CBA_fnc_targetEvent;
detach GVAR(helper);
// can't delete GVAR(helper) without ropeDetach which requires local rope (==parent), so pass it to owner
if (isNull (_child getVariable [QGVAR(parent), objNull])) then {
[QGVAR(attachVehicles), [_parent, _child, _relativeAttachPos, _rope, GVAR(helper)]] call CBA_fnc_globalEvent;
} else {
[QGVAR(ropeAttachTo), [_child, _relativeAttachPos, _rope, GVAR(helper)], _parent] call CBA_fnc_targetEvent;
};
GVAR(attachHelper) ropeDetach _rope;
[_child, _relativeAttachPos] ropeAttachTo _rope;
private _hookParent = createVehicle [QGVAR(hook), [0, 0, 0], [], 0, "CAN_COLLIDE"];
_hookParent attachTo [_parent, _parent worldToModelVisual ASLtoAGL getPosASLVisual _rope];
private _hook = createVehicle [QGVAR(hook), [0, 0, 0], [], 0, "NONE"];
private _hook = createVehicle [QGVAR(hook), [0, 0, 0], [], 0, "CAN_COLLIDE"];
_hook attachTo [_child, _relativeAttachPos];
_hook setVariable [QGVAR(parent), _parent, true];
_hook setVariable [QGVAR(child), _child, true];
_child setVariable [QGVAR(rope), _rope, true];
_child setVariable [QGVAR(hook), _hook, true];
// use array to decrease public setVar count
private _hookVars = [_parent, _child, _rope, _ropeClass, _hookParent];
_hook setVariable [QGVAR(vars), _hookVars, true];
_parent setVariable [QGVAR(hook), _hook, true];
_hookParent setVariable [QGVAR(hook), _hook, true];
_rope setVariable [QGVAR(hook), _hook, true];
_hook setVariable [QGVAR(ropeClass), _ropeClass, true];
private _childParentHooks = _child getVariable [QGVAR(parentHooks), []];
_childParentHooks pushBack _hook;
_child setVariable [QGVAR(parentHooks), _childParentHooks, true];
_child setVariable [QGVAR(towing), true, true];
_parent setVariable [QGVAR(towing), true, true];
_hook setVariable [QGVAR(parentDeleteEventHandler), _parent addEventHandler ["Deleted", {
params ["_entity"];
private _hook = _entity getVariable [QGVAR(hook), objNull];
private _child = _hook getVariable [QGVAR(child), objNull];
private _parent = _hook getVariable [QGVAR(parent), objNull];
[objNull, _parent, _child] call FUNC(detach);
}], true];
_hook setVariable [QGVAR(childDeleteEventHandler), _child addEventHandler ["Deleted", {
params ["_entity"];
private _hook = _entity getVariable [QGVAR(hook), objNull];
private _child = _hook getVariable [QGVAR(child), objNull];
private _parent = _hook getVariable [QGVAR(parent), objNull];
[objNull, _parent, _child] call FUNC(detach);
}], true];
_parent setVariable [QGVAR(ropeBreakEventHandler), _parent addEventHandler ["RopeBreak", {
params ["_parent", "_rope", "_child"];
[objNull, _parent, _child] call FUNC(detach);
_parent removeEventHandler ["RopeBreak", _parent getVariable QGVAR(ropeBreakEventHandler)];
_parent setVariable [QGVAR(ropeBreakEventHandler), -1];
}], true];
private _parentChildHooks = _parent getVariable [QGVAR(childHooks), []];
_parentChildHooks pushBack _hook;
_parent setVariable [QGVAR(childHooks), _parentChildHooks, true];
_args set [0, TOW_STATE_CLEANUP];
};
case TOW_STATE_CANCEL: {
TRACE_1("state cancel",_rope);
if !(isNull _rope) then {
detach GVAR(helper);
deleteVehicle GVAR(helper);
ropeDestroy _rope;
};
[_unit, _ropeClass, true] call CBA_fnc_addItem;
@ -174,6 +158,7 @@ switch (_state) do {
TRACE_2("state cleanup",GVAR(attachHelper),_handle);
deleteVehicle GVAR(attachHelper);
[_handle] call CBA_fnc_removePerFrameHandler;
["MouseButtonDown", GVAR(onMouseButtonDownEHID)] call CBA_fnc_removeDisplayHandler;
_unit setVariable [QGVAR(hint), []];
call EFUNC(interaction,hideMouseHint);
if (GVAR(blockFireEHID) != -1) then {

View File

@ -7,7 +7,8 @@
{
if !(_this && {isServer} && {isNil QGVAR(addRopeToVehicleInventory_initialized)}) exitWith {};
GVAR(addRopeToVehicleInventory_initialized) = true;
["Tank", "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler;
["Car", "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler;
{
[_x, "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler;
} forEach ["Car", "Ship", "Tank"];
}
] call CBA_fnc_addSetting;

View File

@ -24,4 +24,3 @@
#define TOW_STATE_ATTACH 2
#define TOW_STATE_CANCEL 3
#define TOW_STATE_CLEANUP 4

View File

@ -63,10 +63,10 @@ private _east = (abs (_ax - _bx)) >= (abs (_ay - _by));
private _origin2D = [];
private _length = 0;
if (_east) then {
_origin2D = if (_ax < _bx) then { _start2d } else { _end2d };
_origin2D = [_end2d, _start2d] select (_ax < _bx);
_length = (abs (_ax - _bx)) / _cellsize;
} else {
_origin2D = if (_ay < _by) then { _start2d } else { _end2d };
_origin2D = [_end2d, _start2d] select (_ay < _by);
_length = (abs (_ay - _by)) / _cellsize;
};
TRACE_3("",_east,_origin2D,_length);

View File

@ -68,7 +68,7 @@ if (!_force) then {
};
private _displays = ((uiNamespace getVariable "IGUI_displays") + [findDisplay IDD_MISSION]) select {_idd == ctrlIDD _x};
private _fade = [1, 0] select _show;
private _fade = parseNumber !_show;
// Disable/Enable elements
private _success = false;

View File

@ -18,7 +18,7 @@
params ["_unit"];
TRACE_1("params",_unit);
if (isNil (format ["%1", _unit getVariable "ACE_airTemperatureBias"])) then {
if (isNil {_unit getVariable "ACE_airTemperatureBias"}) then {
_unit setVariable ["ACE_airTemperatureBias", [-(random(3) + 1), random(3) + 1]];
};

View File

@ -86,7 +86,7 @@ if (_retTex != ctrlText _ctrlScopeReticle) then { _ctrlScopeReticle ctrlSetText
private _rangeInfo = _range call {
if (_range == 0) exitWith { "" };
if (_range < 0) exitWith { // range error - blink if recent
if ((_timeSinceLastInput < 3) && {(floor (4*_timeSinceLastInput)) % 2 == 1}) then { "----" } else { "" };
["", "----"] select ((_timeSinceLastInput < 3) && {(floor (4*_timeSinceLastInput)) % 2 == 1});
};
format ["%1 m", _range toFixed 0]
};
@ -98,7 +98,7 @@ _ctrl ctrlSetText _rangeInfo;
private _bearingInfo = call {
private _bearingSetting = GVAR(data) getOrDefault ["bearing_show", 0];
if ((_bearingSetting == 2) && {_timeSinceLastInput > 2}) exitWith { "" };
if ((_bearingSetting == 1)) exitWith { format ["%1", floor (17.777777 * _weaponDir)]; }; // (6400 Mils, not MRAD)
if ((_bearingSetting == 1)) exitWith { str floor (17.777777 * _weaponDir); }; // (6400 Mils, not MRAD)
format ["%1°", floor _weaponDir];
};
private _ctrl = _display displayCtrl IDC_SCREEN_TEXT_UPPER_LEFT;

View File

@ -257,7 +257,7 @@ if (_activated) then {
//--- Player
if (hasinterface) then {
waituntil {local player};
_serverCommand = if (_ownerVar == "#adminLogged") then {"#shutdown"} else {"#kick"};
_serverCommand = ["#kick", "#shutdown"] select (_ownerVar == "#adminLogged");
//--- Black effect until the interface is open
_forced = _logic getvariable ["forced",0] > 0;

View File

@ -30,7 +30,7 @@ if (_activated && local _logic && !isnull curatorcamera) then {
//--- Get unit under cursor
_unit = objnull;
_mouseOver = missionnamespace getvariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]];
if ((_mouseOver select 0) == typename objnull) then {_unit = _mouseOver select 1;};
if ((_mouseOver select 0) == "OBJECT") then {_unit = _mouseOver select 1;};
_unit = effectivecommander _unit;
//--- Temp owner

View File

@ -53,7 +53,7 @@ if !(isNull _unit) then {
if (isNull _unit) then {
(_display displayCtrl 56220) lbDelete 0;
} else {
(_display displayCtrl 56218) lbSetCurSel ([0, 1] select (_unit isFlashlightOn currentWeapon _unit));
(_display displayCtrl 56218) lbSetCurSel (parseNumber (_unit isFlashlightOn currentWeapon _unit));
};
private _fnc_onUnload = {

View File

@ -53,7 +53,7 @@ if !(isNull _unit) then {
if (isNull _unit) then {
(_display displayCtrl 92856) lbDelete 0;
} else {
(_display displayCtrl 92855) lbSetCurSel ([0, 1] select (hmd _unit isNotEqualTo ""));
(_display displayCtrl 92855) lbSetCurSel (parseNumber (hmd _unit isNotEqualTo ""));
};
private _fnc_onUnload = {

View File

@ -54,7 +54,7 @@ switch _mode do {
_control = _display displayctrl _idc;
//--- Admin specific attribute
_show = if (getnumber (_cfgControl >> "adminOnly") > 0) then {_enableAdmin} else {true};
_show = [true, _enableAdmin] select (getnumber (_cfgControl >> "adminOnly") > 0);
if ((_allAttributes || {_x == configname _cfgControl} count _attributes > 0) && _show) then {
_controlPos = ctrlposition _control;
@ -75,10 +75,10 @@ switch _mode do {
_target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull];
_name = switch (typename _target) do {
case (typename objnull): {gettext (configfile >> "cfgvehicles" >> typeof _target >> "displayname")};
case (typename grpnull): {groupid _target};
case (typename []): {format ["%1: %3 #%2",groupid (_target select 0),_target select 1,localize "str_a3_cfgmarkers_waypoint_0"]};
case (typename ""): {markertext _target};
case ("OBJECT"): {gettext (configfile >> "cfgvehicles" >> typeof _target >> "displayname")};
case ("GROUP"): {groupid _target};
case ("ARRAY"): {format ["%1: %3 #%2",groupid (_target select 0),_target select 1,localize "str_a3_cfgmarkers_waypoint_0"]};
case ("STRING"): {markertext _target};
};
_ctrlTitle ctrlsettext format [ctrltext _ctrlTitle,toupper _name];
@ -115,19 +115,19 @@ switch _mode do {
_display = _this select 0;
_target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull];
switch (typename _target) do {
case (typename objnull): {
case ("OBJECT"): {
_isAlive = alive _target;
waituntil {isnull _display || (_isAlive && !alive _target)};
};
case (typename grpnull): {
case ("GROUP"): {
waituntil {isnull _display || isnull _target};
};
case (typename []): {
case ("ARRAY"): {
_grp = _target select 0;
_wpCount = count waypoints _grp;
waituntil {isnull _display || (count waypoints _grp != _wpCount)};
};
case (typename ""): {
case ("STRING"): {
waituntil {isnull _display || markertype _target == ""};
};
};