From 9abe4ac92bd373771e20e8d971ee0fa5d61c3169 Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 4 Apr 2024 03:04:35 +0200 Subject: [PATCH 1/4] Various changes. See changelog.md --- framework/TODO.md | 2 +- framework/changelog.md | 18 +++ .../aar/functions/fn_endMission.sqf | 4 +- .../components/aar/functions/fn_record.sqf | 10 +- .../components/aar/functions/fn_stats.sqf | 57 ++++---- .../components/ai/functions/fn_hostage.sqf | 4 +- .../components/ai/functions/fn_reinforce.sqf | 6 +- framework/components/common/XEH_PREP.sqf | 3 +- framework/components/common/XEH_postInit.sqf | 9 -- framework/components/common/XEH_preInit.sqf | 9 ++ .../common/functions/fn_acreRestore.sqf | 2 + .../functions/fn_displayAddInitEvent.sqf | 45 ++++++ framework/components/curator/XEH_PREP.sqf | 25 ++-- framework/components/curator/XEH_postInit.sqf | 135 +++++++++++++----- .../curator/functions/fn_addCutoffPhase.sqf | 32 +++++ .../functions/fn_addRallypointModule.sqf | 32 ----- .../curator/functions/fn_ammoboxModule.sqf | 34 ----- .../functions/fn_disableFreezeTime.sqf | 29 ---- .../functions/fn_disableRallypoints.sqf | 24 ++++ .../functions/fn_enableRallypoints.sqf | 28 ++++ .../curator/functions/fn_forceArsenal.sqf | 24 ++++ .../functions/fn_forceArsenalModule.sqf | 28 ---- .../functions/fn_forceCloseArsenal.sqf | 24 ++++ .../functions/fn_kosherForceCloseModule.sqf | 28 ---- .../curator/functions/fn_randomLoadout.sqf | 41 ++++++ .../functions/fn_removeCutoffPhase.sqf | 39 +++++ .../functions/fn_removeRallypointModule.sqf | 28 ---- .../functions/fn_resetkosherRoleModule.sqf | 56 -------- .../functions/fn_safestartCutoffPhases.sqf | 62 -------- .../curator/functions/fn_safestartPhases.sqf | 32 ----- .../curator/functions/fn_setAmmobox.sqf | 31 ++++ .../curator/functions/fn_setCrateLoadout.sqf | 41 ++++++ .../curator/functions/fn_setLives.sqf | 32 +++++ .../curator/functions/fn_setLivesModule.sqf | 36 ----- .../curator/functions/fn_setPhase.sqf | 28 ++++ .../functions/fn_setUnitParameters.sqf | 52 +++++++ .../curator/functions/fn_toggleFreezeTime.sqf | 26 ++++ .../curator/functions/fn_toggleSpectator.sqf | 33 +++++ .../functions/fn_toggleSpectatorModule.sqf | 36 ----- .../components/curator/script_component.hpp | 4 +- framework/components/curator/stringtable.sqf | 39 ++--- framework/components/diagnostic/XEH_PREP.sqf | 3 +- .../components/diagnostic/XEH_preInit.sqf | 2 +- .../diagnostic/functions/fn_error.sqf | 2 +- .../functions/fn_initDisplayLog.sqf | 80 +++++++++++ .../diagnostic/functions/fn_log.sqf | 2 +- .../diagnostic/script_component.hpp | 29 ++-- .../components/kosherArsenal/XEH_3denInit.sqf | 43 ++++++ .../components/kosherArsenal/XEH_preInit.sqf | 3 + .../functions/fn_forceArsenal.sqf | 2 +- .../kosherArsenal/functions/fn_forceClose.sqf | 2 +- .../kosherArsenal/functions/fn_init.sqf | 9 +- .../components/logistics/XEH_3denInit.sqf | 48 +++++++ framework/components/logistics/XEH_PREP.sqf | 1 + .../logistics/functions/fn_cratePreset.sqf | 39 ++--- .../logistics/functions/fn_fillCrate.sqf | 63 ++++++++ framework/components/main/changelog.sqf | 46 +++--- framework/components/main/script_macros.hpp | 5 + framework/components/main/script_version.hpp | 2 +- framework/components/map/initSettings.sqf | 2 +- .../menu/functions/fn_diagnostics.sqf | 4 +- framework/components/player/XEH_postInit.sqf | 4 +- framework/components/respawn/XEH_postInit.sqf | 4 +- .../components/respawn/functions/fn_limit.sqf | 4 +- .../respawn/functions/fn_rallypoint.sqf | 24 ++-- .../respawn/functions/fn_setLimit.sqf | 4 +- .../vehicles/functions/fn_damageEH.sqf | 2 +- framework/description.ext | 13 +- framework/initPlayerLocal.sqf | 2 +- framework/rsc/loadouts/!arsenal_template.sqf | 2 +- framework/rsc/ui/RscImports.hpp | 47 +++++- framework/rsc/ui/RscLog.hpp | 72 ++++++++++ framework/rsc/ui/UI.hpp | 8 ++ 73 files changed, 1168 insertions(+), 633 deletions(-) create mode 100644 framework/components/common/functions/fn_displayAddInitEvent.sqf create mode 100644 framework/components/curator/functions/fn_addCutoffPhase.sqf delete mode 100644 framework/components/curator/functions/fn_addRallypointModule.sqf delete mode 100644 framework/components/curator/functions/fn_ammoboxModule.sqf delete mode 100644 framework/components/curator/functions/fn_disableFreezeTime.sqf create mode 100644 framework/components/curator/functions/fn_disableRallypoints.sqf create mode 100644 framework/components/curator/functions/fn_enableRallypoints.sqf create mode 100644 framework/components/curator/functions/fn_forceArsenal.sqf delete mode 100644 framework/components/curator/functions/fn_forceArsenalModule.sqf create mode 100644 framework/components/curator/functions/fn_forceCloseArsenal.sqf delete mode 100644 framework/components/curator/functions/fn_kosherForceCloseModule.sqf create mode 100644 framework/components/curator/functions/fn_randomLoadout.sqf create mode 100644 framework/components/curator/functions/fn_removeCutoffPhase.sqf delete mode 100644 framework/components/curator/functions/fn_removeRallypointModule.sqf delete mode 100644 framework/components/curator/functions/fn_resetkosherRoleModule.sqf delete mode 100644 framework/components/curator/functions/fn_safestartCutoffPhases.sqf delete mode 100644 framework/components/curator/functions/fn_safestartPhases.sqf create mode 100644 framework/components/curator/functions/fn_setAmmobox.sqf create mode 100644 framework/components/curator/functions/fn_setCrateLoadout.sqf create mode 100644 framework/components/curator/functions/fn_setLives.sqf delete mode 100644 framework/components/curator/functions/fn_setLivesModule.sqf create mode 100644 framework/components/curator/functions/fn_setPhase.sqf create mode 100644 framework/components/curator/functions/fn_setUnitParameters.sqf create mode 100644 framework/components/curator/functions/fn_toggleFreezeTime.sqf create mode 100644 framework/components/curator/functions/fn_toggleSpectator.sqf delete mode 100644 framework/components/curator/functions/fn_toggleSpectatorModule.sqf create mode 100644 framework/components/diagnostic/functions/fn_initDisplayLog.sqf create mode 100644 framework/components/kosherArsenal/XEH_preInit.sqf create mode 100644 framework/components/logistics/XEH_3denInit.sqf create mode 100644 framework/components/logistics/functions/fn_fillCrate.sqf create mode 100644 framework/rsc/ui/RscLog.hpp create mode 100644 framework/rsc/ui/UI.hpp diff --git a/framework/TODO.md b/framework/TODO.md index 1f532c6..4398efd 100644 --- a/framework/TODO.md +++ b/framework/TODO.md @@ -136,7 +136,7 @@ ## cleanup - [X] Move images from rsc\data to folders inside components - - [ ] Add Readme to each module + - [X] Add Readme to each module - [ ] Cleanup ui files - [ ] Follow ACE Code rules and remove sleeps, spawns etc. Get everything unscheduled: https://ace3.acemod.org/wiki/development/arma-3-scheduler-and-our-practices.html diff --git a/framework/changelog.md b/framework/changelog.md index bb08ba3..1d9ba77 100644 --- a/framework/changelog.md +++ b/framework/changelog.md @@ -1,3 +1,21 @@ +# Changelog v2.1.1.61 => v2.1.1.62 +*Reverted back to v2.1.1.58* + +## Added +- Added function to set a random loadout for a unit using a specified loadoutfile in 3den and zeus +- Added function to set a crate loadout for a crate using a specified logistics file in 3den and zeus +- Added a script log viewer to the CMF menu +- Added `PATHTO` family of macros + +# Changed +- Changed how ui elements are included. it now uses a master include file in the ui directory +- Changed how zeus/curator modules are registered +- Renamed all curator functions to reflect the change +- Changed so logistics crates will always be carryable / draggable regardless of weight + +# Fixed +- Fixed bug where vehicle rallypoints were placeable for everyone + # Changelog v2.1.1.60 => v2.1.1.61 ## Fixed - Fixed bug with ace action on crates being broken diff --git a/framework/components/aar/functions/fn_endMission.sqf b/framework/components/aar/functions/fn_endMission.sqf index 7cd6acb..7935da3 100644 --- a/framework/components/aar/functions/fn_endMission.sqf +++ b/framework/components/aar/functions/fn_endMission.sqf @@ -94,6 +94,8 @@ EFUNC(inline_aar,endMission) = { _statsText = _statsText + format["Your Enemy Kills: %1
", (player getVariable [QGVAR(stats_E_kills), 0])]; _statsText = _statsText + format["Your Friendly Kills: %1
", (player getVariable [QGVAR(stats_F_kills), 0])]; _statsText = _statsText + format["Your Civilian Kills: %1
", (player getVariable [QGVAR(stats_C_kills), 0])]; + _statsText = _statsText + format["Shots Fired: %1
", (player getVariable [QGVAR(stats_shots_fired), 0])]; + // @TODO: Make sure to save stats incase of a rejip while { player getVariable QGVAR(spectatorStatus) } do { hintSilent parseText _statsText; @@ -177,7 +179,7 @@ EFUNC(inline_aar,endMission) = { private _EHIndex = addMissionEventHandler ["EntityCreated", { params ["_entity"]; - if ((typeof _entity) isEqualTo "ModuleEndMission_F") then { + if ((typeof _entity) isEqualTo "ModuleEndMission_F" && local _entity) then { deleteVehicle _entity; [] spawn EFUNC(inline_aar,endMission); }; diff --git a/framework/components/aar/functions/fn_record.sqf b/framework/components/aar/functions/fn_record.sqf index 32584c4..d4dee37 100644 --- a/framework/components/aar/functions/fn_record.sqf +++ b/framework/components/aar/functions/fn_record.sqf @@ -10,7 +10,7 @@ * None * * Example: - * call cmf_aar_fnc_record + * [] call cmf_aar_fnc_record * * Public: No */ @@ -22,7 +22,7 @@ if (!isServer) exitWith { }; addMissionEventHandler ["EntityCreated", { params ["_entity"]; - if ((_entity in allUnits || _entity in allMapMarkers || _entity in vehicles) && { !isNull _entity }) then { + if ((_entity in allUnits || _entity in allMapMarkers || _entity in vehicles) && !isNull _entity) then { _entity addEventHandler ["Fired", { params ["_unit", "_weapon", "", "", "", "", "_projectile"]; @@ -45,10 +45,10 @@ addMissionEventHandler ["EntityCreated", { _this spawn { /* Get title of mission */ - private _missionTitle = if (!isNil QGVAR(safestart_title)) then { - GVAR(safestart_title) + private _missionTitle = if (!isNil { missionNameSpace getVariable QGVAR(safestart_title) }) then { + missionNameSpace getVariable QGVAR(safestart_title) } else { - [getMissionConfigValue ['IntelBriefingName', briefingName]] call EFUNC(common,hexToASCII); + [getMissionConfigValue ['IntelBriefingName', briefingName]] call cmf_utility_fnc_hexToASCII; }; /* Set base AAR data (and overwrite any old data) */ diff --git a/framework/components/aar/functions/fn_stats.sqf b/framework/components/aar/functions/fn_stats.sqf index 5b1dec8..63dedbb 100644 --- a/framework/components/aar/functions/fn_stats.sqf +++ b/framework/components/aar/functions/fn_stats.sqf @@ -16,33 +16,40 @@ */ SCRIPT(stats); -if (!isServer) exitWith { }; - -addMissionEventHandler ["EntityKilled", { - /* Track deaths */ - if (isPlayer (_this select 0)) then { - private _deaths = (_this select 0) getVariable [QGVAR(stats_deaths), -1]; - (_this select 0) setVariable [QGVAR(stats_deaths), _deaths, true]; - }; +if (isServer) then { + addMissionEventHandler ["EntityKilled", { + /* Track deaths */ + if (isPlayer (_this select 0)) then { + private _deaths = (_this select 0) getVariable [QGVAR(stats_deaths), -1]; + (_this select 0) setVariable [QGVAR(stats_deaths), _deaths + 1, true]; + }; - /* Don't count suicides as kills */ - if ((_this select 1) isEqualTo (_this select 0)) exitWith { }; + /* Don't count suicides as kills */ + if ((_this select 1) isEqualTo (_this select 0)) exitWith { }; - /* Track kills */ - if (isPlayer (_this select 1) && { (_this select 0) isKindOf "Man" }) then { - if (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsEnemy) && { (side group (_this select 0) != civilian) }) exitWith { - private _kills = (_this select 1) getVariable [QGVAR(stats_E_kills), 0]; - (_this select 1) setVariable [QGVAR(stats_E_kills), _kills + 1, true]; - }; + /* Track kills */ + if (isPlayer (_this select 1) && (_this select 0) isKindOf "Man") then { + switch (true) do { + case (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsEnemy) && (side group (_this select 0) != civilian)): { + private _kills = (_this select 1) getVariable [QGVAR(stats_E_kills), 0]; + (_this select 1) setVariable [QGVAR(stats_E_kills), _kills + 1, true]; + }; - if (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsFriendly) && { (side group (_this select 0) != civilian) }) exitWith { - private _kills = (_this select 1) getVariable [QGVAR(stats_F_kills), 0]; - (_this select 1) setVariable [QGVAR(stats_F_kills), _kills + 1, true]; - }; + case (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsFriendly) && (side group (_this select 0) != civilian)): { + private _kills = (_this select 1) getVariable [QGVAR(stats_F_kills), 0]; + (_this select 1) setVariable [QGVAR(stats_F_kills), _kills + 1, true]; + }; - if (side group (_this select 0) isEqualTo civilian) exitWith { - private _kills = (_this select 1) getVariable [QGVAR(stats_C_kills), 0]; - (_this select 1) setVariable [QGVAR(stats_C_kills), _kills + 1, true]; + case (side group (_this select 0) == civilian): { + private _kills = (_this select 1) getVariable [QGVAR(stats_C_kills), 0]; + (_this select 1) setVariable [QGVAR(stats_C_kills), _kills + 1, true]; + }; + }; }; - }; -}]; + }]; +} else { + player addEventHandler ["Fired", { + private _shots = player getVariable [QGVAR(stats_shots_fired), 0]; + player setVariable [QGVAR(stats_shots_fired), _shots + 1, true]; + }]; +}; \ No newline at end of file diff --git a/framework/components/ai/functions/fn_hostage.sqf b/framework/components/ai/functions/fn_hostage.sqf index 87e17d1..05addaf 100644 --- a/framework/components/ai/functions/fn_hostage.sqf +++ b/framework/components/ai/functions/fn_hostage.sqf @@ -70,7 +70,7 @@ GVAR(hostage_followPlayerFNC) = { private _getSeat = [vehicle _target] call ace_captives_fnc_findEmptyNonFFVCargoSeat; _getSeat params ["_cargoIndex"]; - if (_cargoIndex isEqualTo -1) exitWith {}; + if (_cargoIndex == -1) exitWith {}; _hostage assignAsCargoIndex [vehicle _target, _cargoIndex]; [_hostage] orderGetIn true; @@ -89,7 +89,7 @@ private _followAction = [QGVAR(hostageFollow), "Follow Me!", "", GVAR(hostage_followPlayerFNC), { isNull ((_this select 0) getVariable [QGVAR(hostage_owner), objNull]) && - { !((_this select 0) getVariable ["ace_captives_isHandcuffed", false]) } + !((_this select 0) getVariable ["ace_captives_isHandcuffed", false]) } ] call ace_interact_menu_fnc_createAction; diff --git a/framework/components/ai/functions/fn_reinforce.sqf b/framework/components/ai/functions/fn_reinforce.sqf index f376b55..d3845b1 100644 --- a/framework/components/ai/functions/fn_reinforce.sqf +++ b/framework/components/ai/functions/fn_reinforce.sqf @@ -38,10 +38,10 @@ if (!isServer) exitWith {}; _thisArgs params ["_reinforceGroup"]; params ["", "_shareGroup", "_target"]; - if (_reinforceGroup getVariable [QGVAR(reinforce_disableGroup), false]) exitWith { }; - if ((group _target) getVariable [QGVAR(reinforce_disableTarget), false]) exitWith { }; + if (_reinforceGroup getVariable [QGVAR(reinforce_disableGroup), false]) exitWith {}; + if ((group _target) getVariable [QGVAR(reinforce_disableTarget), false]) exitWith {}; - if ( (leader _reinforceGroup distance leader _shareGroup) < SETTING(reinforceRange) && { _reinforceGroup != _shareGroup && { !(_reinforceGroup getVariable [QGVAR(reinforce_targetGroup), grpNull] isEqualTo _shareGroup) && { side _reinforceGroup isEqualTo side _shareGroup } } }) then { + if ( (leader _reinforceGroup distance leader _shareGroup) < SETTING(reinforceRange) && _reinforceGroup != _shareGroup && !(_reinforceGroup getVariable [QGVAR(reinforce_targetGroup), grpNull] isEqualTo _shareGroup) && side _reinforceGroup isEqualTo side _shareGroup ) then { LOG_2("%1 reinforcing %2(TaskRush)", groupId _reinforceGroup, groupId _shareGroup); [_reinforceGroup, 200, 15, [], getPos _target, false] spawn lambs_wp_fnc_taskRush; diff --git a/framework/components/common/XEH_PREP.sqf b/framework/components/common/XEH_PREP.sqf index 2a22216..9eadd36 100644 --- a/framework/components/common/XEH_PREP.sqf +++ b/framework/components/common/XEH_PREP.sqf @@ -17,4 +17,5 @@ PREP(stripUnit); PREP(versionCompare); PREP(zeusHint); PREP(acreRestore); -PREP(chatHandler); \ No newline at end of file +PREP(chatHandler); +PREP(displayAddInitEvent); \ No newline at end of file diff --git a/framework/components/common/XEH_postInit.sqf b/framework/components/common/XEH_postInit.sqf index d11da37..61ca95f 100644 --- a/framework/components/common/XEH_postInit.sqf +++ b/framework/components/common/XEH_postInit.sqf @@ -22,15 +22,6 @@ cmf_player removeDiarySubject "Statistics"; /* Remove team diary */ cmf_player removeDiarySubject "Units"; -/* Create notification colors */ -GVAR(notificationColors) = createHashMapFromArray [ - ["DEFAULT", [0.69, 0.69, 0.69, 0.50]], - ["INFO", [0.00, 0.75, 0.75, 0.50]], - ["DEBUG", [0.99, 0.42, 0.98, 0.50]], - ["WARNING", [0.78, 0.78, 0.00, 0.50]], - ["ERROR", [0.81, 0.20, 0.17, 0.50]] -]; - /* Create sub category for radios */ [(call acre_api_fnc_getAllRadios) select 0, "Radios", "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa", 1] call ace_arsenal_fnc_addRightPanelButton; diff --git a/framework/components/common/XEH_preInit.sqf b/framework/components/common/XEH_preInit.sqf index 210ebd5..db8d39d 100644 --- a/framework/components/common/XEH_preInit.sqf +++ b/framework/components/common/XEH_preInit.sqf @@ -7,5 +7,14 @@ ACE_maxWeightDrag = 1500; /* Disable CTAB on ground vehicles */ cTab_vehicleClass_has_FBCB2 = []; +/* Create notification colors */ +GVAR(notificationColors) = createHashMapFromArray [ + ["DEFAULT", [0.69, 0.69, 0.69, 0.50]], + ["INFO", [0.00, 0.75, 0.75, 0.50]], + ["DEBUG", [0.99, 0.42, 0.98, 0.50]], + ["WARNING", [0.78, 0.78, 0.00, 0.50]], + ["ERROR", [0.81, 0.20, 0.17, 0.50]] +]; + /* Handle connection and disconnection messages */ call FUNC(chatHandler); \ No newline at end of file diff --git a/framework/components/common/functions/fn_acreRestore.sqf b/framework/components/common/functions/fn_acreRestore.sqf index 9e9b3c9..3322588 100644 --- a/framework/components/common/functions/fn_acreRestore.sqf +++ b/framework/components/common/functions/fn_acreRestore.sqf @@ -16,6 +16,8 @@ */ params ["_newUnit", "_oldUnit"]; +if (isNull _oldUnit) exitWith { }; + private _oldPTT = cmf_player getVariable [QGVAR(ACREPTT), call acre_api_fnc_getMultiPushToTalkAssignment]; private _oldRadios = ([_oldUnit] call acre_sys_core_fnc_getGear) select { ([_x] call acre_api_fnc_getBaseRadio) != "" }; private _newRadios = ([_newUnit] call acre_sys_core_fnc_getGear) select { ([_x] call acre_api_fnc_getBaseRadio) != "" }; diff --git a/framework/components/common/functions/fn_displayAddInitEvent.sqf b/framework/components/common/functions/fn_displayAddInitEvent.sqf new file mode 100644 index 0000000..4fe7053 --- /dev/null +++ b/framework/components/common/functions/fn_displayAddInitEvent.sqf @@ -0,0 +1,45 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Attaches a display / dialog init event + * + * Arguments: + * 0: IDD + * 1: Callback + * 2: Arguments + * + * Return Value: + * CBA PerFramehandler Handle + * + * Example: + * [313, { hint str _this }, ["foo", "bar"]] call cmf_common_fnc_displayAddInitEvent + * + * Public: Yes + */ +params ["_idd", "_callback", ["_args", []]]; + +private _displayInitEvent = { + params ["_self", "_idd", "_callback", "_args"]; + + [findDisplay _idd, _args] call _callback; + + [ + { isNull findDisplay (_this select 1) }, + { + params ["_self"]; + + [ + { !isNull findDisplay (_this select 1) }, + _self, + _this + ] call CBA_fnc_waitUntilAndExecute; + }, + _this + ] call CBA_fnc_waitUntilAndExecute; +}; + +[ + { !isNull findDisplay (_this select 1) }, + _displayInitEvent, + [_displayInitEvent, _idd, _callback, _args] +] call CBA_fnc_waitUntilAndExecute; \ No newline at end of file diff --git a/framework/components/curator/XEH_PREP.sqf b/framework/components/curator/XEH_PREP.sqf index 4c9d947..db28a90 100644 --- a/framework/components/curator/XEH_PREP.sqf +++ b/framework/components/curator/XEH_PREP.sqf @@ -1,15 +1,18 @@ #include "script_component.hpp" -PREP(setLivesModule); -PREP(forceArsenalModule); -PREP(ammoboxModule); -PREP(resetKosherRoleModule); -PREP(kosherForceCloseModule); -PREP(disableFreezeTime); -PREP(toggleSpectatorModule); -PREP(addRallypointModule); -PREP(removeRallypointModule); +PREP(setLives); +PREP(forceArsenal); +PREP(setAmmobox); +PREP(setUnitParameters); +PREP(forceCloseArsenal); +PREP(toggleFreezeTime); +PREP(toggleSpectator); +PREP(enableRallypoints); +PREP(disableRallypoints); +PREP(setPhase); +PREP(addCutoffPhase); +PREP(removeCutoffPhase); +PREP(randomLoadout); +PREP(setCrateLoadout); PREP(playerInfo); -PREP(safestartPhases); -PREP(safestartCutoffPhases); PREP(initDisplayCurator); diff --git a/framework/components/curator/XEH_postInit.sqf b/framework/components/curator/XEH_postInit.sqf index 5f15fb6..5d618e8 100644 --- a/framework/components/curator/XEH_postInit.sqf +++ b/framework/components/curator/XEH_postInit.sqf @@ -1,46 +1,109 @@ #include "script_component.hpp" -call FUNC(setLivesModule); -call FUNC(forceArsenalModule); -call FUNC(ammoboxModule); -call FUNC(resetKosherRoleModule); -call FUNC(kosherForceCloseModule); -call FUNC(disableFreezeTime); -call FUNC(toggleSpectatorModule); -call FUNC(addRallypointModule); -call FUNC(removeRallypointModule); +[ /* Set Lives */ + QUOTE(FRAMEWORK: Respawn), + LSTRING(setLives), + FUNC(setLives), + QPATHTOF(data\icon_module_setLives_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Force Kosher Arsenal */ + QUOTE(FRAMEWORK: Kosher Arsenal), + LSTRING(forceArsenal), + FUNC(forceArsenal), + QPATHTOF(data\icon_module_kosherArsenal_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Set ammobox */ + QUOTE(FRAMEWORK: Kosher Arsenal), + LSTRING(setAmmobox), + FUNC(setAmmobox), + QPATHTOF(data\icon_module_ammobox_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Set Unit Parameters */ + QUOTE(FRAMEWORK: Respawn), + LSTRING(setUnitParameters), + FUNC(setUnitParameters), + "" +] call zen_custom_modules_fnc_register; + +[ /* Force Close Kosher Arsenal */ + QUOTE(FRAMEWORK: Kosher Arsenal), + LSTRING(forceCloseArsenal), + FUNC(forceCloseArsenal), + QPATHTOF(data\icon_module_closeKosherArsenal_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Toggle Freezetime */ + QUOTE(FRAMEWORK: Common), + LSTRING(toggleFreezeTime), + FUNC(toggleFreezeTime), + QPATHTOF(data\icon_module_disableSetDate_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Toggle spectator */ + QUOTE(FRAMEWORK: Common), + LSTRING(toggleSpectator), + FUNC(toggleSpectator), + QPATHTOF(data\icon_module_spectate_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Enable rallypoints */ + QUOTE(FRAMEWORK: Respawn), + LSTRING(enableRallypoints), + FUNC(enableRallypoints), + QPATHTOEF(respawn,data\icon_ace_rallypoint_place_ca.paa) +] call zen_custom_modules_fnc_register; + +[ /* Disable rallypoints */ + QUOTE(FRAMEWORK: Respawn), + LSTRING(disableRallypoints), + FUNC(disableRallypoints), + QPATHTOEF(respawn,data\icon_ace_rallypoint_disabled_ca.paa) +] call zen_custom_modules_fnc_register; + +[ + QUOTE(FRAMEWORK: Safestart), + "Set Phase", + FUNC(setPhase), + "" +] call zen_custom_modules_fnc_register; + +[ + QUOTE(FRAMEWORK: Safestart), + "Add Cutoff Phase", + FUNC(addCutoffPhase), + "" +] call zen_custom_modules_fnc_register; + +[ + QUOTE(FRAMEWORK: Safestart), + "Remove Cutoff Phase", + FUNC(removeCutoffPhase), + "" +] call zen_custom_modules_fnc_register; + +[ /* Set Random Loadout */ + QUOTE(FRAMEWORK: Kosher Arsenal), + "Set Random Loadout", + FUNC(randomLoadout), + "a3\ui_f\data\gui\rsc\rscdisplayarsenal\uniform_ca.paa" +] call zen_custom_modules_fnc_register; + +[ /* Set Crate Loadout */ + QUOTE(FRAMEWORK: Logistics), + "Set Crate Loadout", + FUNC(setCrateLoadout), + "a3\ui_f\data\map\vehicleicons\iconcrateord_ca.paa" +] call zen_custom_modules_fnc_register; + call FUNC(playerInfo); -call FUNC(safestartPhases); -call FUNC(safestartCutoffPhases); GVAR(zeusInfoShow) = true; /* curator displayInit */ -private _displayInitEvent = { - params ["_self"]; - - [findDisplay 312] call FUNC(initDisplayCurator); - - [ - { isNull findDisplay 312 }, - { - params ["_displayInitEvent"]; - - [ - { !isNull findDisplay 312 }, - _displayInitEvent, - [_displayInitEvent] - ] call CBA_fnc_waitUntilAndExecute; - }, - [_self] - ] call CBA_fnc_waitUntilAndExecute; -}; - -[ - { !isNull findDisplay 312 }, - _displayInitEvent, - [_displayInitEvent] -] call CBA_fnc_waitUntilAndExecute; +[IDD_ZEUS, FUNC(initDisplayCurator)] call EFUNC(common,displayAddInitEvent); [QGVAR(toggleZeusInfo), { GVAR(zeusInfoShow) = !GVAR(zeusInfoShow); diff --git a/framework/components/curator/functions/fn_addCutoffPhase.sqf b/framework/components/curator/functions/fn_addCutoffPhase.sqf new file mode 100644 index 0000000..051bfeb --- /dev/null +++ b/framework/components/curator/functions/fn_addCutoffPhase.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +/* + * Author: Eric + * module to add/remove safestart cutoff phases + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_safestartCutoffPhases + * + * Public: No + */ +SCRIPT(safestartCutoffPhases); + +private _onConfirm = { + (_this select 0) params ["_name", "_cutoff", "_code"]; + private _cutoffPhases = missionNameSpace getVariable [QEGVAR(gameplay,safestart_phaseCutOffs), []]; + + _cutoffPhases pushBack [_name, time + (_cutOff * 60), _code]; + EGVAR(gameplay,safestart_phaseCutOffs) = _cutoffPhases; + publicVariable QEGVAR(gameplay,safestart_phaseCutOffs); +}; + +["Add: Cutoff Phase", [ + ["EDIT", ["Phase name", "Name of the cutoff phase"], [""]], + ["SLIDER", ["Cutoff Time", "(In minutes)"], [0, 60, 20, 0]], + ["EDIT:CODE", ["On Complete", "Code that get's executed when the phase completes"], [""]] +], _onConfirm, {}] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_addRallypointModule.sqf b/framework/components/curator/functions/fn_addRallypointModule.sqf deleted file mode 100644 index e0488e9..0000000 --- a/framework/components/curator/functions/fn_addRallypointModule.sqf +++ /dev/null @@ -1,32 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates a zeus module to add rallypoints for unit - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_addRallypointModule - * - * Public: No - */ -SCRIPT(setLivesModule); - -private _moduleFunction = { - if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; - if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; - if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; - - if !((_this select 1) getVariable [QEGVAR(respawn,rallypoint), false]) then { - [[(_this select 1)]] call EFUNC(respawn,rallypoint); - } else { - (_this select 1) setVariable [QEGVAR(respawn,showRallypoint), true, true]; - }; - [format[LSTRING(rallypoint_success_message), name (_this select 1)]] call zen_common_fnc_showMessage; -}; - -[LSTRING(respawn_module_category_displayname), LSTRING(rallypoint_module_displayname), _moduleFunction, "components\respawn\data\icon_ace_rallypoint_place_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_ammoboxModule.sqf b/framework/components/curator/functions/fn_ammoboxModule.sqf deleted file mode 100644 index 2c86f56..0000000 --- a/framework/components/curator/functions/fn_ammoboxModule.sqf +++ /dev/null @@ -1,34 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates a zeus module to set object as an ammo box - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_ammoboxModule - * - * Public: No - */ -SCRIPT(ammoboxModule); - -/* Add kosher ammobox to object */ -private _dialogFunction = { - if (isNull (_this select 1)) exitWith {[LSTRING(object_requirement_message)] call zen_common_fnc_showMessage}; - - private _result = [(_this select 1)] call EFUNC(kosherArsenal,ammobox); - if (_result) then { - [LSTRING(ammobox_success_message)] call zen_common_fnc_showMessage; - - /* Raise event */ - [QGVAR(ammobox_added), [_this select 1]] call CBA_fnc_globalEvent; - } else { - [LSTRING(ammobox_fail_message)] call zen_common_fnc_showMessage; - }; -}; - -[LSTRING(kosherArsenal_module_category_displayname), LSTRING(ammobox_module_displayname), _dialogFunction, "components\curator\data\icon_module_ammobox_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_disableFreezeTime.sqf b/framework/components/curator/functions/fn_disableFreezeTime.sqf deleted file mode 100644 index 0c66753..0000000 --- a/framework/components/curator/functions/fn_disableFreezeTime.sqf +++ /dev/null @@ -1,29 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates a zeus module to disable freezeTime - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_disableFreezeTime - * - * Public: No - */ -SCRIPT(disableFreezeTime); - -[LSTRING(common_module_category_displayname), LSTRING(dis_freezeTime_module_displayname), { - ESETTING(environment,freezeTime) = !ESETTING(environment,freezeTime); - publicVariable ESETTING(environment,freezeTime); - - if (ESETTING(environment,freezeTime)) then { - [LSTRING(en_freezeTime_success_message)] call zen_common_fnc_showMessage; - } else { - [LSTRING(dis_freezeTime_success_message)] call zen_common_fnc_showMessage; - }; - -}, "components\curator\data\icon_module_disableSetDate_ca.paa"] call zen_custom_modules_fnc_register; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_disableRallypoints.sqf b/framework/components/curator/functions/fn_disableRallypoints.sqf new file mode 100644 index 0000000..5d685de --- /dev/null +++ b/framework/components/curator/functions/fn_disableRallypoints.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates a zeus module to remove rallypoints for unit + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call cmf_zeus_fnc_disableRallypoints + * + * Public: No + */ +SCRIPT(disableRallypoints); + +if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; +if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; + +(_this select 1) setVariable [QEGVAR(respawn,showRallypoint), false, true]; +[format[LSTRING(rallypoint_remove_success_message), name (_this select 1)]] call zen_common_fnc_showMessage; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_enableRallypoints.sqf b/framework/components/curator/functions/fn_enableRallypoints.sqf new file mode 100644 index 0000000..7174337 --- /dev/null +++ b/framework/components/curator/functions/fn_enableRallypoints.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates a zeus module to add rallypoints for unit + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call cmf_zeus_fnc_enableRallypoints + * + * Public: No + */ +SCRIPT(enableRallypoints); + +if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; +if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; + +if !((_this select 1) getVariable [QEGVAR(respawn,rallypoint), false]) then { + [[(_this select 1)]] call EFUNC(respawn,rallypoint); +} else { + (_this select 1) setVariable [QEGVAR(respawn,showRallypoint), true, true]; +}; +[format[LSTRING(rallypoint_success_message), name (_this select 1)]] call zen_common_fnc_showMessage; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_forceArsenal.sqf b/framework/components/curator/functions/fn_forceArsenal.sqf new file mode 100644 index 0000000..b0bbb44 --- /dev/null +++ b/framework/components/curator/functions/fn_forceArsenal.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates a zeus module to force kosher arsenal on a player + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_forceArsenal + * + * Public: No + */ +SCRIPT(forceArsenal); + +if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; +if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; + +[(_this select 1)] call EFUNC(kosherArsenal,forceArsenal); +[LSTRING(forceopen_kosherArsenal_success_message)] call zen_common_fnc_showMessage; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_forceArsenalModule.sqf b/framework/components/curator/functions/fn_forceArsenalModule.sqf deleted file mode 100644 index 8d79993..0000000 --- a/framework/components/curator/functions/fn_forceArsenalModule.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates a zeus module to force kosher arsenal on a player - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_forceArsenalModule - * - * Public: No - */ -SCRIPT(forceArsenalModule); - -private _dialogFunction = { - if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; - if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; - if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; - - [(_this select 1)] call EFUNC(kosherArsenal,forceArsenal); - [LSTRING(forceopen_kosherArsenal_success_message)] call zen_common_fnc_showMessage; -}; - -[LSTRING(kosherArsenal_module_category_displayname), LSTRING(forceopen_kosherArsenal_module_displayname), _dialogFunction, "components\curator\data\icon_module_kosherArsenal_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_forceCloseArsenal.sqf b/framework/components/curator/functions/fn_forceCloseArsenal.sqf new file mode 100644 index 0000000..9e11e29 --- /dev/null +++ b/framework/components/curator/functions/fn_forceCloseArsenal.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates module that force closes kosher arsenal for supplied unit + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_forceCloseArsenal + * + * Public: No + */ +SCRIPT(forceCloseArsenal); + +if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; +if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; + +[(_this select 1)] call EFUNC(kosherArsenal,forceClose); +[LSTRING(forceclose_kosherArsenal_message)] call zen_common_fnc_showMessage; diff --git a/framework/components/curator/functions/fn_kosherForceCloseModule.sqf b/framework/components/curator/functions/fn_kosherForceCloseModule.sqf deleted file mode 100644 index 6905f94..0000000 --- a/framework/components/curator/functions/fn_kosherForceCloseModule.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates module that force closes kosher arsenal for supplied unit - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_kosherForceCloseModule - * - * Public: No - */ -SCRIPT(kosherForceCloseModule); - -private _dialogFunction = { - if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; - if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; - if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; - - [(_this select 1)] call EFUNC(kosherArsenal,forceClose); - [LSTRING(forceclose_kosherArsenal_message)] call zen_common_fnc_showMessage; -}; - -[LSTRING(kosherArsenal_module_category_displayname), LSTRING(forceclose_kosherArsenal_module_displayname), _dialogFunction, "components\curator\data\icon_module_closeKosherArsenal_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_randomLoadout.sqf b/framework/components/curator/functions/fn_randomLoadout.sqf new file mode 100644 index 0000000..173b2a7 --- /dev/null +++ b/framework/components/curator/functions/fn_randomLoadout.sqf @@ -0,0 +1,41 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Sets a random loadout for a selected unit based on a role and loadoutfile + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call cmf_curator_fnc_randomLoadout + * + * Public: No + */ + +private _unit = _this param [1, objNull]; + +if (isNull _unit) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !(_unit isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; + +private _randomizeLoadout = { + params ["_values", "_unit"]; + + private _loadout = format["rsc\loadouts\%1.sqf", _values select 1]; + if !(FILE_EXISTS(_loadout)) exitWith { ERROR_MSG_1("Unable to find loadoutfile: %1", _loadout) }; + private _whitelist = [_values select 0, player, true] call compile(preprocessFileLineNumbers _loadout); + + [_unit, _values select 0, _whitelist select 1] call EFUNC(kosherAI,setLoadout); + + ["Randomized Loadout"] call zen_common_fnc_showMessage; +}; + +private _defaultRole = [_unit] call EFUNC(kosherAI,getRole); +private _defaultLoadout = (missionNamespace getVariable [QEGVAR(kosherAI,loadouts), [""]]) select 0; + +["Set Random Loadout", [ + ["EDIT", ["Role", "Role to set unit as"], [_defaultRole]], + ["EDIT", ["Loadout File", "Loadout file to use"], [_defaultLoadout]] +], _randomizeLoadout, {}, _unit] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_removeCutoffPhase.sqf b/framework/components/curator/functions/fn_removeCutoffPhase.sqf new file mode 100644 index 0000000..7530770 --- /dev/null +++ b/framework/components/curator/functions/fn_removeCutoffPhase.sqf @@ -0,0 +1,39 @@ +#include "script_component.hpp" +/* + * Author: Eric + * module to add/remove safestart cutoff phases + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_safestartCutoffPhases + * + * Public: No + */ +SCRIPT(safestartCutoffPhases); + +private _onConfirm = { + (_this select 0) params ["_name", "_cutoff", "_code"]; + private _cutoffPhases = missionNameSpace getVariable [QEGVAR(gameplay,safestart_phaseCutOffs), []]; + + _cutoffPhases pushBack [_name, _cutOff, _code]; + EGVAR(gameplay,safestart_phaseCutOffs) = _cutoffPhases; + publicVariable QEGVAR(gameplay,safestart_phaseCutOffs); +}; + +/* Get current cutoff phases */ +private _cutoffPhases = missionNameSpace getVariable [QEGVAR(gameplay,safestart_phaseCutOffs), []]; + +/* get indexes */ +private _values = []; +for "_i" from 0 to count _cutoffPhases do { + _values pushBack _i; +}; + +["Remove: Cutoff Phase", [ + ["LIST", ["Phase name", "Name of the cutoff phase"], [_values, _cutoffPhases, 0, 5]] +], _onConfirm, {}] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_removeRallypointModule.sqf b/framework/components/curator/functions/fn_removeRallypointModule.sqf deleted file mode 100644 index dde9935..0000000 --- a/framework/components/curator/functions/fn_removeRallypointModule.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates a zeus module to remove rallypoints for unit - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_removeRallypointModule - * - * Public: No - */ -SCRIPT(setLivesModule); - -private _moduleFunction = { - if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; - if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; - if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; - - (_this select 1) setVariable [QEGVAR(respawn,showRallypoint), false, true]; - [format[LSTRING(rallypoint_remove_success_message), name (_this select 1)]] call zen_common_fnc_showMessage; -}; - -[LSTRING(respawn_module_category_displayname), LSTRING(rallypoint_remove_module_displayname), _moduleFunction, "components\respawn\data\icon_ace_rallypoint_disabled_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_resetkosherRoleModule.sqf b/framework/components/curator/functions/fn_resetkosherRoleModule.sqf deleted file mode 100644 index f8b16c4..0000000 --- a/framework/components/curator/functions/fn_resetkosherRoleModule.sqf +++ /dev/null @@ -1,56 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * module to reset a players role and/or team for kosher arsenal - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_resetKosherRoleModule - * - * Public: No - */ -SCRIPT(resetKosherRoleModule); - -private _dialogFunction = { - if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; - if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; - if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; - - private _defaultRole = ((_this select 1) getVariable [QEGVAR(common,role), "RFL"]); - private _defaultTeam = ((_this select 1) getVariable [QEGVAR(common,team), 0]); - private _defaultLoadout = ((_this select 1) getVariable [QEGVAR(kosherArsenal,loadout), ""]); - _defaultLoadout = _defaultLoadout splitString "\" select (count (_defaultLoadout splitString "\") - 1); - _defaultLoadout = (_defaultLoadout splitString ".") select 0; - - private _onConfirm = { - params["_dialogValues", "_unit", "_defaultRole", "_defaultTeam", "_defaultLoadout"]; - - _dialogValues params[["_role", _defaultRole], ["_team", _defaultTeam], ["_loadout", _defaultLoadout]]; - - /* Set the unit's role and team */ - [_unit, _role, _team] call EFUNC(organization,setRole); - - /* Set the unit's loadoutfile */ - private _loadout = format["rsc\loadouts\%1.sqf", _loadout]; - if !(FILE_EXISTS(_loadout)) exitWith { [LSTRING(no_loadoutFile_message)] call zen_common_fnc_showMessage }; - _unit setVariable [QEGVAR(kosherArsenal,loadout), _loadout, true]; - - /* Open kosher arsenal */ - [_unit] call EFUNC(common,stripUnit); - [_unit] call EFUNC(kosherArsenal,forceArsenal); - [LSTRING(reset_kosherArsenal_success_message)] call zen_common_fnc_showMessage; - }; - - [LSTRING(change_kosherArsenal_module_displayname), [ - ["EDIT", [LSTRING(role), LSTRING(role_tooltip)], [_defaultRole]], - ["SLIDER", [LSTRING(team), LSTRING(team_tooltip)], [0, 100, _defaultTeam, 0]], - ["EDIT", [LSTRING(loadout), LSTRING(loadout_tooltip)], [_defaultLoadout]] - ], _onConfirm, {}, (_this select 1), _defaultRole, _defaultTeam, _defaultLoadout] call zen_dialog_fnc_create; -}; - -[LSTRING(common_module_category_displayname), LSTRING(change_kosherArsenal_module_displayname), _dialogFunction, ""] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_safestartCutoffPhases.sqf b/framework/components/curator/functions/fn_safestartCutoffPhases.sqf deleted file mode 100644 index 66d717f..0000000 --- a/framework/components/curator/functions/fn_safestartCutoffPhases.sqf +++ /dev/null @@ -1,62 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * module to add/remove safestart cutoff phases - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_safestartCutoffPhases - * - * Public: No - */ -SCRIPT(safestartCutoffPhases); - -private _addFunction = { - private _onConfirm = { - (_this select 0) params ["_name", "_cutoff", "_code"]; - private _cutoffPhases = missionNameSpace getVariable [QEGVAR(gameplay,safestart_phaseCutOffs), []]; - - _cutoffPhases pushBack [_name, time + (_cutOff * 60), _code]; - EGVAR(gameplay,safestart_phaseCutOffs) = _cutoffPhases; - publicVariable QEGVAR(gameplay,safestart_phaseCutOffs); - }; - - ["Add: Cutoff Phase", [ - ["EDIT", ["Phase name", "Name of the cutoff phase"], [""]], - ["SLIDER", ["Cutoff Time", "(In minutes)"], [0, 60, 20, 0]], - ["EDIT:CODE", ["On Complete", "Code that get's executed when the phase completes"], [""]] - ], _onConfirm, {}] call zen_dialog_fnc_create; -}; - -["CMF: Safestart", "Add Cutoff Phase", _addFunction, ""] call zen_custom_modules_fnc_register; - -private _removeFunction = { - private _onConfirm = { - (_this select 0) params ["_name", "_cutoff", "_code"]; - private _cutoffPhases = missionNameSpace getVariable [QEGVAR(gameplay,safestart_phaseCutOffs), []]; - - _cutoffPhases pushBack [_name, _cutOff, _code]; - EGVAR(gameplay,safestart_phaseCutOffs) = _cutoffPhases; - publicVariable QEGVAR(gameplay,safestart_phaseCutOffs); - }; - - /* Get current cutoff phases */ - private _cutoffPhases = missionNameSpace getVariable [QEGVAR(gameplay,safestart_phaseCutOffs), []]; - - /* get indexes */ - private _values = []; - for "_i" from 0 to count _cutoffPhases do { - _values pushBack _i; - }; - - ["Remove: Cutoff Phase", [ - ["LIST", ["Phase name", "Name of the cutoff phase"], [_values, _cutoffPhases, 0, 5]] - ], _onConfirm, {}] call zen_dialog_fnc_create; -}; - -["CMF: Safestart", "Remove Cutoff Phase", _removeFunction, ""] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_safestartPhases.sqf b/framework/components/curator/functions/fn_safestartPhases.sqf deleted file mode 100644 index c4c383f..0000000 --- a/framework/components/curator/functions/fn_safestartPhases.sqf +++ /dev/null @@ -1,32 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * module to change safestart phase - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_safestartPhases - * - * Public: No - */ -SCRIPT(safestartPhases); - -private _addFunction = { - private _onConfirm = { - (_this select 0) params ["_name"]; - - EGVAR(gameplay,safestart_phase) = [_name, serverTime]; - publicVariable QEGVAR(gameplay,safestart_phase); - }; - - ["Change: Phase", [ - ["EDIT", ["Phase name", "Name of the phase"], [""]] - ], _onConfirm, {}] call zen_dialog_fnc_create; -}; - -["CMF: Safestart", "Change Phase", _addFunction, ""] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_setAmmobox.sqf b/framework/components/curator/functions/fn_setAmmobox.sqf new file mode 100644 index 0000000..2b647e4 --- /dev/null +++ b/framework/components/curator/functions/fn_setAmmobox.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates a zeus module to set object as an ammo box + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_setAmmobox + * + * Public: No + */ +SCRIPT(setAmmobox); + +if (isNull (_this select 1)) exitWith {[LSTRING(object_requirement_message)] call zen_common_fnc_showMessage}; + +private _result = [(_this select 1)] call EFUNC(kosherArsenal,ammobox); +if (_result) then { + [LSTRING(ammobox_success_message)] call zen_common_fnc_showMessage; + + /* Raise event */ + [QGVAR(ammobox_added), [_this select 1]] call CBA_fnc_globalEvent; +} else { + [LSTRING(ammobox_fail_message)] call zen_common_fnc_showMessage; +}; + + diff --git a/framework/components/curator/functions/fn_setCrateLoadout.sqf b/framework/components/curator/functions/fn_setCrateLoadout.sqf new file mode 100644 index 0000000..9c8667e --- /dev/null +++ b/framework/components/curator/functions/fn_setCrateLoadout.sqf @@ -0,0 +1,41 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Sets crate loadout for a selected crate based on a crate type and logistics file + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call cmf_curator_fnc_setCrateLoadout + * + * Public: No + */ + +private _crate = _this param [1, objNull]; + +if (isNull _crate) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; + +private _setLoadout = { + params ["_values", "_crate"]; + + private _path = format["rsc\loadouts\%1.sqf", (_values select 0)]; + if !(FILE_EXISTS(_path)) exitWith { ERROR_MSG_1("Unable to find preset: %1", (_values select 0)); }; + + private _presets = [call compile preprocessFileLineNumbers _path] call CBA_fnc_hashCreate; + private _preset = [_presets, (_values select 1)] call CBA_fnc_hashGet; + private _presetData = [_preset] call FUNC(presetCompile); + + [_crate, _presetData] call FUNC(fillCrate); // @BUG: Does not work in 3DEN Preview from zeus + ["Set Crate Loadout"] call zen_common_fnc_showMessage; +}; + +_defaultFile = missionNamespace getVariable [QEGVAR(logistics,crateConfigFile), ""]; + +["Set Crate Loadout", [ + ["EDIT", ["Logistics File", "Logistics file to use"], [_defaultFile]], + ["EDIT", ["Crate type", "Type of create to make e.g. Fireteam, Medical etc. (case sensitive)"], [""]] +], _setLoadout, {}, _crate] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_setLives.sqf b/framework/components/curator/functions/fn_setLives.sqf new file mode 100644 index 0000000..8228b06 --- /dev/null +++ b/framework/components/curator/functions/fn_setLives.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates a zeus module to set a player's lives + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_setLives + * + * Public: No + */ +SCRIPT(setLives); + +if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; +if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; + +private _onConfirm = { + params["_dialogValues", "_unit"]; + [[_unit, round(_dialogValues select 0), (_dialogValues select 1)], EFUNC(respawn,setLimit)] remoteExec ["call", _unit, true]; + [format[LSTRING(setRespawns_success_message), round(_dialogValues select 0)]] call zen_common_fnc_showMessage +}; + +[LSTRING(setRespawns_module_displayname), [ + ["SLIDER", [LSTRING(respawns_title), LSTRING(respawns_tooltip)], [0, 100, ((_this select 1) getVariable [QEGVAR(respawn,respawns)]), 0]], + ["CHECKBOX", [LSTRING(silent_title), LSTRING(silent_tooltip)], false] +], _onConfirm, {}, (_this select 1)] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_setLivesModule.sqf b/framework/components/curator/functions/fn_setLivesModule.sqf deleted file mode 100644 index 88a3e99..0000000 --- a/framework/components/curator/functions/fn_setLivesModule.sqf +++ /dev/null @@ -1,36 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Creates a zeus module to set a player's lives - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_setLivesModule - * - * Public: No - */ -SCRIPT(setLivesModule); - -private _dialogFunction = { - if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; - if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; - if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; - - private _onConfirm = { - params["_dialogValues", "_unit"]; - [[_unit, round(_dialogValues select 0), (_dialogValues select 1)], EFUNC(respawn,setLimit)] remoteExec ["call", _unit, true]; - [format[LSTRING(setRespawns_success_message), round(_dialogValues select 0)]] call zen_common_fnc_showMessage - }; - - [LSTRING(setRespawns_module_displayname), [ - ["SLIDER", [LSTRING(respawns_title), LSTRING(respawns_tooltip)], [0, 100, ((_this select 1) getVariable [QEGVAR(respawn,respawns)]), 0]], - ["CHECKBOX", [LSTRING(silent_title), LSTRING(silent_tooltip)], false] - ], _onConfirm, {}, (_this select 1)] call zen_dialog_fnc_create; -}; - -[LSTRING(respawn_module_category_displayname), LSTRING(setRespawns_module_displayname), _dialogFunction, "components\curator\data\icon_module_setLives_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/functions/fn_setPhase.sqf b/framework/components/curator/functions/fn_setPhase.sqf new file mode 100644 index 0000000..358db7c --- /dev/null +++ b/framework/components/curator/functions/fn_setPhase.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: Eric + * module to change safestart phase + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_setPhase + * + * Public: No + */ +SCRIPT(setPhase); + +private _onConfirm = { + (_this select 0) params ["_name"]; + + EGVAR(gameplay,safestart_phase) = [_name, serverTime]; + publicVariable QEGVAR(gameplay,safestart_phase); +}; + +["Change: Phase", [ + ["EDIT", ["Phase name", "Name of the phase"], [""]] +], _onConfirm, {}] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_setUnitParameters.sqf b/framework/components/curator/functions/fn_setUnitParameters.sqf new file mode 100644 index 0000000..4327fec --- /dev/null +++ b/framework/components/curator/functions/fn_setUnitParameters.sqf @@ -0,0 +1,52 @@ +#include "script_component.hpp" +/* + * Author: Eric + * module to reset a players role and/or team for kosher arsenal + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call cmf_zeus_fnc_setUnitParameters + * + * Public: No + */ +SCRIPT(setUnitParameters); + +if (isNull (_this select 1)) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; +if !((_this select 1) isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; +if !(isPlayer (_this select 1)) exitWith { [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage }; + +private _defaultRole = ((_this select 1) getVariable [QEGVAR(common,role), "RFL"]); +private _defaultTeam = ((_this select 1) getVariable [QEGVAR(common,team), 0]); +private _defaultLoadout = ((_this select 1) getVariable [QEGVAR(kosherArsenal,loadout), ""]); +_defaultLoadout = _defaultLoadout splitString "\" select (count (_defaultLoadout splitString "\") - 1); +_defaultLoadout = (_defaultLoadout splitString ".") select 0; + +private _onConfirm = { + params["_dialogValues", "_unit", "_defaultRole", "_defaultTeam", "_defaultLoadout"]; + + _dialogValues params[["_role", _defaultRole], ["_team", _defaultTeam], ["_loadout", _defaultLoadout]]; + + /* Set the unit's role and team */ + [_unit, _role, _team] call EFUNC(organization,setRole); + + /* Set the unit's loadoutfile */ + private _loadout = format["rsc\loadouts\%1.sqf", _loadout]; + if !(FILE_EXISTS(_loadout)) exitWith { [LSTRING(no_loadoutFile_message)] call zen_common_fnc_showMessage }; + _unit setVariable [QEGVAR(kosherArsenal,loadout), _loadout, true]; + + /* Open kosher arsenal */ + [_unit] call EFUNC(utility,stripUnit); + [_unit] call EFUNC(kosherArsenal,forceArsenal); + [LSTRING(reset_kosherArsenal_success_message)] call zen_common_fnc_showMessage +}; + +[LSTRING(change_kosherArsenal_module_displayname), [ + ["EDIT", [LSTRING(role), LSTRING(role_tooltip)], [_defaultRole]], + ["SLIDER", [LSTRING(team), LSTRING(team_tooltip)], [0, 100, _defaultTeam, 0]], + ["EDIT", [LSTRING(loadout), LSTRING(loadout_tooltip)], [_defaultLoadout]] +], _onConfirm, {}, (_this select 1), _defaultRole, _defaultTeam, _defaultLoadout] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_toggleFreezeTime.sqf b/framework/components/curator/functions/fn_toggleFreezeTime.sqf new file mode 100644 index 0000000..c4bb207 --- /dev/null +++ b/framework/components/curator/functions/fn_toggleFreezeTime.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Creates a zeus module to disable freezeTime + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_toggleFreezeTime + * + * Public: No + */ +SCRIPT(toggleFreezeTime); + +ESETTING(environment,freezeTime) = !ESETTING(environment,freezeTime); +publicVariable QESETTING(environment,freezeTime); + +if (ESETTING(environment,freezeTime)) then { + [LSTRING(en_freezeTime_success_message)] call zen_common_fnc_showMessage; +} else { + [LSTRING(dis_freezeTime_success_message)] call zen_common_fnc_showMessage; +}; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_toggleSpectator.sqf b/framework/components/curator/functions/fn_toggleSpectator.sqf new file mode 100644 index 0000000..9feaa5e --- /dev/null +++ b/framework/components/curator/functions/fn_toggleSpectator.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Toggles spectator for unit + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call cmf_zeus_fnc_toggleSpectator + * + * Public: No + */ +SCRIPT(toggleSpectator); + +private _entity = _this select 1; + +if (_entity != objNull) then { + if (isPlayer _entity) then { + [[], { + private _curSpectators = call ace_spectator_fnc_players; + [!(player in _curSpectators)] call ace_spectator_fnc_setSpectator; + }] remoteExec ["call", _entity]; + [LSTRING(toggle_spectator_success_message)] call zen_common_fnc_showMessage; + } else { + [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage; + }; +} else { + [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage; +}; diff --git a/framework/components/curator/functions/fn_toggleSpectatorModule.sqf b/framework/components/curator/functions/fn_toggleSpectatorModule.sqf deleted file mode 100644 index 3badaad..0000000 --- a/framework/components/curator/functions/fn_toggleSpectatorModule.sqf +++ /dev/null @@ -1,36 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Eric - * Toggles spectator for unit - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call cmf_zeus_fnc_toggleSpectatorModule - * - * Public: No - */ -SCRIPT(toggleSpectatorModule); - -[LSTRING(common_module_category_displayname), LSTRING(toggle_spectator_module_displayname), { - private _entity = _this select 1; - - if (_entity != objNull) then { - if (isPlayer _entity) then { - [[], { - private _curSpectators = call ace_spectator_fnc_players; - [!(player in _curSpectators)] call ace_spectator_fnc_setSpectator; - }] remoteExec ["call", _entity]; - [LSTRING(toggle_spectator_success_message)] call zen_common_fnc_showMessage; - } else { - [LSTRING(player_requirement_message)] call zen_common_fnc_showMessage; - }; - } else { - [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage; - }; - -}, "components\curator\data\icon_module_spectate_ca.paa"] call zen_custom_modules_fnc_register; diff --git a/framework/components/curator/script_component.hpp b/framework/components/curator/script_component.hpp index d95cc2b..a6bb73c 100644 --- a/framework/components/curator/script_component.hpp +++ b/framework/components/curator/script_component.hpp @@ -14,4 +14,6 @@ #include "..\main\script_component.hpp" -#include "\a3\ui_f\hpp\definedikcodes.inc" \ No newline at end of file +#include "\a3\ui_f\hpp\definedikcodes.inc" + +#define IDD_ZEUS 312 \ No newline at end of file diff --git a/framework/components/curator/stringtable.sqf b/framework/components/curator/stringtable.sqf index d1cdd61..0981568 100644 --- a/framework/components/curator/stringtable.sqf +++ b/framework/components/curator/stringtable.sqf @@ -20,13 +20,8 @@ ["English", "Added rallypoints for %1"], ["Spanish", "Añadido rallypoints para %1"] ]], - [DSTRING(respawn_module_category_displayname), [ - ["English", "CMF: Respawn"], - ["Spanish", "CMF: Respawn"] - ]], - [DSTRING(rallypoint_module_displayname), [ - ["English", "Add rallypoint"], - ["Spanish", "Añadir rallypoint"] + [DSTRING(enableRallypoints), [ + ["English", "Enable rallypoints"] ]], [DSTRING(object_requirement_message), [ @@ -41,20 +36,12 @@ ["English", "Failed to add kosher ammobox"], ["Spanish", "Fallo al añadir KosherArsenal a la caja de munición"] ]], - [DSTRING(kosherArsenal_module_category_displayname), [ - ["English", "CMF: Kosher Arsenal"], - ["Spanish", "CMF: Kosher Arsenal"] - ]], - [DSTRING(ammobox_module_displayname), [ + [DSTRING(setAmmobox), [ ["English", "Set as ammobox"], ["Spanish", "Configurar como caja de munición"] ]], - [DSTRING(common_module_category_displayname), [ - ["English", QUOTE(FRAMEWORK: Common)], - ["Spanish", QUOTE(FRAMEWORK: Common)] - ]], - [DSTRING(dis_freezeTime_module_displayname), [ + [DSTRING(toggleFreezeTime), [ ["English", "Toggle frozen time"] ]], [DSTRING(en_freezeTime_success_message), [ @@ -68,7 +55,7 @@ ["English", "Forced open kosher arsenal on unit"], ["Spanish", "Se ha forzado la apertura del Kosher Arsenal en la unidad"] ]], - [DSTRING(forceopen_kosherArsenal_module_displayname), [ + [DSTRING(forceArsenal), [ ["English", "Open Kosher Arsenal"], ["Spanish", "Abrir Kosher Arsenal"] ]], @@ -77,7 +64,7 @@ ["English", "Closed units arsenal"], ["Spanish", "Cerrar arsenal a todos"] ]], - [DSTRING(forceclose_kosherArsenal_module_displayname), [ + [DSTRING(forceCloseArsenal), [ ["English", "Close Kosher Arsenal"], ["Spanish", "Cerrar Kosher Arsenal"] ]], @@ -86,9 +73,8 @@ ["English", "Removed rallypoints from %1"], ["Spanish", "Eliminar rallypoint para %1"] ]], - [DSTRING(rallypoint_remove_module_displayname), [ - ["English", "Remove rallypoint"], - ["Spanish", "Eliminar rallypoint"] + [DSTRING(disableRallypoints), [ + ["English", "Disable rallypoints"] ]], [DSTRING(no_loadoutFile_message), [ @@ -123,12 +109,11 @@ ["English", "Sets player's loadout. Only write the filename without it's extension"], ["Spanish", "Asignar equipación al jugador. Solo escribe el nombre del archivo, sin la extensión"] ]], - [DSTRING(change_kosherArsenal_module_displayname), [ - ["English", "Change kosher parameters"], - ["Spanish", "Cambiar los parámetros del Kosher Arsenal"] + [DSTRING(setUnitParameters), [ + ["English", "Set Unit Parameters"] ]], - [DSTRING(setRespawns_module_displayname), [ + [DSTRING(setLives), [ ["English", "Set respawns"], ["Spanish", "Asignar respawns"] ]], @@ -153,7 +138,7 @@ ["Spanish", "Si es falso no mostrará una pista al jugador"] ]], - [DSTRING(toggle_spectator_module_displayname), [ + [DSTRING(toggleSpectator), [ ["English", "Toggle Spectator"], ["Spanish", "Alternar Espectador"] ]], diff --git a/framework/components/diagnostic/XEH_PREP.sqf b/framework/components/diagnostic/XEH_PREP.sqf index 3bfb2b1..ce50caa 100644 --- a/framework/components/diagnostic/XEH_PREP.sqf +++ b/framework/components/diagnostic/XEH_PREP.sqf @@ -3,4 +3,5 @@ PREP(log); PREP(error); PREP(logFlush); -PREP(errorFlush); \ No newline at end of file +PREP(errorFlush); +PREP(initDisplayLog); \ No newline at end of file diff --git a/framework/components/diagnostic/XEH_preInit.sqf b/framework/components/diagnostic/XEH_preInit.sqf index af1d6d7..6b34ec8 100644 --- a/framework/components/diagnostic/XEH_preInit.sqf +++ b/framework/components/diagnostic/XEH_preInit.sqf @@ -16,7 +16,7 @@ addMissionEventHandler ["ScriptError", { text format ["at %1:%2", _sourceFile, _lineNumber] ]; - GVAR(errorOut) pushBack [QUOTE(PREFIX), QUOTE(MODULE), _errorText, _errorPos, _sourceFile, _lineNumber]; + GVAR(errorOut) pushBack [serverTime, systemTime, [QUOTE(PREFIX), QUOTE(MODULE), _errorText, _errorPos, _sourceFile, _lineNumber]]; [QGVAR(errorNotification), _notif] call CBA_fnc_globalEvent; }]; \ No newline at end of file diff --git a/framework/components/diagnostic/functions/fn_error.sqf b/framework/components/diagnostic/functions/fn_error.sqf index 2757208..60c8fb9 100644 --- a/framework/components/diagnostic/functions/fn_error.sqf +++ b/framework/components/diagnostic/functions/fn_error.sqf @@ -20,6 +20,6 @@ * Public: no */ -if (!is3DEN) then { _nil = GVAR(errorOut) pushBack _this }; +if (!is3DEN) then { _nil = GVAR(errorOut) pushBack [serverTime, systemTime, _this] }; _this call CBA_fnc_error; diff --git a/framework/components/diagnostic/functions/fn_initDisplayLog.sqf b/framework/components/diagnostic/functions/fn_initDisplayLog.sqf new file mode 100644 index 0000000..4a81aa0 --- /dev/null +++ b/framework/components/diagnostic/functions/fn_initDisplayLog.sqf @@ -0,0 +1,80 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Initializes log display + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call cmf_diagnostic_fnc_initDisplayLog + * + * Public: No + */ + +params ["_display"]; + +private _formatTime = { + (_this select [3, 3]) apply { [_x, 2] call CBA_fnc_formatNumber } joinString ":"; +}; + +/* Style errors */ +private _formattedError = GVAR(errorOut) apply { + private _errorColor = (EGVAR(common,notificationColors) get "ERROR") call BIS_fnc_colorRGBtoHTML; + private _infoColor = (EGVAR(common,notificationColors) get "INFO") call BIS_fnc_colorRGBtoHTML; + format ["%1 %2", (_x select 1) call _formatTime, (_x select 2), _infoColor, _errorColor]; +}; + +/* Style log */ +private _logContent = GVAR(logOut) apply { + private _infoColor = (EGVAR(common,notificationColors) get "INFO") call BIS_fnc_colorRGBtoHTML; + format ["%1 %2", (_x select 1) call _formatTime, (_x select 2), _infoColor]; +}; + +_logContent append _formattedError; +_logContent sort true; + +disableSerialization; +private _ctrlClear = _display displayCtrl IDC_LOG_CLEAR; +private _ctrlText = _display displayCtrl IDC_LOG_TEXT; +private _ctrlLines = _display displayCtrl IDC_LOG_LINES; +private _ctrlGroup = ctrlParentControlsGroup _ctrlText; + +ctrlPosition _ctrlGroup params ["_xParent", "_yParent", "_wParent", "_hParent"]; +_maxW = selectMax (_logContent apply { + str parseText _x getTextWidth ["RobotoCondensedLight", LOG_FONTSIZE * 2] +}); + +_ctrlText ctrlSetPositionW (_maxW max _wParent); +_ctrlText ctrlCommit 0; + +_ctrlText ctrlSetStructuredText parseText (_logContent joinString "
"); +_ctrlLines ctrlSetText str (count _logContent); +_ctrlText ctrlSetPosition [ + 0, + 0, + _wParent max _maxW, + _hParent max ctrlTextHeight _ctrlText +]; +_ctrlText ctrlCommit 0; + +_ctrlGroup spawn { + _this ctrlSetScrollValues [1,0]; +}; + +_ctrlClear ctrlAddEventHandler ["ButtonClick", { + _this spawn { + params ["_ctrl"]; + + private _result = ["This will clear the log. Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage; + + if (_result) then { + call FUNC(errorFlush); + call FUNC(logFlush); + (ctrlParent _ctrl) closeDisplay 1; + }; + }; +}]; \ No newline at end of file diff --git a/framework/components/diagnostic/functions/fn_log.sqf b/framework/components/diagnostic/functions/fn_log.sqf index 401dd60..f74ffeb 100644 --- a/framework/components/diagnostic/functions/fn_log.sqf +++ b/framework/components/diagnostic/functions/fn_log.sqf @@ -15,6 +15,6 @@ * Public: no */ -if (!is3DEN) then { _nil = GVAR(logOut) pushBack _this }; +if (!is3DEN) then { _nil = GVAR(logOut) pushBack [serverTime, systemTime, _this] }; _this call CBA_fnc_log; \ No newline at end of file diff --git a/framework/components/diagnostic/script_component.hpp b/framework/components/diagnostic/script_component.hpp index a7b5f35..a8fe54f 100644 --- a/framework/components/diagnostic/script_component.hpp +++ b/framework/components/diagnostic/script_component.hpp @@ -16,24 +16,19 @@ #include "\a3\ui_f\hpp\definecommongrids.inc" -#define DIALOG_CENTER ((20 * GUI_GRID_CENTER_W) / 2) - GUI_GRID_W +#define IDC_LOG_TEXT 200 +#define IDC_LOG_CLEAR 300 -#define SLIDER_HEIGHT 1.3 * GUI_GRID_CENTER_H -#define SLIDER_WIDTH 20 * GUI_GRID_CENTER_W -#define SLIDER_X DIALOG_CENTER + (0 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X) -#define SLIDER_GAP 0.01 -#define SLIDER_Y(var1) (SLIDER_HEIGHT + SLIDER_GAP) * var1 +#define RSCDEBUG_W 45 +#define RSCDEBUG_H 30 -#define LABEL_X SLIDER_X + SLIDER_WIDTH + SLIDER_GAP +#define UI_GRID_W (5 * 0.5 * pixelW * pixelGrid) +#define UI_GRID_H (5 * 0.5 * pixelH * pixelGrid) +#define CUI_GRID_X (0.5) +#define CUI_GRID_Y (0.5) +#define CUI_GRID_W UI_GRID_W +#define CUI_GRID_H UI_GRID_H -#define BUTTON_GAP 0.025 -#define BUTTON_W ((SLIDER_WIDTH / 3) - BUTTON_GAP) -#define BUTTON_X(var1) SLIDER_X + (BUTTON_W * var1) + (BUTTON_GAP * var1) +#define LOG_FONTSIZE 0.7 * CUI_GRID_H -#define CONTROL_WIDTH(var1) (GUI_GRID_W * var1) -#define CONTROL_HEIGHT(var1) (GUI_GRID_H * var1) - -#define DIALOG_MARGIN 0.1 - -#define DIALOG_X(var1) ((GUI_GRID_X + CONTROL_WIDTH(DIALOG_MARGIN) + var1) min (GUI_GRID_W - CONTROL_WIDTH(DIALOG_MARGIN))) -#define DIALOG_Y(var1) ((GUI_GRID_Y + CONTROL_HEIGHT(DIALOG_MARGIN) + var1) min (GUI_GRID_H - CONTROL_HEIGHT(DIALOG_MARGIN))) \ No newline at end of file +#define LINES_TOOLTIP QUOTE(Define the number of lines to be shown. 30 means the last 30 lines are shown. Use a small number to speed up the process. Use a very large number to display all lines.) \ No newline at end of file diff --git a/framework/components/kosherArsenal/XEH_3denInit.sqf b/framework/components/kosherArsenal/XEH_3denInit.sqf index 0ac6690..453b9b8 100644 --- a/framework/components/kosherArsenal/XEH_3denInit.sqf +++ b/framework/components/kosherArsenal/XEH_3denInit.sqf @@ -34,4 +34,47 @@ private _ammoBoxAction = [ [ _ammoBoxAction ] +] call EFUNC(3den,addMenuItem); + +private _randomLoadoutAction = [ + "Set Random Loadout", + "a3\ui_f\data\gui\rsc\rscdisplayarsenal\uniform_ca.paa", + { + if (count get3DENSelected "object" isEqualTo 0) exitWith { + ["No units selected", 0, 1] call BIS_fnc_3DENNotification; + }; + + private _randomizeLoadout = { + params ["_values", "_units"]; + + private _loadout = format["rsc\loadouts\%1.sqf", _values select 1]; + if !(FILE_EXISTS(_loadout)) exitWith { ERROR_MSG_1("Unable to find loadoutfile: %1", _loadout) }; + private _whitelist = [_values select 0, player, true] call compile(preprocessFileLineNumbers _loadout); + + { + [_x, _values select 0, _whitelist select 1] call EFUNC(kosherAI,setLoadout); + save3DENInventory [_x]; + } forEach _units; + + [format ["Set random loadout for %1 units.", count _units], 0, 1] call BIS_fnc_3DENNotification; + }; + + ["Set Random Loadout", [ + ["EDIT", ["Role", "Role to set unit as"], ["RFL"]], + ["EDIT", ["Loadoutfile", "Loadoutfile to use"], [""]] + ], _randomizeLoadout, {}, (get3DENSelected "object") select { _x isKindOf "Man" }] call zen_dialog_fnc_create; + + } +]; + +[ + _path, + QUOTE(MODULE_BEAUTIFIED), + "a3\3den\data\displays\display3den\toolbar\open_ca.paa", + {}, + [], + [ + _ammoBoxAction, + _randomLoadoutAction + ] ] call EFUNC(3den,addMenuItem); \ No newline at end of file diff --git a/framework/components/kosherArsenal/XEH_preInit.sqf b/framework/components/kosherArsenal/XEH_preInit.sqf new file mode 100644 index 0000000..f992a91 --- /dev/null +++ b/framework/components/kosherArsenal/XEH_preInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +GVAR(loadouts) = []; \ No newline at end of file diff --git a/framework/components/kosherArsenal/functions/fn_forceArsenal.sqf b/framework/components/kosherArsenal/functions/fn_forceArsenal.sqf index e734e95..36b87b6 100644 --- a/framework/components/kosherArsenal/functions/fn_forceArsenal.sqf +++ b/framework/components/kosherArsenal/functions/fn_forceArsenal.sqf @@ -79,7 +79,7 @@ params ["_unit", ["_forcePrimary", true]]; /* Remove the closed eventHandler */ ["ace_arsenal_displayClosed", _thisId] call CBA_fnc_removeEventHandler; - cmf_player setVariable [QGVAR(close), false, true]; + player setVariable [QGVAR(close), false, true]; /* Raise event */ [QGVAR(onClose), [(player getVariable [QGVAR(close), false])]] call CBA_fnc_localEvent; diff --git a/framework/components/kosherArsenal/functions/fn_forceClose.sqf b/framework/components/kosherArsenal/functions/fn_forceClose.sqf index b985898..1e179e6 100644 --- a/framework/components/kosherArsenal/functions/fn_forceClose.sqf +++ b/framework/components/kosherArsenal/functions/fn_forceClose.sqf @@ -19,4 +19,4 @@ SCRIPT(forceClose); params ["_unit"]; /* Forcefully close the units kosherArsenal */ -cmf_player setVariable [QGVAR(close), true, true]; \ No newline at end of file +_unit setVariable [QGVAR(close), true, true]; \ No newline at end of file diff --git a/framework/components/kosherArsenal/functions/fn_init.sqf b/framework/components/kosherArsenal/functions/fn_init.sqf index 526db05..6a1e5ae 100644 --- a/framework/components/kosherArsenal/functions/fn_init.sqf +++ b/framework/components/kosherArsenal/functions/fn_init.sqf @@ -28,8 +28,11 @@ if (!hasInterface) exitWith {}; if (isNil "_loadouts") exitWith { ERROR_MSG("No loadoutfiles defined"); }; + /* Keep a list of used loadouts */ + { GVAR(loadouts) pushBackUnique _x } forEach _loadouts; + /* Check if light should be attached */ - _light = ((getLightingAt cmf_player) select 1 < 0.75); // @TODO: Fine tune this value + _light = ((getLightingAt cmf_player) select 1 < 30); // @TODO: Fine tune this value /* Randomize player spawn position if enabled */ if (_randomPos) then { @@ -49,7 +52,7 @@ if (!hasInterface) exitWith {}; /* Verify that the loadoutfile exists and save it on the unit */ private _loadout = format["rsc\loadouts\%1.sqf", (_loadouts select _team)]; if !(FILE_EXISTS(_loadout)) exitWith { ERROR_MSG_1("Unable to find loadoutfile: %1", _loadout); }; - cmf_player setVariable [QGVAR(loadout), _loadout, true]; + player setVariable [QGVAR(loadout), _loadout, true]; /* If player is Re-Jip in same role exit */ private _reJip = false; @@ -152,7 +155,7 @@ if (!hasInterface) exitWith {}; deleteVehicle _lightobject; }; - cmf_player setVariable [QGVAR(close), false, true]; + player setVariable [QGVAR(close), false, true]; /* Raise event */ [QGVAR(onClose), [(player getVariable [QGVAR(close), false])]] call CBA_fnc_localEvent; diff --git a/framework/components/logistics/XEH_3denInit.sqf b/framework/components/logistics/XEH_3denInit.sqf new file mode 100644 index 0000000..c37d3bf --- /dev/null +++ b/framework/components/logistics/XEH_3denInit.sqf @@ -0,0 +1,48 @@ +#include "script_component.hpp" + +waitUntil { !isNil QEGVAR(3den,menu_entity) }; + +private _path = EGVAR(3den,menu_entity); + +private _crateLoadoutAction = [ + "Set Crate Loadout", + "a3\ui_f\data\map\vehicleicons\iconcrateord_ca.paa", + { + if (count get3DENSelected "object" isEqualTo 0) exitWith { + ["No units selected", 0, 1] call BIS_fnc_3DENNotification; + }; + + private _setLoadout = { + params ["_values", "_crates"]; + + private _path = format["rsc\loadouts\%1.sqf", (_values select 0)]; + if !(FILE_EXISTS(_path)) exitWith { ERROR_MSG_1("Unable to find preset: %1", (_values select 0)); }; + + private _presets = [call compile preprocessFileLineNumbers _path] call CBA_fnc_hashCreate; + private _preset = [_presets, (_values select 1)] call CBA_fnc_hashGet; + private _presetData = [_preset] call FUNC(presetCompile); + + { + [_x, _presetData] call FUNC(fillCrate); + } forEach _crates; + + [format ["Set crate loadout for %1 objects.", count _crates], 0, 2] call BIS_fnc_3DENNotification; + }; + + ["Set Crate Loadout", [ + ["EDIT", ["Logistics File", "Logistics file to use"], [""]], + ["EDIT", ["Crate type", "Type of create to make e.g. Fireteam, Medical etc. (case sensitive)"], [""]] + ], _setLoadout, {}, (get3DENSelected "object") select { !(_x isKindOf "Man") }] call zen_dialog_fnc_create; + } +]; + +[ + _path, + QUOTE(MODULE_BEAUTIFIED), + "a3\3den\data\displays\display3den\toolbar\open_ca.paa", + {}, + [], + [ + _crateLoadoutAction + ] +] call EFUNC(3den,addMenuItem); \ No newline at end of file diff --git a/framework/components/logistics/XEH_PREP.sqf b/framework/components/logistics/XEH_PREP.sqf index ce35064..5b38142 100644 --- a/framework/components/logistics/XEH_PREP.sqf +++ b/framework/components/logistics/XEH_PREP.sqf @@ -4,4 +4,5 @@ PREP(cratePFH); PREP(crateActions); PREP(cratePreset); PREP(presetCompile); +PREP(fillCrate); PREP(crateSpawner); diff --git a/framework/components/logistics/functions/fn_cratePreset.sqf b/framework/components/logistics/functions/fn_cratePreset.sqf index 117fe8e..76e5682 100644 --- a/framework/components/logistics/functions/fn_cratePreset.sqf +++ b/framework/components/logistics/functions/fn_cratePreset.sqf @@ -14,12 +14,12 @@ * * Public: Yes */ -if (!isServer) exitWith { }; params ["_name"]; if (isNil "_name") exitWith { ERROR_MSG("No preset defined") }; private _path = format["rsc\loadouts\%1.sqf", _name]; if !(FILE_EXISTS(_path)) exitWith { ERROR_MSG_1("Unable to find preset: %1", _name); }; +GVAR(crateConfigFile) = _name; private _presets = [call compile preprocessFileLineNumbers _path] call CBA_fnc_hashCreate; GVAR(crateConfig) = _presets; @@ -40,33 +40,24 @@ publicVariable QGVAR(crateConfig); /* Using this method won't allow for using the same crate for different crates */ [(_presetData select 1), "init", compile (" params ['_crate']; + if (_crate getVariable ['ace_cargo_customName', ''] isEqualTo '') then { _crate setVariable ['ace_cargo_customName', '" + _key + " Crate | ', true]; }; - [_crate, true] call ace_dragging_fnc_setCarryable; - [_crate, true] call ace_dragging_fnc_setDraggable; - - clearItemCargoGlobal _crate; - clearMagazineCargoGlobal _crate; - clearWeaponCargoGlobal _crate; - clearBackpackCargoGlobal _crate; - {_crate addWeaponCargoGlobal _x} forEach "+str(_presetData select 2)+"; - {_crate addMagazineCargoGlobal _x} forEach "+str(_presetData select 3)+"; - {_crate addItemCargoGlobal _x} forEach "+str(_presetData select 4)+"; + private _weight = [] call ace_dragging_fnc_getWeight; + _weight = (_weight > misionNamespace getVariable [""ACE_maxWeightDrag"", 1E11]); - if (count "+str(_presetData select 5)+" > 0) then { - private _cargoSpace = 0; - { - _cargoSpace = _cargoSpace + _x; - } forEach ("+str(_presetData select 5)+" apply { ([_x select 0] call ace_cargo_fnc_getSizeItem) * (_x select 1) }); - [_crate, _cargoSpace] call ace_cargo_fnc_setSpace; - { - private _cargo = _x; - for '_i' from 0 to (_cargo select 1) do { - [(_cargo select 0), _crate] call ace_cargo_fnc_loadItem; - }; - } forEach "+str(_presetData select 5)+"; - }; + private _position = _object getVariable [""ace_dragging_carryPosition"", [0, 1.5, 0]]; + private _direction = _object getVariable [""ace_dragging_carryDirection"", 0]; + + [_crate, true, _position, _direction, _weight] call ace_dragging_fnc_setCarryable; + + _position = _object getVariable [""ace_dragging_dragPosition"", [0, 1.5, 0]]; + _direction = _object getVariable [""ace_dragging_dragDirection"", 0]; + [_crate, true, _position, _direction, _weight] call ace_dragging_fnc_setDraggable; + + + [_crate, " + str _presetData + "] call cmf_logistics_fnc_fillCrate "), true, [], true] call CBA_fnc_addClassEventHandler; } forEach ([_presets] call CBA_fnc_hashKeys); \ No newline at end of file diff --git a/framework/components/logistics/functions/fn_fillCrate.sqf b/framework/components/logistics/functions/fn_fillCrate.sqf new file mode 100644 index 0000000..1de159d --- /dev/null +++ b/framework/components/logistics/functions/fn_fillCrate.sqf @@ -0,0 +1,63 @@ +#include "script_component.hpp" +/* + * Author: Eric + * Fills crate with passed cargo + * + * Arguments: + * 0: Crate + * 1: Cargo Preset + * - 0: Empty + * - 1: Empty + * - 2: weapons + * - 3: magazines + * - 4: items + * - 5: ace cargo + * + * Return Value: + * None + * + * Example: + * [this, _myPreset] call cmf_logistics_fnc_fillCrate + * + * Public: Yes + */ +params ["_crate", "_cargoPreset"]; + +if (is3DEN) exitWith { + private _equipment = [ + [ + [(_cargoPreset select 4) apply { _x select 0 }, (_cargoPreset select 4) apply { _x select 1 }], + [(_cargoPreset select 3) apply { _x select 0 }, (_cargoPreset select 3) apply { _x select 1 }], + [(_cargoPreset select 2) apply { _x select 0 }, (_cargoPreset select 2) apply { _x select 1 }], + [[],[]] // Backpacks + ], + false + ]; + + _crate set3DENAttribute ["ammoBox", str _equipment]; +}; + +if (!isServer && { !local _crate }) exitWith {}; + +clearItemCargoGlobal _crate; +clearMagazineCargoGlobal _crate; +clearWeaponCargoGlobal _crate; +clearBackpackCargoGlobal _crate; + +{_crate addWeaponCargoGlobal _x} forEach (_cargoPreset select 2); +{_crate addMagazineCargoGlobal _x} forEach (_cargoPreset select 3); +{_crate addItemCargoGlobal _x} forEach (_cargoPreset select 4); + +if (count (_cargoPreset select 5) > 0) then { + private _cargoSpace = 0; + { + _cargoSpace = _cargoSpace + _x; + } forEach ((_cargoPreset select 5) apply { ([_x select 0] call ace_cargo_fnc_getSizeItem) * (_x select 1) }); + [_crate, _cargoSpace] call ace_cargo_fnc_setSpace; + { + private _cargo = _x; + for '_i' from 0 to (_cargo select 1) do { + [(_cargo select 0), _crate] call ace_cargo_fnc_loadItem; + }; + } forEach (_cargoPreset select 5); +}; \ No newline at end of file diff --git a/framework/components/main/changelog.sqf b/framework/components/main/changelog.sqf index ab3d4b9..c66d29e 100644 --- a/framework/components/main/changelog.sqf +++ b/framework/components/main/changelog.sqf @@ -1,35 +1,35 @@ " -CMF Changelog v2.1.1.60 => v2.1.1.61 -Fixed - • Fixed bug with ace action on crates being broken - -

