diff --git a/CfgActionMenu_self.hpp b/CfgActionMenu_self.hpp
new file mode 100644
index 0000000..4ab84b3
--- /dev/null
+++ b/CfgActionMenu_self.hpp
@@ -0,0 +1,14 @@
+class Ignatz_DoorOpener
+{
+ condition = "if (dyna_AtHome && dyna_IsDriver) then {['opencheck'] call Ignatz_Client_DoorOpener} else {false};";
+ action = "['open'] call Ignatz_Client_DoorOpener;";
+ icon = "addons\pics\Actions\Gate_Open.paa";
+ tooltip = "Open Gate";
+};
+class Ignatz_DoorCloser
+{
+ condition = "if (dyna_AtHome && dyna_IsDriver) then {['closecheck'] call Ignatz_Client_DoorOpener} else {false};";
+ action = "['close'] call Ignatz_Client_DoorOpener;";
+ icon = "addons\pics\Actions\Gate_Close.paa";
+ tooltip = "Close Gate";
+};
diff --git a/README.md b/README.md
index b685d4b..6bfb909 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,12 @@
-# Ignatz_Tools
+# Ignatz_Tools for Arma3-EpochMod
- Earplugs
- StatusBar
- Autorestart
-Put your servercomandpassword in @epochhive\addons\ignatz_server\config.cpp
-All other Settings are in Epoch.Mission\ignatz_config.hpp
+- Autmatic Door Opener
+
+- copy the files from epoch.mission into your mission file (if init.sqf already exist, paste the code into this file)
+- Add the following lines from CfgActionMenu_self.hpp into this file: "epoch.mission\epoch_config\Configs\CfgActionMenu\CfgActionMenu_self.hpp"
+- Put your servercomandpassword in @epochhive\addons\ignatz_server\config.cpp
+- All other Settings are in Epoch.Mission\ignatz_config.hpp
diff --git a/epoch.Mission/Ignatz_config.hpp b/epoch.Mission/Ignatz_config.hpp
index 01f6089..de327d6 100644
--- a/epoch.Mission/Ignatz_config.hpp
+++ b/epoch.Mission/Ignatz_config.hpp
@@ -1,24 +1,35 @@
class Ignatz_config {
// Earplugs
- Earplugs_Keybind = 0x3E; /* Key to put in / out the Earplugs (F4) full list: https://community.bistudio.com/wiki/DIK_KeyCodes */
- Earplugs_AutoEarplugs = "true"; /* Auto insert / remove Earplugs by entering leaving Vehicles */
- Earplugs_UseInVehicles = "true"; /* Set it to false to disable manual Earplugs in Vehicles */
- Earplugs_HintsMessages = "true"; /* Show Hint Messages on Auto-Insert / Remove Earplugs */
- Earplugs_Systemchat = "true"; /* Show Systemchat Messages on Auto-Insert / Remove Earplugs */
+ Earplugs_Keybind = 0x3E; /* Key to put in / out the Earplugs (F4) full list: https://community.bistudio.com/wiki/DIK_KeyCodes */
+ Earplugs_AutoEarplugs = "true"; /* Auto insert / remove Earplugs by entering leaving Vehicles */
+ Earplugs_UseInVehicles = "true"; /* Set it to false to disable manual Earplugs in Vehicles */
+ Earplugs_HintsMessages = "true"; /* Show Hint Messages on Auto-Insert / Remove Earplugs */
+ Earplugs_Systemchat = "true"; /* Show Systemchat Messages on Auto-Insert / Remove Earplugs */
// Statusbar
- Statusbar_OnStart = 1; /* Status Bar on Start - 0 = off / 1 = full / 2 = half / 3 = small */
- Statusbar_UseKeybind = "true"; /* Use SwitchKey to switch between different Status Bars */
- Statusbar_Keybind = 0x36; /* Key to switch between the Status Bars (right shift key) full list: https://community.bistudio.com/wiki/DIK_KeyCodes */
+ Statusbar_OnStart = 1; /* Status Bar on Start - 0 = off / 1 = full / 2 = half / 3 = small */
+ Statusbar_UseKeybind = "true"; /* Use SwitchKey to switch between different Status Bars */
+ Statusbar_Keybind = 0x36; /* Key to switch between the Status Bars (right shift key) full list: https://community.bistudio.com/wiki/DIK_KeyCodes */
+
+// DoorOpener
+ OpenableObjets[] = { /* Array with Objects handled by the DoorOpener */
+ "CinderWallGarage_EPOCH"
+ };
+ WorkingVehicleTypes[] = {"LandVehicle"}; /* Array with VehicleTypes inside Players can use the Opener */
+ NeededItems[] = {
+ {1,"CircuitParts","true"}, /* [count,"itemclass",RemoveOnUse] */
+ {250,"Energy","true"} /* [count,"itemclass",RemoveOnUse] */
+ };
+
// Restart
- FirstRestartOnDay = 0; /* On which time the Server will restart the first time (0 = 00:00 / 2 = 02:00 ...). Only full hour restarts are supported */
- Restart_Intervall = 3; /* in hours */
- AutoKickBeforeRestart = 120; /* in seconds */
- AutolockBeforeRestart = 180; /* in seconds */
- Restart_WarningTimes[] = {1,2,5,10}; /* Array of restart-warning (x minutes before Restart) */
- Restart_AutoAdjust = "true"; /* Autmatically adjust Restarttime acc. to Realtime */
- SelfRestart = "false"; /* true = Server will restart himself */
- SelfShutdown = "false"; /* true = Server shut down himself (has no effect, if SelfRestart = "true") */
- /* You can use SelfShutdown, if you use FireDaemon and have configured to Restart the rogramm on Program Exit (under Lifecycle) */
+ FirstRestartOnDay = 0; /* On which time the Server will restart the first time (0 = 00:00 / 2 = 02:00 ...). Only full hour restarts are supported */
+ Restart_Intervall = 3; /* in hours */
+ AutoKickBeforeRestart = 120; /* in seconds */
+ AutolockBeforeRestart = 180; /* in seconds */
+ Restart_WarningTimes[] = {1,2,5,10}; /* Array of restart-warning (x minutes before Restart) */
+ Restart_AutoAdjust = "true"; /* Autmatically adjust Restarttime acc. to Realtime */
+ SelfRestart = "false"; /* true = Server will restart himself */
+ SelfShutdown = "false"; /* true = Server shut down himself (has no effect, if SelfRestart = "true") */
+ /* You can use SelfShutdown, if you use FireDaemon and have configured to Restart the rogramm on Program Exit (under Lifecycle) */
};
\ No newline at end of file
diff --git a/epoch.Mission/addons/Ignatz_Client_DoorOpener.sqf b/epoch.Mission/addons/Ignatz_Client_DoorOpener.sqf
new file mode 100644
index 0000000..ad75d67
--- /dev/null
+++ b/epoch.Mission/addons/Ignatz_Client_DoorOpener.sqf
@@ -0,0 +1,89 @@
+_config = getmissionconfig 'Ignatz_config';
+_OpenableObjets = (getArray (_config >> "OpenableObjets"));
+_WorkingVehicleTypes = (getArray (_config >> "WorkingVehicleTypes"));
+_NeededItems = [];
+{
+ _x params ["_count","_item","_DoRemove"];
+ if ((tolower _DoRemove) isequalto "true") then {_DoRemove = true} else {_DoRemove = false};
+ _NeededItems pushback [_count,_item,_DoRemove];
+} foreach (getArray (_config >> "NeededItems"));
+
+params [["_do",'close']];
+if ((player == vehicle player) || !(player == (driver (vehicle player)))) exitwith {false};
+if !({(vehicle player) iskindof _x} count _WorkingVehicleTypes > 0) exitwith {false};
+_config = 'CfgEpochClient' call EPOCH_returnConfig;
+_buildingJammerRange = getNumber(_config >> "buildingJammerRange");
+_value = 0;
+_lockvalue = 1;
+_nearjammers = nearestobjects [player,["Plotpole_EPOCH"],_buildingJammerRange];
+if (_nearjammers isEqualTo []) exitwith {false};
+_nearestJammer = _nearjammers select 0;
+if !((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) exitwith {false};
+_NearestDoors = [];
+_fnc_CheckDoorsToOpen = {
+ _NearestDoors = (nearestobjects [_nearestJammer,_OpenableObjets,_buildingJammerRange]) select {
+ ([_x, "VIEW",vehicle player] checkVisibility [eyePos player, [(getposasl _x select 0),(getposasl _x select 1),(getposasl _x select 2) + 1.5]]) > 0.5 && (
+ _x animationPhase "open_left" < 0.5 && _x animationPhase "open_right" < 0.5 && _x animationPhase "Door_1_rot" < 0.5 && _x animationPhase "Open_Door" < 0.5)
+ };
+ _NearestDoors
+};
+_fnc_CheckDoorsToClose = {
+ _NearestDoors = (nearestobjects [_nearestJammer,_OpenableObjets,_buildingJammerRange]) select {
+ ([_x, "VIEW",vehicle player] checkVisibility [eyePos player, [(getposasl _x select 0),(getposasl _x select 1),(getposasl _x select 2) + 1.5]]) > 0.5 &&
+ (_x animationPhase "open_left" > 0.5 || _x animationPhase "open_right" > 0.5 || _x animationPhase "Door_1_rot" > 0.5 || _x animationPhase "Open_Door" > 0.5)
+ };
+ _NearestDoors
+};
+switch _do do {
+ case "opencheck";
+ case "open": {
+ _NearestDoors = call _fnc_CheckDoorsToOpen; _value = 1; _lockvalue = 0;
+ };
+ case "closecheck";
+ case "close": {
+ _NearestDoors = call _fnc_CheckDoorsToClose; _value = 0; _lockvalue = 1;
+ };
+};
+if (_do in ["opencheck","closecheck"]) exitwith {!(_NearestDoors isequalto [])};
+if (_NearestDoors isequalto []) exitwith {[format ["No Door found to %1",_do],5] call Epoch_Message;};
+
+_missing = [];
+{
+ _x params ["_count","_item"];
+ _has = 0;
+ if (_item isequalto "Energy") then {
+ _has = Epoch_PlayerEnergy;
+ }
+ else {
+ _has = {_x == _item} count ((magazines player)+(items player));
+ };
+ if (_has < _count) then {
+ _missing pushback [_count-_has,_item];
+ };
+} foreach _NeededItems;
+if !(_missing isequalto []) exitwith {
+ _Msg = 'Missing:';
+ {
+ _Msg = _Msg + format [' %1 %2,', _x select 0, (_x select 1) call EPOCH_itemDisplayName];
+ } foreach _missing;
+ [_Msg,5] call Epoch_Message;
+};
+{
+ _x params ["_count","_item","_remove"];
+ if (_remove) then {
+ if (_item isequalto "Energy") then {
+ ["Energy",-_count] call Epoch_GiveAttributes;
+ }
+ else {
+ [player,_item,_count] call BIS_fnc_invRemove;
+ };
+ };
+} foreach _NeededItems;
+_sorted = [_NearestDoors,[],{player distance _x},'ASCEND'] call BIS_fnc_sortBy;
+_DoorToHandle = _sorted select 0;
+_DoorToHandle animate ['open_left', _value];
+_DoorToHandle animate ['open_right', _value];
+_DoorToHandle animate ['Door_1_rot', _value];
+_DoorToHandle animate ['Open_Door', _value];
+_DoorToHandle animate ['lock_cGarage', _lockvalue];
+_DoorToHandle animate ['lock_Door', _lockvalue];
diff --git a/epoch.Mission/addons/pics/Actions/Gate_Close.paa b/epoch.Mission/addons/pics/Actions/Gate_Close.paa
new file mode 100644
index 0000000..9dbce53
Binary files /dev/null and b/epoch.Mission/addons/pics/Actions/Gate_Close.paa differ
diff --git a/epoch.Mission/addons/pics/Actions/Gate_Open.paa b/epoch.Mission/addons/pics/Actions/Gate_Open.paa
new file mode 100644
index 0000000..a490a93
Binary files /dev/null and b/epoch.Mission/addons/pics/Actions/Gate_Open.paa differ
diff --git a/epoch.Mission/init.sqf b/epoch.Mission/init.sqf
index a395947..763404b 100644
--- a/epoch.Mission/init.sqf
+++ b/epoch.Mission/init.sqf
@@ -3,4 +3,5 @@
if (hasInterface) then {
[] execVM "addons\Ignatz_EarPlugs.sqf";
[] execVM "addons\Ignatz_Statusbar.sqf";
+ Ignatz_Client_DoorOpener = compilefinal preprocessfilelinenumbers "addons\Ignatz_Client_DoorOpener.sqf";
};
\ No newline at end of file