From 0cc2dd0ce3cb38982a96aa71054ac2b694e5ddb1 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 24 Oct 2024 02:21:12 +0200 Subject: [PATCH 01/12] Add test mission --- .gitignore | 1 + .hemtt/launch.toml | 2 + .hemtt/missions/test.Stratis/cba_settings.sqf | 4 + .hemtt/missions/test.Stratis/description.ext | 7 + .hemtt/missions/test.Stratis/mission.sqm | 357 ++++++++++++++++++ 5 files changed, 371 insertions(+) create mode 100644 .hemtt/missions/test.Stratis/cba_settings.sqf create mode 100644 .hemtt/missions/test.Stratis/description.ext create mode 100644 .hemtt/missions/test.Stratis/mission.sqm diff --git a/.gitignore b/.gitignore index 25afacd..cf8be52 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ hemtt hemtt.exe .hemtt/local +.hemtt/missions/~* symbols/* # Bikey diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index fe4bfee..00ea1a0 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -5,8 +5,10 @@ workshop = [ ] parameters = [ "-name=dev", + "-noPause", "-window", ] +mission = "test.Stratis" [ace] extends = "default" diff --git a/.hemtt/missions/test.Stratis/cba_settings.sqf b/.hemtt/missions/test.Stratis/cba_settings.sqf new file mode 100644 index 0000000..31eb1f9 --- /dev/null +++ b/.hemtt/missions/test.Stratis/cba_settings.sqf @@ -0,0 +1,4 @@ + +// ArmaForces - Respawn +afm_respawn_enabled = true; +afm_respawn_time = 60; diff --git a/.hemtt/missions/test.Stratis/description.ext b/.hemtt/missions/test.Stratis/description.ext new file mode 100644 index 0000000..d248bb4 --- /dev/null +++ b/.hemtt/missions/test.Stratis/description.ext @@ -0,0 +1,7 @@ + +cba_settings_hasSettingsFile = 1; + +respawn = 3; +respawnDelay = 1e10; +respawnOnStart = -1; +respawnTemplates[] = {"afm_respawn_default", "Counter"}; diff --git a/.hemtt/missions/test.Stratis/mission.sqm b/.hemtt/missions/test.Stratis/mission.sqm new file mode 100644 index 0000000..44122c8 --- /dev/null +++ b/.hemtt/missions/test.Stratis/mission.sqm @@ -0,0 +1,357 @@ +version=54; +class EditorData +{ + moveGridStep=1; + angleGridStep=0.2617994; + scaleGridStep=1; + autoGroupingDist=10; + toggles=1025; + class ItemIDProvider + { + nextID=83; + }; + class MarkerIDProvider + { + nextID=8; + }; + class LayerIndexProvider + { + nextID=18; + }; + class Camera + { + pos[]={2127.4077,61.299213,5718.915}; + dir[]={-0.31338736,-0.65491021,-0.68766344}; + up[]={-0.27158761,0.75570667,-0.59594256}; + aside[]={-0.90996075,0,0.41469443}; + }; +}; +binarizationWanted=0; +sourceName="test"; +addons[]= +{ + "A3_Characters_F", + "afm_respawn" +}; +class AddonsMetaData +{ + class List + { + items=2; + class Item0 + { + className="A3_Characters_F"; + name="Arma 3 Alpha - Characters and Clothing"; + author="Bohemia Interactive"; + url="https://www.arma3.com"; + }; + class Item1 + { + className="afm_respawn"; + name="AFM - respawn"; + author="ArmaForces"; + }; + }; +}; +randomSeed=2670849; +class ScenarioData +{ + author="veteran29"; +}; +class CustomAttributes +{ + class Category0 + { + name="Scenario"; + class Attribute0 + { + property="cba_settings_hasSettingsFile"; + expression="false"; + class Value + { + class data + { + singleType="BOOL"; + value=1; + }; + }; + }; + nAttributes=1; + }; +}; +class Mission +{ + class Intel + { + timeOfChanges=1800.0002; + startWeather=0.30000001; + startWind=0.1; + startWaves=0.1; + forecastWeather=0.30000001; + forecastWind=0.1; + forecastWaves=0.1; + forecastLightnings=0.1; + wavesForced=1; + windForced=1; + year=2035; + month=7; + day=6; + hour=12; + minute=0; + startFogDecay=0.014; + forecastFogDecay=0.014; + }; + class Entities + { + items=5; + class Item0 + { + dataType="Group"; + side="West"; + class Entities + { + items=1; + class Item0 + { + dataType="Object"; + class PositionInfo + { + position[]={2095.22,6.6758265,5649.3877}; + angles[]={0,3.8437212,0}; + }; + side="West"; + flags=7; + class Attributes + { + isPlayer=1; + }; + id=75; + type="B_Soldier_SL_F"; + atlOffset=4.7683716e-07; + class CustomAttributes + { + class Attribute0 + { + property="speaker"; + expression="_this setspeaker _value;"; + class Value + { + class data + { + singleType="STRING"; + value="Male11ENG"; + }; + }; + }; + class Attribute1 + { + property="pitch"; + expression="_this setpitch _value;"; + class Value + { + class data + { + singleType="SCALAR"; + value=1; + }; + }; + }; + nAttributes=2; + }; + }; + }; + class Attributes + { + name="respawn_group"; + }; + id=74; + atlOffset=4.7683716e-07; + }; + class Item1 + { + dataType="Group"; + side="West"; + class Entities + { + items=1; + class Item0 + { + dataType="Object"; + class PositionInfo + { + position[]={2124.301,6.2714386,5664.3506}; + angles[]={0,3.4975924,-0}; + }; + side="West"; + flags=7; + class Attributes + { + isPlayable=1; + }; + id=78; + type="B_Soldier_SL_F"; + class CustomAttributes + { + class Attribute0 + { + property="speaker"; + expression="_this setspeaker _value;"; + class Value + { + class data + { + singleType="STRING"; + value="Male06ENG"; + }; + }; + }; + class Attribute1 + { + property="pitch"; + expression="_this setpitch _value;"; + class Value + { + class data + { + singleType="SCALAR"; + value=1.01; + }; + }; + }; + nAttributes=2; + }; + }; + }; + class Attributes + { + }; + id=77; + }; + class Item2 + { + dataType="Logic"; + class PositionInfo + { + position[]={2085.3547,6.6999998,5638.6855}; + }; + name="module_respawnWest"; + id=79; + type="afm_respawn_moduleRespawn"; + class CustomAttributes + { + class Attribute0 + { + property="afm_respawn_applyTo"; + expression="_this setVariable ['afm_respawn_applyTo',_value,true];"; + class Value + { + class data + { + singleType="STRING"; + value="1"; + }; + }; + }; + class Attribute1 + { + property="afm_respawn_filter"; + expression="_this setVariable ['afm_respawn_filter', compileFinal _value];"; + class Value + { + class data + { + singleType="STRING"; + value="(_this#0) in units respawn_group"; + }; + }; + }; + nAttributes=2; + }; + }; + class Item3 + { + dataType="Trigger"; + position[]={2085.5859,6.6999946,5621.6021}; + angle=0.21598445; + class Attributes + { + onActivation="systemChat ""Respawn trigger"";"; + sizeA=33.768002; + sizeB=40.047001; + sizeC=5; + timeout[]={5,5,5}; + interuptable=1; + activationType="NOT PRESENT"; + activationBy="WEST"; + isRectangle=1; + isServerOnly=1; + }; + id=81; + type="EmptyDetectorArea10x10"; + atlOffset=-0.026000023; + }; + class Item4 + { + dataType="Logic"; + class PositionInfo + { + position[]={2030.3116,9.3913212,5636.2998}; + angles[]={6.2033563,0,0.0075011365}; + }; + name="module_respawnEast"; + id=82; + type="afm_respawn_moduleRespawn"; + class CustomAttributes + { + class Attribute0 + { + property="afm_respawn_applyTo"; + expression="_this setVariable ['afm_respawn_applyTo',_value,true];"; + class Value + { + class data + { + singleType="STRING"; + value="0"; + }; + }; + }; + class Attribute1 + { + property="afm_respawn_filter"; + expression="_this setVariable ['afm_respawn_filter', compileFinal _value];"; + class Value + { + class data + { + singleType="STRING"; + value="true"; + }; + }; + }; + nAttributes=2; + }; + }; + }; + class Connections + { + class LinkIDProvider + { + nextID=1; + }; + class Links + { + items=1; + class Item0 + { + linkID=0; + item0=81; + item1=79; + class CustomData + { + type="Sync"; + }; + }; + }; + }; +}; From b01f69861adcbc08a9236dc0ee2591e87c5ef95e Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 24 Oct 2024 02:21:30 +0200 Subject: [PATCH 02/12] Add common editor attributes for code --- addons/common/CfgVehicles.hpp | 20 ++++++++++++++++++++ addons/common/config.cpp | 1 + 2 files changed, 21 insertions(+) create mode 100644 addons/common/CfgVehicles.hpp diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp new file mode 100644 index 0000000..3b8d3eb --- /dev/null +++ b/addons/common/CfgVehicles.hpp @@ -0,0 +1,20 @@ +class CfgVehicles { + class Logic; + class Module_F: Logic { + class AttributesBase { + class Default; + class GVAR(codeBig): Default { + control = "EditCodeMulti5"; + typeName = "STRING"; + expression = "_this setVariable ['%s', compileFinal _value];"; + validate = "none"; + // these seem buggy, _this is a control during validation and breaks it + // validate = "expression"; + // validate = "condition"; + }; + class GVAR(codeSmall): GVAR(codeBig) { + control = "EditCodeMulti3"; + }; + }; + }; +}; diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 422099f..4b4833c 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -15,4 +15,5 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" #include "ui\RscModal.hpp" From cb6a278eda081d4151658828617d2099bae9a2e2 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 24 Oct 2024 02:21:56 +0200 Subject: [PATCH 03/12] Add return value to PREP_RECOMPILE makes it easier to be sure it has executed --- addons/main/script_debug.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/script_debug.hpp b/addons/main/script_debug.hpp index cea601d..2f4f32f 100644 --- a/addons/main/script_debug.hpp +++ b/addons/main/script_debug.hpp @@ -15,7 +15,7 @@ };\ PREFIX##_PREP_RECOMPILE_BUTTON = true;\ } - #define PREP_RECOMPILE_START if (isNil 'PREFIX##_PREP_RECOMPILE') then {PREFIX##_RECOMPILES = []; PREFIX##_PREP_RECOMPILE = {{call _x} forEach PREFIX##_RECOMPILES;}}; private _recomp = {INFO('Compiling'); + #define PREP_RECOMPILE_START if (isNil 'PREFIX##_PREP_RECOMPILE') then {PREFIX##_RECOMPILES = []; PREFIX##_PREP_RECOMPILE = {{call _x} forEach PREFIX##_RECOMPILES; diag_frameNo}}; private _recomp = {INFO('Compiling'); #define PREP_RECOMPILE_END }; call _recomp; PREFIX##_RECOMPILES pushBack _recomp; PREP_RECOMPILE_ADD_BUTTON; #else #define LINKFUNC(x) FUNC(x) From 967569f48108c6216a79f08ff7c754e5cf1bee31 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 24 Oct 2024 02:38:17 +0200 Subject: [PATCH 04/12] Add module to respawn players of specified side --- .hemtt/missions/test.Stratis/cba_settings.sqf | 4 +- .hemtt/missions/test.Stratis/mission.sqm | 22 +++--- addons/respawn/CfgVehicles.hpp | 79 +++++++++++++++++++ addons/respawn/XEH_PREP.hpp | 2 + addons/respawn/config.cpp | 1 + .../respawn/functions/fnc_moduleRespawn.sqf | 41 ++++++++++ 6 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 addons/respawn/CfgVehicles.hpp create mode 100644 addons/respawn/functions/fnc_moduleRespawn.sqf diff --git a/.hemtt/missions/test.Stratis/cba_settings.sqf b/.hemtt/missions/test.Stratis/cba_settings.sqf index 31eb1f9..a4bc22d 100644 --- a/.hemtt/missions/test.Stratis/cba_settings.sqf +++ b/.hemtt/missions/test.Stratis/cba_settings.sqf @@ -1,4 +1,4 @@ // ArmaForces - Respawn -afm_respawn_enabled = true; -afm_respawn_time = 60; +force afm_respawn_enabled = true; +force afm_respawn_time = 60; diff --git a/.hemtt/missions/test.Stratis/mission.sqm b/.hemtt/missions/test.Stratis/mission.sqm index 44122c8..24e8fed 100644 --- a/.hemtt/missions/test.Stratis/mission.sqm +++ b/.hemtt/missions/test.Stratis/mission.sqm @@ -21,9 +21,9 @@ class EditorData class Camera { pos[]={2127.4077,61.299213,5718.915}; - dir[]={-0.31338736,-0.65491021,-0.68766344}; - up[]={-0.27158761,0.75570667,-0.59594256}; - aside[]={-0.90996075,0,0.41469443}; + dir[]={-0.31839693,-0.64070541,-0.6986559}; + up[]={-0.26569697,0.76778686,-0.58301681}; + aside[]={-0.90996081,0,0.41469446}; }; }; binarizationWanted=0; @@ -180,7 +180,7 @@ class Mission class PositionInfo { position[]={2124.301,6.2714386,5664.3506}; - angles[]={0,3.4975924,-0}; + angles[]={0,3.4975924,0}; }; side="West"; flags=7; @@ -232,7 +232,7 @@ class Mission dataType="Logic"; class PositionInfo { - position[]={2085.3547,6.6999998,5638.6855}; + position[]={2085.355,6.6999998,5638.686}; }; name="module_respawnWest"; id=79; @@ -247,8 +247,8 @@ class Mission { class data { - singleType="STRING"; - value="1"; + singleType="SCALAR"; + value=1; }; }; }; @@ -295,8 +295,8 @@ class Mission dataType="Logic"; class PositionInfo { - position[]={2030.3116,9.3913212,5636.2998}; - angles[]={6.2033563,0,0.0075011365}; + position[]={2030.312,9.391324,5636.2998}; + angles[]={6.2033539,0,0.0075049158}; }; name="module_respawnEast"; id=82; @@ -311,8 +311,8 @@ class Mission { class data { - singleType="STRING"; - value="0"; + singleType="SCALAR"; + value=0; }; }; }; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp new file mode 100644 index 0000000..271c074 --- /dev/null +++ b/addons/respawn/CfgVehicles.hpp @@ -0,0 +1,79 @@ +class CfgVehicles { + class Logic; + class Module_F: Logic { + class AttributesBase { + class Combo; + class EGVAR(common,codeSmall); + class ModuleDescription; + }; + + class ModuleDescription { + class EmptyDetector; + class Condition; + }; + }; + + class GVAR(moduleRespawn): Module_F { + scope = 2; + + displayName = "$$$ RESPAWN $$$"; + category = QUOTE(PREFIX); + icon = "\a3\Modules_f\data\iconRespawn_ca.paa"; + portrait = "\a3\Modules_f\data\portraitRespawn_ca.paa"; + + function = QFUNC(moduleRespawn); + isGlobal = 0; + isTriggerActivated = 1; + isDisposable = 1; + + class Attributes: AttributesBase { + + class GVAR(applyTo): Combo { + displayName = "Apply to"; + + property = QGVAR(applyTo); + typeName = "NUMBER"; + + class Values { + class EAST { + name = "$STR_A3_CfgGroups_East0"; + value = 0; + }; + class WEST { + name = "$STR_A3_CfgGroups_West0"; + value = 1; + default = 1; + }; + class INDEP { + name = "$STR_A3_CfgGroups_Indep0"; + value = 2; + }; + }; + }; + + class GVAR(filter): EGVAR(common,codeSmall) { + displayName = "Filter units code"; + tooltip = "\nparams [""_unit""]"; + + property = QGVAR(filter); + defaultValue = "'true'"; + }; + + class ModuleDescription: ModuleDescription {}; + }; + + class ModuleDescription: ModuleDescription { + description[] = { + "Synchronize the module with a trigger to respawn players of the selected side once it's activated.", + "List of the players can be filtered with optional condition code." + }; + sync[] = {"EmptyDetector"}; + + duplicate = 1; + direction = 0; + position = 0; + + class EmptyDetector: EmptyDetector {}; + }; + }; +}; diff --git a/addons/respawn/XEH_PREP.hpp b/addons/respawn/XEH_PREP.hpp index cfa63ed..e9b2f10 100644 --- a/addons/respawn/XEH_PREP.hpp +++ b/addons/respawn/XEH_PREP.hpp @@ -5,3 +5,5 @@ PREP(enable); PREP(onPlayerKilled); PREP(onPlayerRespawn); PREP(toggle); + +PREP(moduleRespawn); diff --git a/addons/respawn/config.cpp b/addons/respawn/config.cpp index 2141ea0..07ed49a 100644 --- a/addons/respawn/config.cpp +++ b/addons/respawn/config.cpp @@ -17,3 +17,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgRespawnTemplates.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/respawn/functions/fnc_moduleRespawn.sqf b/addons/respawn/functions/fnc_moduleRespawn.sqf new file mode 100644 index 0000000..9df2881 --- /dev/null +++ b/addons/respawn/functions/fnc_moduleRespawn.sqf @@ -0,0 +1,41 @@ +#define DEBUG_SYNCHRONOUS +#include "script_component.hpp" +/* + * Author: veteran29 + * Respawn players module logic. + * + * Arguments: + * 0: Module + * + * Return Value: + * None + * + * Public: No + */ + +[{ + params ["_logic"]; + + private _synchronizedTriggers = synchronizedObjects _logic select {_x isKindOf "EmptyDetector"}; + if (_synchronizedTriggers isEqualTo []) exitWith { + WARNING_1("No synchronized triggers: %1",_logic); + }; + + private _side = (_logic getVariable QGVAR(applyTo)) call BIS_fnc_sideType; + private _filter = _logic getVariable QGVAR(filter); + + private _units = allPlayers select { + !alive _x + && side group _x == _side + && {[_x] call _filter} + }; + + TRACE_1("",_filter); + INFO_2("Respawning %2 players of side %1:",_side,count _units); + { + diag_log text format [" %1", name _x]; + } forEach _units; + + [QGVAR(force), nil, _units] call CBA_fnc_targetEvent; + +}, _this] call CBA_fnc_directCall; From 9fec377980d7d2def94ae8ed2d8c6050b841fa14 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 24 Oct 2024 02:38:58 +0200 Subject: [PATCH 05/12] Add documentation about mission config setup for respawn --- addons/respawn/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/respawn/README.md b/addons/respawn/README.md index 506f4f0..5cf2311 100644 --- a/addons/respawn/README.md +++ b/addons/respawn/README.md @@ -2,6 +2,17 @@ Respawn template with live customization available through CBA settings. +### Enabling in a mission + +Following config needs to be added to a mission config to allow this system to work properly: + +```cpp +respawn = 3; +respawnDelay = 1e10; +respawnOnStart = -1; +respawnTemplates[] = {"afm_respawn_default", "Counter"}; +``` + ## Respawn delay change You can change respawn delay at any time during the mission. If someone was already waiting for respawn, his timer will get adjusted to account for already spent time waiting. From 6edd3a0ddb0832b8db6a5ef980e29fd30603c9f7 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 24 Oct 2024 03:34:28 +0200 Subject: [PATCH 06/12] Add ZEN respawn module --- .hemtt/launch.toml | 1 + .hemtt/missions/test.Stratis/mission.sqm | 91 +++++++++++++++++-- addons/respawn/XEH_PREP.hpp | 3 +- addons/respawn/XEH_postInit.sqf | 2 + .../respawn/functions/fnc_addZeusModules.sqf | 37 ++++++++ 5 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 addons/respawn/functions/fnc_addZeusModules.sqf diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index 00ea1a0..1468aff 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -2,6 +2,7 @@ workshop = [ "450814997", # CBA_A3 "2369477168", # ADT + "1779063631", # ZEN ] parameters = [ "-name=dev", diff --git a/.hemtt/missions/test.Stratis/mission.sqm b/.hemtt/missions/test.Stratis/mission.sqm index 24e8fed..9a37e6b 100644 --- a/.hemtt/missions/test.Stratis/mission.sqm +++ b/.hemtt/missions/test.Stratis/mission.sqm @@ -8,7 +8,7 @@ class EditorData toggles=1025; class ItemIDProvider { - nextID=83; + nextID=84; }; class MarkerIDProvider { @@ -20,10 +20,10 @@ class EditorData }; class Camera { - pos[]={2127.4077,61.299213,5718.915}; - dir[]={-0.31839693,-0.64070541,-0.6986559}; - up[]={-0.26569697,0.76778686,-0.58301681}; - aside[]={-0.90996081,0,0.41469446}; + pos[]={2115.6221,61.299213,5696.2256}; + dir[]={-0.35770744,-0.57448208,-0.73621982}; + up[]={-0.25105935,0.81851542,-0.51672125}; + aside[]={-0.89945447,1.6298145e-09,0.43701831}; }; }; binarizationWanted=0; @@ -31,13 +31,14 @@ sourceName="test"; addons[]= { "A3_Characters_F", - "afm_respawn" + "afm_respawn", + "A3_Modules_F_Curator_Curator" }; class AddonsMetaData { class List { - items=2; + items=3; class Item0 { className="A3_Characters_F"; @@ -51,6 +52,13 @@ class AddonsMetaData name="AFM - respawn"; author="ArmaForces"; }; + class Item2 + { + className="A3_Modules_F_Curator"; + name="Arma 3 Zeus Update - Scripted Modules"; + author="Bohemia Interactive"; + url="https://www.arma3.com"; + }; }; }; randomSeed=2670849; @@ -103,7 +111,7 @@ class Mission }; class Entities { - items=5; + items=6; class Item0 { dataType="Group"; @@ -332,6 +340,73 @@ class Mission nAttributes=2; }; }; + class Item5 + { + dataType="Logic"; + class PositionInfo + { + position[]={2030.7878,6.2922206,5623.8281}; + }; + id=83; + type="ModuleCurator_F"; + atlOffset=-4.7683716e-07; + class CustomAttributes + { + class Attribute0 + { + property="ModuleCurator_F_Owner"; + expression="_this setVariable ['Owner',_value,true];"; + class Value + { + class data + { + singleType="STRING"; + value=""; + }; + }; + }; + class Attribute1 + { + property="ModuleCurator_F_Forced"; + expression="_this setVariable ['Forced',_value,true];"; + class Value + { + class data + { + singleType="SCALAR"; + value=0; + }; + }; + }; + class Attribute2 + { + property="ModuleCurator_F_Name"; + expression="_this setVariable ['Name',_value,true];"; + class Value + { + class data + { + singleType="STRING"; + value=""; + }; + }; + }; + class Attribute3 + { + property="ModuleCurator_F_Addons"; + expression="_this setVariable ['Addons',_value,true];"; + class Value + { + class data + { + singleType="SCALAR"; + value=2; + }; + }; + }; + nAttributes=4; + }; + }; }; class Connections { diff --git a/addons/respawn/XEH_PREP.hpp b/addons/respawn/XEH_PREP.hpp index e9b2f10..16b94b9 100644 --- a/addons/respawn/XEH_PREP.hpp +++ b/addons/respawn/XEH_PREP.hpp @@ -5,5 +5,6 @@ PREP(enable); PREP(onPlayerKilled); PREP(onPlayerRespawn); PREP(toggle); - +// modules +PREP(addZeusModules); PREP(moduleRespawn); diff --git a/addons/respawn/XEH_postInit.sqf b/addons/respawn/XEH_postInit.sqf index bcf50a6..50f35ea 100644 --- a/addons/respawn/XEH_postInit.sqf +++ b/addons/respawn/XEH_postInit.sqf @@ -37,4 +37,6 @@ if (hasInterface) then { [QGVAR(adjustTimeLocal), { _this call FUNC(adjustTimeLocal); }] call CBA_fnc_addEventHandler; + + [] call FUNC(addZeusModules); }; diff --git a/addons/respawn/functions/fnc_addZeusModules.sqf b/addons/respawn/functions/fnc_addZeusModules.sqf new file mode 100644 index 0000000..e241f24 --- /dev/null +++ b/addons/respawn/functions/fnc_addZeusModules.sqf @@ -0,0 +1,37 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Adds custom modules to Zeus via Zeus Enhanced framework. + * + * Public: No + */ + +if (isNil "zen_custom_modules_fnc_register") exitWith {}; + +LOG("Adding ZEN modules"); + +[ELSTRING(Main,Category), "Respawn players", { + private _deadPlayers = allPlayers select {!alive _x}; + [ + "Respawn players", + [ + ["OWNERS", "Who to respawn", [[], [], [], 0]] + ], + { + (_this#0) params ["_selections"]; + _selections params ["_sides", "_groups", "_players"]; + + _players = flatten [ + allPlayers select {side group _x in _sides}, + flatten (_groups apply {units _x}), + _players + ]; + _players = (_players arrayIntersect _players) select {isPlayer _x && !alive _x}; + + INFO_1("Respawning players via Zeus: %1",_players); + + format ["Respawning %1 players", count _players] call CBA_fnc_notify; + [QGVAR(force), nil, _players] call CBA_fnc_targetEvent; + } + ] call zen_dialog_fnc_create; +}, getText (configFile >> "CfgVehicles" >> QGVAR(moduleRespawn) >> "portrait")] call zen_custom_modules_fnc_register; From aa7184bf71f572b74f6f4278ebac0358878916b9 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Fri, 25 Oct 2024 02:56:27 +0200 Subject: [PATCH 07/12] Split ZEN respawn modules into two modules --- .../respawn/functions/fnc_addZeusModules.sqf | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/addons/respawn/functions/fnc_addZeusModules.sqf b/addons/respawn/functions/fnc_addZeusModules.sqf index e241f24..e4b1a21 100644 --- a/addons/respawn/functions/fnc_addZeusModules.sqf +++ b/addons/respawn/functions/fnc_addZeusModules.sqf @@ -6,32 +6,62 @@ * Public: No */ -if (isNil "zen_custom_modules_fnc_register") exitWith {}; +if (isNil "zen_custom_modules_fnc_register" || !isMultiplayer) exitWith {}; LOG("Adding ZEN modules"); -[ELSTRING(Main,Category), "Respawn players", { - private _deadPlayers = allPlayers select {!alive _x}; +[ELSTRING(Main,Category), "Respawn side", { [ - "Respawn players", + "Respawn side", [ - ["OWNERS", "Who to respawn", [[], [], [], 0]] + [ + "SIDES", + "Sides to respawn", + [], + false + ] ], { - (_this#0) params ["_selections"]; - _selections params ["_sides", "_groups", "_players"]; - - _players = flatten [ - allPlayers select {side group _x in _sides}, - flatten (_groups apply {units _x}), - _players - ]; - _players = (_players arrayIntersect _players) select {isPlayer _x && !alive _x}; + params ["_dialogValues"]; + _dialogValues params ["_sides"]; + TRACE_1("",_dialogValues); - INFO_1("Respawning players via Zeus: %1",_players); + private _players = allPlayers select {side group _x in _sides && !alive _x}; format ["Respawning %1 players", count _players] call CBA_fnc_notify; [QGVAR(force), nil, _players] call CBA_fnc_targetEvent; } ] call zen_dialog_fnc_create; }, getText (configFile >> "CfgVehicles" >> QGVAR(moduleRespawn) >> "portrait")] call zen_custom_modules_fnc_register; + +[ELSTRING(Main,Category), "Respawn player", { + private _deadPlayers = allPlayers select {!alive _x}; + private _deadPlayersNames = _deadPlayers apply {format ["%1 (%2)", name _x, side group _x]}; + [ + "Respawn player", + [ + [ + "LIST", + "Dead players:", + [ + _deadPlayers, + _deadPlayersNames, + 0, + 10 + ], + true + ] + ], + { + params ["_dialogValues", "_deadPlayers"]; + _dialogValues params ["_selected"]; + TRACE_1("",_dialogValues); + + format ["Respawning %1", name _selected] call CBA_fnc_notify; + + [QGVAR(force), nil, _selected] call CBA_fnc_targetEvent; + }, + {}, + _deadPlayers + ] call zen_dialog_fnc_create; +}, getText (configFile >> "CfgVehicles" >> QGVAR(moduleRespawn) >> "portrait")] call zen_custom_modules_fnc_register; From 3982a16668f94778fa34c79462dbd960a8277296 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Fri, 25 Oct 2024 03:24:19 +0200 Subject: [PATCH 08/12] Add translations, warning for no dead players --- .hemtt/missions/test.Stratis/mission.sqm | 21 ++++---- addons/respawn/CfgVehicles.hpp | 12 ++--- .../respawn/functions/fnc_addZeusModules.sqf | 27 ++++++---- addons/respawn/stringtable.xml | 53 +++++++++++++++++++ 4 files changed, 86 insertions(+), 27 deletions(-) diff --git a/.hemtt/missions/test.Stratis/mission.sqm b/.hemtt/missions/test.Stratis/mission.sqm index 9a37e6b..a6dbd89 100644 --- a/.hemtt/missions/test.Stratis/mission.sqm +++ b/.hemtt/missions/test.Stratis/mission.sqm @@ -20,10 +20,10 @@ class EditorData }; class Camera { - pos[]={2115.6221,61.299213,5696.2256}; - dir[]={-0.35770744,-0.57448208,-0.73621982}; - up[]={-0.25105935,0.81851542,-0.51672125}; - aside[]={-0.89945447,1.6298145e-09,0.43701831}; + pos[]={2103.7285,49.199692,5677.5742}; + dir[]={-0.24344152,-0.74140024,-0.6253494}; + up[]={-0.26895773,0.67106307,-0.69089508}; + aside[]={-0.93187869,-1.4901161e-08,0.36276996}; }; }; binarizationWanted=0; @@ -124,18 +124,18 @@ class Mission dataType="Object"; class PositionInfo { - position[]={2095.22,6.6758265,5649.3877}; + position[]={2093.6479,6.6836753,5649.085}; angles[]={0,3.8437212,0}; }; side="West"; flags=7; class Attributes { + name="zeus"; isPlayer=1; }; id=75; type="B_Soldier_SL_F"; - atlOffset=4.7683716e-07; class CustomAttributes { class Attribute0 @@ -173,7 +173,6 @@ class Mission name="respawn_group"; }; id=74; - atlOffset=4.7683716e-07; }; class Item1 { @@ -345,11 +344,11 @@ class Mission dataType="Logic"; class PositionInfo { - position[]={2030.7878,6.2922206,5623.8281}; + position[]={2030.788,6.292222,5623.8281}; }; id=83; type="ModuleCurator_F"; - atlOffset=-4.7683716e-07; + atlOffset=4.7683716e-07; class CustomAttributes { class Attribute0 @@ -361,7 +360,7 @@ class Mission class data { singleType="STRING"; - value=""; + value="zeus"; }; }; }; @@ -400,7 +399,7 @@ class Mission class data { singleType="SCALAR"; - value=2; + value=3; }; }; }; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index 271c074..d254164 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -16,7 +16,7 @@ class CfgVehicles { class GVAR(moduleRespawn): Module_F { scope = 2; - displayName = "$$$ RESPAWN $$$"; + displayName = CSTRING(ModuleRespawn_DisplayName); category = QUOTE(PREFIX); icon = "\a3\Modules_f\data\iconRespawn_ca.paa"; portrait = "\a3\Modules_f\data\portraitRespawn_ca.paa"; @@ -29,7 +29,7 @@ class CfgVehicles { class Attributes: AttributesBase { class GVAR(applyTo): Combo { - displayName = "Apply to"; + displayName = CSTRING(ModuleRespawn_Attribute_ApplyTo_DisplayName); property = QGVAR(applyTo); typeName = "NUMBER"; @@ -52,8 +52,8 @@ class CfgVehicles { }; class GVAR(filter): EGVAR(common,codeSmall) { - displayName = "Filter units code"; - tooltip = "\nparams [""_unit""]"; + displayName = CSTRING(ModuleRespawn_Attribute_Filter_DisplayName); + tooltip = "params [""_unit""]"; property = QGVAR(filter); defaultValue = "'true'"; @@ -64,8 +64,8 @@ class CfgVehicles { class ModuleDescription: ModuleDescription { description[] = { - "Synchronize the module with a trigger to respawn players of the selected side once it's activated.", - "List of the players can be filtered with optional condition code." + CSTRING(ModuleRespawn_Description_0), + CSTRING(ModuleRespawn_Description_1), }; sync[] = {"EmptyDetector"}; diff --git a/addons/respawn/functions/fnc_addZeusModules.sqf b/addons/respawn/functions/fnc_addZeusModules.sqf index e4b1a21..e499d98 100644 --- a/addons/respawn/functions/fnc_addZeusModules.sqf +++ b/addons/respawn/functions/fnc_addZeusModules.sqf @@ -10,13 +10,15 @@ if (isNil "zen_custom_modules_fnc_register" || !isMultiplayer) exitWith {}; LOG("Adding ZEN modules"); -[ELSTRING(Main,Category), "Respawn side", { +private _iconRespawn = getText (configFile >> "CfgVehicles" >> QGVAR(moduleRespawn) >> "portrait"); + +[ELSTRING(Main,Category), LSTRING(ModuleRespawn_ZEN_Sides_DisplayName), { [ - "Respawn side", + LSTRING(ModuleRespawn_ZEN_Sides_DisplayName), [ [ "SIDES", - "Sides to respawn", + LSTRING(ModuleRespawn_ZEN_Sides_AttributeSides_DisplayName), [], false ] @@ -28,21 +30,26 @@ LOG("Adding ZEN modules"); private _players = allPlayers select {side group _x in _sides && !alive _x}; - format ["Respawning %1 players", count _players] call CBA_fnc_notify; + format [LLSTRING(ModuleRespawn_Notification_RespawningMany), count _players] call CBA_fnc_notify; [QGVAR(force), nil, _players] call CBA_fnc_targetEvent; } ] call zen_dialog_fnc_create; -}, getText (configFile >> "CfgVehicles" >> QGVAR(moduleRespawn) >> "portrait")] call zen_custom_modules_fnc_register; +}, _iconRespawn] call zen_custom_modules_fnc_register; -[ELSTRING(Main,Category), "Respawn player", { +[ELSTRING(Main,Category), LSTRING(ModuleRespawn_ZEN_Player_DisplayName), { private _deadPlayers = allPlayers select {!alive _x}; private _deadPlayersNames = _deadPlayers apply {format ["%1 (%2)", name _x, side group _x]}; + + if (_deadPlayers isEqualTo []) exitWith { + [objNull, LLSTRING(ModuleRespawn_Notification_NoDead)] call BIS_fnc_showCuratorFeedbackMessage; + }; + [ - "Respawn player", + LSTRING(ModuleRespawn_ZEN_Player_DisplayName), [ [ "LIST", - "Dead players:", + LSTRING(ModuleRespawn_ZEN_Player_AttributeDead_DisplayName), [ _deadPlayers, _deadPlayersNames, @@ -57,11 +64,11 @@ LOG("Adding ZEN modules"); _dialogValues params ["_selected"]; TRACE_1("",_dialogValues); - format ["Respawning %1", name _selected] call CBA_fnc_notify; + format [LLSTRING(ModuleRespawn_Notification_RespawningSingle), name _selected] call CBA_fnc_notify; [QGVAR(force), nil, _selected] call CBA_fnc_targetEvent; }, {}, _deadPlayers ] call zen_dialog_fnc_create; -}, getText (configFile >> "CfgVehicles" >> QGVAR(moduleRespawn) >> "portrait")] call zen_custom_modules_fnc_register; +}, _iconRespawn] call zen_custom_modules_fnc_register; diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml index 8d0ecb5..35862e6 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -21,5 +21,58 @@ How much time must pass before player will respawn (if respawn is enabled). Jak dużo czasu musi upłynąć by gracz mógł się odrodzić (jeśli odrodzenie jest włączone). + + + Force respawn + Wymuś odrodzenie + + + Apply to + Zastosuj do + + + Filter units code + Kod filtru jednostek + + + Synchronize the module with a trigger to respawn players of the selected side once it's activated. + Zsynchronizuj moduł z triggerem aby odrodzić graczy po jego aktywacji. + + + List of the players can be filtered with filter code. + Lista graczy może zostać odfiltrowana za pomocą kodu filtru. + + + + Respawn sides + Odródź strony + + + Sides to respawn + Strony do odrodzenia + + + + Respawn player + Odródź gracza + + + Dead players: + Martwi gracze: + + + + Respawning %1 + Odradzanie %1 + + + Respawning %1 players + Odradzanie %1 graczy + + + No dead players + Brak martwych graczy + + From ada06d74651a8d6b598f8c028ec5de5ce9ccd5e0 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Fri, 25 Oct 2024 03:24:33 +0200 Subject: [PATCH 09/12] Update file lang assignment for hemtt extension --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 568d9e4..dc2ecbf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "sqf.enableCBA": true, "sqf.enableACE3": true, "files.associations": { - "*.hpp": "ext" + "*.hpp": "arma-config" }, "sqflint.ignoredVariables": [ "_input0", From e2e5e42305a6de0f49569678be94fb38ea7f7422 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Fri, 25 Oct 2024 03:30:48 +0200 Subject: [PATCH 10/12] Fix docs --- addons/respawn/functions/fnc_addZeusModules.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/respawn/functions/fnc_addZeusModules.sqf b/addons/respawn/functions/fnc_addZeusModules.sqf index e499d98..937e2d7 100644 --- a/addons/respawn/functions/fnc_addZeusModules.sqf +++ b/addons/respawn/functions/fnc_addZeusModules.sqf @@ -3,6 +3,12 @@ * Author: veteran29 * Adds custom modules to Zeus via Zeus Enhanced framework. * + * Arguments: + * None + * + * Return Value: + * None + * * Public: No */ From e0cb717c99add2351cf3accb9672c8880fd4eef6 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Mon, 4 Nov 2024 01:39:27 +0100 Subject: [PATCH 11/12] Add civilian side to 3den module --- addons/respawn/CfgVehicles.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index d254164..efc58a3 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -48,6 +48,10 @@ class CfgVehicles { name = "$STR_A3_CfgGroups_Indep0"; value = 2; }; + class CIVILIAN { + name = "$STR_Civilian"; + value = 2; + }; }; }; From 03134f11f5496730578c68091638e87325ae62af Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Mon, 4 Nov 2024 01:40:28 +0100 Subject: [PATCH 12/12] Update translations Co-authored-by: 3Mydlo3 --- addons/respawn/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml index 35862e6..389ff68 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -36,10 +36,10 @@ Synchronize the module with a trigger to respawn players of the selected side once it's activated. - Zsynchronizuj moduł z triggerem aby odrodzić graczy po jego aktywacji. + Zsynchronizuj moduł z triggerem aby odrodzić graczy wybranej strony po jego aktywacji. - List of the players can be filtered with filter code. + The list of players can be filtered with filter code. Lista graczy może zostać odfiltrowana za pomocą kodu filtru.