CMF Changelog v2.1.1.59 => v2.1.1.60 +CMF3 Changelog v2.1.1.61 => v2.1.1.62 +Reverted codebase back to v2.1.1.58 + +Added + • Added function to set a random loadout for a unit using a specified loadoutfile in 3den and zeus + • Added function to set a crate loadout for a crate using a specified logistics file in 3den and zeus + • Added a script log viewer to the CMF menu + • Added `PATHTO` family of macros Changed - • Temporarily disabled logistics crate actions as it created a bug where all ace actions were removed from the crate - • Use SETTING Macro in every instance + • Changed how ui elements are included. it now uses a master include file in the ui directory + • Changed how zeus/curator modules are registered + • Renamed all curator functions to reflect the change + • Changed so logistics crates will always be carryable / draggable regardless of weight Fixed - • Fixed bug where players where unable to take items from cmf logistic crates - -

CMF Changelog v2.1.1.58 => v2.1.1.59 - -Changed - • Replaced `CBA_fnc_setVarNet` with vanilla `setVariable` (setVarNet was too unstable) + • Fixed bug where vehicle rallypoints were placeable for everyone " // @TODO: Use markdown parser with a custom stylesheet mimicking github markdown /* - TEMPLATES + TEMPLATES - ADDED - Added + ADDED + Added - CHANGED - Changed + CHANGED + Changed - FIXED - Fixed + FIXED + Fixed - REMOVED - Removed -*/ + REMOVED + Removed +*/ \ No newline at end of file diff --git a/framework/components/main/script_macros.hpp b/framework/components/main/script_macros.hpp index 9c4a0f9..c09b9ea 100644 --- a/framework/components/main/script_macros.hpp +++ b/framework/components/main/script_macros.hpp @@ -55,6 +55,11 @@ #define PATHTOF_SYS(var1,var2) components\var1\var2 #endif +#define PATHTOF(var1) PATHTOF_SYS(MODULE,var1) +#define PATHTOEF(var1,var2) PATHTOF_SYS(var1,var2) +#define QPATHTOF(var1) QUOTE(PATHTOF(var1)) +#define QPATHTOEF(var1,var2) QUOTE(PATHTOEF(var1,var2)) + #define DSTRING(var1) QUOTE(TRIPLES(STR,COMPONENT,var1)) #define EDSTRING(var1,var2) QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2)) #define LSTRING(var1) ([QUOTE(PATHTOF_SYS(MODULE,stringtable.sqf)), DSTRING(var1)] call compile preProcessFileLineNumbers QUOTE(PATHTOF_SYS(main,localize.sqf))) diff --git a/framework/components/main/script_version.hpp b/framework/components/main/script_version.hpp index cf31763..3c241d8 100644 --- a/framework/components/main/script_version.hpp +++ b/framework/components/main/script_version.hpp @@ -1,4 +1,4 @@ #define MAJOR 2 #define MINOR 1 #define PATCHLVL 1 -#define BUILD 61 +#define BUILD 62 \ No newline at end of file diff --git a/framework/components/map/initSettings.sqf b/framework/components/map/initSettings.sqf index a0df187..8e547b4 100644 --- a/framework/components/map/initSettings.sqf +++ b/framework/components/map/initSettings.sqf @@ -19,7 +19,7 @@ ] call EFUNC(common,addSetting); [ - QSETTING(_consistentMarkers), + QSETTING(consistentMarkers), "CHECKBOX", ["Consistent Marker Size", "Forces a consistent marker size regardless of zoom"], QUOTE(MODULE_BEAUTIFIED), diff --git a/framework/components/menu/functions/fn_diagnostics.sqf b/framework/components/menu/functions/fn_diagnostics.sqf index e9230ac..93a9eac 100644 --- a/framework/components/menu/functions/fn_diagnostics.sqf +++ b/framework/components/menu/functions/fn_diagnostics.sqf @@ -98,7 +98,9 @@ private _action = ([QGVAR(diag_menu), "Diagnostics", "z\ace\addons\medical_gui\d _actions pushBack [_action, [], _target]; /* Error Count */ - private _action = ([QGVAR(fps), "Errors: 0", ["a3\ui_f\data\igui\cfg\simpletasks\types\documents_ca.paa", (EGVAR(common,notificationColors) get "ERROR") call BIS_fnc_colorRGBtoHTML], { }, { true }, { }, [], "", 4, [false, false, false, true, false], { + private _action = ([QGVAR(fps), "Errors: 0", ["a3\ui_f\data\igui\cfg\simpletasks\types\documents_ca.paa", (EGVAR(common,notificationColors) get "ERROR") call BIS_fnc_colorRGBtoHTML], { + ([] call BIS_fnc_displayMission) createDisplay "CMF_RscLog"; + }, { true }, { }, [], "", 4, [false, false, false, true, false], { (_this select 3) set [1, format ["Errors: %1", count EGVAR(diagnostic,errorOut)]] }] call ace_interact_menu_fnc_createAction); _actions pushBack [_action, [], _target]; diff --git a/framework/components/player/XEH_postInit.sqf b/framework/components/player/XEH_postInit.sqf index ca90b11..70c6cd0 100644 --- a/framework/components/player/XEH_postInit.sqf +++ b/framework/components/player/XEH_postInit.sqf @@ -59,6 +59,6 @@ cmf_player addEventHandler ["Respawn", { /* Make sure player is able to use ACRE */ cmf_player setVariable [QGVAR(overrideSound), nil]; GVAR(disableACRERadio) = false; - cmf_player setVariable ['acre_sys_core_isDisabled', false, true]; - cmf_player setVariable ['acre_sys_core_isDisabledRadio', false, true]; + cmf_player setVariable ["acre_sys_core_isDisabled", false, true]; + cmf_player setVariable ["acre_sys_core_isDisabledRadio", false, true]; }]; \ No newline at end of file diff --git a/framework/components/respawn/XEH_postInit.sqf b/framework/components/respawn/XEH_postInit.sqf index ab8b1a9..df65bac 100644 --- a/framework/components/respawn/XEH_postInit.sqf +++ b/framework/components/respawn/XEH_postInit.sqf @@ -79,8 +79,8 @@ if (!isNil "_disconUnit" && { !ESETTING(gameplay,safestart) || missionNamespace }; /* Set respawns */ - cmf_player setVariable [QEGVAR(respawn,respawns), ((_this select 4) select 0), true]; - cmf_player setVariable [QEGVAR(respawn,deaths), ((_this select 4) select 1), true]; + player setVariable [QEGVAR(respawn,respawns), ((_disconUnit select 4) select 0), true]; + player setVariable [QEGVAR(respawn,deaths), ((_disconUnit select 4) select 1), true]; /* set player position and if leader is in vehicle attempt to move into vehicle cargo */ if (!isNull leader (_this select 1)) then { diff --git a/framework/components/respawn/functions/fn_limit.sqf b/framework/components/respawn/functions/fn_limit.sqf index 406b509..0828de9 100644 --- a/framework/components/respawn/functions/fn_limit.sqf +++ b/framework/components/respawn/functions/fn_limit.sqf @@ -24,7 +24,7 @@ if (isNil "_respawns") exitWith { ERROR_MSG("respawns cannot be nil"); false }; if (call _condition) then { /* Set the amount of allowed respawns */ - cmf_player setVariable [QGVAR(respawns), _respawns, true]; + player setVariable[QGVAR(respawns), _respawns, true]; /* Check if player is out of lives on respawn */ player addEventHandler ["Respawn", { @@ -44,7 +44,7 @@ if (call _condition) then { /* Decrement the respawn counter */ private _pCount = player getVariable[QGVAR(deaths), 0]; private _pCount = _pCount + 1; - cmf_player setVariable [QGVAR(deaths), _pCount, true]; + player setVariable[QGVAR(deaths), _pCount, true]; }; }]; }; diff --git a/framework/components/respawn/functions/fn_rallypoint.sqf b/framework/components/respawn/functions/fn_rallypoint.sqf index 57b2690..766002c 100644 --- a/framework/components/respawn/functions/fn_rallypoint.sqf +++ b/framework/components/respawn/functions/fn_rallypoint.sqf @@ -123,16 +123,16 @@ private _rallypointPlaceCode = { _respawn call BIS_fnc_RemoveRespawnPosition; deleteVehicle _obj; - cmf_player setVariable [QGVAR(rallypoint_lastRally), [objNull, [objNull, -1], scriptNull], true]; + player setVariable [QGVAR(rallypoint_lastRally), [objNull, [objNull, -1], scriptNull], true]; }, [_obj, _respawn]] call CBA_fnc_waitUntilAndExecute; /* Save current rally to unit */ - cmf_player setVariable [QGVAR(rallypoint_lastRally), [_obj, _respawn], true]; + player setVariable [QGVAR(rallypoint_lastRally), [_obj, _respawn], true]; /* Spawn cooldown timer */ - cmf_player setVariable [QGVAR(rallypoint_canCreate), false, true]; + player setVariable [QGVAR(rallypoint_canCreate), false, true]; [{ - cmf_player setVariable [QGVAR(rallypoint_canCreate), true, true]; + player setVariable [QGVAR(rallypoint_canCreate), true, true]; }, [], SETTING(rallypointCooldown)] call CBA_fnc_waitAndExecute; } else { deleteVehicle _obj; @@ -148,7 +148,7 @@ private _rallypointFailedCode = { /* Create Place action */ private _rallypointPlaceAction = [QGVAR(rallypoint_place), LSTRING(place_rallypoint), "components\respawn\data\icon_ace_rallypoint_place_ca.paa", _rallypointPlaceCode, { ((isNull objectParent player) && { (player getVariable [QGVAR(rallypoint_canCreate), true]) && !(missionNamespace getVariable [QGVAR(rallypoint_disabled), false]) }) - && { (player getVariable [QGVAR(showRallypoint), true]) + && { (player getVariable [QGVAR(showRallypoint), false]) && !visibleMap } }] call ace_interact_menu_fnc_createAction; @@ -156,7 +156,7 @@ private _rallypointPlaceAction = [QGVAR(rallypoint_place), LSTRING(place_rallypo private _rallypointFailedAction = [QGVAR(rallypoint_disabled), LSTRING(place_rallypoint), "components\respawn\data\icon_ace_rallypoint_disabled_ca.paa", _rallypointFailedCode, { (((isNull objectParent player) && { !(player getVariable [QGVAR(rallypoint_canCreate), true]) }) || (missionNamespace getVariable [QGVAR(rallypoint_disabled), false])) - && { (player getVariable [QGVAR(showRallypoint), true]) + && { (player getVariable [QGVAR(showRallypoint), false]) && !visibleMap } }] call ace_interact_menu_fnc_createAction; @@ -173,7 +173,8 @@ if (count _units isEqualTo 0) exitWith { [typeOf player, 1, ["ACE_SelfActions"], _rallypointPlaceAction] call ace_interact_menu_fnc_addActionToClass; [typeOf player, 1, ["ACE_SelfActions"], _rallypointFailedAction] call ace_interact_menu_fnc_addActionToClass; - cmf_player setVariable [QGVAR(rallypoint), true, true]; + player setVariable [QGVAR(rallypoint), true, true]; + player setVariable [QGVAR(showRallypoint), true, true]; LOG_1("Added rallypoint for %1", name player); }; continue; @@ -188,6 +189,7 @@ if (count _units isEqualTo 0) exitWith { [[typeOf _x, 1, ["ACE_SelfActions"], _rallypointFailedAction], ace_interact_menu_fnc_addActionToClass] remoteExec ["call", _x]; _x setVariable [QGVAR(rallypoint), true, true]; + _x setVariable [QGVAR(showRallypoint), true, true]; LOG_1("Added rallypoint for %1", name _x); }; }; @@ -215,16 +217,16 @@ private _action = [QGVAR(other), "Set as rallypoint", "components\respawn\data\i publicVariable QGVAR(rallypoints); /* Save current rally to unit */ - cmf_player setVariable [QGVAR(rallypoint_lastRally), [_target, _respawn], true]; + player setVariable [QGVAR(rallypoint_lastRally), [_target, _respawn], true]; /* Spawn cooldown timer */ - cmf_player setVariable [QGVAR(rallypoint_canCreate), false, true]; + player setVariable [QGVAR(rallypoint_canCreate), false, true]; [{ - cmf_player setVariable [QGVAR(rallypoint_canCreate), true, true]; + player setVariable [QGVAR(rallypoint_canCreate), true, true]; }, [], SETTING(rallypointCooldown)] call CBA_fnc_waitAndExecute; }, { ((isNull objectParent cmf_player) && { (cmf_player getVariable [QGVAR(rallypoint_canCreate), true]) && !(missionNamespace getVariable [QGVAR(rallypoint_disabled), false]) }) - && { (cmf_player getVariable [QGVAR(showRallypoint), true]) + && { (cmf_player getVariable [QGVAR(showRallypoint), false]) && !visibleMap } }] call ace_interact_menu_fnc_createAction; diff --git a/framework/components/respawn/functions/fn_setLimit.sqf b/framework/components/respawn/functions/fn_setLimit.sqf index fa79d76..9037e8c 100644 --- a/framework/components/respawn/functions/fn_setLimit.sqf +++ b/framework/components/respawn/functions/fn_setLimit.sqf @@ -20,8 +20,8 @@ SCRIPT(setLimit); params["_obj", "_respawns", ["_silent", false]]; /* Set the new amount of respawns and reset death counter */ -_obj setVariable [QGVAR(respawns), _respawns, true]; -_obj setVariable [QGVAR(deaths), 0, true]; +_obj setVariable[QGVAR(respawns), _respawns, true]; +_obj setVariable[QGVAR(deaths), 0, true]; if (!local _obj) exitWith {}; diff --git a/framework/components/vehicles/functions/fn_damageEH.sqf b/framework/components/vehicles/functions/fn_damageEH.sqf index 7f53b21..f1b6cf3 100644 --- a/framework/components/vehicles/functions/fn_damageEH.sqf +++ b/framework/components/vehicles/functions/fn_damageEH.sqf @@ -105,7 +105,7 @@ if (_damage > 0.8 && { (_selection in _vehicleSelections) || _selection isEqualT ["ace_fire_addFireSource", [_veh, _radius, 10 * (fuel _veh), _key, { (_this select 0) > time }, [_burnTime]]] call CBA_fnc_serverEvent; _veh setVariable [QGVAR(isBurning), true, true]; - [{time > (_this select 0)}, { (_this select 1) setVariable [QGVAR(isBurning), false, true]; }, [_burnTime, _veh]] call CBA_fnc_waitUntilAndExecute; + [{time > (_this select 0)}, { (_this select 1) setVariable [QGVAR(isBurning), false, true] }, [_burnTime, _veh]] call CBA_fnc_waitUntilAndExecute; }; } else { _damage = 0.8; diff --git a/framework/description.ext b/framework/description.ext index 5e53281..46e4a50 100644 --- a/framework/description.ext +++ b/framework/description.ext @@ -12,17 +12,8 @@ enableDebugConsole[] = {"76561198065818848"}; /* Force rotor lib */ forceRotorLibSimulation = 0; -/* Include imported UI elements */ -#include "rsc\ui\RscImports.hpp" - -/* Include custom defines */ -#include "rsc\ui\RscDefines.hpp" - -/* Include Dialogs */ -#include "rsc\ui\RscDialogs.hpp" - -/* Include Controls */ -#include "rsc\ui\RscControls.hpp" +/* Include UI Classes */ +#include "rsc\ui\UI.hpp" /* include Enhanced Vehicles config */ #include "configs\CfgEnhancedVehicles.hpp" diff --git a/framework/initPlayerLocal.sqf b/framework/initPlayerLocal.sqf index 7499204..ef7d2f8 100644 --- a/framework/initPlayerLocal.sqf +++ b/framework/initPlayerLocal.sqf @@ -18,4 +18,4 @@ waitUntil { missionNamespace getVariable ["cmf_main_player_initialized", false] ["!garage_template"] call cmf_kosherGarage_fnc_vehiclePreset; /* Initialize rallypoints */ -[["FTL", "SL", "PL", "CO"]] call cmf_respawn_fnc_rallypoint; +[["FTL", "SL", "PL", "CO"]] call cmf_respawn_fnc_rallypoint; \ No newline at end of file diff --git a/framework/rsc/loadouts/!arsenal_template.sqf b/framework/rsc/loadouts/!arsenal_template.sqf index 1554ce5..9cda5bd 100644 --- a/framework/rsc/loadouts/!arsenal_template.sqf +++ b/framework/rsc/loadouts/!arsenal_template.sqf @@ -52,7 +52,7 @@ if (_condition && _role in ["PL", "SL", "FTL"]) then { /* Medic */ if (_condition && _role in ["MED"]) then { - [_unit, "ace_medical_medicclass", 2] call CBA_fnc_setVarNet; + _unit setVariable ["ace_medical_medicclass", 2, true]; _availableUniforms = []; _availableWeapons = []; _availableAttachments = []; diff --git a/framework/rsc/ui/RscImports.hpp b/framework/rsc/ui/RscImports.hpp index 658776b..f891751 100644 --- a/framework/rsc/ui/RscImports.hpp +++ b/framework/rsc/ui/RscImports.hpp @@ -1,4 +1,49 @@ +import RscObject; import RscText; +import RscFrame; +import RscLine; +import RscProgress; +import RscPicture; +import RscPictureKeepAspect; +import RscVideo; +import RscHTML; +import RscButton; +import RscShortcutButton; +import RscEdit; +import RscCombo; +import RscListBox; +import RscListNBox; +import RscXListBox; +import RscTree; +import RscSlider; +import RscXSliderH; +import RscActiveText; +import RscActivePicture; +import RscActivePictureKeepAspect; import RscStructuredText; +import RscToolbox; +import RscControlsGroup; +import RscControlsGroupNoScrollbars; +import RscControlsGroupNoHScrollbars; +import RscControlsGroupNoVScrollbars; +import RscButtonTextOnly; import RscButtonMenu; -import RscXSliderH; \ No newline at end of file +import RscButtonMenuOK; +import RscButtonMenuCancel; +import RscButtonMenuSteam; +import RscMapControl; +import RscMapControlEmpty; +import RscCheckBox; + +import ctrlButton; +import ctrlButtonClose; +import ctrlProgress; +import ctrlStatic; +import ctrlEdit; +import ctrlEditMulti; +import ctrlStaticTitle; +import ctrlStructuredText; +import ctrlControlsGroup; +import ctrlStaticBackground; +import ctrlStaticBackgroundDisable; +import ctrlStaticBackgroundDisableTiles; \ No newline at end of file diff --git a/framework/rsc/ui/RscLog.hpp b/framework/rsc/ui/RscLog.hpp new file mode 100644 index 0000000..f0a25c5 --- /dev/null +++ b/framework/rsc/ui/RscLog.hpp @@ -0,0 +1,72 @@ +#if __has_include("..\..\components\diagnostic\script_component.hpp") + +#include "..\..\components\diagnostic\script_component.hpp" + +class CMF_RscLog { + idd = -1; + movingEnable = "true"; + onLoad = QUOTE(_this call FUNC(initDisplayLog)) + class ControlsBackground { + //class BackgroundDisable: ctrlStaticBackgroundDisable {}; + //class BackgroundDisableTiles: ctrlStaticBackgroundDisableTiles {}; + class Background: ctrlStaticBackground { + x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; + y = CUI_GRID_Y - 13 * CUI_GRID_H; + w = RSCDEBUG_W * CUI_GRID_W; + h = RSCDEBUG_H * CUI_GRID_H; + }; + + class TitleHeader: ctrlStaticTitle { + text = "Mission Script Log"; + x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; + y = CUI_GRID_Y - 14 * CUI_GRID_H; + w = RSCDEBUG_W * CUI_GRID_W; + h = CUI_GRID_H; + }; + }; + class Controls { + class Group: ctrlControlsGroup { + x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; + y = CUI_GRID_Y - 13 * CUI_GRID_H; + w = RSCDEBUG_W * CUI_GRID_W; + h = RSCDEBUG_H * CUI_GRID_H - CUI_GRID_H - 3/5 * CUI_GRID_H; + class Controls { + class Content: ctrlStructuredText { + idc = IDC_LOG_TEXT; + text = ""; + x = 0; + y = 0; + w = (RSCDEBUG_W - 0.2) * CUI_GRID_W; + h = RSCDEBUG_H - 2.2 * CUI_GRID_H; + style = ST_NO_RECT + ST_MULTI; + canModify = 0; + size = 0.7 * CUI_GRID_H; + shadow = 0; + colorBackground[] = {0,0,0,0.8}; + class Attributes { + font = "EtelkaMonospacePro"; + }; + }; + }; + }; + + class Close: ctrlButtonClose { + x = CUI_GRID_X + RSCDEBUG_W / 2 * CUI_GRID_W - 5.2 * CUI_GRID_W; + y = CUI_GRID_Y + RSCDEBUG_H * CUI_GRID_H - 14.2 * CUI_GRID_H; + w = 5 * CUI_GRID_W; + h = CUI_GRID_H; + }; + + class Clear: ctrlButton { + idc = IDC_LOG_CLEAR; + text = "CLEAR"; + tooltip = "Clear / Flush log"; + x = CUI_GRID_X + RSCDEBUG_W / 2 * CUI_GRID_W - 10.4 * CUI_GRID_W; + y = CUI_GRID_Y + RSCDEBUG_H * CUI_GRID_H - 14.2 * CUI_GRID_H; + w = 5 * CUI_GRID_W; + h = CUI_GRID_H; + }; + }; +}; + +#endif \ No newline at end of file diff --git a/framework/rsc/ui/UI.hpp b/framework/rsc/ui/UI.hpp new file mode 100644 index 0000000..0230a84 --- /dev/null +++ b/framework/rsc/ui/UI.hpp @@ -0,0 +1,8 @@ +/* Include imported UI elements */ +#include "RscImports.hpp" +#include "RscDefines.hpp" + + +#include "RscDialogs.hpp" +#include "RscControls.hpp" +#include "RscLog.hpp" \ No newline at end of file From 9bc1f70942af5fc0ed487b8fe50cfdbf3520adb7 Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 4 Apr 2024 03:08:14 +0200 Subject: [PATCH 2/4] Add missing changelog entry --- framework/changelog.md | 1 + framework/components/main/changelog.sqf | 1 + 2 files changed, 2 insertions(+) diff --git a/framework/changelog.md b/framework/changelog.md index 1d9ba77..8c0115c 100644 --- a/framework/changelog.md +++ b/framework/changelog.md @@ -6,6 +6,7 @@ - Added function to set a crate loadout for a crate using a specified logistics file in 3den and zeus - Added a script log viewer to the CMF menu - Added `PATHTO` family of macros +- Added shots fired statistic to AAR # Changed - Changed how ui elements are included. it now uses a master include file in the ui directory diff --git a/framework/components/main/changelog.sqf b/framework/components/main/changelog.sqf index c66d29e..8972be8 100644 --- a/framework/components/main/changelog.sqf +++ b/framework/components/main/changelog.sqf @@ -7,6 +7,7 @@ Reverted codebase back to v2.1.1.58 • Added function to set a crate loadout for a crate using a specified logistics file in 3den and zeus • Added a script log viewer to the CMF menu • Added `PATHTO` family of macros + • Added shots fired statistic to AAR Changed • Changed how ui elements are included. it now uses a master include file in the ui directory From a75caa98011d639b2a6488047e2bef0ac076e601 Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 4 Apr 2024 03:10:46 +0200 Subject: [PATCH 3/4] Added another missing changelog entry --- framework/changelog.md | 1 + framework/components/main/changelog.sqf | 1 + 2 files changed, 2 insertions(+) diff --git a/framework/changelog.md b/framework/changelog.md index 8c0115c..88a310c 100644 --- a/framework/changelog.md +++ b/framework/changelog.md @@ -7,6 +7,7 @@ - Added a script log viewer to the CMF menu - Added `PATHTO` family of macros - Added shots fired statistic to AAR +- Added `cmf_common_fnc_displayAddInitEvent` function # Changed - Changed how ui elements are included. it now uses a master include file in the ui directory diff --git a/framework/components/main/changelog.sqf b/framework/components/main/changelog.sqf index 8972be8..32b48b1 100644 --- a/framework/components/main/changelog.sqf +++ b/framework/components/main/changelog.sqf @@ -8,6 +8,7 @@ Reverted codebase back to v2.1.1.58 • Added a script log viewer to the CMF menu • Added `PATHTO` family of macros • Added shots fired statistic to AAR + • Added cmf_common_fnc_displayAddInitEvent function Changed • Changed how ui elements are included. it now uses a master include file in the ui directory From 4fbf27a2acade8e1d61bf0334aba45b884d62a6e Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 4 Apr 2024 03:16:33 +0200 Subject: [PATCH 4/4] Fixed syntax errors --- .../curator/functions/fn_randomLoadout.sqf | 16 +-- .../curator/functions/fn_setCrateLoadout.sqf | 20 +-- .../functions/fn_initDisplayLog.sqf | 42 +++--- .../diagnostic/script_component.hpp | 8 +- .../logistics/functions/fn_fillCrate.sqf | 42 +++--- framework/rsc/ui/RscLog.hpp | 122 +++++++++--------- 6 files changed, 125 insertions(+), 125 deletions(-) diff --git a/framework/components/curator/functions/fn_randomLoadout.sqf b/framework/components/curator/functions/fn_randomLoadout.sqf index 173b2a7..571feaf 100644 --- a/framework/components/curator/functions/fn_randomLoadout.sqf +++ b/framework/components/curator/functions/fn_randomLoadout.sqf @@ -21,21 +21,21 @@ if (isNull _unit) exitWith { [LSTRING(unitObject_requirement_message)] call zen_ if !(_unit isKindOf "Man") exitWith { [LSTRING(unit_requirement_message)] call zen_common_fnc_showMessage }; private _randomizeLoadout = { - params ["_values", "_unit"]; + params ["_values", "_unit"]; - private _loadout = format["rsc\loadouts\%1.sqf", _values select 1]; - if !(FILE_EXISTS(_loadout)) exitWith { ERROR_MSG_1("Unable to find loadoutfile: %1", _loadout) }; - private _whitelist = [_values select 0, player, true] call compile(preprocessFileLineNumbers _loadout); + private _loadout = format["rsc\loadouts\%1.sqf", _values select 1]; + if !(FILE_EXISTS(_loadout)) exitWith { ERROR_MSG_1("Unable to find loadoutfile: %1", _loadout) }; + private _whitelist = [_values select 0, player, true] call compile(preprocessFileLineNumbers _loadout); - [_unit, _values select 0, _whitelist select 1] call EFUNC(kosherAI,setLoadout); + [_unit, _values select 0, _whitelist select 1] call EFUNC(kosherAI,setLoadout); - ["Randomized Loadout"] call zen_common_fnc_showMessage; + ["Randomized Loadout"] call zen_common_fnc_showMessage; }; private _defaultRole = [_unit] call EFUNC(kosherAI,getRole); private _defaultLoadout = (missionNamespace getVariable [QEGVAR(kosherAI,loadouts), [""]]) select 0; ["Set Random Loadout", [ - ["EDIT", ["Role", "Role to set unit as"], [_defaultRole]], - ["EDIT", ["Loadout File", "Loadout file to use"], [_defaultLoadout]] + ["EDIT", ["Role", "Role to set unit as"], [_defaultRole]], + ["EDIT", ["Loadout File", "Loadout file to use"], [_defaultLoadout]] ], _randomizeLoadout, {}, _unit] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/curator/functions/fn_setCrateLoadout.sqf b/framework/components/curator/functions/fn_setCrateLoadout.sqf index 9c8667e..797e2f8 100644 --- a/framework/components/curator/functions/fn_setCrateLoadout.sqf +++ b/framework/components/curator/functions/fn_setCrateLoadout.sqf @@ -20,22 +20,22 @@ private _crate = _this param [1, objNull]; if (isNull _crate) exitWith { [LSTRING(unitObject_requirement_message)] call zen_common_fnc_showMessage }; private _setLoadout = { - params ["_values", "_crate"]; + params ["_values", "_crate"]; - private _path = format["rsc\loadouts\%1.sqf", (_values select 0)]; - if !(FILE_EXISTS(_path)) exitWith { ERROR_MSG_1("Unable to find preset: %1", (_values select 0)); }; + private _path = format["rsc\loadouts\%1.sqf", (_values select 0)]; + if !(FILE_EXISTS(_path)) exitWith { ERROR_MSG_1("Unable to find preset: %1", (_values select 0)); }; - private _presets = [call compile preprocessFileLineNumbers _path] call CBA_fnc_hashCreate; - private _preset = [_presets, (_values select 1)] call CBA_fnc_hashGet; - private _presetData = [_preset] call FUNC(presetCompile); + private _presets = [call compile preprocessFileLineNumbers _path] call CBA_fnc_hashCreate; + private _preset = [_presets, (_values select 1)] call CBA_fnc_hashGet; + private _presetData = [_preset] call FUNC(presetCompile); - [_crate, _presetData] call FUNC(fillCrate); // @BUG: Does not work in 3DEN Preview from zeus - ["Set Crate Loadout"] call zen_common_fnc_showMessage; + [_crate, _presetData] call FUNC(fillCrate); // @BUG: Does not work in 3DEN Preview from zeus + ["Set Crate Loadout"] call zen_common_fnc_showMessage; }; _defaultFile = missionNamespace getVariable [QEGVAR(logistics,crateConfigFile), ""]; ["Set Crate Loadout", [ - ["EDIT", ["Logistics File", "Logistics file to use"], [_defaultFile]], - ["EDIT", ["Crate type", "Type of create to make e.g. Fireteam, Medical etc. (case sensitive)"], [""]] + ["EDIT", ["Logistics File", "Logistics file to use"], [_defaultFile]], + ["EDIT", ["Crate type", "Type of create to make e.g. Fireteam, Medical etc. (case sensitive)"], [""]] ], _setLoadout, {}, _crate] call zen_dialog_fnc_create; \ No newline at end of file diff --git a/framework/components/diagnostic/functions/fn_initDisplayLog.sqf b/framework/components/diagnostic/functions/fn_initDisplayLog.sqf index 4a81aa0..6fcc904 100644 --- a/framework/components/diagnostic/functions/fn_initDisplayLog.sqf +++ b/framework/components/diagnostic/functions/fn_initDisplayLog.sqf @@ -18,20 +18,20 @@ params ["_display"]; private _formatTime = { - (_this select [3, 3]) apply { [_x, 2] call CBA_fnc_formatNumber } joinString ":"; + ((_this select [3, 3]) apply { [_x, 2] call CBA_fnc_formatNumber }) joinString ":"; }; /* Style errors */ private _formattedError = GVAR(errorOut) apply { - private _errorColor = (EGVAR(common,notificationColors) get "ERROR") call BIS_fnc_colorRGBtoHTML; - private _infoColor = (EGVAR(common,notificationColors) get "INFO") call BIS_fnc_colorRGBtoHTML; - format ["%1 %2", (_x select 1) call _formatTime, (_x select 2), _infoColor, _errorColor]; + private _errorColor = (EGVAR(common,notificationColors) get "ERROR") call BIS_fnc_colorRGBtoHTML; + private _infoColor = (EGVAR(common,notificationColors) get "INFO") call BIS_fnc_colorRGBtoHTML; + format ["%1 %2", (_x select 1) call _formatTime, (_x select 2), _infoColor, _errorColor]; }; /* Style log */ private _logContent = GVAR(logOut) apply { - private _infoColor = (EGVAR(common,notificationColors) get "INFO") call BIS_fnc_colorRGBtoHTML; - format ["%1 %2", (_x select 1) call _formatTime, (_x select 2), _infoColor]; + private _infoColor = (EGVAR(common,notificationColors) get "INFO") call BIS_fnc_colorRGBtoHTML; + format ["%1 %2", (_x select 1) call _formatTime, (_x select 2), _infoColor]; }; _logContent append _formattedError; @@ -45,7 +45,7 @@ private _ctrlGroup = ctrlParentControlsGroup _ctrlText; ctrlPosition _ctrlGroup params ["_xParent", "_yParent", "_wParent", "_hParent"]; _maxW = selectMax (_logContent apply { - str parseText _x getTextWidth ["RobotoCondensedLight", LOG_FONTSIZE * 2] + str parseText _x getTextWidth ["RobotoCondensedLight", LOG_FONTSIZE * 2] }); _ctrlText ctrlSetPositionW (_maxW max _wParent); @@ -54,27 +54,27 @@ _ctrlText ctrlCommit 0; _ctrlText ctrlSetStructuredText parseText (_logContent joinString "
"); _ctrlLines ctrlSetText str (count _logContent); _ctrlText ctrlSetPosition [ - 0, - 0, - _wParent max _maxW, - _hParent max ctrlTextHeight _ctrlText + 0, + 0, + _wParent max _maxW, + _hParent max ctrlTextHeight _ctrlText ]; _ctrlText ctrlCommit 0; _ctrlGroup spawn { - _this ctrlSetScrollValues [1,0]; + _this ctrlSetScrollValues [1,0]; }; _ctrlClear ctrlAddEventHandler ["ButtonClick", { - _this spawn { - params ["_ctrl"]; + _this spawn { + params ["_ctrl"]; - private _result = ["This will clear the log. Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage; + private _result = ["This will clear the log. Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage; - if (_result) then { - call FUNC(errorFlush); - call FUNC(logFlush); - (ctrlParent _ctrl) closeDisplay 1; - }; - }; + if (_result) then { + call FUNC(errorFlush); + call FUNC(logFlush); + (ctrlParent _ctrl) closeDisplay 1; + }; + }; }]; \ No newline at end of file diff --git a/framework/components/diagnostic/script_component.hpp b/framework/components/diagnostic/script_component.hpp index a8fe54f..1b45510 100644 --- a/framework/components/diagnostic/script_component.hpp +++ b/framework/components/diagnostic/script_component.hpp @@ -24,10 +24,10 @@ #define UI_GRID_W (5 * 0.5 * pixelW * pixelGrid) #define UI_GRID_H (5 * 0.5 * pixelH * pixelGrid) -#define CUI_GRID_X (0.5) -#define CUI_GRID_Y (0.5) -#define CUI_GRID_W UI_GRID_W -#define CUI_GRID_H UI_GRID_H +#define CUI_GRID_X (0.5) +#define CUI_GRID_Y (0.5) +#define CUI_GRID_W UI_GRID_W +#define CUI_GRID_H UI_GRID_H #define LOG_FONTSIZE 0.7 * CUI_GRID_H diff --git a/framework/components/logistics/functions/fn_fillCrate.sqf b/framework/components/logistics/functions/fn_fillCrate.sqf index 1de159d..231fc35 100644 --- a/framework/components/logistics/functions/fn_fillCrate.sqf +++ b/framework/components/logistics/functions/fn_fillCrate.sqf @@ -24,17 +24,17 @@ params ["_crate", "_cargoPreset"]; if (is3DEN) exitWith { - private _equipment = [ - [ - [(_cargoPreset select 4) apply { _x select 0 }, (_cargoPreset select 4) apply { _x select 1 }], - [(_cargoPreset select 3) apply { _x select 0 }, (_cargoPreset select 3) apply { _x select 1 }], - [(_cargoPreset select 2) apply { _x select 0 }, (_cargoPreset select 2) apply { _x select 1 }], - [[],[]] // Backpacks - ], - false - ]; + private _equipment = [ + [ + [(_cargoPreset select 4) apply { _x select 0 }, (_cargoPreset select 4) apply { _x select 1 }], + [(_cargoPreset select 3) apply { _x select 0 }, (_cargoPreset select 3) apply { _x select 1 }], + [(_cargoPreset select 2) apply { _x select 0 }, (_cargoPreset select 2) apply { _x select 1 }], + [[],[]] // Backpacks + ], + false + ]; - _crate set3DENAttribute ["ammoBox", str _equipment]; + _crate set3DENAttribute ["ammoBox", str _equipment]; }; if (!isServer && { !local _crate }) exitWith {}; @@ -49,15 +49,15 @@ clearBackpackCargoGlobal _crate; {_crate addItemCargoGlobal _x} forEach (_cargoPreset select 4); if (count (_cargoPreset select 5) > 0) then { - private _cargoSpace = 0; - { - _cargoSpace = _cargoSpace + _x; - } forEach ((_cargoPreset select 5) apply { ([_x select 0] call ace_cargo_fnc_getSizeItem) * (_x select 1) }); - [_crate, _cargoSpace] call ace_cargo_fnc_setSpace; - { - private _cargo = _x; - for '_i' from 0 to (_cargo select 1) do { - [(_cargo select 0), _crate] call ace_cargo_fnc_loadItem; - }; - } forEach (_cargoPreset select 5); + private _cargoSpace = 0; + { + _cargoSpace = _cargoSpace + _x; + } forEach ((_cargoPreset select 5) apply { ([_x select 0] call ace_cargo_fnc_getSizeItem) * (_x select 1) }); + [_crate, _cargoSpace] call ace_cargo_fnc_setSpace; + { + private _cargo = _x; + for '_i' from 0 to (_cargo select 1) do { + [(_cargo select 0), _crate] call ace_cargo_fnc_loadItem; + }; + } forEach (_cargoPreset select 5); }; \ No newline at end of file diff --git a/framework/rsc/ui/RscLog.hpp b/framework/rsc/ui/RscLog.hpp index f0a25c5..2374712 100644 --- a/framework/rsc/ui/RscLog.hpp +++ b/framework/rsc/ui/RscLog.hpp @@ -3,70 +3,70 @@ #include "..\..\components\diagnostic\script_component.hpp" class CMF_RscLog { - idd = -1; - movingEnable = "true"; - onLoad = QUOTE(_this call FUNC(initDisplayLog)) - class ControlsBackground { - //class BackgroundDisable: ctrlStaticBackgroundDisable {}; - //class BackgroundDisableTiles: ctrlStaticBackgroundDisableTiles {}; - class Background: ctrlStaticBackground { - x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; - y = CUI_GRID_Y - 13 * CUI_GRID_H; - w = RSCDEBUG_W * CUI_GRID_W; - h = RSCDEBUG_H * CUI_GRID_H; - }; + idd = -1; + movingEnable = "true"; + onLoad = QUOTE(_this call FUNC(initDisplayLog)) + class ControlsBackground { + //class BackgroundDisable: ctrlStaticBackgroundDisable {}; + //class BackgroundDisableTiles: ctrlStaticBackgroundDisableTiles {}; + class Background: ctrlStaticBackground { + x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; + y = CUI_GRID_Y - 13 * CUI_GRID_H; + w = RSCDEBUG_W * CUI_GRID_W; + h = RSCDEBUG_H * CUI_GRID_H; + }; - class TitleHeader: ctrlStaticTitle { - text = "Mission Script Log"; - x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; - y = CUI_GRID_Y - 14 * CUI_GRID_H; - w = RSCDEBUG_W * CUI_GRID_W; - h = CUI_GRID_H; - }; - }; - class Controls { - class Group: ctrlControlsGroup { - x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; - y = CUI_GRID_Y - 13 * CUI_GRID_H; - w = RSCDEBUG_W * CUI_GRID_W; - h = RSCDEBUG_H * CUI_GRID_H - CUI_GRID_H - 3/5 * CUI_GRID_H; - class Controls { - class Content: ctrlStructuredText { - idc = IDC_LOG_TEXT; - text = ""; - x = 0; - y = 0; - w = (RSCDEBUG_W - 0.2) * CUI_GRID_W; - h = RSCDEBUG_H - 2.2 * CUI_GRID_H; - style = ST_NO_RECT + ST_MULTI; - canModify = 0; - size = 0.7 * CUI_GRID_H; - shadow = 0; - colorBackground[] = {0,0,0,0.8}; - class Attributes { - font = "EtelkaMonospacePro"; - }; - }; - }; - }; + class TitleHeader: ctrlStaticTitle { + text = "Mission Script Log"; + x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; + y = CUI_GRID_Y - 14 * CUI_GRID_H; + w = RSCDEBUG_W * CUI_GRID_W; + h = CUI_GRID_H; + }; + }; + class Controls { + class Group: ctrlControlsGroup { + x = CUI_GRID_X - RSCDEBUG_W / 2 * CUI_GRID_W; + y = CUI_GRID_Y - 13 * CUI_GRID_H; + w = RSCDEBUG_W * CUI_GRID_W; + h = RSCDEBUG_H * CUI_GRID_H - CUI_GRID_H - 3/5 * CUI_GRID_H; + class Controls { + class Content: ctrlStructuredText { + idc = IDC_LOG_TEXT; + text = ""; + x = 0; + y = 0; + w = (RSCDEBUG_W - 0.2) * CUI_GRID_W; + h = RSCDEBUG_H - 2.2 * CUI_GRID_H; + style = ST_NO_RECT + ST_MULTI; + canModify = 0; + size = 0.7 * CUI_GRID_H; + shadow = 0; + colorBackground[] = {0,0,0,0.8}; + class Attributes { + font = "EtelkaMonospacePro"; + }; + }; + }; + }; - class Close: ctrlButtonClose { - x = CUI_GRID_X + RSCDEBUG_W / 2 * CUI_GRID_W - 5.2 * CUI_GRID_W; - y = CUI_GRID_Y + RSCDEBUG_H * CUI_GRID_H - 14.2 * CUI_GRID_H; - w = 5 * CUI_GRID_W; - h = CUI_GRID_H; - }; + class Close: ctrlButtonClose { + x = CUI_GRID_X + RSCDEBUG_W / 2 * CUI_GRID_W - 5.2 * CUI_GRID_W; + y = CUI_GRID_Y + RSCDEBUG_H * CUI_GRID_H - 14.2 * CUI_GRID_H; + w = 5 * CUI_GRID_W; + h = CUI_GRID_H; + }; - class Clear: ctrlButton { - idc = IDC_LOG_CLEAR; - text = "CLEAR"; - tooltip = "Clear / Flush log"; - x = CUI_GRID_X + RSCDEBUG_W / 2 * CUI_GRID_W - 10.4 * CUI_GRID_W; - y = CUI_GRID_Y + RSCDEBUG_H * CUI_GRID_H - 14.2 * CUI_GRID_H; - w = 5 * CUI_GRID_W; - h = CUI_GRID_H; - }; - }; + class Clear: ctrlButton { + idc = IDC_LOG_CLEAR; + text = "CLEAR"; + tooltip = "Clear / Flush log"; + x = CUI_GRID_X + RSCDEBUG_W / 2 * CUI_GRID_W - 10.4 * CUI_GRID_W; + y = CUI_GRID_Y + RSCDEBUG_H * CUI_GRID_H - 14.2 * CUI_GRID_H; + w = 5 * CUI_GRID_W; + h = CUI_GRID_H; + }; + }; }; #endif \ No newline at end of file