diff --git a/.github/workflows/update-RPT-issue.yml b/.github/workflows/update-RPT-issue.yml new file mode 100644 index 0000000..cf4ae5e --- /dev/null +++ b/.github/workflows/update-RPT-issue.yml @@ -0,0 +1,23 @@ +name: Update RPT issue (#12) + +on: + push: + branches: + - main + +jobs: + updateRPT: + runs-on: ubuntu-latest + steps: + - name: Checkout the source code + uses: actions/checkout@master + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dependencies v1 + run: pip install pygithub + - name: Install dependencies v2 + run: pip install pygithub3 + - name: Update Issue + run: python3 tools/update_RPT_ToDo.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 43310b9..16b769e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,8 @@ "GVAR", "Koromiko", "listbox", + "OCAP", + "pygithub", "QEFUNC", "QEGVAR", "QFUNC", diff --git a/addons/ace/XEH_PREP.hpp b/addons/ace/XEH_PREP.hpp index a0832ee..ae69add 100644 --- a/addons/ace/XEH_PREP.hpp +++ b/addons/ace/XEH_PREP.hpp @@ -1 +1,6 @@ +PREP(addActionsManageKit); +PREP(addActionsTPToSquad); PREP(initLocalArsenal); +PREP(interactions); +PREP(playerActions); +PREP(zeusActions); diff --git a/addons/ace/XEH_clientPostInit.sqf b/addons/ace/XEH_clientPostInit.sqf index 161de3a..0961276 100644 --- a/addons/ace/XEH_clientPostInit.sqf +++ b/addons/ace/XEH_clientPostInit.sqf @@ -1,145 +1,13 @@ #include "script_component.hpp" // should behave identically to initPlayerLocal -if (!("@ace" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; - -/* ACE3 Interactions */ -private ["_action", "_statement"]; -private _buttons = missionNamespace getVariable [QEGVAR(configuration,buttons), []]; -private _arsenals = missionNamespace getVariable [QEGVAR(configuration,arsenals), []]; -private _commonObjects = +_buttons + _arsenals; -_commonObjects = _commonObjects arrayIntersect _commonObjects; - -// ======================================================================================= -// Player Self Actions - -// SIA Parent Action -_action = [QGVAR(siaActions), " SIA Options", QPATHTOEF(core,ui\logo_sia3f_tiny.paa), {}, { true }] call ace_interact_menu_fnc_createAction; -[typeOf player, 1, ["ACE_SelfActions"], _action] call ace_interact_menu_fnc_addActionToClass; - -// Go AFK -if (GET_CONFIG(enableGoAFK,true)) then { - private _action = [QGVAR(AFK), "Go AFK", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\wait_ca.paa", { [] spawn EFUNC(core,goAFK) }, { !(player getVariable [QEGVAR(core,isAFK), false]) }] call ace_interact_menu_fnc_createAction; - [typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _action] call ace_interact_menu_fnc_addActionToClass; -}; - -// Setup safeStart Hint -_action = [QGVAR(safeStartHint), "Show Mission Info", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\unknown_ca.paa", { call EFUNC(core,hint) }, { true }] call ace_interact_menu_fnc_createAction; -[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _action] call ace_interact_menu_fnc_addActionToClass; - -_statement = { - if (player getVariable [QEGVAR(core,safeStartHintEnabled), true]) then { - player setVariable [QEGVAR(core,safeStartHintEnabled), false]; - hint "Setup Hint is now DISABLED"; - } else { - player setVariable [QEGVAR(core,safeStartHintEnabled), true]; - hint "Setup Hint is now ENABLED"; - }; -}; - -_action = [QGVAR(safeStartHintToggle), "Toggle Setup Hint", "", _statement, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; -[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions), QGVAR(safeStartHint)], _action] call ace_interact_menu_fnc_addActionToClass; - -// Music Control -_action = [QGVAR(MusicStop), "Stop Music", "\A3\Ui_F\Data\IGUI\RscIngameUI\RscUnitInfoAirRTDFull\ico_cpt_music_OFF_ca.paa", { playMusic "" }, { true }] call ace_interact_menu_fnc_createAction; -[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _action] call ace_interact_menu_fnc_addActionToClass; - -_action = [QGVAR(MusicMute), "Mute All Music", "", { 1 fadeMusic 0 }, { musicVolume > 0 }] call ace_interact_menu_fnc_createAction; -[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions), QGVAR(MusicStop)], _action] call ace_interact_menu_fnc_addActionToClass; - -_action = [QGVAR(MusicUnmute), "Unmute All Music", "", { 1 fadeMusic 0.5 }, { musicVolume <= 0 }] call ace_interact_menu_fnc_createAction; -[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions), QGVAR(MusicStop)], _action] call ace_interact_menu_fnc_addActionToClass; - -// ======================================================================================= -// Arsenal/Button Actions - -// Teleport to Squad -if (!isNil "_buttons" && GET_CONFIG(enableTPToSquad,true)) then { - _action = [QGVAR(TpSquad), "Teleport to Squad", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\meet_ca.paa", { [] spawn EFUNC(core,teleportToSquad) }, { true }] call ace_interact_menu_fnc_createAction; - { [_x, 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToObject } forEach _buttons; -}; - -// Manage Loadouts -if (GET_CONFIG(enableManageKit,true)) then { - - _statement = { - player setVariable [QEGVAR(core,savedLoadout), getUnitLoadout player]; - hint "Kit saved. Will be loaded on respawn."; - }; - - _action = [QGVAR(kit), "Save/Manage Kit", "\A3\Ui_F\Data\IGUI\Cfg\Actions\gear_ca.paa", _statement, { true }] call ace_interact_menu_fnc_createAction; - { [_x, 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToObject; } forEach _commonObjects; - - _action = [QGVAR(kitSave), "Save Current Kit", "\A3\Ui_F\Data\GUI\Rsc\RscDisplayArcadeMap\icon_save_ca.paa", _statement, { true }] call ace_interact_menu_fnc_createAction; - { [_x, 0, ["ACE_MainActions", QGVAR(kit)], _action, true] call ace_interact_menu_fnc_addActionToObject; } forEach _commonObjects; - - _action = [QGVAR(kitLoad), "Load Saved Kit", "\A3\Ui_F\Data\IGUI\Cfg\Actions\reammo_ca.paa", { player setUnitLoadout (player getVariable [QEGVAR(core,savedLoadout), []]); hint "Saved kit loaded." }, { true }] call ace_interact_menu_fnc_createAction; - { [_x, 0, ["ACE_MainActions", QGVAR(kit)], _action, true] call ace_interact_menu_fnc_addActionToObject; } forEach _commonObjects; - - _action = [QGVAR(kitClear), "Remove Saved Kit", "z\ace\addons\arsenal\data\iconClearContainer.paa", { player setVariable [QEGVAR(core,savedLoadout), nil]; hint "Saved kit cleared. Will use kit from death when respawned" }, { true }] call ace_interact_menu_fnc_createAction; - { [_x, 0, ["ACE_MainActions", QGVAR(kit)], _action, true] call ace_interact_menu_fnc_addActionToObject; } forEach _commonObjects; -}; - -// Update Loadout Info -if (GET_CONFIG(enableLoadoutInfo,true) && GET_CONFIG(briefLoadout,true)) then { - _action = [QGVAR(loadoutNotesRefresh), "Update Team Loadout Info", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\documents_ca.paa", { - call EFUNC(core,loadoutNotes); - openMap true; - player selectDiarySubject "Diary"; - }, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - [typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _action] call ace_interact_menu_fnc_addActionToClass; -}; - -// ======================================================================================= -// Zeus Actions - -// Pre-OP Phases -private _actionSetPhase = [QEGVAR(core,safeStart_phase), "Set Phase", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\use_ca.paa", {}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - -private _actionPhaseBriefUpper = [QGVAR(safeStart_phaseBriefUpper), "Upper-level Brief", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa", { - [QEGVAR(core,safeStart_phase), ["The upper-level brief is commencing!", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; - missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Upper-level Briefing", true]; -}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - -private _actionPhaseBriefLower = [QGVAR(safeStart_phaseBriefLower), "Lower-level Brief", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa", { - [QEGVAR(core,safeStart_phase), ["The lower-level brief is commencing!", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; - missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Lower-level Briefing", true]; -}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - -private _actionPhaseKit = [QGVAR(safeStart_phaseKit), "Kit Up", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\rearm_ca.paa", { - [QEGVAR(core,safeStart_phase), ["Time to kit up!", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\rearm_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; - missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Kitting Up", true]; -}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - -private _actionPhaseMount = [QGVAR(safeStart_phaseMount), "Mount Up", "\A3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_loadDevice_ca.paa", { - [QEGVAR(core,safeStart_phase), ["Time to mount up!", "\A3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_loadDevice_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; - missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Mounting Up", true]; -}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - -private _actionPhaseStandby = [QGVAR(safeStart_phaseStandby), "Stand By", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\wait_ca.paa", { - [QEGVAR(core,safeStart_phase), ["Stand By", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\wait_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; - missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Standing By", true]; -}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; - -private _phaseActions = [_actionPhaseBriefUpper, _actionPhaseBriefLower, _actionPhaseKit, _actionPhaseMount, _actionPhaseStandby]; -[["ACE_ZeusActions"], _actionSetPhase] call ace_interact_menu_fnc_addActionToZeus; -{ [["ACE_ZeusActions", QEGVAR(core,safeStart_phase)], _x] call ace_interact_menu_fnc_addActionToZeus } forEach _phaseActions; - -// ToDo: Give plt leader access to phase change. - -// Start Mission Action + Confirmation -_action = [QGVAR(safeStart_missionStart), "Start Mission", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\getin_ca.paa", {}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; -[["ACE_ZeusActions"], _action] call ace_interact_menu_fnc_addActionToZeus; - -_action = [QGVAR(safeStart_missionStartConfirm), "Confirm", "", { call EFUNC(core,startMission) }, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; -[["ACE_ZeusActions", QGVAR(safeStart_missionStart)], _action] call ace_interact_menu_fnc_addActionToZeus; - -// End Mission Action + Confirmation -_action = [QGVAR(safeStart_missionEnd), "End Mission", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\getOut_ca.paa", {}, { (missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; -[["ACE_ZeusActions"], _action] call ace_interact_menu_fnc_addActionToZeus; - -_action = [QGVAR(safeStart_missionEndWin), "Win", "", { ["end1", true, true] remoteExecCall ["BIS_fnc_endMission"] }, { (missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; -[["ACE_ZeusActions", QGVAR(safeStart_missionEnd)], _action] call ace_interact_menu_fnc_addActionToZeus; - -_action = [QGVAR(safeStart_missionEndLose), "Lose", "", { ["end1", false, true] remoteExecCall ["BIS_fnc_endMission"] }, { (missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; -[["ACE_ZeusActions", QGVAR(safeStart_missionEnd)], _action] call ace_interact_menu_fnc_addActionToZeus; +if ( + !("@ace" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; + +// Player Self Actions +call FUNC(playerActions); +call FUNC(zeusActions); diff --git a/addons/ace/XEH_preInit.sqf b/addons/ace/XEH_preInit.sqf index cfc3a2d..e38158f 100644 --- a/addons/ace/XEH_preInit.sqf +++ b/addons/ace/XEH_preInit.sqf @@ -4,6 +4,11 @@ ADDON = false; #include "XEH_PREP.hpp" -if (!("@ace" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + !("@ace" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; ADDON = true; diff --git a/addons/ace/XEH_preStart.sqf b/addons/ace/XEH_preStart.sqf index dfe8296..440b088 100644 --- a/addons/ace/XEH_preStart.sqf +++ b/addons/ace/XEH_preStart.sqf @@ -2,4 +2,9 @@ #include "XEH_PREP.hpp" -if (!("@ace" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + !("@ace" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; diff --git a/addons/ace/functions/fnc_addActionsManageKit.sqf b/addons/ace/functions/fnc_addActionsManageKit.sqf new file mode 100644 index 0000000..52f998b --- /dev/null +++ b/addons/ace/functions/fnc_addActionsManageKit.sqf @@ -0,0 +1,66 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, Siege + * Add 'Manage Kit' actions to the given objects. + * + * Arguments: + * 0: button objects + * + * Return Value: + * None + * + * Example: + * [[someButton, someOtherButton]] call sia3f_ace_fnc_addActionsManageKit +*/ + +params [ + ["_objects", [], [[objNull]]] +]; + +if (!GET_CONFIG(enableManageKit,true) || _objects isEqualTo []) exitWith { + LOG_FUNC_END_ERROR("enableManageKit disabled or invalid/empty params"); +}; +LOG_FUNC_START; + +TRACE_1("params",_objects); + +// Manage Loadouts Expressions +private _statementKitSave = { + player setVariable [QEGVAR(core,savedLoadout), getUnitLoadout player]; + hint "Kit saved. Will be loaded on respawn."; +}; + +private _statementKitLoad = { + player setUnitLoadout (player getVariable [QEGVAR(core,savedLoadout), []]); + hint "Saved kit loaded."; +}; + +private _statementKitClear = { + player setVariable [QEGVAR(core,savedLoadout), nil]; + hint "Saved kit cleared. Will use kit from death when respawned."; +}; + +if ("@ace" call EFUNC(core,checkModPresence)) then { + private _mainAction = [QGVAR(kit), "Save/Manage Kit", "\A3\Ui_F\Data\IGUI\Cfg\Actions\gear_ca.paa", _statementKitSave, { true }] call ace_interact_menu_fnc_createAction; + private _saveAction = [QGVAR(kitSave), "Save Current Kit", "\A3\Ui_F\Data\GUI\Rsc\RscDisplayArcadeMap\icon_save_ca.paa", _statementKitSave, { true }] call ace_interact_menu_fnc_createAction; + private _loadAction = [QGVAR(kitLoad), "Load Saved Kit", "\A3\Ui_F\Data\IGUI\Cfg\Actions\reammo_ca.paa", _statementKitLoad, { true }] call ace_interact_menu_fnc_createAction; + private _clearAction = [QGVAR(kitClear), "Remove Saved Kit", "z\ace\addons\arsenal\data\iconClearContainer.paa", _statementKitClear, { true }] call ace_interact_menu_fnc_createAction; + + { + private _y = _x; + [_y, 0, ["ACE_MainActions"], _mainAction, true] call ace_interact_menu_fnc_addActionToObject; + { [_y, 0, ["ACE_MainActions", QGVAR(kit)], _x, true] call ace_interact_menu_fnc_addActionToObject; } forEach [_saveAction, _loadAction, _clearAction]; + } forEach _objects; + +} else { + { + _x addAction ["----------", {}]; // 10 indents for spacing + _x addAction [" Save Current Kit", _statementKitSave]; + _x addAction [" Load Saved Kit", _statementKitLoad]; + _x addAction [" Remove Saved Kit", _statementKitClear]; + _x addAction ["----------", {}]; + } forEach _objects; +}; + +LOG_FUNC_END; diff --git a/addons/ace/functions/fnc_addActionsTPToSquad.sqf b/addons/ace/functions/fnc_addActionsTPToSquad.sqf new file mode 100644 index 0000000..55720cd --- /dev/null +++ b/addons/ace/functions/fnc_addActionsTPToSquad.sqf @@ -0,0 +1,37 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, Siege + * Add 'Teleport to Squad' actions to the given objects. + * + * Arguments: + * 0: button objects + * + * Return Value: + * None + * + * Example: + * [[someButton, someOtherButton]] call sia3f_ace_fnc_addActionsTPToSquad +*/ + +params [ + ["_objects", [], [[objNull]]] +]; + +if (!GET_CONFIG(enableTPToSquad,true) || _objects isEqualTo []) exitWith { + LOG_FUNC_END_ERROR("enableTPToSquad disabled or invalid/empty params"); +}; +LOG_FUNC_START; + +TRACE_1("params",_objects); + +if ("@ace" call EFUNC(core,checkModPresence)) then { + private _tpToSquadAction = [QGVAR(TpSquad), "Teleport to Squad", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\meet_ca.paa", { [] spawn EFUNC(core,teleportToSquad) }, { true }] call ace_interact_menu_fnc_createAction; + { [_x, 0, ["ACE_MainActions"], _tpToSquadAction, true] call ace_interact_menu_fnc_addActionToObject; } forEach _objects; +} else { + { + _x addAction [" Teleport to Squad", { [] spawn EFUNC(core,teleportToSquad); }]; + } forEach _objects; +}; + +LOG_FUNC_END; diff --git a/addons/ace/functions/fnc_interactions.sqf b/addons/ace/functions/fnc_interactions.sqf new file mode 100644 index 0000000..a3af585 --- /dev/null +++ b/addons/ace/functions/fnc_interactions.sqf @@ -0,0 +1,35 @@ +#include "script_component.hpp" + +/* + * Author: Siege + * Organizes buttons/arsenals and calls add action functions. + * + * Arguments: + * 0: Buttons + * 1: Arsenals + * + * Return Value: + * None + * + * Example: + * call sia3f_ace_fnc_interactions +*/ + +// interaction objects +params [ + ["_buttons", [], [[]]], + ["_arsenals", [], [[]]] +]; +LOG_FUNC_START; +TRACE_2("params",_buttons,_arsenals); + +private _commonObjects = +_buttons + _arsenals; +_commonObjects = _commonObjects arrayIntersect _commonObjects; +TRACE_3("interaction objects",_buttons,_arsenals,_commonObjects); + +// Arsenal/Button Actions +[_buttons] call FUNC(addActionsTPToSquad); +[_commonObjects] call FUNC(addActionsManageKit); +["addActions", _buttons] call EFUNC(core,teleport); + +LOG_FUNC_END; diff --git a/addons/ace/functions/fnc_playerActions.sqf b/addons/ace/functions/fnc_playerActions.sqf new file mode 100644 index 0000000..533ebf7 --- /dev/null +++ b/addons/ace/functions/fnc_playerActions.sqf @@ -0,0 +1,63 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, Siege + * Add ace self actions for all players. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call sia3f_ace_fnc_playerActions +*/ + +LOG_FUNC_START; + +private _parentAction = [QGVAR(siaActions), " SIA Options", QPATHTOEF(core,ui\logo_sia3f_tiny.paa), {}, { true }] call ace_interact_menu_fnc_createAction; +[typeOf player, 1, ["ACE_SelfActions"], _parentAction] call ace_interact_menu_fnc_addActionToClass; + +// AFK +if (GET_CONFIG(enableGoAFK,true)) then { + private _afkAction = [QGVAR(AFK), "Go AFK", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\wait_ca.paa", { [] spawn EFUNC(core,goAFK); }, { !(player getVariable [QEGVAR(core,isAFK), false]) }] call ace_interact_menu_fnc_createAction; + [typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _afkAction] call ace_interact_menu_fnc_addActionToClass; +}; + +// safeStart Hint +private _safeStartAction = [QGVAR(safeStartHint), "Show Mission Info", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\unknown_ca.paa", { call EFUNC(core,hint); }, { true }] call ace_interact_menu_fnc_createAction; +[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _safeStartAction] call ace_interact_menu_fnc_addActionToClass; + +private _safeStartToggleAction = [QGVAR(safeStartHintToggle), "Toggle Setup Hint", "", { + if (player getVariable [QEGVAR(core,safeStartHintEnabled), true]) then { + player setVariable [QEGVAR(core,safeStartHintEnabled), false]; + hint "Setup Hint is now DISABLED"; + } else { + player setVariable [QEGVAR(core,safeStartHintEnabled), true]; + hint "Setup Hint is now ENABLED"; + }; +}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; +[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions), QGVAR(safeStartHint)], _safeStartToggleAction] call ace_interact_menu_fnc_addActionToClass; + +// Music Control +private _musicStopAction = [QGVAR(MusicStop), "Stop Music", "\A3\Ui_F\Data\IGUI\RscIngameUI\RscUnitInfoAirRTDFull\ico_cpt_music_OFF_ca.paa", { playMusic ""; }, { true }] call ace_interact_menu_fnc_createAction; +private _musicMuteAction = [QGVAR(MusicMute), "Mute All Music", "", { 1 fadeMusic 0; }, { musicVolume > 0 }] call ace_interact_menu_fnc_createAction; +private _musicUnmuteAction = [QGVAR(MusicUnmute), "Unmute All Music", "", { 1 fadeMusic 0.5; }, { musicVolume <= 0 }] call ace_interact_menu_fnc_createAction; + +[typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _musicStopAction] call ace_interact_menu_fnc_addActionToClass; +{ [typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions), QGVAR(MusicStop)], _x] call ace_interact_menu_fnc_addActionToClass; } forEach [_musicMuteAction, _musicUnmuteAction]; + +// Update Loadout Info +if (GET_CONFIG(enableLoadoutInfo,true) && GET_CONFIG(briefLoadout,true)) then { + private _loadoutRefreshAction = [QGVAR(loadoutNotesRefresh), "Update Team Loadout Info", "\A3\Ui_F\Data\IGUI\Cfg\simpleTasks\types\documents_ca.paa", { + call EFUNC(core,loadoutNotes); + openMap true; + player selectDiarySubject "Diary"; + }, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + [typeOf player, 1, ["ACE_SelfActions", QGVAR(siaActions)], _loadoutRefreshAction] call ace_interact_menu_fnc_addActionToClass; +}; + +// ToDo: Give plt leader access to phase change. + +LOG_FUNC_END; diff --git a/addons/ace/functions/fnc_zeusActions.sqf b/addons/ace/functions/fnc_zeusActions.sqf new file mode 100644 index 0000000..1d1e53b --- /dev/null +++ b/addons/ace/functions/fnc_zeusActions.sqf @@ -0,0 +1,65 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, Siege + * Add ace actions for zeus(es) + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call sia3f_ace_fnc_zeusActions +*/ + +LOG_FUNC_START; + +// Pre-OP Phases +private _actionSetPhase = [QEGVAR(core,safeStart_phase), "Set Phase", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\use_ca.paa", {}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +private _actionPhaseBriefUpper = [QGVAR(safeStart_phaseBriefUpper), "Upper-level Brief", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa", { + [QEGVAR(core,safeStart_phase), ["The upper-level brief is commencing!", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; + missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Upper-level Briefing", true]; +}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +private _actionPhaseBriefLower = [QGVAR(safeStart_phaseBriefLower), "Lower-level Brief", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa", { + [QEGVAR(core,safeStart_phase), ["The lower-level brief is commencing!", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\whiteboard_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; + missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Lower-level Briefing", true]; +}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +private _actionPhaseKit = [QGVAR(safeStart_phaseKit), "Kit Up", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\rearm_ca.paa", { + [QEGVAR(core,safeStart_phase), ["Time to kit up!", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\rearm_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; + missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Kitting Up", true]; +}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +private _actionPhaseMount = [QGVAR(safeStart_phaseMount), "Mount Up", "\A3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_loadDevice_ca.paa", { + [QEGVAR(core,safeStart_phase), ["Time to mount up!", "\A3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_loadDevice_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; + missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Mounting Up", true]; +}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +private _actionPhaseStandby = [QGVAR(safeStart_phaseStandby), "Stand By", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\wait_ca.paa", { + [QEGVAR(core,safeStart_phase), ["Stand By", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\wait_ca.paa"]] remoteExec ["BIS_fnc_showNotification"]; + missionNamespace setVariable [QEGVAR(core,safeStart_phase), "Standing By", true]; +}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +[["ACE_ZeusActions"], _actionSetPhase] call ace_interact_menu_fnc_addActionToZeus; +{ [["ACE_ZeusActions", QEGVAR(core,safeStart_phase)], _x] call ace_interact_menu_fnc_addActionToZeus; } forEach [_actionPhaseBriefUpper, _actionPhaseBriefLower, _actionPhaseKit, _actionPhaseMount, _actionPhaseStandby]; + +// Start Mission Action + Confirmation +private _actionMissionStart = [QGVAR(safeStart_missionStart), "Start Mission", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\getin_ca.paa", {}, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; +private _actionConfirm = [QGVAR(safeStart_missionStartConfirm), "Confirm", "", { call EFUNC(core,startMission); }, { !(missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +[["ACE_ZeusActions"], _actionMissionStart] call ace_interact_menu_fnc_addActionToZeus; +[["ACE_ZeusActions", QGVAR(safeStart_missionStart)], _actionConfirm] call ace_interact_menu_fnc_addActionToZeus; + +// End Mission Action + Confirmation +private _actionMissionEnd = [QGVAR(safeStart_missionEnd), "End Mission", "\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\getOut_ca.paa", {}, { (missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; +private _actionEndWin = [QGVAR(safeStart_missionEndWin), "Win", "", { ["end1", true, true] remoteExecCall ["BIS_fnc_endMission"]; }, { (missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; +private _actionEndLose = [QGVAR(safeStart_missionEndLose), "Lose", "", { ["end1", false, true] remoteExecCall ["BIS_fnc_endMission"]; }, { (missionNamespace getVariable [QEGVAR(core,missionStarted), false]) }] call ace_interact_menu_fnc_createAction; + +[["ACE_ZeusActions"], _actionMissionEnd] call ace_interact_menu_fnc_addActionToZeus; +{ [["ACE_ZeusActions", QGVAR(safeStart_missionEnd)], _x] call ace_interact_menu_fnc_addActionToZeus } forEach [_actionEndWin, _actionEndLose]; + +LOG_FUNC_END; diff --git a/addons/ace/script_component.hpp b/addons/ace/script_component.hpp index b9ccd08..9da6de5 100644 --- a/addons/ace/script_component.hpp +++ b/addons/ace/script_component.hpp @@ -7,11 +7,11 @@ // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MAIN - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_MAIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN #endif #include "\z\sia3f\addons\main\script_macros.hpp" diff --git a/addons/configuration/Cfg3DEN.hpp b/addons/configuration/Cfg3DEN.hpp index b920f58..07e0f2e 100644 --- a/addons/configuration/Cfg3DEN.hpp +++ b/addons/configuration/Cfg3DEN.hpp @@ -14,61 +14,7 @@ class Cfg3DEN { class Object { class AttributeCategories { - class GVAR(objectSettings) { - displayName = "SIA Framework"; - collapsed = 0; - class Attributes { - class GVAR(isArsenal) { - displayName = "Is Arsenal"; - tooltip = "Check if this object is meant to be an arsenal"; - property = QGVAR(isArsenal); - control = "Checkbox"; - expression = QUOTE( \ - if (_value) then { \ - if (isNil QQGVAR(arsenals)) then { GVAR(arsenals) = []; }; \ - GVAR(arsenals) pushBackUnique _this; \ - } else { \ - GVAR(arsenals) = GVAR(arsenals) - [_this]; \ - }; \ - ); - defaultValue = false; - - // condition should be objectSimulated && !objectControllable && !logicModule - condition = "objectSimulated * (1 - objectControllable) * (1 - logicModule)"; // https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Condition - }; - - class GVAR(isButton) { - displayName = "Is Button"; - tooltip = "Check if this object is meant to be a button"; - property = QGVAR(isButton); - control = "Checkbox"; - expression = QUOTE( \ - if (_value) then { \ - if (isNil QQGVAR(buttons)) then { GVAR(buttons) = []; }; \ - GVAR(buttons) pushBackUnique _this; \ - } else { \ - GVAR(buttons) = GVAR(buttons) - [_this]; \ - }; \ - ); - defaultValue = false; - // condition should be objectSimulated && !objectControllable && !logicModule - condition = "objectSimulated * (1 - objectControllable) * (1 - logicModule)"; // https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Condition - }; - - class GVAR(role) { - displayName = "Role"; - tooltip = "The unit's role (e.g, ""Rifleman""); Only needs to be defined on playable units"; - property = QGVAR(role); - control = "Edit"; // ToDo: custom control that hides when unit is not playable - expression = QUOTE([ARR_2(_this, _value)] call FUNC(rolesExpression);); - typeName = "STRING"; - defaultValue = "''"; - - // only units should have this attribute - condition = "objectControllable"; - }; - }; - }; + #include "objectAttributes.hpp" }; }; diff --git a/addons/configuration/CfgEventHandlers.hpp b/addons/configuration/CfgEventHandlers.hpp index abb036f..d39cf9b 100644 --- a/addons/configuration/CfgEventHandlers.hpp +++ b/addons/configuration/CfgEventHandlers.hpp @@ -9,3 +9,9 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + +class Extended_PostInit_EventHandlers { + class ADDON { + serverInit = QUOTE(call COMPILE_FILE(XEH_serverPostInit)); + }; +}; diff --git a/addons/configuration/README.md b/addons/configuration/README.md index 47898d4..ff03a33 100644 --- a/addons/configuration/README.md +++ b/addons/configuration/README.md @@ -1,6 +1,6 @@ # configuration -Handles all functionality in the Eden Editor. +Handles all functionality in the Eden Editor. (Note: The expression attribute for objects is only executed on the server. I do not fully understand this, but I *think* that it works on local MP and singleplayer, but only on the server for dedicated MP.) ## Config Definitions This will define all of the variables that can be used with ``GET_CONFIG(var,default)``. The following table lists the variable name, in-game name, description , and type of every config value. Ordered in the same way it is in-game. diff --git a/addons/configuration/XEH_serverPostInit.sqf b/addons/configuration/XEH_serverPostInit.sqf new file mode 100644 index 0000000..39066c8 --- /dev/null +++ b/addons/configuration/XEH_serverPostInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (allDisplays isEqualTo [findDisplay 0] && !is3DEN) exitWith {}; + +[GVAR(buttons), GVAR(arsenals)] remoteExecCall [QEFUNC(ace,interactions), 0, true]; diff --git a/addons/configuration/functions/fnc_additionalItemsAddCompatible.sqf b/addons/configuration/functions/fnc_additionalItemsAddCompatible.sqf index 5a74455..30e556d 100644 --- a/addons/configuration/functions/fnc_additionalItemsAddCompatible.sqf +++ b/addons/configuration/functions/fnc_additionalItemsAddCompatible.sqf @@ -18,7 +18,7 @@ private _category = lbCurSel ((findDisplay 8502) displayCtrl 2300); // Exit if selected category is not attachments or magazines if !(_category in [4, 5, 6, 7, 8]) exitWith { - LOG_FUNC_END_ERROR("attempted to add compatible items with invalid category"); + LOG_FUNC_END_ERROR("attempted to add compatible items with invalid category"); }; private _configItems = +(uiNamespace getVariable [QGVAR(configItems), []]); @@ -33,36 +33,36 @@ private _cfgWeapons = configFile >> "CfgWeapons"; private _itemsToAdd = []; if (_category == 8) then { - private _magazineGroups = uiNamespace getVariable QGVAR(magazineGroups); - private _cfgMagazines = configFile >> "CfgMagazines"; + private _magazineGroups = uiNamespace getVariable QGVAR(magazineGroups); + private _cfgMagazines = configFile >> "CfgMagazines"; - { - private _weaponConfig = _cfgWeapons >> _x; + { + private _weaponConfig = _cfgWeapons >> _x; - { - private _muzzleConfig = if (_x == "this") then { _weaponConfig } else { _weaponConfig >> _x }; + { + private _muzzleConfig = if (_x == "this") then { _weaponConfig } else { _weaponConfig >> _x }; - // Only add existent magazines and ensure correct classname case - private _magazines = getArray (_muzzleConfig >> "magazines") select { isClass (_cfgMagazines >> _x) }; - _magazines = _magazines apply { configName (_cfgMagazines >> _x) }; - _itemsToAdd append _magazines; + // Only add existent magazines and ensure correct classname case + private _magazines = getArray (_muzzleConfig >> "magazines") select { isClass (_cfgMagazines >> _x) }; + _magazines = _magazines apply { configName (_cfgMagazines >> _x) }; + _itemsToAdd append _magazines; - { - _itemsToAdd append (_magazineGroups get (toLower _x)); - } forEach getArray (_muzzleConfig >> "magazineWell"); - } forEach getArray (_weaponConfig >> "muzzles"); - } forEach _attributeWeapons; + { + _itemsToAdd append (_magazineGroups get (toLower _x)); + } forEach getArray (_muzzleConfig >> "magazineWell"); + } forEach getArray (_weaponConfig >> "muzzles"); + } forEach _attributeWeapons; } else { - private _attachmentCategory = _category - 4; - private _filter = ["optic", "pointer", "muzzle", "bipod"] select _attachmentCategory; + private _attachmentCategory = _category - 4; + private _filter = ["optic", "pointer", "muzzle", "bipod"] select _attachmentCategory; - { - _itemsToAdd append ([_x, _filter] call CBA_fnc_compatibleItems); - } forEach _attributeWeapons; + { + _itemsToAdd append ([_x, _filter] call CBA_fnc_compatibleItems); + } forEach _attributeWeapons; - // Only add items with scope of 2 and ensure correct classname case - _itemsToAdd = _itemsToAdd select { getNumber (_cfgWeapons >> _x >> "scope") == 2 }; - _itemsToAdd = _itemsToAdd apply { configName (_cfgWeapons >> _x) }; + // Only add items with scope of 2 and ensure correct classname case + _itemsToAdd = _itemsToAdd select { getNumber (_cfgWeapons >> _x >> "scope") == 2 }; + _itemsToAdd = _itemsToAdd apply { configName (_cfgWeapons >> _x) }; }; _items append _itemsToAdd; diff --git a/addons/configuration/functions/fnc_initFramework.sqf b/addons/configuration/functions/fnc_initFramework.sqf index aabc80b..a5d302f 100644 --- a/addons/configuration/functions/fnc_initFramework.sqf +++ b/addons/configuration/functions/fnc_initFramework.sqf @@ -14,8 +14,7 @@ * call sia3f_configuration_fnc_initFramework */ -if (("sia3f_configuration_hiddenConfigValues" get3DENMissionAttribute "sia3f_configuration_frameworkInit") isEqualTo true) exitWith { - // attribute starts as '0' and is set to true once initialization is complete, so comparison can't be type strict (no ==) +if (GET_CONFIG(frameworkInit,false)) exitWith { ["SIA Mission Framework has already been initialized.", 1] call BIS_fnc_3DENNotification; LOG_FUNC_END_ERROR("framework already initialized"); }; diff --git a/addons/configuration/objectAttributes.hpp b/addons/configuration/objectAttributes.hpp new file mode 100644 index 0000000..5bbc288 --- /dev/null +++ b/addons/configuration/objectAttributes.hpp @@ -0,0 +1,73 @@ +class GVAR(objectSettings) { + displayName = "SIA Framework"; + collapsed = 0; + class Attributes { + class GVAR(isArsenal) { + displayName = "Is Arsenal"; + tooltip = "Check if this object is meant to be an arsenal"; + property = QGVAR(isArsenal); + control = "Checkbox"; + expression = QUOTE( \ + if (_value) then { \ + if (isNil QQGVAR(arsenals)) then { GVAR(arsenals) = []; }; \ + GVAR(arsenals) pushBackUnique _this; \ + } else { \ + GVAR(arsenals) = GVAR(arsenals) - [_this]; \ + }; \ + ); + defaultValue = false; + + // condition should be objectSimulated && !objectControllable && !logicModule + condition = "objectSimulated * (1 - objectControllable) * (1 - logicModule)"; // https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Condition + }; + + class GVAR(isButton) { + displayName = "Is Button"; + tooltip = "Check if this object is meant to be a button"; + property = QGVAR(isButton); + control = "Checkbox"; + expression = QUOTE( \ + if (_value) then { \ + if (isNil QQGVAR(buttons)) then { GVAR(buttons) = []; }; \ + GVAR(buttons) pushBackUnique _this; \ + } else { \ + GVAR(buttons) = GVAR(buttons) - [_this]; \ + }; \ + ); + defaultValue = false; + // condition should be objectSimulated && !objectControllable && !logicModule + condition = "objectSimulated * (1 - objectControllable) * (1 - logicModule)"; // https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Condition + }; + + class GVAR(role) { + displayName = "Role"; + tooltip = "The unit's role (e.g, ""Rifleman""); Only needs to be defined on playable units"; + property = QGVAR(role); + control = "Edit"; // ToDo: custom control that hides when unit is not playable + expression = QUOTE([ARR_2(_this, _value)] call FUNC(rolesExpression);); + typeName = "STRING"; + defaultValue = "''"; + + // only units should have this attribute + condition = "objectControllable"; + }; + + class GVAR(supportInfo) { + displayName = "Add to Support Info"; + tooltip = "Add object to the vehicle info tab"; + property = QGVAR(supportInfo); + control = "Checkbox"; + expression = QUOTE( \ + if (_value) then { \ + if (isNil QQGVAR(supportObjects)) then { GVAR(supportObjects) = []; }; \ + GVAR(supportObjects) pushBackUnique _this; \ + } else { \ + GVAR(supportObjects) = GVAR(supportObjects) - [_this]; \ + }; \ + ); + defaultValue = false; + // condition should be objectSimulated && ((objectBrain && !objectControllable) || objectVehicle) + condition = "objectSimulated * ((objectBrain * (1 - objectControllable)) max objectVehicle)"; + }; + }; +}; diff --git a/addons/configuration/script_component.hpp b/addons/configuration/script_component.hpp index 2e1ecf3..714743b 100644 --- a/addons/configuration/script_component.hpp +++ b/addons/configuration/script_component.hpp @@ -7,11 +7,11 @@ // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_BLANK - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_BLANK - #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK + #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK #endif #include "\z\sia3f\addons\main\script_macros.hpp" diff --git a/addons/core/XEH_PREP.hpp b/addons/core/XEH_PREP.hpp index d343635..5897691 100644 --- a/addons/core/XEH_PREP.hpp +++ b/addons/core/XEH_PREP.hpp @@ -4,14 +4,20 @@ PREP(exitAFK); PREP(exportScoreboard); PREP(formatBriefing); PREP(goAFK); -PREP(hint); PREP(introText); PREP(loadoutNotes); PREP(loadoutNotesDataToText); PREP(loadoutNotesGetLoadout); PREP(loadoutNotesName); PREP(loadoutNotesWepMags); +PREP(onMissionEnd); PREP(orbat); +PREP(safeStartHint); +PREP(safeStartInit); +PREP(safeStartLoop); +PREP(setupGlobalArsenal); PREP(startMission); PREP(teleport); PREP(teleportToSquad); +PREP(vehicleInfo); +PREP(vehicleInfoTab); diff --git a/addons/core/XEH_clientPostInit.sqf b/addons/core/XEH_clientPostInit.sqf index f946071..af46ab6 100644 --- a/addons/core/XEH_clientPostInit.sqf +++ b/addons/core/XEH_clientPostInit.sqf @@ -1,7 +1,11 @@ #include "script_component.hpp" // should behave identically to initPlayerLocal -if ((allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; player addEventHandler ["Killed", { params ["_unit"]; diff --git a/addons/core/XEH_postInit.sqf b/addons/core/XEH_postInit.sqf index add8eda..bb5dc71 100644 --- a/addons/core/XEH_postInit.sqf +++ b/addons/core/XEH_postInit.sqf @@ -1,6 +1,10 @@ #include "script_component.hpp" -if ((allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; call FUNC(loadoutNotes); call FUNC(briefing); diff --git a/addons/core/XEH_preInit.sqf b/addons/core/XEH_preInit.sqf index 88aafd4..a59cca3 100644 --- a/addons/core/XEH_preInit.sqf +++ b/addons/core/XEH_preInit.sqf @@ -4,7 +4,11 @@ ADDON = false; #include "XEH_PREP.hpp" -if ((allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; // these should not be updated after initialization GVAR(roles) = GET_CONFIG(roles,createHashMap); diff --git a/addons/core/XEH_preStart.sqf b/addons/core/XEH_preStart.sqf index 7f6d97f..e63a36d 100644 --- a/addons/core/XEH_preStart.sqf +++ b/addons/core/XEH_preStart.sqf @@ -2,4 +2,8 @@ #include "XEH_PREP.hpp" -if ((allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; diff --git a/addons/core/XEH_serverPostInit.sqf b/addons/core/XEH_serverPostInit.sqf index 67ef5bc..81f6f63 100644 --- a/addons/core/XEH_serverPostInit.sqf +++ b/addons/core/XEH_serverPostInit.sqf @@ -1,8 +1,10 @@ #include "script_component.hpp" -#define SAFESTART_HINT_REFRESH 30; - -if ((allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; // basically initServer.sqf GVAR(startTime) = date; @@ -11,108 +13,27 @@ setTimeMultiplier 0.1; missionNamespace setVariable [QGVAR(safeStart_phase), "Waiting", true]; missionNamespace setVariable [QGVAR(missionStarted), false, true]; -if (!isNil QEGVAR(configuration,arsenals)) then { - // === Setup Global Arsenal === - - { - clearBackpackCargoGlobal _x; - clearMagazineCargoGlobal _x; - clearWeaponCargoGlobal _x; - clearItemCargoGlobal _x; - [_x, false] remoteExecCall ["ace_dragging_fnc_setDraggable"]; - [_x, false] remoteExecCall ["ace_dragging_fnc_setCarryable"]; - [_x, false] call ace_arsenal_fnc_initBox; - } forEach EGVAR(configuration,arsenals); - - // Add basic items. - if (GET_CONFIG(haveBasics,true)) then { - /* To-do: learn a way to allow end-user to modify data below */ - private _arr = ["ACE_fieldDressing", "ACE_elasticBandage", "ACE_packingBandage", "ACE_quikclot", "ACE_bloodIV", "ACE_bloodIV_250", "ACE_bloodIV_500", "ACE_CableTie", "ACE_Chemlight_Shield", "ACE_EarPlugs", "ACE_epinephrine", "ACE_MapTools", "ACE_morphine", "ACE_RangeCard", "ACE_splint", "ACE_tourniquet", "ACE_surgicalKit", "ACE_salineIV", "ACE_salineIV_250", "ACE_salineIV_500", "ToolKit", "ACE_artilleryTable", "Chemlight_blue", "Chemlight_green", "Chemlight_red", "Chemlight_yellow", "ItemWatch", "ItemCompass", "ItemMap", "ACE_Canteen", "ACE_WaterBottle"]; - { [_x, _arr, true] call ace_arsenal_fnc_addVirtualItems; } forEach EGVAR(configuration,arsenals); - }; - - // Add ACRE radio items. - if (GET_CONFIG(acreEnabled,true) && "@ACRE2" call FUNC(checkModPresence)) then { - { - private _acreRadios = ([] call acre_api_fnc_getAllRadios) select 0; - if (_x != "NONE") then { - private _y = _x; - if (_x in _acreRadios) then { - { [_x, [_y], true] call ace_arsenal_fnc_addVirtualItems; } forEach EGVAR(configuration,arsenals); - } else { - ERROR_1("Setup Global Arsenal radios, invalid radio type: %1",_x); - }; - }; - } forEach [GVAR(personalRadio), GVAR(handheldRadio), GVAR(manpackRadio)]; - }; - - // Add cTab items. - if (GET_CONFIG(haveCTab,true) && "@cTab" call FUNC(checkModPresence)) then { // TODO: double check cTab's mod tag - private _arr = ["ItemMicroDAGR", "ItemcTabHCam", "ItemAndroid", "ItemcTab"]; - { [_x, _arr, true] call ace_arsenal_fnc_addVirtualItems; } forEach EGVAR(configuration,arsenals); - }; - - // Add KAT Medical items. - switch (GET_CONFIG(haveKATMedical,2)) do { - case 2: { - private _arr = ["kat_aatKit", "kat_accuvac", "kat_guedel", "kat_AED", "kat_X_AED", "kat_larynx", "kat_Pulseoximeter", "kat_chestSeal", "kat_Painkiller", "kat_stretcherBag", "Attachable_Helistretcher", "kat_stethoscope", "KAT_Empty_bloodIV_500", "KAT_Empty_bloodIV_250", "kat_IV_16", "kat_IO_FAST", "kat_amiodarone", "kat_atropine", "kat_lidocaine", "kat_naloxone", "kat_nitroglycerin", "kat_norepinephrine", "kat_phenylephrine", "kat_TXA"]; - { [_x, _arr, true] call ace_arsenal_fnc_addVirtualItems; } forEach EGVAR(configuration,arsenals); - }; - - case 1: - { - private _arr = ["kat_guedel", "kat_larynx", "kat_chestSeal", "kat_Painkiller", "kat_IV_16", "kat_AED"]; - { [_x, _arr, true] call ace_arsenal_fnc_addVirtualItems; } forEach EGVAR(configuration,arsenals); - }; - }; - - call EFUNC(ace,initLocalArsenal); +if (!isNil QEGVAR(configuration,arsenals) && "@ace" call EFUNC(core,checkModPresence)) then { + call FUNC(setupGlobalArsenal); + call EFUNC(ace,initLocalArsenal); }; if (!isNil QEGVAR(configuration,buttons)) then { if (GET_CONFIG(enableTPMenu,true)) then { ["enableGlobalMessage", false] call FUNC(teleport); // Disable global message { - ["addActions", [_x]] call FUNC(teleport); _x setObjectTextureGlobal [0, QPATHTOEF(core,ui\ace_button_img.paa)]; } forEach EGVAR(configuration,buttons); // Add 'Teleport Menu' to objects }; }; -/* Safe Start */ - -if (GET_CONFIG(showSafestartHint,true)) then { - [] spawn { - while { !(missionNamespace getVariable [QGVAR(missionStarted), false]) } do { - remoteExec [QFUNC(hint)]; - sleep SAFESTART_HINT_REFRESH; - }; - }; +// Safe Start +if (GET_CONFIG(showSafestartHint,true)) then { // To-do: Pass as param along with safety enabled. + call FUNC(safeStartInit); }; -/* Mission End */ - +// Mission End addMissionEventHandler ["MPEnded", { - - // OCAP2 Replay check and export. - if !(isNil "ocap_fnc_exportData") then { - private _realDate = "real_date" callExtension "EST+"; - private _outcome = "Mission Completed"; // To do: Add functionality to determine if mission failed. - if (_realDate != "") then { - private _opType = "MISC"; - private _weekday = (parseSimpleArray _realDate) # 6; - switch (_weekday) do { - case 0: { _opType = "MAIN OP"; }; // sunday - case 5: { _opType = "SIDE OP"; }; // friday - }; - [_side, _outcome, _opType] call ocap_fnc_exportData; - } else { - [_side, _outcome, "unk"] call ocap_fnc_exportData; - ERROR("real_date extension not found"); - }; - } else { - ERROR("ocap_fnc_exportData function not found"); - }; - + call FUNC(onMissionEnd); call FUNC(exportScoreboard); }]; diff --git a/addons/core/functions/fnc_briefing.sqf b/addons/core/functions/fnc_briefing.sqf index 2b42b01..c1a455f 100644 --- a/addons/core/functions/fnc_briefing.sqf +++ b/addons/core/functions/fnc_briefing.sqf @@ -20,11 +20,19 @@ private _missionText = [GET_CONFIG(missionTabText,"")] call FUNC(formatBriefing) private _executionText = [GET_CONFIG(execTabText,"")] call FUNC(formatBriefing); private _supportText = [GET_CONFIG(supportTabText,"")] call FUNC(formatBriefing); private _signalText = [GET_CONFIG(signalTabText,"")] call FUNC(formatBriefing); + TRACE_5("briefing content",_situationText,_missionText,_executionText,_supportText,_signalText); player createDiaryRecord ["Diary", [GET_CONFIG(signalTabName,"Signal"), _signalText]]; -player createDiaryRecord ["Diary", [GET_CONFIG(supportTabName,"Support"), _supportText]]; +private _record = player createDiaryRecord ["Diary", [GET_CONFIG(supportTabName,"Support"), _supportText]]; player createDiaryRecord ["Diary", [GET_CONFIG(execTabName,"Execution"), _executionText]]; player createDiaryRecord ["Diary", [GET_CONFIG(missionTabName,"Mission"), _missionText]]; player createDiaryRecord ["Diary", [GET_CONFIG(situationTabName,"Situation"), _situationText]]; + +private _vehicles = EGVAR(configuration,supportObjects); +if (isNil "_vehicles") exitWith { LOG_FUNC_END_ERROR("nil _vehicles"); }; + +_supportText = _supportText + "



Vehicle Assets (Automatically Generated by the SIA Framework):



" + ([_vehicles, _record] call FUNC(vehicleInfo)); +player setDiaryRecordText [["Diary", _record], [GET_CONFIG(supportTabName,"Support"), _supportText]]; + LOG_FUNC_END; diff --git a/addons/core/functions/fnc_onMissionEnd.sqf b/addons/core/functions/fnc_onMissionEnd.sqf new file mode 100644 index 0000000..4771839 --- /dev/null +++ b/addons/core/functions/fnc_onMissionEnd.sqf @@ -0,0 +1,40 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, Siege + * Exports OCAP data + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call sia3f_core_fnc_onMissionEnd +*/ + +LOG_FUNC_START; + +if (isNil "ocap_fnc_exportData") exitWith { + LOG_FUNC_END_ERROR("ocap_fnc_exportData function not found"); +}; + +private _weekday = [systemTime] call CBA_fnc_weekDay; +private _outcome = "Mission Completed"; // ToDo: Add functionality to determine if mission failed. +private _opType = "UNK"; + +if (_weekday >= 0) then { + switch (_weekday) do { + case 0: { _opType = "MAIN OP"; }; // sunday + case 5: { _opType = "SIDE OP"; }; // friday + default { _opType = "MISC"; }; // any other day + }; +} else { + ERROR("Failed to fetch weekday"); +}; + +TRACE_2("ocap export data",_weekday,_outcome,_opType); +[_side, _outcome, _opType] call ocap_fnc_exportData; + +LOG_FUNC_END; diff --git a/addons/core/functions/fnc_hint.sqf b/addons/core/functions/fnc_safeStartHint.sqf similarity index 97% rename from addons/core/functions/fnc_hint.sqf rename to addons/core/functions/fnc_safeStartHint.sqf index 1a3128a..d62fcfd 100644 --- a/addons/core/functions/fnc_hint.sqf +++ b/addons/core/functions/fnc_safeStartHint.sqf @@ -23,7 +23,7 @@ * None * * Example: - * call sia3f_core_fnc_hint + * call sia3f_core_fnc_safeStartHint */ if (!hasInterface || !(player getVariable [QGVAR(safeStartHintEnabled), true])) exitWith { @@ -46,7 +46,7 @@ private _txtSetupPhase = text (missionNamespace getVariable [QGVAR(safeStart_pha _txtSetupPhase setAttributes ["align", "right", "font", FONT_HEADER]; private _txtLocation = text (GET_CONFIG(missionLocationName, worldName) + " " + str (date select 1) + "-" + str (date select 2) + "-" + str (date select 0) + " " + ([daytime, "HH:MM"] call BIS_fnc_timeToString)); -_txtLocation setAttributes ["center", "left", "color", HEX_SECONDARY, "font", FONT_PRIMARY, "size", "0.8"]; +_txtLocation setAttributes ["align", "center", "color", HEX_SECONDARY, "font", FONT_PRIMARY, "size", "0.8"]; private _txtSystemTime = text "System Time:"; _txtSystemTime setAttributes ["align", "left", "font", FONT_HEADER]; diff --git a/addons/core/functions/fnc_safeStartInit.sqf b/addons/core/functions/fnc_safeStartInit.sqf new file mode 100644 index 0000000..0ae23f5 --- /dev/null +++ b/addons/core/functions/fnc_safeStartInit.sqf @@ -0,0 +1,46 @@ +#include "script_component.hpp" + +#define SAFESTART_HINT_REFRESH 30; +/* + * Author: McKendrick + * Safe Start initlization for safety and hint. + * + * Arguments: + * 0: If safeStart Hint feature is enabled (default: True) + * 1: If safeStart Safety feature is enabled (default: True) + * + * Return Value: + * None + * + * Example: + * call sia3f_core_fnc_safeStartInit +*/ +LOG("fnc_safeStartHint.sqf started."); + +params [ + ["_safeStartHintEnabled", true, [true]], + ["_safeStartSafetyEnabled", true, [true]] +]; + +/* Safe Start Hint */ +if (_safeStartHintEnabled && isServer) then { + [] spawn { + while { !(missionNamespace getVariable [QGVAR(missionStarted), false]) } do { + remoteExec [QFUNC(safeStartHint)]; + sleep SAFESTART_HINT_REFRESH; + }; + }; +}; + +/* Safe Start Safety */ +if (_safeStartSafetyEnabled && hasInterface) then { + [ + { !isNull (getAssignedCuratorLogic _this) }, + { [_this] spawn FUNC(safeStartLoop) }, + player, + 1, + { [_this] spawn FUNC(safeStartLoop) } + ] call CBA_fnc_waitUntilAndExecute; +}; + +INFO("fnc_safeStartInit.sqf fully executed."); \ No newline at end of file diff --git a/addons/core/functions/fnc_safeStartLoop.sqf b/addons/core/functions/fnc_safeStartLoop.sqf new file mode 100644 index 0000000..462d72e --- /dev/null +++ b/addons/core/functions/fnc_safeStartLoop.sqf @@ -0,0 +1,53 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick + * Credits: F3 - Please see the F3 online manual (http://www.ferstaberinde.com/f3/en/) + * Safe Start, Safety and Invicibility Toggle + * + * Arguments: + * 0: ID of "FiredMan" safety event handler . + * + * Return Value: + * None + * + * Example: + * call sia3f_core_fnc_safeStartLoop +*/ +INFO("fnc_safeStartLoop.sqf started."); + +params [ + [ "_unit", player] +]; + +_unit allowDamage false; // Make the zeus(es) invincible. + +if (_unit in (allCurators apply { getAssignedCuratorUnit _x })) exitWith { LOG("fnc_safeStartLoop.sqf was exited: unit is a curator.") }; + +{ [_unit, _x, true] call ace_safemode_fnc_setWeaponSafety } forEach (weapons _unit); +_unit setVariable ["ace_common_effect_blockThrow", 1]; // force use vanilla throwing so the event handler works (need to make ensure that another function doesn't set it to 0) +_unit setVariable ["ace_explosives_PlantingExplosive", true]; // This is the only way to stop planting of explosives that I could find + +private _FiredMan_EH = _unit addEventHandler ["FiredMan", { + deleteVehicle (_this # 6); + + if (_this # 1 == "Throw") then { + (_this # 0) addItem (_this # 4); // replace lost grenades, smokes, etc. + }; +}]; + +while { !(missionNamespace getVariable [QGVAR(missionStarted), false]) } do { + waitUntil { (_unit getVariable ["ace_safemode_safedWeapons", []]) isNotEqualTo (weapons _unit) || (missionNamespace getVariable [QGVAR(missionStarted), false]) }; + if (!(missionNamespace getVariable [QGVAR(missionStarted), false])) then { + { [_unit, _x, true] call ace_safemode_fnc_setWeaponSafety } forEach ((weapons _unit) - (_unit getVariable "ace_safemode_safedWeapons")); + }; +}; + +// reset everything to their proper states +_unit allowDamage true; +{ [_unit, _x, false] call ace_safemode_fnc_setWeaponSafety } forEach (weapons _unit); +_unit setVariable ["ace_common_effect_blockThrow", 0]; +_unit setVariable ["ace_explosives_PlantingExplosive", false]; +_unit removeEventHandler ["FiredMan", _FiredMan_EH]; + +INFO("fnc_safeStartLoop.sqf fully executed."); \ No newline at end of file diff --git a/addons/core/functions/fnc_setupGlobalArsenal.sqf b/addons/core/functions/fnc_setupGlobalArsenal.sqf new file mode 100644 index 0000000..cec4d08 --- /dev/null +++ b/addons/core/functions/fnc_setupGlobalArsenal.sqf @@ -0,0 +1,76 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, Siege + * Configures arsenal objects and adds global items. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call sia3f_core_fnc_setupGlobalArsenal +*/ + +LOG_FUNC_START; +private _arsenals = EGVAR(configuration,arsenals); +TRACE_1("arsenals",_arsenals); + +{ + clearBackpackCargoGlobal _x; + clearMagazineCargoGlobal _x; + clearWeaponCargoGlobal _x; + clearItemCargoGlobal _x; + + if !("@ace" call EFUNC(core,checkModPresence)) exitWith {}; + + [_x, false] remoteExecCall ["ace_dragging_fnc_setDraggable"]; + [_x, false] remoteExecCall ["ace_dragging_fnc_setCarryable"]; + [_x, false] call ace_arsenal_fnc_initBox; + + private _globalItems = []; + + if (GET_CONFIG(haveBasics,true)) then { + // basic items + // ToDo: allow end-user to modify data below + _globalItems append ["ACE_fieldDressing", "ACE_elasticBandage", "ACE_packingBandage", "ACE_quikclot", "ACE_bloodIV", "ACE_bloodIV_250", "ACE_bloodIV_500", "ACE_CableTie", "ACE_Chemlight_Shield", "ACE_EarPlugs", "ACE_epinephrine", "ACE_MapTools", "ACE_morphine", "ACE_RangeCard", "ACE_splint", "ACE_tourniquet", "ACE_surgicalKit", "ACE_salineIV", "ACE_salineIV_250", "ACE_salineIV_500", "ToolKit", "ACE_artilleryTable", "Chemlight_blue", "Chemlight_green", "Chemlight_red", "Chemlight_yellow", "ItemWatch", "ItemCompass", "ItemMap", "ACE_Canteen", "ACE_WaterBottle"]; + }; + + if (GET_CONFIG(acreEnabled,true) && "@ACRE2" call FUNC(checkModPresence)) then { + // ACRE radio items + { + private _acreRadios = ([] call acre_api_fnc_getAllRadios) select 0; + if (_x != "NONE") then { + if (_x in _acreRadios) then { + _globalItems pushBackUnique _x; + } else { + ERROR_1("Setup Global Arsenal radios, invalid radio type: %1",_x); + }; + }; + } forEach [GVAR(personalRadio), GVAR(handheldRadio), GVAR(manpackRadio)]; + }; + + if (GET_CONFIG(haveCTab,true) && "@cTab" call FUNC(checkModPresence)) then { + // cTab items + _globalItems append ["ItemMicroDAGR", "ItemcTabHCam", "ItemAndroid", "ItemcTab"]; + }; + + switch (GET_CONFIG(haveKATMedical,2)) do { + // KAT Medical items + case 2: { + _globalItems append ["kat_aatKit", "kat_accuvac", "kat_guedel", "kat_AED", "kat_X_AED", "kat_larynx", "kat_Pulseoximeter", "kat_chestSeal", "kat_Painkiller", "kat_stretcherBag", "Attachable_Helistretcher", "kat_stethoscope", "KAT_Empty_bloodIV_500", "KAT_Empty_bloodIV_250", "kat_IV_16", "kat_IO_FAST", "kat_amiodarone", "kat_atropine", "kat_lidocaine", "kat_naloxone", "kat_nitroglycerin", "kat_norepinephrine", "kat_phenylephrine", "kat_TXA"]; + }; + + case 1: + { + _globalItems append ["kat_guedel", "kat_larynx", "kat_chestSeal", "kat_Painkiller", "kat_IV_16", "kat_AED"]; + }; + }; + + TRACE_1("items added to global arsenal",_globalItems); + [_x, _globalItems, true] call ace_arsenal_fnc_addVirtualItems; +} forEach _arsenals; + +LOG_FUNC_END; diff --git a/addons/core/functions/fnc_startMission.sqf b/addons/core/functions/fnc_startMission.sqf index 6a9e605..29f52ee 100644 --- a/addons/core/functions/fnc_startMission.sqf +++ b/addons/core/functions/fnc_startMission.sqf @@ -23,12 +23,16 @@ params [ ]; LOG_FUNC_START; -if (isMultiplayer) then { setDate GVAR(startTime) }; // Set time to start of mission. +if (isMultiplayer) then { setDate GVAR(startTime); }; // Set time to start of mission. setTimeMultiplier 1; // Set time acceleration to default. missionNamespace setVariable [QGVAR(missionStarted), true, true]; // Update variable. -if (GET_CONFIG(briefLoadout,true)) then { remoteExec [QFUNC(loadoutNotes)] }; // Refresh loadout information if enabled. +if (GET_CONFIG(briefLoadout,true)) then { remoteExec [QFUNC(loadoutNotes)]; }; // Refresh loadout information if enabled. + +if (GET_CONFIG(enableManageKit,true)) then { + { _x setVariable [QGVAR(savedLoadout), getUnitLoadout _x, true]; } forEach (call BIS_fnc_listPlayers); +}; // save each player's loadout. // Update phase to "Mission Started". missionNamespace setVariable [QGVAR(safeStart_phase), "In Progress", true]; @@ -38,13 +42,13 @@ missionNamespace setVariable [QGVAR(safeStart_phase), "In Progress", true]; // Display intro text if enabled. if (GET_CONFIG(showIntroText,true)) then { [ - { [(getMissionConfigValue ["onLoadName", missionName])] remoteExec ["BIS_fnc_moduleMissionName", _this] }, + { [(getMissionConfigValue ["onLoadName", missionName])] remoteExec ["BIS_fnc_moduleMissionName", _this]; }, _gm, 5 ] call CBA_fnc_waitAndExecute; [ - { remoteExecCall [_this] }, + { remoteExecCall [_this]; }, QFUNC(introText), 15 ] call CBA_fnc_waitAndExecute; diff --git a/addons/core/functions/fnc_teleport.sqf b/addons/core/functions/fnc_teleport.sqf index 62ab558..e880e5b 100644 --- a/addons/core/functions/fnc_teleport.sqf +++ b/addons/core/functions/fnc_teleport.sqf @@ -111,19 +111,13 @@ switch (_mode) do { case "addActions": { if !(_parameters isEqualTypeAll objNull) exitWith { ERROR("TPD Actions could not be added"); }; - _parameters apply { - - //Modified by McKendrick - // vvvv - if ("@ace" call FUNC(checkModPresence)) then { - private _action = ["TPD", "Open Teleport Menu", "\a3\modules_f_curator\data\portraitobjectivemove_ca.paa", { [] spawn { findDisplay 46 createDisplay QGVAR(TPD_Teleport) } }, { true }] call ace_interact_menu_fnc_createAction; - [_x, 0, ["ACE_MainActions"], _action, true] remoteExecCall ["ace_interact_menu_fnc_addActionToObject"]; - } else { - [_x, [" Select Teleport Location", { findDisplay 46 createDisplay QGVAR(TPD_Teleport) }, nil, 6, true, true, "", "true", 4]] remoteExec ["addAction", 0, _x]; - }; - // ^^^^ - - }; + TRACE_1("addActions parameters",_parameters); + if ("@ace" call FUNC(checkModPresence)) then { + private _action = ["TPD", "Open Teleport Menu", "\a3\modules_f_curator\data\portraitobjectivemove_ca.paa", { [] spawn { findDisplay 46 createDisplay QGVAR(TPD_Teleport) } }, { true }] call ace_interact_menu_fnc_createAction; + { [_x, 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToObject; } forEach _parameters; + } else { + { _x addAction [" Select Teleport Location", { findDisplay 46 createDisplay QGVAR(TPD_Teleport) }, nil, 6, true, true, "", "true", 4] } forEach _parameters; + }; }; case "previewPosition": { diff --git a/addons/core/functions/fnc_vehicleInfo.sqf b/addons/core/functions/fnc_vehicleInfo.sqf new file mode 100644 index 0000000..1a65506 --- /dev/null +++ b/addons/core/functions/fnc_vehicleInfo.sqf @@ -0,0 +1,143 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, modified by Siege + * Generates information regarding available vehicles and their seats, weapons, and ammo. + * + * Arguments: + * 0: Array of vehicles + * 1: Diary record of the support briefing tab + * + * Return value: + * Formatted information + * + * Example: + * [helicopter, jet] call sia3f_core_fnc_vehicleInfo +*/ + +params [ + ["_vehicles", [], [[]]], + ["_record", ""] +]; + +if (_vehicles isEqualTo []) exitWith { + LOG_FUNC_END_ERROR("invalid parameters or no vehicles to add"); +}; // Exit if array not given. +LOG_FUNC_START; + +private _newDiarySubject = "vehicleInfo"; +private _cfgVehicles = configFile >> "CfgVehicles"; // cache cfgVehicles + +private _newArr = []; +{ + private _vicName = getText (_cfgVehicles >> typeOf _x >> "displayName"); + private _weaponsInfo = [getAllPylonsInfo _x]; + private _className = typeOf _x; + + // If vehicle has pylons then combine like pylons, else show turret info if any. + if (count (_weaponsInfo select 0) > 0) then { + private _pylons = []; + { + // Get weapon name and ammo count for each pylon. + private _weapon = getText (configFile >> "CfgMagazines" >> (_x select 3) >> "displayName"); + private _ammo = _x select 4; + + // Check if existing similar pylon already exists and combine, otherwise add pylon info to array. + private _index = _pylons findIf { _x select 0 == _weapon }; + if (_index > -1) then { + private _pylonInfo = _pylons select _index; + _pylonInfo set [1, (_pylonInfo select 1) + _ammo]; + } else { + _pylons pushBack [_weapon, _ammo]; + }; + } forEach (_weaponsInfo select 0); + + _weaponsInfo = [_pylons]; + + }; + private _turrets = (_x weaponsTurret [0]) + (_x weaponsTurret [0,0]); + + // Create new array of display names of turrets. + if (count _turrets > 0) then { + private _newArr = []; + { _newArr pushBackUnique (getText (configFile >> "CfgWeapons" >> _x >> "displayName")); } forEach _turrets; + _turrets = _newArr; + }; + + _weaponsInfo pushBack _turrets; + // ToDo: Add magazine info. + + _newArr pushBack [_className, _weaponsInfo]; +} forEach _vehicles; +_vehicles = _newArr; + +// Condense array by removing and numbering duplicates +private _uniqueArr = []; +private _newArr = []; +{ _uniqueArr pushBackUnique _x; } forEach _vehicles; // create array of unique elements +{ + private _y = _x; // _x from count would overwrite _x from forEach + _newArr pushBack [_y, { _x isEqualTo _y } count _vehicles]; +} forEach _uniqueArr; // populate array with amount of items +_vehicles = _newArr; + +// Get editor category of each vehicle. +{ + private _category = getText (configFile >> "CfgEditorSubcategories" >> getText (_cfgVehicles >> ((_x select 0) select 0) >> "editorSubcategory") >> "displayName"); // Get name of the vehicle's eden category; + _x pushBack _category; +} forEach _vehicles; + +// Separate vehicles into category then sort. +private _newArr = []; +{ + private _category = _x select 2; + private _index = _newArr findIf { _x select 0 == _category }; + _x deleteAt 2; + if (_index > -1) then { + ((_newArr select _index) select 1) pushBack _x; + } else { + _newArr pushBack [_category, [_x]]; + }; +} forEach _vehicles; + +_vehicles = [_newArr] call BIS_fnc_sortBy; // Sort categories alphabetically. + +private _text = []; + +// Formatting text +{ + private _category = _x select 0; + private _str = ""; + //private _diaryLink = player createDiaryLink ["Diary", record, text] + + // Category Header + _str = _str + format ["%1", _category]; + _str = _str + "

"; + + { + (_x select 0) params ["_className", "_weaponsInfo"]; + private _amount = _x select 1; + private _displayName = getText (_cfgVehicles >> _className >> "displayName"); + + // Icon img + /* + private _icon = getText (_cfgVehicles >> _className >> "picture"); + _str = _str + format [" ",_icon]; + */ + + // Number of vics + if (_amount > 0) then { _str = _str + format ["%1x ", _amount]; }; // Add amount of vics if more than one is available. + + // Name + private _newDiaryRecord = [_className, _weaponsInfo, _newDiarySubject, _record] call FUNC(vehicleInfoTab); + _str = _str + "" + createDiaryLink [_newDiarySubject, _newDiaryRecord, _displayName] + ""; + + _str = _str + "

"; + } forEach (_x select 1); + _text pushBack (_str + "

"); +} forEach _vehicles; + +_text = _text joinString ""; +TRACE_1("return text",_text); +LOG_FUNC_END; +_text diff --git a/addons/core/functions/fnc_vehicleInfoTab.sqf b/addons/core/functions/fnc_vehicleInfoTab.sqf new file mode 100644 index 0000000..6a6578d --- /dev/null +++ b/addons/core/functions/fnc_vehicleInfoTab.sqf @@ -0,0 +1,79 @@ +#include "script_component.hpp" + +/* + * Author: McKendrick, modified by Siege + * Create diary record for vehicle with formatted information + * + * Arguments: + * 0: Vehicle class name + * 1: Vehicle weapons info + * 2: Diary subject name + * 3: Diary record of the support briefing tab + * + * Return value: + * Vehicle diary record + * + * Example: + * [params] call sia3f_core_fnc_vehicleInfoTab +*/ + +params ["_className", "_weaponsInfo", "_newDiarySubject", "_record"]; +LOG_FUNC_START; +TRACE_4("params",_className,_weaponsInfo,_newDiarySubject,_record); + +private _cfgVehicles = configFile >> "CfgVehicles"; // cache cfgVehicles + +private _displayName = getText (_cfgVehicles >> _className >> "displayName"); +// private _category = getText (configFile >> "CfgEditorSubcategories" >> getText (_cfgVehicles >> _className >> "editorSubcategory") >> "displayName"); //? not used +private _seatsTotal = [_className, true] call BIS_fnc_crewCount; // Number of total seats: crew + non-FFV cargo/passengers + FFV cargo/passengers +private _seatsCrew = [_className, false] call BIS_fnc_crewCount; // Number of crew seats only +private _seatsCargo = _seatsTotal - _seatsCrew; // Number of total cargo/passenger seats: non-FFV + FFV +// private _seatsNonFFVcargo = getNumber (_cfgVehicles >> _className >> "transportSoldier"); // Number of non-FFV cargo seats only //? not used +// private _seatsFFVcargo = _seatsCargo - _seatsNonFFVcargo; // Number of FFV cargo seats only //? not used + +// Icon img +private _icon = getText (_cfgVehicles >> _className >> "picture"); + +// === Text Formatting === +private _strArr = []; +private _colorSeatsCrew = if (_seatsCrew > 0) then [{ ['#FFB84C', '#FFFFFF'] }, { ['#A9A9A9', '#A9A9A9'] }]; +private _colorSeatsCargo = if (_seatsCargo > 0) then [{ ['#FFB84C', '#FFFFFF'] }, { ['#A9A9A9', '#A9A9A9'] }]; + +_strArr pushBack format ["", _icon]; +_strArr pushBack "

"; +_strArr pushBack format ["%1", _displayName]; +_strArr pushBack "



"; +_strArr pushBack format ["Seats

Crew: %1

Cargo: %2
", _seatsCrew, _seatsCargo, _colorSeatsCrew select 0, _colorSeatsCrew select 1, _colorSeatsCargo select 0, _colorSeatsCargo select 1]; + +// Weapons Info +_weaponsInfo params ["_pylons", "_turrets"]; +private _newArr = []; + +// Turrets +if (count _turrets > 0) then { + _newArr pushBack "



Armaments

"; + { + if (_forEachIndex > 0) then { _newArr pushBack ", "; }; + _newArr pushBack format ["%1", _x]; + } forEach _turrets; +}; + +// Pylons +if (count _pylons > 0) then { + _newArr pushBack "



Munitions"; + { + _x params ["_weapon", "_ammo"]; + _newArr pushBack format ["

%1: %2x", _weapon, _ammo]; + } forEach _pylons; +}; + +_strArr pushBack (_newArr joinString ""); +_strArr pushBack format ["



" + createDiaryLink ["Diary", _record, "Go back"]]; + +private _text = _strArr joinString ""; +if (!(player diarySubjectExists _newDiarySubject)) then { player createDiarySubject [_newDiarySubject, "Vehicle Information"]; }; + +TRACE_3("diary record values"_displayName,_text,_icon); +private _retValue = player createDiaryRecord ["vehicleInfo", [_displayName, _text, _icon]]; +LOG_FUNC_END; +_retValue diff --git a/addons/core/script_component.hpp b/addons/core/script_component.hpp index 0d0ded4..b92bf81 100644 --- a/addons/core/script_component.hpp +++ b/addons/core/script_component.hpp @@ -7,11 +7,11 @@ // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_BLANK - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_BLANK - #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK + #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK #endif #include "\z\sia3f\addons\main\script_macros.hpp" diff --git a/addons/main/CfgSettings.hpp b/addons/main/CfgSettings.hpp index f92ca66..5bcb699 100644 --- a/addons/main/CfgSettings.hpp +++ b/addons/main/CfgSettings.hpp @@ -1,11 +1,11 @@ class CfgSettings { - class CBA { - class Versioning { - class PREFIX { - class dependencies { - CBA[] = {"cba_main", REQUIRED_CBA_VERSION, "(true)"}; - }; - }; - }; - }; + class CBA { + class Versioning { + class PREFIX { + class dependencies { + CBA[] = {"cba_main", REQUIRED_CBA_VERSION, "(true)"}; + }; + }; + }; + }; }; diff --git a/addons/main/script_component.hpp b/addons/main/script_component.hpp index 4979d37..e687f54 100644 --- a/addons/main/script_component.hpp +++ b/addons/main/script_component.hpp @@ -7,11 +7,11 @@ // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MAIN - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_MAIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN #endif #include "\z\sia3f\addons\main\script_macros.hpp" diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 7868da1..019962f 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -20,9 +20,9 @@ // from ACE 3 #ifdef DISABLE_COMPILE_CACHE - #undef PREP - #define PREP(fncName) FUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf) + #undef PREP + #define PREP(fncName) FUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf) #else - #undef PREP - #define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction + #undef PREP + #define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction #endif diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 6277441..c5d0c81 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -14,7 +14,7 @@ #define REQUIRED_CBA_VERSION {3,15,7} // ToDo #ifdef COMPONENT_BEAUTIFIED - #define COMPONENT_NAME QUOTE(SIA 3DEN Framework - COMPONENT_BEAUTIFIED) + #define COMPONENT_NAME QUOTE(SIA 3DEN Framework - COMPONENT_BEAUTIFIED) #else - #define COMPONENT_NAME QUOTE(SIA 3DEN Framework - COMPONENT) + #define COMPONENT_NAME QUOTE(SIA 3DEN Framework - COMPONENT) #endif diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index 73306f8..f13adb3 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,4 +1,4 @@ -#define MAJOR 0 -#define MINOR 2 +#define MAJOR 1 +#define MINOR 0 #define PATCHLVL 0 -#define BUILD 2 +#define BUILD 3 diff --git a/addons/radio/XEH_clientPostInit.sqf b/addons/radio/XEH_clientPostInit.sqf index 9907366..cc5a659 100644 --- a/addons/radio/XEH_clientPostInit.sqf +++ b/addons/radio/XEH_clientPostInit.sqf @@ -3,7 +3,13 @@ #define PERSONAL_RADIO_CLASSNAME missionNameSpace getVariable [QGVAR(personalRadio), "ACRE_PRC343"] // should behave identically to initPlayerLocal -if (!GET_CONFIG(acreEnabled,true) || !("@ACRE2" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + !GET_CONFIG(acreEnabled,true) || + !("@ACRE2" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; call FUNC(giveRadios); @@ -19,9 +25,9 @@ player addEventHandler ["Respawn", { if ("@ace" call EFUNC(core,checkModPresence)) then { ["ace_arsenal_displayClosed", { - private _personalRadioClassname = PERSONAL_RADIO_CLASSNAME; + // private _personalRadioClassname = ; [] spawn FUNC(loadDefaultSpatial); - [_personalRadioClassname] spawn FUNC(reorderMPTT); + [PERSONAL_RADIO_CLASSNAME] spawn FUNC(reorderMPTT); [((group player) getVariable [QEGVAR(configuration,radioChannel), 1]), _personalRadioClassname] spawn FUNC(setRadioChannel); }] call CBA_fnc_addEventHandler; }; diff --git a/addons/radio/XEH_postInit.sqf b/addons/radio/XEH_postInit.sqf index 9958fc7..cceba7d 100644 --- a/addons/radio/XEH_postInit.sqf +++ b/addons/radio/XEH_postInit.sqf @@ -1,3 +1,9 @@ #include "script_component.hpp" -if (!GET_CONFIG(acreEnabled,true) || !("@ACRE2" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + !GET_CONFIG(acreEnabled,true) || + !("@ACRE2" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; diff --git a/addons/radio/XEH_preInit.sqf b/addons/radio/XEH_preInit.sqf index d2f0cb8..f9c68fa 100644 --- a/addons/radio/XEH_preInit.sqf +++ b/addons/radio/XEH_preInit.sqf @@ -21,8 +21,13 @@ SPATIALIZATION_SETTINGS(ACRE_SEM90,"SEM90",0); #include "XEH_PREP.hpp" -if (!GET_CONFIG(acreEnabled,true) || !("@ACRE2" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; - +if ( + !GET_CONFIG(acreEnabled,true) || + !("@ACRE2" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; missionNamespace setVariable [QGVAR(personalRadio), ["NONE", "ACRE_PRC343", "ACRE_BF888S", "ACRE_SEM52SL"] select GET_CONFIG(personalRadio,1)]; missionNamespace setVariable [QGVAR(handheldRadio), ["NONE", "ACRE_PRC343", "ACRE_PRC148", "ACRE_PRC152"] select GET_CONFIG(handheldRadio,3)]; missionNamespace setVariable [QGVAR(manpackRadio), ["NONE", "ACRE_PRC117F", "ACRE_PRC77", "ACRE_SEM70"] select GET_CONFIG(manpackRadio,1)]; diff --git a/addons/radio/XEH_preStart.sqf b/addons/radio/XEH_preStart.sqf index e3ddac3..f989889 100644 --- a/addons/radio/XEH_preStart.sqf +++ b/addons/radio/XEH_preStart.sqf @@ -2,4 +2,10 @@ #include "XEH_PREP.hpp" -if (!GET_CONFIG(acreEnabled,true) || !("@ACRE2" call EFUNC(core,checkModPresence)) || (allDisplays isEqualTo [findDisplay 0]) || is3DEN) exitWith {}; +if ( + !GET_CONFIG(acreEnabled,true) || + !("@ACRE2" call EFUNC(core,checkModPresence)) || + allDisplays isEqualTo [findDisplay 0] || + is3DEN || + !GET_CONFIG(frameworkInit,false) +) exitWith {}; diff --git a/addons/radio/functions/fnc_giveRadios.sqf b/addons/radio/functions/fnc_giveRadios.sqf index 435e6a5..9142583 100644 --- a/addons/radio/functions/fnc_giveRadios.sqf +++ b/addons/radio/functions/fnc_giveRadios.sqf @@ -40,9 +40,9 @@ private _rolesManpackRadio = []; } forEach EGVAR(core,groups); TRACE_2("Radio roles",_rolesHandheldRadio,_rolesManpackRadio); -private _personalRadioClassname = missionNameSpace getVariable [QGVAR(personalRadio),"ACRE_PRC343"]; -private _handheldRadioClassname = missionNameSpace getVariable [QGVAR(handheldRadio),"ACRE_PRC152"]; -private _manpackRadioClassname = missionNameSpace getVariable [QGVAR(manpackRadio),"ACRE_PRC117F"]; +private _personalRadioClassname = missionNameSpace getVariable [QGVAR(personalRadio), "ACRE_PRC343"]; +private _handheldRadioClassname = missionNameSpace getVariable [QGVAR(handheldRadio), "ACRE_PRC152"]; +private _manpackRadioClassname = missionNameSpace getVariable [QGVAR(manpackRadio), "ACRE_PRC117F"]; TRACE_3("Radio classnames",_personalRadioClassname,_handheldRadioClassname,_manpackRadioClassname); private _role = player getVariable [QEGVAR(configuration,role), "default"]; diff --git a/addons/radio/functions/fnc_reorderMPTT.sqf b/addons/radio/functions/fnc_reorderMPTT.sqf index 727ca72..a8a2ae3 100644 --- a/addons/radio/functions/fnc_reorderMPTT.sqf +++ b/addons/radio/functions/fnc_reorderMPTT.sqf @@ -19,10 +19,15 @@ if (!GET_CONFIG(acreEnabled,true) || !hasInterface || !("@ACRE2" call EFUNC(core }; // Exit if not player or if ACRE is disabled/not loaded. params [ - ["_radioType", missionNameSpace getVariable [QGVAR(personalRadio), "ACRE_PRC343"], ""] + ["_radioType", missionNamespace getVariable [QGVAR(personalRadio), "ACRE_PRC343"], [""]] ]; +if (isNil "_radioType" || _radioType == "") exitWith { + LOG_FUNC_END_ERROR("radioType nil or empty"); +}; + LOG_FUNC_START; +TRACE_1("params",_radioType); waitUntil { ([] call acre_api_fnc_isInitialized) }; // Wait until player's radios are initialized. diff --git a/addons/radio/functions/fnc_setDefaultSpatial.sqf b/addons/radio/functions/fnc_setDefaultSpatial.sqf index f32732d..c9804bd 100644 --- a/addons/radio/functions/fnc_setDefaultSpatial.sqf +++ b/addons/radio/functions/fnc_setDefaultSpatial.sqf @@ -21,7 +21,7 @@ if (!GET_CONFIG(acreEnabled,true) || !hasInterface || !("@ACRE2" call EFUNC(core params [ ["_radio", "", [""]], - ["_ear", 1 , [0]] + ["_ear", 1, [0]] ]; LOG_FUNC_START; diff --git a/addons/radio/script_component.hpp b/addons/radio/script_component.hpp index 2a366ea..0399cde 100644 --- a/addons/radio/script_component.hpp +++ b/addons/radio/script_component.hpp @@ -7,11 +7,11 @@ // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MAIN - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_MAIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN #endif #include "\z\sia3f\addons\main\script_macros.hpp" diff --git a/build.bat b/build.bat deleted file mode 100644 index 3392b5b..0000000 --- a/build.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -hemtt.exe build -pause diff --git a/extras/blank/script_component.hpp b/extras/blank/script_component.hpp index 8f8e34c..848737a 100644 --- a/extras/blank/script_component.hpp +++ b/extras/blank/script_component.hpp @@ -7,11 +7,11 @@ // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MAIN - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_MAIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN #endif #include "\z\sia3f\addons\main\script_macros.hpp" diff --git a/tools/make.cfg b/tools/make.cfg index b8a2cc2..5b7dd25 100644 --- a/tools/make.cfg +++ b/tools/make.cfg @@ -15,7 +15,7 @@ project = @sia3f # Path to project secret key for signing # Make sure this isn't in your public repository! # Default: \private_keys\ace_3.0.0.biprivatekey -# key = P:\private_keys\ace_3.0.0.biprivatekey +key = P:\private_keys\SIA.biprivatekey # Path to where private keys are automatically created if the command-line parameter "key" is used # Make sure this isn't in your public repository! diff --git a/tools/make.py b/tools/make.py index 6d40a02..5d56976 100644 --- a/tools/make.py +++ b/tools/make.py @@ -846,7 +846,7 @@ def main(argv): arg_modules = False # Only build modules on command line? use_pboproject = True # Default to pboProject build tool make_target = "DEFAULT" # Which section in make.cfg to use for the build - new_key = True # Make a new key and use it to sign? + new_key = False # Make a new key and use it to sign? quiet = False # Suppress output from build tool? sqfc_compiling = True @@ -1009,7 +1009,10 @@ def main(argv): commit_id = get_commit_ID() get_project_version(version_increments) - key_name = versionStamp = get_private_keyname(commit_id) + key_name = key[key.find(private_key_path) + len("{}\\".format(private_key_path)):key.find(".biprivatekey")] + if not (os.path.exists(os.path.join(private_key_path, key_name + ".biprivatekey")) and os.path.exists(os.path.join(private_key_path, key_name + ".bikey"))): + key_name = versionStamp = get_private_keyname(commit_id) + new_key = True print_green ("module_root: {}".format(module_root)) if (os.path.isdir(optionals_root)): @@ -1167,6 +1170,9 @@ def main(argv): raise key = os.path.join(private_key_path, "{}.biprivatekey".format(key_name)) + else: + print_green("\nNote: Using key {}".format(key)) + shutil.copyfile(os.path.join(private_key_path, key_name + ".bikey"), os.path.join(module_root, release_dir, project, "keys", "{}.bikey".format(key_name))) # Remove any obsolete files. print_blue("\nChecking for obsolete files...") diff --git a/tools/update_RPT_ToDo.py b/tools/update_RPT_ToDo.py new file mode 100644 index 0000000..a3c0466 --- /dev/null +++ b/tools/update_RPT_ToDo.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 + +import os + +from pygithub3 import Github + +def get_files(): + filePath = os.path.dirname(os.getcwd()) # get root directory + filePath = os.path.join(filePath,'addons') + allFiles = {} + paths = os.listdir(filePath) + + for path in paths: + pathFiles = [] + fullPath = os.path.join(filePath,path,"functions") + if (not os.path.isdir(fullPath)): continue + + # print(fullPath) + for file in os.listdir(fullPath): + if (file.endswith(".sqf") and file.startswith('fnc_')): + pathFiles.append(file[4:-4]) + + allFiles.update({path: pathFiles}) + + return allFiles + +def formatMessage(files, oldMessage): + index = oldMessage.find('- [') + oldMessage = oldMessage[index:] + + oldFunctions = {} + for message in oldMessage.split('\n'): + message = message.split('\r')[0] + index = message.find('] ') + if (index > -1): + isComplete = message.find('[x]') > -1 + message = message[index + 2:] + oldFunctions.update({message: isComplete}) + # print(oldFunctions) + + newMessage = "See the [RPT Logging Macros](https://github.com/Soliders-in-Arms-Arma-3-Group/sia3f/wiki/Development#33-rpt-logging-macros) for information on the available macros." + for module in files: + newMessage += "\n\n**{} module**".format(module) + for function in files.get(module): + isCompleteText = ' ' + if (oldFunctions.get(function)): + isCompleteText = 'x' + newMessage += "\n- [{}] {}".format(isCompleteText,function) + newMessage += "\n\n*Auto-generated by tools/update_RPT_ToDo.py*" + + return newMessage + +def main(): + files = get_files() + gh = Github(login_or_token=os.environ("GITHUB_TOKEN")) + + issue = gh.get_repo(488816799).get_issue(12) + currentMessage = issue.body + + newMessage = formatMessage(files, currentMessage) + print(newMessage) + issue.edit(issue.title, newMessage) +if __name__ == "__main__": + main()