diff --git a/addons/supressHide/$PBOPREFIX$ b/addons/supressHide/$PBOPREFIX$ new file mode 100644 index 0000000..21c93aa --- /dev/null +++ b/addons/supressHide/$PBOPREFIX$ @@ -0,0 +1 @@ +z\afmf\addons\staticspawn \ No newline at end of file diff --git a/addons/supressHide/CfgEventHandlers.hpp b/addons/supressHide/CfgEventHandlers.hpp new file mode 100644 index 0000000..e90bed4 --- /dev/null +++ b/addons/supressHide/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/supressHide/CfgModuleCategories.hpp b/addons/supressHide/CfgModuleCategories.hpp new file mode 100644 index 0000000..84f2529 --- /dev/null +++ b/addons/supressHide/CfgModuleCategories.hpp @@ -0,0 +1 @@ +#include "script_component.hpp" \ No newline at end of file diff --git a/addons/supressHide/XEH_PREP.hpp b/addons/supressHide/XEH_PREP.hpp new file mode 100644 index 0000000..cf3f334 --- /dev/null +++ b/addons/supressHide/XEH_PREP.hpp @@ -0,0 +1,5 @@ +PREP(EH); +PREP(hide); +PREP(init); +PREP(unhide); +PREP(unhideConditionLoop); \ No newline at end of file diff --git a/addons/supressHide/XEH_postInit.sqf b/addons/supressHide/XEH_postInit.sqf new file mode 100644 index 0000000..84f2529 --- /dev/null +++ b/addons/supressHide/XEH_postInit.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" \ No newline at end of file diff --git a/addons/supressHide/XEH_preInit.sqf b/addons/supressHide/XEH_preInit.sqf new file mode 100644 index 0000000..a9b1762 --- /dev/null +++ b/addons/supressHide/XEH_preInit.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" +ADDON = false; +#include "XEH_PREP.hpp" +ADDON = true; diff --git a/addons/supressHide/XEH_preStart.sqf b/addons/supressHide/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/supressHide/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/supressHide/config.cpp b/addons/supressHide/config.cpp new file mode 100644 index 0000000..22b789a --- /dev/null +++ b/addons/supressHide/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + class CfgPatches { + class ADDON { + name = COMPONENT; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {}; + author = "Madin"; + VERSION_CONFIG; + }; + }; + + +#include "CfgEventHandlers.hpp" + +#include "CfgModuleCategories.hpp" \ No newline at end of file diff --git a/addons/supressHide/functions/fn_EH.sqf b/addons/supressHide/functions/fn_EH.sqf new file mode 100644 index 0000000..98438a9 --- /dev/null +++ b/addons/supressHide/functions/fn_EH.sqf @@ -0,0 +1,29 @@ +params [["_unit", objNull], ["_suppressedTime", 30]]; + +// hide when fired at +_unit addEventHandler ["Suppressed", { + params ["_unit", "_distance", "_shooter", "_instigator", "_ammoObject", "_ammoClassName", "_ammoConfig"]; + if !(local _unit) exitWith {}; + if (_unit distance _shooter < 25 + random 25) exitWith {}; + _unit lookAt _shooter; + [_unit] call FUNC(Hide); + + _unit setVariable ["AF_suppressedTime", time + random _suppressedTime]; +}]; + +// hide on reload +_unit addEventHandler ["Fired", { + params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; + if (_unit ammo _muzzle > 0) exitWith {}; + [_unit] call FUNC(Hide); + // [ + // { + // _this ammo currentWeapon _this > 0 + // }, + // { + // _this call FUNC(Unhide); + // }, + // _unit, + // 10 + // ] call CBA_fnc_waitUntilAndExecute; +}]; \ No newline at end of file diff --git a/addons/supressHide/functions/fn_hide.sqf b/addons/supressHide/functions/fn_hide.sqf new file mode 100644 index 0000000..6d8d1b6 --- /dev/null +++ b/addons/supressHide/functions/fn_hide.sqf @@ -0,0 +1,29 @@ +params [["_unit", objNull]]; +private _hidden = _unit getVariable ["AF_unitHidden", false]; +if (_hidden) exitWith {}; + +private _unitPos = unitPos _unit; +if (_unitPos isEqualTo "Down") exitWith {}; + +if (_unitPos isEqualTo "Middle") then { + _unit playActionNow "PlayerProne"; + _unit setUnitPos "Down"; + _unit setVariable ["AF_unitStanceHide", _unitPos]; +} else { + _unit playActionNow "PlayerCrouch"; + _unit setUnitPos "Middle"; + // _unit setUnitPos "Down"; + _unit setVariable ["AF_unitStanceHide", "Up"]; +}; + +_unit setVariable ["AF_unitHidden", true]; + +private _suppressedTime = _unit getVariable ["AF_suppressedTime", 30]; + +[ + { + _this call FUNC(unhideConditionLoop); + }, + _unit, + random _suppressedTime max 2 +] call CBA_fnc_waitAndExecute; \ No newline at end of file diff --git a/addons/supressHide/functions/fn_init.sqf b/addons/supressHide/functions/fn_init.sqf new file mode 100644 index 0000000..d8ea0bd --- /dev/null +++ b/addons/supressHide/functions/fn_init.sqf @@ -0,0 +1,14 @@ +params [["_unit", objNull], ["_suppressedTime", 30]]; +_unit setVariable ["AF_suppressedTime", _suppressedTime]; + +// disable lambs +_unit setVariable ["lambs_danger_disableAI", true]; +if (isFormationLeader _unit) then { + group _unit setVariable ["lambs_danger_disableGroupAI", true]; +}; + +if (unitPos _unit == "Auto") then { + _unit setUnitPos "Up"; +}; + +[_unit, _suppressedTime] call FUNC(EH); \ No newline at end of file diff --git a/addons/supressHide/functions/fn_unhide.sqf b/addons/supressHide/functions/fn_unhide.sqf new file mode 100644 index 0000000..8f41ee7 --- /dev/null +++ b/addons/supressHide/functions/fn_unhide.sqf @@ -0,0 +1,5 @@ +params [["_unit", objNull]]; + +_unit setVariable ["AF_unitHidden", false]; +private _unitPos = _unit getVariable ["AF_unitStanceHide", "Up"]; +_unit setUnitPos _unitPos; \ No newline at end of file diff --git a/addons/supressHide/functions/fn_unhideConditionLoop.sqf b/addons/supressHide/functions/fn_unhideConditionLoop.sqf new file mode 100644 index 0000000..9c72fd6 --- /dev/null +++ b/addons/supressHide/functions/fn_unhideConditionLoop.sqf @@ -0,0 +1,15 @@ +params [["_unit", objNull]]; + +if !(alive _unit) exitWith {}; + +private _suppressedTime = _unit getVariable ["AF_suppressedTime", 30]; +private _currentAmmo = _unit ammo currentWeapon _unit; + +if (time < _suppressedTime || _currentAmmo == 0) exitWith { + [ + {_this call FUNC(unhideConditionLoop)}, + _this, + 0 + ] call CBA_fnc_waitAndExecute; +}; +_unit call AF_fnc_suppressUnhide; \ No newline at end of file diff --git a/addons/supressHide/script_component.hpp b/addons/supressHide/script_component.hpp new file mode 100644 index 0000000..38686d5 --- /dev/null +++ b/addons/supressHide/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT staticspawn +#include "\z\afmf\addons\main\script_mod.hpp" + +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_STATICSPAWN + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_STATICSPAWN + #define DEBUG_SETTINGS DEBUG_SETTINGS_STATICSPAWN +#endif + +#include "\z\afmf\addons\main\script_macros.hpp" diff --git a/addons/supressHide/stringtable.xml b/addons/supressHide/stringtable.xml new file mode 100644 index 0000000..c530f5f --- /dev/null +++ b/addons/supressHide/stringtable.xml @@ -0,0 +1,35 @@ + + + + Distance + Dystans + + + The distance of checking the presence of players + Dystans sprawdzania obecności graczy + + + Despawn distance + Dystans despawnu + + + The distance of checking the presence of players above which units will be removed. Added to spawn value. + Dystans sprawdzania obecności graczy powyżej którego jednostki zostaną usunięte. Dodane do wartości spawnu. + + + Visibility check + Sprawdzanie widoczności + + + Unactive + Nieaktywne + + + Offset checking + Przsunięcie sprawdzania + + + How far back will players be checked. + Jak daleko do tyłu będzie sprawdzane obecność graczy. + +