diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index 594b44f..ffbe75a 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -1,6 +1,6 @@ -[hemtt.launch.default] +[default] workshop = [ "450814997", # CBA_A3's Workshop ID "463939057", # ACE3 @@ -17,20 +17,20 @@ parameters = [ "-noPauseAudio", ] -[hemtt.launch.Stratis] +[Stratis] extends = "default" dlc = ["ws","rf"] mission = "Stratis.Stratis" -[hemtt.launch.GreenMag] +[GreenMag] extends = "Stratis" workshop = ["2352603233"] -[hemtt.launch.exec] +[exec] extends = "default" mission = "exec.VR" -[hemtt.launch.airlift] +[airlift] extends = "default" mission = "airlift.VR" \ No newline at end of file diff --git a/.hemtt/lint.toml b/.hemtt/lints.toml similarity index 50% rename from .hemtt/lint.toml rename to .hemtt/lints.toml index f851073..aa93b27 100644 --- a/.hemtt/lint.toml +++ b/.hemtt/lints.toml @@ -4,4 +4,11 @@ lints.sqf.banned_commands = "Warning" options.ignore = [ "createSoundSource", + "addPublicVariableEventHandler", + +] + +[lints.sqf.command_case] +options.ignore = [ + "rankID", ] \ No newline at end of file diff --git a/.hemtt/missions/Stratis.Stratis/initPlayerLocal.sqf b/.hemtt/missions/Stratis.Stratis/initPlayerLocal.sqf new file mode 100644 index 0000000..882d86a --- /dev/null +++ b/.hemtt/missions/Stratis.Stratis/initPlayerLocal.sqf @@ -0,0 +1 @@ +["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups; \ No newline at end of file diff --git a/.hemtt/missions/Stratis.Stratis/initServer.sqf b/.hemtt/missions/Stratis.Stratis/initServer.sqf new file mode 100644 index 0000000..a40946e --- /dev/null +++ b/.hemtt/missions/Stratis.Stratis/initServer.sqf @@ -0,0 +1 @@ +["Initialize", [true]] call BIS_fnc_dynamicGroups; \ No newline at end of file diff --git a/.hemtt/missions/Stratis.Stratis/mission.sqm b/.hemtt/missions/Stratis.Stratis/mission.sqm index f8cccc1..e8d225f 100644 --- a/.hemtt/missions/Stratis.Stratis/mission.sqm +++ b/.hemtt/missions/Stratis.Stratis/mission.sqm @@ -12,10 +12,10 @@ class EditorData }; class Camera { - pos[]={3483.2817,147.82555,2635.5703}; - dir[]={-0.52101308,-0.30827615,0.79594111}; - up[]={-0.16883896,0.95129669,0.25793207}; - aside[]={0.83669001,-7.2759576e-009,0.54768705}; + pos[]={2720.408,194.23297,2352.8496}; + dir[]={0.94591177,-0.09906961,0.30897394}; + up[]={0.094179317,0.99508041,0.030762935}; + aside[]={0.31050187,1.0849908e-007,-0.95058888}; }; }; binarizationWanted=0; @@ -29,13 +29,14 @@ addons[]= "ace_rearm", "ace_cargo", "A3_Characters_F_Orange", - "RF_Vehicles_Pickup_01" + "RF_Vehicles_Pickup_01", + "CVO_Compat_RF" }; class AddonsMetaData { class List { - items=8; + items=9; class Item0 { className="A3_Characters_F"; @@ -92,6 +93,13 @@ class AddonsMetaData author="Rotators Collective"; url="https://reactionforces.rotators.net/"; }; + class Item8 + { + className="CVO_Compat_RF"; + name="CVO_Compat_RF"; + author="Overlord Zorn [CVO]"; + url="http://chronivoron.net"; + }; }; }; dlcs[]= diff --git a/.hemtt/project.toml b/.hemtt/project.toml index d06e727..df65341 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -31,42 +31,4 @@ path = "addons/main/script_version.hpp" # Default # major = 0 # Overrides path when set # minor = 1 # patch = 1 -# git_hash = 4 # Default: 8 - - - - -[hemtt.launch.default] -workshop = [ - "450814997", # CBA_A3's Workshop ID - "463939057", # ACE3 - "2369477168", # Advanced Developer Tools - "1779063631", # ZEN -] - -dlc = [] -optionals = [] - -parameters = [ - "-window", - "-noPause", - "-noPauseAudio", -] - -[hemtt.launch.Stratis] -extends = "default" -dlc = ["ws","rf"] -mission = "Stratis.Stratis" - - -[hemtt.launch.GreenMag] -extends = "Stratis" -workshop = ["2352603233"] - -[hemtt.launch.exec] -extends = "default" -mission = "exec.VR" - -[hemtt.launch.airlift] -extends = "default" -mission = "airlift.VR" \ No newline at end of file +# git_hash = 4 # Default: 8 \ No newline at end of file diff --git a/addons/arsenal/config.cpp b/addons/arsenal/config.cpp index d4867d6..63e48a3 100644 --- a/addons/arsenal/config.cpp +++ b/addons/arsenal/config.cpp @@ -11,7 +11,7 @@ class CfgPatches { url = "http://chronivoron.net"; // Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game. - requiredVersion = 2.0; + requiredVersion = 2.02; // Required addons, used for setting load order. // When any of the addons is missing, pop-up warning will appear when launching the game. diff --git a/addons/bigboom/functions/fn_bigBoomHMO.sqf b/addons/bigboom/functions/fn_bigBoomHMO.sqf index b00699c..3078a80 100644 --- a/addons/bigboom/functions/fn_bigBoomHMO.sqf +++ b/addons/bigboom/functions/fn_bigBoomHMO.sqf @@ -246,7 +246,7 @@ private _HashMapObject = createHashMapObject [[ _helperObj addEventHandler ["Deleted", { params ["_helperObj"]; private _varNameHMO = _helperObj getVariable "varNameHMO"; - missionNameSpace setVariable [_varNameHMO, nil]; // Will delete the HMO + missionNamespace setVariable [_varNameHMO, nil]; // Will delete the HMO diag_log format ['[CVO](debug)(fn_bigBoomHMO) isNil _varNameHMO: %1', isNil _varNameHMO]; }]; }] diff --git a/addons/bigboom/functions/fn_bigBoomPrep.sqf b/addons/bigboom/functions/fn_bigBoomPrep.sqf index 240dca7..1c14476 100644 --- a/addons/bigboom/functions/fn_bigBoomPrep.sqf +++ b/addons/bigboom/functions/fn_bigBoomPrep.sqf @@ -12,7 +12,7 @@ private _ehCode = { params ["_object", "_killer", "_instigator", "_useEffects"]; _thisArgs params ["_delay"]; - diag_log format ['[CVO](debug)(Killed EH triggered) %1 killed by %2 - instigator: ', _object ,_killer, _instigator]; + diag_log format ['[CVO](debug)(Killed EH triggered) %1 killed by %2 - instigator: %3',_object,_killer, _instigator]; // creates helper object which can be deleted by zeus to stop the effects diff --git a/addons/csc/functions/fn_spawnCSC.sqf b/addons/csc/functions/fn_spawnCSC.sqf index b18d78d..51ae546 100644 --- a/addons/csc/functions/fn_spawnCSC.sqf +++ b/addons/csc/functions/fn_spawnCSC.sqf @@ -148,7 +148,7 @@ while {_addTracks > 0} do { ["ACE_Track", _box] call ace_cargo_fnc ["cvo_csc_Event_crateSpawnedServer", [_box, _title] ] call CBA_fnc_ServerEvent; -diag_log format ['[CVO](debug)(fn_spawnCSC) %" - Requested by %2', _title , _player]; +diag_log format ['[CVO](debug)(fn_spawnCSC) %1 - Requested by %2', _title , _player]; diff --git a/addons/insignia/CfgExtendedEventHandlers.hpp b/addons/insignia/CfgExtendedEventHandlers.hpp new file mode 100644 index 0000000..0d2c2cd --- /dev/null +++ b/addons/insignia/CfgExtendedEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PreInit_EventHandlers { + class CVO_Insignia_CBA_Settings_XHE_PreInit { + init = "call compile preprocessFileLineNumbers 'z\cvo_aux\addons\insignia\XEH_preInit.sqf'"; + }; +}; \ No newline at end of file diff --git a/addons/insignia/CfgFunctions.hpp b/addons/insignia/CfgFunctions.hpp new file mode 100644 index 0000000..b112872 --- /dev/null +++ b/addons/insignia/CfgFunctions.hpp @@ -0,0 +1,17 @@ +class CfgFunctions { + class CVO_Insignia { + class CVO_Insignia { + file = "z\cvo_aux\addons\insignia\functions"; + class postInit { postInit = 1; }; + // class preInit { preInit = 1; }; + + class eh_arsenal {}; + class eh_group {}; + + class autoAssign {}; + + class identify {}; + class apply {}; + }; + }; +}; diff --git a/addons/insignia/CfgUnitInsignia.hpp b/addons/insignia/CfgUnitInsignia.hpp new file mode 100644 index 0000000..468c26e --- /dev/null +++ b/addons/insignia/CfgUnitInsignia.hpp @@ -0,0 +1,285 @@ +class CfgUnitInsignia +{ + // 1-0 + class CVO_insignia_10_COY_CO + { + displayName = "CVO 1-0 Company Commander"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-10-COY-CO.paa"; + textureVehicle = ""; + }; + class CVO_insignia_10_COY_RFL + { + displayName = "CVO 1-0 Company Officer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-10-COY.paa"; + textureVehicle = ""; + }; + + + // 1-6 + class CVO_insignia_16_PL_CO + { + displayName = "CVO 1-6 Platoon Commander"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-CO.paa"; + textureVehicle = ""; + }; + class CVO_insignia_16_PL_SGT + { + displayName = "CVO 1-6 Platoon Sergant"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-sgt.paa"; + textureVehicle = ""; + }; + class CVO_insignia_16_PL_RFL + { + displayName = "CVO 1-6 Platoon Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-rfl.paa"; + textureVehicle = ""; + }; + class CVO_insignia_16_PL_MED + { + displayName = "CVO 1-6 Platoon Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-med.paa"; + textureVehicle = ""; + }; + class CVO_insignia_16_PL_ENG + { + displayName = "CVO 1-6 Platoon Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-eng.paa"; + textureVehicle = ""; + }; + + + // 1-1 + class CVO_insignia_11_SL + { + displayName = "CVO 1-1 Squad Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-11-SL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_11_TL + { + displayName = "CVO 1-1 Team Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-11-TL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_11_RFL + { + displayName = "CVO 1-1 Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-11-rfl.paa"; + textureVehicle = ""; + }; + class CVO_insignia_11_MED + { + displayName = "CVO 1-1 Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-11-MED.paa"; + textureVehicle = ""; + }; + class CVO_insignia_11_ENG + { + displayName = "CVO 1-1 Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-11-ENG.paa"; + textureVehicle = ""; + }; + + + // 1-2 + class CVO_insignia_12_SL + { + displayName = "CVO 1-2 Squad Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-12-SL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_12_TL + { + displayName = "CVO 1-2 Team Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-12-TL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_12_RFL + { + displayName = "CVO 1-2 Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-12-rfl.paa"; + textureVehicle = ""; + }; + class CVO_insignia_12_MED + { + displayName = "CVO 1-2 Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-12-MED.paa"; + textureVehicle = ""; + }; + class CVO_insignia_12_ENG + { + displayName = "CVO 1-2 Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-12-ENG.paa"; + textureVehicle = ""; + }; + + + // 1-3 + class CVO_insignia_13_SL + { + displayName = "CVO 1-3 Squad Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-13-SL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_13_TL + { + displayName = "CVO 1-3 Team Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-13-TL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_13_RFL + { + displayName = "CVO 1-3 Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-13-rfl.paa"; + textureVehicle = ""; + }; + class CVO_insignia_13_MED + { + displayName = "CVO 1-3 Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-13-MED.paa"; + textureVehicle = ""; + }; + class CVO_insignia_13_ENG + { + displayName = "CVO 1-3 Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-13-ENG.paa"; + textureVehicle = ""; + }; + + + // 1-4 + class CVO_insignia_14_SL + { + displayName = "CVO 1-4 Squad Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-14-SL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_14_TL + { + displayName = "CVO 1-4 Team Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-14-TL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_14_RFL + { + displayName = "CVO 1-4 Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-14-rfl.paa"; + textureVehicle = ""; + }; + class CVO_insignia_14_MED + { + displayName = "CVO 1-4 Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-14-MED.paa"; + textureVehicle = ""; + }; + class CVO_insignia_14_ENG + { + displayName = "CVO 1-4 Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-14-ENG.paa"; + textureVehicle = ""; + }; + + + // 1-5 + class CVO_insignia_15_SL + { + displayName = "CVO 1-5 Squad Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-15-SL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_15_TL + { + displayName = "CVO 1-5 Team Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-15-TL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_15_RFL + { + displayName = "CVO 1-5 Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-15-rfl.paa"; + textureVehicle = ""; + }; + class CVO_insignia_15_MED + { + displayName = "CVO 1-5 Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-15-MED.paa"; + textureVehicle = ""; + }; + class CVO_insignia_15_ENG + { + displayName = "CVO 1-5 Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-15-ENG.paa"; + textureVehicle = ""; + }; + + + // Blank + class CVO_insignia_blank_SL + { + displayName = "CVO Squad Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-blank-SL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_blank_TL + { + displayName = "CVO Team Leader"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-blank-TL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_blank_RFL + { + displayName = "CVO Rifleman"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-blank-RFL.paa"; + textureVehicle = ""; + }; + class CVO_insignia_blank_MED + { + displayName = "CVO Medic"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-blank-MED.paa"; + textureVehicle = ""; + }; + class CVO_insignia_blank_ENG + { + displayName = "CVO Engineer"; + author = "CVO"; + texture = "z\cvo_aux\addons\insignia\img\cvo-blank-ENG.paa"; + textureVehicle = ""; + }; + +}; diff --git a/addons/insignia/XEH_preInit.sqf b/addons/insignia/XEH_preInit.sqf new file mode 100644 index 0000000..86e668b --- /dev/null +++ b/addons/insignia/XEH_preInit.sqf @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////// +// General Marker Settings + +[ + "CVO_SET_Insignia_on_arsenalClosed", // _setting - Unique setting name. Matches resulting variable name + "CHECKBOX", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" + ["AutoAssign on ACE Arsenal Closed","Identifes and AutoAssigns Units Insignia when the ACE Arsenal is being closed."], + // _title - Display name or display name + tooltip (optional, default: same as setting name) + ["CVO", "Insignia"], // _category - Category for the settings menu + optional sub-category + true, // _valueInfo - Extra properties of the setting depending of _settingType. See examples below + 0, // _isGlobal - 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) + { + [_this] call CVO_Insignia_fnc_EH_Arsenal; + }, // _script - Script to execute when setting is changed. (optional) + false // _needRestart - Setting will be marked as needing mission restart after being changed. (optional, default false) +] call CBA_fnc_addSetting; + + +[ + "CVO_SET_Insignia_on_missionStart", // _setting - Unique setting name. Matches resulting variable name + "CHECKBOX", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" + ["AutoAssign on Mission Start","Identifes and AutoAssigns Units Insignia during Mission Start."], + // _title - Display name or display name + tooltip (optional, default: same as setting name) + ["CVO", "Insignia"], // _category - Category for the settings menu + optional sub-category + true, // _valueInfo - Extra properties of the setting depending of _settingType. See examples below + 0, // _isGlobal - 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) + {}, // _script - Script to execute when setting is changed. (optional) + true // _needRestart - Setting will be marked as needing mission restart after being changed. (optional, default false) +] call CBA_fnc_addSetting; + +[ + "CVO_SET_Insignia_on_GroupChange", // _setting - Unique setting name. Matches resulting variable name + "CHECKBOX", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" + ["AutoAssign on Join/Leave of Group","Identifes and AutoAssigns Units Insignia when someone joins/leaves the Squad."], + // _title - Display name or display name + tooltip (optional, default: same as setting name) + ["CVO", "Insignia"], // _category - Category for the settings menu + optional sub-category + true, // _valueInfo - Extra properties of the setting depending of _settingType. See examples below + 1, // _isGlobal - 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) + { + [_this] call CVO_Insignia_fnc_EH_Group; + }, // _script - Script to execute when setting is changed. (optional) + false // _needRestart - Setting will be marked as needing mission restart after being changed. (optional, default false) +] call CBA_fnc_addSetting; + + +/* Add Further Option: AutoAssign on Group Change + +Whenever Leader changes? (this might trigger when unit gets uncon/killed?) -> Doesnt matter cause leadership is based on rank, not on actual leader of the group :smort: +Whenever Unit Joins or Leaves the squad. GroupIdChanged +// https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Group_Event_Handlers + + +*/ + +[ + "CVO_SET_Insignia_threshold_SL", // _setting - Unique setting name. Matches resulting variable name + "SLIDER", // _settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" + ["Threshhold for Squadleaders","An Infantrysquad needs to have atleast this many units for the highest ranking Unit to become an SL instead of a TL."], + // _title - Display name or display name + tooltip (optional, default: same as setting name) + ["CVO", "Insignia"], // _category - Category for the settings menu + optional sub-category + [3,12,5,0,false], // _valueInfo - Extra properties of the setting depending of _settingType. See examples below + 1, // _isGlobal - 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) + {}, // _script - Script to execute when setting is changed. (optional) + false // _needRestart - Setting will be marked as needing mission restart after being changed. (optional, default false) +] call CBA_fnc_addSetting; \ No newline at end of file diff --git a/addons/insignia/config.cpp b/addons/insignia/config.cpp index c039270..d559dd1 100644 --- a/addons/insignia/config.cpp +++ b/addons/insignia/config.cpp @@ -10,7 +10,7 @@ class CfgPatches { url = "http://chronivoron.net"; // Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game. - requiredVersion = 2.0; + requiredVersion = 2.04; // Required addons, used for setting load order. // When any of the addons is missing, pop-up warning will appear when launching the game. @@ -29,7 +29,7 @@ class CfgPatches { }; -class CfgUnitInsignia -{ - #include "insignias.hpp" -}; +#include "CfgFunctions.hpp" +#include "CfgUnitInsignia.hpp" +#include "CfgExtendedEventHandlers.hpp" + diff --git a/addons/insignia/functions/fn_apply.sqf b/addons/insignia/functions/fn_apply.sqf new file mode 100644 index 0000000..7eee7cd --- /dev/null +++ b/addons/insignia/functions/fn_apply.sqf @@ -0,0 +1,15 @@ +params [ + ["_unit", player, [objNull]], + ["_className", "", [""]] +]; + +if (_unit isEqualTo objNull) exitWith {}; +if (_className isEqualTo "") exitWith {}; + + +// Check if _className exists in CfgUnitInsignia +if !(_className in ("true" configClasses (configFile >> "CfgUnitInsignia") apply { configName _x})) exitWith {false}; + +_unit setVariable ["BIS_fnc_setUnitInsignia_class", nil]; +[_unit, _className] call BIS_fnc_setUnitInsignia; + diff --git a/addons/insignia/functions/fn_autoAssign.sqf b/addons/insignia/functions/fn_autoAssign.sqf new file mode 100644 index 0000000..b0a9863 --- /dev/null +++ b/addons/insignia/functions/fn_autoAssign.sqf @@ -0,0 +1,24 @@ +/* +* Author: Zorn +* identifies and applies the unit's insignia +* +* Arguments: +* 0 _unit +* +* Return Value: +* None +* +* Example: +* ['something', player] call cvo_insignia_fnc_autoAssign +* +* Public: Yes +*/ + +params [ + ["_unit", player, [objNull]] +]; + +private _className = [_unit] call cvo_insignia_fnc_identify; +if (_classname isEqualTo false) exitWith {}; +[_unit, _className] call cvo_insignia_fnc_apply; + diff --git a/addons/insignia/functions/fn_eh_arsenal.sqf b/addons/insignia/functions/fn_eh_arsenal.sqf new file mode 100644 index 0000000..0287bce --- /dev/null +++ b/addons/insignia/functions/fn_eh_arsenal.sqf @@ -0,0 +1,27 @@ +params [ + ["_enable", true, [true]] +]; + +private _id = missionNamespace getVariable ["cvo_insignia_eh_arsenal_id", "404"]; +private _isEnabled = _id isNotEqualTo "404"; + + +switch (true) do { + + case ( _enable && (!_isEnabled) ): { + + _id = ["ace_arsenal_displayClosed", { + + [player] call cvo_insignia_fnc_autoAssign; + + }] call CBA_fnc_addEventHandler; + + missionNamespace setVariable ["cvo_insignia_eh_arsenal_id", _id]; + }; + + case ( !_enable && (_isEnabled) ): { + ["ace_arsenal_displayClosed", _id] call CBA_fnc_removeEventHandler; + missionNamespace setVariable ["cvo_insignia_eh_arsenal_id", nil]; + }; +}; + diff --git a/addons/insignia/functions/fn_eh_group.sqf b/addons/insignia/functions/fn_eh_group.sqf new file mode 100644 index 0000000..7823448 --- /dev/null +++ b/addons/insignia/functions/fn_eh_group.sqf @@ -0,0 +1,11 @@ +params [ + ["_enable", true, [true]] +]; + +if !(isServer) exitWith {}; + +private _id = missionNamespace getVariable ["cvo_insignia_eh_group_id", "404"]; +private _isEnabled = _id isNotEqualTo "404"; + +// // ["CVO_Insignia_Request_AutoAssign",[], _group] call CBA_fnc_targetEvent; + diff --git a/addons/insignia/functions/fn_identify.sqf b/addons/insignia/functions/fn_identify.sqf new file mode 100644 index 0000000..8fc75d7 --- /dev/null +++ b/addons/insignia/functions/fn_identify.sqf @@ -0,0 +1,134 @@ +/* +* Author: Zorn +* Function to identify Insignia based on Groupname, Leadership Position and Trait (medic, Engineer) +* +* Arguments: +* +* Return Value: +* if failed, will return "404", otherwise, choosen Classname +* +* Example: +* [] call cvo_aux_insignia_fnc_identify; +* +* Public: Yes +*/ + + +params [ + ["_unit", player, [objNull]] +]; + + +if (_unit isEqualTo objNull) exitWith {false}; +if (!isPlayer _unit) exitWith {false}; + +private _groupName = groupId group _unit; + +private _regexReturn = flatten (_groupName regexFind ["1-[0-9]"]); + +if (_regexReturn isEqualTo []) then {_regexReturn = "404"}; + +_regexReturn = flatten _regexReturn # 0; + +private _callSign = switch (_regexReturn) do { + case "1-1": { "11" }; + case "1-2": { "12" }; + case "1-3": { "13" }; + case "1-4": { "14" }; + case "1-5": { "15" }; + + case "1-6": { "16_PL" }; + case "1-0": { "10_COY" }; + + default {"blank"}; +}; + +private _threshold = missionNamespace getVariable ["CVO_SET_Insignia_threshold_SL", 5]; + +private _sortedByRankID = [units group _unit, [], {rankId _x}, "DESCEND"] call BIS_fnc_sortBy; +private _ranks = _sortedByRankID apply {rankID _x}; +_ranks = _ranks arrayIntersect _ranks; + +private _classNameArray = ["CVO","insignia",_callSign]; +private _steamID = getPlayerUID _unit; +private _groupSize = count units _unit; + +private _highestRank = (_sortedByRankID # 0) isEqualTo _unit; + +private _highestRankAndSquadsize = ( + _highestRank && + {_groupSize >= _threshold} +); + + +private _notLowestRank = ( + !_higestRank && + { rankID (_sortedByRankID # -1) isNotEqualTo (rankID _unit); } +); + + +private _leadership = switch (_regexReturn) do { + case "1-0": { + switch _steamID do { + case "76561197960287930": { 69 }; + default { 0 }; + }; + }; + case "1-6": { + switch (true) do { + case _highestRank: { 2 }; + case _notLowestRank: { 1 }; + default { 0 }; + }; + }; + default { + switch (true) do { + case _highestRankAndSquadsize: { 2 }; + case _highestRank: { 1 }; + case _notLowestRank: { 1 }; + default { 0 }; + }; + }; +}; + + + + +private _isMedic = [_unit, 1] call ace_medical_treatment_fnc_isMedic; +private _isEngineer = [_unit, 1] call ace_repair_fnc_isEngineer; + +private _type = switch (_callSign) do { + + case "10_COY" : { + switch _leadership do { + case 69: { "CO" }; + default { "RFL" }; + }; + }; + + case "16_PL" : { + switch (true) do { + case (_leadership == 2): { "CO" }; + case (_leadership == 1): { "SGT" }; + case _isMedic: { "MED" }; + case _isEngineer: { "ENG" }; + default { "RFL" }; + }; + }; + + default { + switch (true) do { + case (_leadership == 2): { "SL" }; + case (_leadership == 1): { "TL" }; + case _isMedic: { "MED" }; + case _isEngineer: { "ENG" }; + default { "RFL" }; + }; + }; + +}; + +_classNameArray pushBack _type; +private _return = _classNameArray joinString "_"; +diag_log format ['[CVO](debug)(fn_identity) _return: %1', _return]; +_return diff --git a/addons/insignia/functions/fn_postInit.sqf b/addons/insignia/functions/fn_postInit.sqf new file mode 100644 index 0000000..0331b67 --- /dev/null +++ b/addons/insignia/functions/fn_postInit.sqf @@ -0,0 +1,20 @@ +if !(hasInterface) exitWith {}; + +// Once CBA_Settings are initialized, will run the fnc_eventhandler to add/remove the Ace Arsenal closed eventhandler. + +private _code = { + private _isEnabled = missionNamespace getVariable ["CVO_SET_Insignia_on_arsenalClosed", false]; + [_isEnabled] call CVO_Insignia_fnc_eventhandler; + + + _isEnabled = missionNamespace getVariable ["CVO_SET_Insignia_on_missionStart", false]; + if (_isEnabled) then { [player] call cvo_insignia_fnc_autoAssign; }; + +}; + +if (missionNamespace getVariable ["cba_settings_ready",false]) then _code else { ["CBA_settingsInitialized",_code,[]] call CBA_fnc_addEventHandler; }; + + + +// Register Event +["CVO_Insignia_Request_AutoAssign", { [player] call cvo_insignia_fnc_autoAssign; }] call CBA_fnc_addEventHandler; \ No newline at end of file diff --git a/addons/insignia/functions/fn_preInit.sqf b/addons/insignia/functions/fn_preInit.sqf new file mode 100644 index 0000000..26a98ad --- /dev/null +++ b/addons/insignia/functions/fn_preInit.sqf @@ -0,0 +1,9 @@ +addMissionEventHandler ["GroupCreated", { + params ["_group"]; + + diag_log format ['[CVO](debug)(fn_preInit) _group: %1', _group]; + diag_log format ['[CVO](debug)(fn_preInit) units _group: %1', units _group]; + private _hasPlayers = (units _group findif {isPlayer _x}) isNotEqualTo -1; + diag_log format ['[CVO](debug)(fn_preInit) _hasPlayers: %1', _hasPlayers]; + +}]; diff --git a/addons/insignia/img/cvo-11.paa b/addons/insignia/img/cvo-11-RFL.paa similarity index 100% rename from addons/insignia/img/cvo-11.paa rename to addons/insignia/img/cvo-11-RFL.paa diff --git a/addons/insignia/img/cvo-12.paa b/addons/insignia/img/cvo-12-RFL.paa similarity index 100% rename from addons/insignia/img/cvo-12.paa rename to addons/insignia/img/cvo-12-RFL.paa diff --git a/addons/insignia/img/cvo-13.paa b/addons/insignia/img/cvo-13-RFL.paa similarity index 100% rename from addons/insignia/img/cvo-13.paa rename to addons/insignia/img/cvo-13-RFL.paa diff --git a/addons/insignia/img/cvo-14.paa b/addons/insignia/img/cvo-14-RFL.paa similarity index 100% rename from addons/insignia/img/cvo-14.paa rename to addons/insignia/img/cvo-14-RFL.paa diff --git a/addons/insignia/img/cvo-15.paa b/addons/insignia/img/cvo-15-RFL.paa similarity index 100% rename from addons/insignia/img/cvo-15.paa rename to addons/insignia/img/cvo-15-RFL.paa diff --git a/addons/insignia/img/cvo-16-PL.paa b/addons/insignia/img/cvo-16-PL-RFL.paa similarity index 100% rename from addons/insignia/img/cvo-16-PL.paa rename to addons/insignia/img/cvo-16-PL-RFL.paa diff --git a/addons/insignia/img/cvo-blank-ENG.paa b/addons/insignia/img/cvo-blank-ENG.paa new file mode 100644 index 0000000..653f92e Binary files /dev/null and b/addons/insignia/img/cvo-blank-ENG.paa differ diff --git a/addons/insignia/img/cvo-blank-MED.paa b/addons/insignia/img/cvo-blank-MED.paa new file mode 100644 index 0000000..8e715d7 Binary files /dev/null and b/addons/insignia/img/cvo-blank-MED.paa differ diff --git a/addons/insignia/img/cvo-blank-RFL.paa b/addons/insignia/img/cvo-blank-RFL.paa new file mode 100644 index 0000000..5fe7c4c Binary files /dev/null and b/addons/insignia/img/cvo-blank-RFL.paa differ diff --git a/addons/insignia/img/cvo-blank-SL.paa b/addons/insignia/img/cvo-blank-SL.paa new file mode 100644 index 0000000..6b0c925 Binary files /dev/null and b/addons/insignia/img/cvo-blank-SL.paa differ diff --git a/addons/insignia/img/cvo-blank-TL.paa b/addons/insignia/img/cvo-blank-TL.paa new file mode 100644 index 0000000..828c695 Binary files /dev/null and b/addons/insignia/img/cvo-blank-TL.paa differ diff --git a/addons/insignia/insignias.hpp b/addons/insignia/insignias.hpp deleted file mode 100644 index 6695cb2..0000000 --- a/addons/insignia/insignias.hpp +++ /dev/null @@ -1,257 +0,0 @@ -class CVO_insignia_10_COY_CO -{ - displayName = "CVO 1-0 Company Commander"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-10-COY-CO.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_10_COY -{ - displayName = "CVO 1-0 Company"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-10-COY.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_16_PL_CO -{ - displayName = "CVO 1-6 Platoon Commander"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-CO.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_16_PL_SGt -{ - displayName = "CVO 1-6 Platoon Sergant"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-sgt.paa"; - textureVehicle = ""; -}; - - -class CVO_insignia_16_PL -{ - displayName = "CVO 1-6 Platoon"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_16_PL_MED -{ - displayName = "CVO 1-6 Platoon Medic"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-med.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_16_PL_ENG -{ - displayName = "CVO 1-6 Platoon Engineer"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-16-pl-eng.paa"; - textureVehicle = ""; -}; - - -class CVO_insignia_11_SL -{ - displayName = "CVO 1-1 Squad Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-11-SL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_11_TL -{ - displayName = "CVO 1-1 Team Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-11-TL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_11_PVT -{ - displayName = "CVO 1-1"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-11.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_11_CLS -{ - displayName = "CVO 1-1 Medic"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-11-MED.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_11_ENG -{ - displayName = "CVO 1-1 Engineer"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-11-ENG.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_12_SL -{ - displayName = "CVO 1-2 Squad Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-12-SL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_12_TL -{ - displayName = "CVO 1-2 Team Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-12-TL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_12_PVT -{ - displayName = "CVO 1-2"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-12.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_12_CLS -{ - displayName = "CVO 1-2 Medic"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-12-MED.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_12_ENG -{ - displayName = "CVO 1-2 Engineer"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-12-ENG.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_13_SL -{ - displayName = "CVO 1-3 Squad Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-13-SL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_13_TL -{ - displayName = "CVO 1-3 Team Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-13-TL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_13_PVT -{ - displayName = "CVO 1-3"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-13.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_13_CLS -{ - displayName = "CVO 1-3 Medic"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-13-MED.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_13_ENG -{ - displayName = "CVO 1-3 Engineer"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-13-ENG.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_14_SL -{ - displayName = "CVO 1-4 Squad Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-14-SL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_14_TL -{ - displayName = "CVO 1-4 Team Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-14-TL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_14_PVT -{ - displayName = "CVO 1-4"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-14.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_14_CLS -{ - displayName = "CVO 1-4 Medic"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-14-MED.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_14_ENG -{ - displayName = "CVO 1-4 Engineer"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-14-ENG.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_15_SL -{ - displayName = "CVO 1-5 Squad Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-15-SL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_15_TL -{ - displayName = "CVO 1-5 Team Leader"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-15-TL.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_15_PVT -{ - displayName = "CVO 1-5"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-15.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_15_CLS -{ - displayName = "CVO 1-5 Medic"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-15-MED.paa"; - textureVehicle = ""; -}; - -class CVO_insignia_15_ENG -{ - displayName = "CVO 1-5 Engineer"; - author = "CVO"; - texture = "z\cvo_aux\addons\insignia\img\cvo-15-ENG.paa"; - textureVehicle = ""; -}; \ No newline at end of file diff --git a/addons/others/functions/fn_airlift_cargo.sqf b/addons/others/functions/fn_airlift_cargo.sqf index 38fad09..3f86453 100644 --- a/addons/others/functions/fn_airlift_cargo.sqf +++ b/addons/others/functions/fn_airlift_cargo.sqf @@ -51,11 +51,7 @@ switch (typeName _heli) do { }; //Check if target can be airlifted -private _helperNeeded = false; -if (count getArray (configOf _cargoObj >> "slingLoadCargoMemoryPoints") == 0) then { - _helperNeeded = true; - -}; +private _helperNeeded = count getArray (configOf _cargoObj >> "slingLoadCargoMemoryPoints") == 0; { _x setGroupOwner 2; } forEach [_heliGRP, group driver _cargoObj]; @@ -69,14 +65,14 @@ if (_protected) then { // Create Helper Object for The Drop Off Point and Landing Point private ["_dropOffPosObj", "_returnPosObj"]; -If (_dropOffPos isEqualType []) then { +if (_dropOffPos isEqualType []) then { _dropOffPosObj = createVehicle ["Land_HelipadEmpty_F", _dropOffPos]; } else { _dropOffPosObj = _dropOffPos; _dropOffPos = getPos _dropOffPosObj; }; if (_returnPos isEqualTo "UNDEFINED") then { _returnPos = getPos leader _heliGRP; }; -If (_returnPos isEqualType []) then { +if (_returnPos isEqualType []) then { _returnPosObj = createVehicle ["Land_HelipadEmpty_F", _returnPos]; } else { _returnPosObj = _returnPos; _returnPos = getPos _returnPosObj; }; @@ -90,21 +86,19 @@ private _far = 750; private _mid = 200; private _near = 50; -if (_direction isEqualto "AUTO" && _dis < 750) then { +if (_direction isEqualTo "AUTO" && _dis < 750) then { _mid = _dis / _far * 200; _far = _dis; }; // Adjust Direction in case of "AUTO" -if (_direction isEqualto "AUTO") then { +if (_direction isEqualTo "AUTO") then { _direction = _cargoObj getDir _heliObj; }; - - // Empty the cargo vehicle and locks it + setMass for Airlift private _code = { params ["_heliObj","_cargoObj","_kickOut"]; @@ -137,7 +131,7 @@ private _code = { if (_ogMass isNotEqualTo "404") then { _cargoOBJ setMass _ogMass; }; }; -[ { (_this # 0 distance2D _this # 1) < 3 }, _code, [_dropOffPosObj, _cargoObj,_kickOut], 600, _code ] call CBA_fnc_waitUntilAndExecute; +[ { (_this # 0 distance2D _this # 1) < 10 }, _code, [_dropOffPosObj, _cargoObj,_kickOut], 600, _code ] call CBA_fnc_waitUntilAndExecute; _heliObj setFuel 1; @@ -149,40 +143,40 @@ private _wpPos3 = _cargoPos getPos [_near, _direction]; private _wpPos4 = + _cargoPos; private _wpPos5 = _cargoPos getPos [_far, _direction]; -private _wp1 = _heliGRP addWaypoint [_wpPos1, -1]; +private _wp1 = _heliGRP addWaypoint [_wpPos1, 0]; _wp1 setWaypointBehaviour "CARELESS"; _wp1 setWaypointStatements ["true", "vehicle this flyInHeight [50, true]; vehicle this limitSpeed 100;"]; _wp1 setWaypointSpeed "FULL"; -private _wp2 = _heliGRP addWaypoint [_wpPos2, -1]; +private _wp2 = _heliGRP addWaypoint [_wpPos2, 0]; _wp2 setWaypointStatements ["true", "vehicle this flyInHeight [30, true]; vehicle this limitSpeed 50;"]; _wp2 setWaypointSpeed "LIMITED"; -private _wp3 = _heliGRP addWaypoint [_wpPos3, -1]; +private _wp3 = _heliGRP addWaypoint [_wpPos3, 0]; _wp3 setWaypointStatements ["true", "vehicle this flyInHeight [30, false]; vehicle this limitSpeed 25;" ]; -private _wp4 = _heliGRP addWaypoint [_cargoObj, -1]; +private _wp4 = _heliGRP addWaypoint [_cargoObj, 0]; _wp4 waypointAttachVehicle _cargoObj; _wp4 setWaypointType "HOOK"; _wp4 setWaypointStatements ["true", "vehicle this flyInHeight [15, false]; vehicle this limitSpeed 75;"]; -private _wp5 = _heliGRP addWaypoint [_wpPos5, -1]; +private _wp5 = _heliGRP addWaypoint [_wpPos5, 0]; _wp5 setWaypointStatements ["true", "vehicle this flyInHeight [75, true]; vehicle this limitSpeed 200;"]; -private _wp6 = _heliGRP addWaypoint [_dropOffPos, -1]; -private _wp7 = _heliGRP addWaypoint [_dropOffPos, -1]; +private _wp6 = _heliGRP addWaypoint [_dropOffPos, 0]; +private _wp7 = _heliGRP addWaypoint [_dropOffPos, 0]; _wp7 waypointAttachVehicle _dropOffPosObj; _wp7 setWaypointType "UNHOOK"; _wp7 setWaypointStatements ["true", "vehicle this flyInHeight [50, false]; vehicle this limitSpeed 200;"]; -private _wp8 = _heliGRP addWaypoint [_returnPos, -1]; +private _wp8 = _heliGRP addWaypoint [_returnPos, 0]; _wp8 setWaypointSpeed "FULL"; _wp8 setWaypointStatements ["true", "vehicle this land 'LAND'"]; _wp8 waypointAttachVehicle _returnPosObj; diff --git a/addons/others/functions/fn_executeUnit.sqf b/addons/others/functions/fn_executeUnit.sqf index e71a175..8ea3c25 100644 --- a/addons/others/functions/fn_executeUnit.sqf +++ b/addons/others/functions/fn_executeUnit.sqf @@ -12,7 +12,7 @@ if (!isServer) exitWith {}; if (_target == objNull) exitWith {}; -if (CBA_MissionTime < 3) exitWith { [missionNameSpace getVariable _fnc_scriptName, _this, 3 + random 3] call CBA_fnc_waitAndExecute; }; +if (CBA_MissionTime < 3) exitWith { [missionNamespace getVariable _fnc_scriptName, _this, 3 + random 3] call CBA_fnc_waitAndExecute; }; if ( _dir isEqualTo "RND" ) then { _dir = selectRandom [-1,1] * random _rndVal;