From 5901134547e5d510db92816b1765b20d8dcebb7d Mon Sep 17 00:00:00 2001 From: Julian | DiGii <45559529+AtrixZockt@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:37:43 +0100 Subject: [PATCH] Chemical - Fix chemical zeus module (#551) I hate this bs... **When merged this pull request will:** - _Describe what this pull request will do_ - _Each change in a separate line_ ### IMPORTANT - [Development Guidelines](https://ace3.acemod.org/wiki/development/) are read, understood and applied. - Title of this PR uses our standard template `Component - Add|Fix|Improve|Change|Make|Remove {changes}`. --------- Co-authored-by: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> --- .../ACE_Medical_Treatment_Actions.hpp | 2 +- addons/chemical/CfgAmmo.hpp | 18 +-- addons/chemical/CfgCloudlets.hpp | 12 +- addons/chemical/CfgUIGrids.hpp | 30 ---- addons/chemical/CfgVehicles.hpp | 5 +- addons/chemical/XEH_PREP.hpp | 5 +- addons/chemical/XEH_postInit.sqf | 9 +- addons/chemical/config.cpp | 1 - .../functions/fnc_AttributeRadius.sqf | 8 +- .../chemical/functions/fnc_CASCreateGas.sqf | 3 +- .../chemical/functions/fnc_GasTripEffect.sqf | 1 + .../chemical/functions/fnc_addLoadAction.sqf | 33 ---- addons/chemical/functions/fnc_afterWait.sqf | 36 ++--- .../chemical/functions/fnc_canPutGasMask.sqf | 4 +- .../fnc_clearChemicalInjuriesLocal.sqf | 30 ---- .../functions/fnc_createSealAction.sqf | 19 +-- addons/chemical/functions/fnc_createZone.sqf | 25 +-- addons/chemical/functions/fnc_csGrenade.sqf | 90 +++++++++++ .../functions/fnc_csGrenadeThrownFuze.sqf | 24 --- addons/chemical/functions/fnc_gasAI.sqf | 17 +- addons/chemical/functions/fnc_gasCheck.sqf | 92 ++++++----- .../chemical/functions/fnc_gasCheckLocal.sqf | 147 +++++++----------- addons/chemical/functions/fnc_gasmodule.sqf | 10 +- .../functions/fnc_giveUnitGasMask.sqf | 9 +- addons/chemical/functions/fnc_handleCSGas.sqf | 27 ++-- addons/chemical/functions/fnc_handleFired.sqf | 13 +- .../functions/fnc_handleGasMaskDur.sqf | 26 ++-- .../chemical/functions/fnc_hasGasMaskON.sqf | 2 +- addons/chemical/functions/fnc_hasGasmask.sqf | 15 +- .../chemical/functions/fnc_spawnGasSmoke.sqf | 61 -------- addons/chemical/functions/fnc_spawnSmoke.sqf | 4 +- .../chemical/functions/fnc_throwGrenade.sqf | 24 +-- .../fnc_treatmentAdvanced_AtropineLocal.sqf | 6 +- .../chemical/functions/fnc_ui_gasModule.sqf | 72 ++++----- addons/chemical/script_component.hpp | 9 ++ 35 files changed, 372 insertions(+), 517 deletions(-) delete mode 100644 addons/chemical/CfgUIGrids.hpp delete mode 100644 addons/chemical/functions/fnc_addLoadAction.sqf delete mode 100644 addons/chemical/functions/fnc_clearChemicalInjuriesLocal.sqf create mode 100644 addons/chemical/functions/fnc_csGrenade.sqf delete mode 100644 addons/chemical/functions/fnc_csGrenadeThrownFuze.sqf delete mode 100644 addons/chemical/functions/fnc_spawnGasSmoke.sqf diff --git a/addons/chemical/ACE_Medical_Treatment_Actions.hpp b/addons/chemical/ACE_Medical_Treatment_Actions.hpp index 22a88188a..d3b32aca0 100644 --- a/addons/chemical/ACE_Medical_Treatment_Actions.hpp +++ b/addons/chemical/ACE_Medical_Treatment_Actions.hpp @@ -1,6 +1,6 @@ class ACE_Medical_Treatment_Actions { class Diagnose; - class putonGasMask: Diagnose { + class PutOnGasMask: Diagnose { displayName = CSTRING(giveGasMask_action); displayNameProgress = CSTRING(giveGasMask_progress); allowedSelections[] = {"Head"}; diff --git a/addons/chemical/CfgAmmo.hpp b/addons/chemical/CfgAmmo.hpp index 686c57f87..3d40ed641 100644 --- a/addons/chemical/CfgAmmo.hpp +++ b/addons/chemical/CfgAmmo.hpp @@ -1,12 +1,12 @@ -class cfgAmmo +class CfgAmmo { class SmokeShellArty; class KAT_SmokeShellArty: SmokeShellArty{ smokeColor[] = {0,0,0,0}; }; - + class Smoke_82mm_AMOS_White; - class Sh_82mm_AMOS_Type0: Smoke_82mm_AMOS_White + class Sh_82mm_AMOS_Type0: Smoke_82mm_AMOS_White { KAT_projectile = 1; KAT_lifetime = 90; @@ -30,7 +30,7 @@ class cfgAmmo }; class SmokeShell; - class KAT_G_M7A3: SmokeShell + class KAT_G_M7A3: SmokeShell { KAT_csGas = 1; model = QPATHTOF(ui\m7a3_throw.p3d); @@ -58,7 +58,7 @@ class cfgAmmo indirectHit = 0; indirectHitRange = 0; soundHit[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - explosionEffects = "KAT_GASTripEffect"; + explosionEffects = "KAT_GASTripEffect"; CraterEffects = ""; soundTrigger[] = {"",1,1}; class CamShakeExplode { @@ -90,7 +90,7 @@ class cfgAmmo explosionTime = 2; explosionForceCoef = 5; explosive = 0.95; - ExplosionEffects = "BombExplosion"; + ExplosionEffects = "BombExplosion"; flightProfiles[] = {"LoalAltitude"}; hit = 0; indirectHit = 0; @@ -116,14 +116,14 @@ class cfgAmmo distance = 250; }; - + }; class Mo_cluster_Bomb_01_F; class KAT_CAS_M43_Ammo_sub: Mo_cluster_Bomb_01_F { hit = 0; indirectHit = 0; indirectHitRange = 0; - explosionEffects = "KAT_GAS_ClusterExplosion"; + explosionEffects = "KAT_GAS_ClusterExplosion"; }; class R_80mm_HE; @@ -133,4 +133,4 @@ class cfgAmmo indirectHitRange = 0; explosionEffects = "KAT_CAS_R_HYDRA_Explosion"; //HERocketExplosion }; -}; \ No newline at end of file +}; diff --git a/addons/chemical/CfgCloudlets.hpp b/addons/chemical/CfgCloudlets.hpp index fe708a5f9..b7ad16364 100644 --- a/addons/chemical/CfgCloudlets.hpp +++ b/addons/chemical/CfgCloudlets.hpp @@ -2,16 +2,14 @@ class CfgCloudlets { class Default; class ACE_GasTrip: Default { lifeTime = 0; - beforeDestroyScript = QPATHTOF(functions\fnc_GasTripEffect.sqf); + beforeDestroyScript = QPATHTOF(functions\fnc_GasTripEffect.sqf); }; - - class CAS_GAS_Explosion_FX_Script: Default { lifeTime = 0; - beforeDestroyScript = QPATHTOF(functions\fnc_CASCreateGas.sqf); + beforeDestroyScript = QPATHTOF(functions\fnc_CASCreateGas.sqf); }; - + class CAS_GAS_Explosion_FX: Default { interval = 0.03; circleRadius = 0; @@ -113,8 +111,8 @@ class CfgCloudlets { angle = 0; position[] = {0,0.2,0}; }; -}; - +}; + class KAT_GASTripEffect { class spawnGAS { simulation = "particles"; diff --git a/addons/chemical/CfgUIGrids.hpp b/addons/chemical/CfgUIGrids.hpp deleted file mode 100644 index b18344eaf..000000000 --- a/addons/chemical/CfgUIGrids.hpp +++ /dev/null @@ -1,30 +0,0 @@ -class CfgUIGrids { - class IGUI { - class Presets { - class Arma3 { - class Variables { - ace_medical_gui_patientInfo[] = { - { - QUOTE(PATIENT_INFO_IGUI_BASE_X), - QUOTE(PATIENT_INFO_IGUI_BASE_Y), - QUOTE(POS_W(9)), - QUOTE(POS_H(20)) - }, - QUOTE(GUI_GRID_W), - QUOTE(GUI_GRID_H) - }; - }; - }; - }; - - class Variables { - class ace_medical_gui_patientInfo { - displayName = ACECSTRING(medical,Category); - description = ACECSTRING(medical_gui,IGUI_PatientInfo); - preview = "\z\ace\addons\medical_gui\ui\patient_info_preview_ca"; - saveToProfile[] = {0, 1}; - canResize = 0; - }; - }; - }; -}; diff --git a/addons/chemical/CfgVehicles.hpp b/addons/chemical/CfgVehicles.hpp index 5a2380fa8..7773ee2f3 100644 --- a/addons/chemical/CfgVehicles.hpp +++ b/addons/chemical/CfgVehicles.hpp @@ -117,11 +117,11 @@ class CfgVehicles { class GAS_Type { displayName = CSTRING(UI_gasType); - typeName = "STRING"; + typeName = "NUMBER"; class values { class toxicgas { name = CSTRING(LvL1_Gas); - value = "Toxic"; + value = 0; default = 1; }; /* class csgas { @@ -210,7 +210,6 @@ class CfgVehicles { }; class APERSTripMine; - class KAT_Gas_TripWireMine: APERSTripMine { author = "DiGii"; ammo = "KAT_Gas_TripWireMine_Ammo"; diff --git a/addons/chemical/XEH_PREP.hpp b/addons/chemical/XEH_PREP.hpp index 1fc5d8034..7052ebf94 100644 --- a/addons/chemical/XEH_PREP.hpp +++ b/addons/chemical/XEH_PREP.hpp @@ -1,4 +1,3 @@ -PREP(addLoadAction); PREP(afterWait); PREP(AttributeRadius); PREP(breathing); @@ -8,11 +7,10 @@ PREP(CASCreateGas); PREP(changeGasMaskFilter); PREP(checkGasMaskDur); PREP(chemDetector); -PREP(clearChemicalInjuriesLocal); PREP(coughing); PREP(createSealAction); PREP(createZone); -PREP(csGrenadeThrownFuze); +PREP(csGrenade); PREP(displayGasMaskDur); PREP(fullHealLocal); PREP(gasAI); @@ -33,7 +31,6 @@ PREP(hasGasmask); PREP(hasGasMaskON); PREP(init); PREP(initModule); -PREP(spawnGasSmoke); PREP(spawnSmoke); PREP(throwGrenade); PREP(treatmentAdvanced_AtropineLocal); diff --git a/addons/chemical/XEH_postInit.sqf b/addons/chemical/XEH_postInit.sqf index 3d99f40c5..4d65f1f2c 100644 --- a/addons/chemical/XEH_postInit.sqf +++ b/addons/chemical/XEH_postInit.sqf @@ -2,10 +2,12 @@ //Events [QGVAR(gasCheck), LINKFUNC(gasCheck)] call CBA_fnc_addEventHandler; -[QGVAR(gasCheck_local), LINKFUNC(gasCheckLocal)] call CBA_fnc_addEventHandler; -[QGVAR(gasCheck_ai), LINKFUNC(gasAI)] call CBA_fnc_addEventHandler; +[QGVAR(gasPlayer), LINKFUNC(gasCheckLocal)] call CBA_fnc_addEventHandler; +[QGVAR(gasAI), LINKFUNC(gasAI)] call CBA_fnc_addEventHandler; [QGVAR(afterWait), LINKFUNC(afterWait)] call CBA_fnc_addEventHandler; -[QGVAR(enteredPoisonEvent), LINKFUNC(chemDetector)] call CBA_fnc_addEventHandler; +[QGVAR(enteredZone), LINKFUNC(chemDetector)] call CBA_fnc_addEventHandler; +[QGVAR(createZoneGlobal), LINKFUNC(createZone)] call CBA_fnc_addEventHandler; +[QGVAR(createSealActionGlobal), LINKFUNC(createSealAction)] call CBA_fnc_addEventHandler; // ACE Events [QACEGVAR(medical_gui,updateInjuryListGeneral), LINKFUNC(gui_updateInjuryListGeneral)] call CBA_fnc_addEventHandler; @@ -19,7 +21,6 @@ //Mortar Events ["Mortar_01_base_F", "fired", {call FUNC(handleFired)}] call CBA_fnc_addClassEventHandler; KAT_ProjectileCache = ("([_x, 'KAT_projectile', 0] call BIS_fnc_returnConfigEntry) != 0" configClasses (configFile >> "cfgAmmo")) apply {configName _x}; -[] call FUNC(addLoadAction); //Grenade Events ["ace_firedPlayer", LINKFUNC(throwGrenade)] call CBA_fnc_addEventHandler; diff --git a/addons/chemical/config.cpp b/addons/chemical/config.cpp index 4311f404f..24987709c 100644 --- a/addons/chemical/config.cpp +++ b/addons/chemical/config.cpp @@ -56,7 +56,6 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgCloudlets.hpp" #include "CfgMagazines.hpp" -#include "CfgUIGrids.hpp" #include "CfgWeapons.hpp" #include "CfgVehicles.hpp" #include "CfgSounds.hpp" diff --git a/addons/chemical/functions/fnc_AttributeRadius.sqf b/addons/chemical/functions/fnc_AttributeRadius.sqf index 86b8d1505..b7d2f8f3e 100644 --- a/addons/chemical/functions/fnc_AttributeRadius.sqf +++ b/addons/chemical/functions/fnc_AttributeRadius.sqf @@ -17,14 +17,14 @@ params ["_control"]; private _display = ctrlParent _control; -private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull]; +private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target",objNull]; _control ctrlRemoveAllEventHandlers "SetFocus"; private _sealCheckBox = _display displayCtrl 1613; private _sealText = _display displayCtrl 1614; private _placeText = _display displayCtrl 1616; // Specific onLoad stuff -if!(isNull attachedTo _logic) then { +if !(isNull attachedTo _logic) then { _sealCheckBox ctrlShow true; _sealText ctrlShow true; @@ -76,14 +76,14 @@ private _fnc_onKeyUp = { }; private _fnc_onCheckChange = { - params["_sealCheckBox"]; + params ["_sealCheckBox"]; _display = ctrlParent _sealCheckBox; private _canBeSealed = cbChecked(_display displayCtrl 1613); _display setVariable [QGVAR(ui_sealable),_canBeSealed]; }; private _fnc_onLBSelChange = { - params["_gasTypeCombo"]; + params ["_gasTypeCombo"]; _display = ctrlParent _gasTypeCombo; private _gastype = lbCurSel _gasTypeCombo; _display setVariable [QGVAR(ui_gastype),_gastype]; diff --git a/addons/chemical/functions/fnc_CASCreateGas.sqf b/addons/chemical/functions/fnc_CASCreateGas.sqf index 5e447d236..e9ac1fca8 100644 --- a/addons/chemical/functions/fnc_CASCreateGas.sqf +++ b/addons/chemical/functions/fnc_CASCreateGas.sqf @@ -17,4 +17,5 @@ */ params ["_posX", "_posY", "_posZ"]; -[[_posX, _posY, _posZ], 240, 15, 0] call FUNC(createZone); + +[QGVAR(createZoneGlobal), [[_posX, _posY, _posZ], 240, 15, 0]] call CBA_fnc_globalEventJIP; diff --git a/addons/chemical/functions/fnc_GasTripEffect.sqf b/addons/chemical/functions/fnc_GasTripEffect.sqf index 8ad1f4f3c..0a3a4ea80 100644 --- a/addons/chemical/functions/fnc_GasTripEffect.sqf +++ b/addons/chemical/functions/fnc_GasTripEffect.sqf @@ -16,4 +16,5 @@ * Creates effects when Trip wire explodes. * Cant be called manualy! */ + [FUNC(spawnSmoke), _this] call CBA_fnc_directcall; diff --git a/addons/chemical/functions/fnc_addLoadAction.sqf b/addons/chemical/functions/fnc_addLoadAction.sqf deleted file mode 100644 index f81b4e0b4..000000000 --- a/addons/chemical/functions/fnc_addLoadAction.sqf +++ /dev/null @@ -1,33 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: DiGii - * - * Arguments: - * NONE - * - * Return Value: - * NONE - * - * Example: - * [] call kat_chemical_fnc_addLoadAction; - * - * Public: No - * - * This adds the function to Load gas mortar rounds into a mortar using the CSW function from ace -*/ -private _condition = { //IGNORE_PRIVATE_WARNING ["_target", "_player"]; - // If magazine handling is enabled or weapon assembly/disassembly is enabled we enable ammo handling - if ((ACEGVAR(csw,ammoHandling) == 0) && {!([false, true, true, ACEGVAR(csw,defaultAssemblyMode)] select (_target getVariable [QACEGVAR(csw,assemblyMode), 3]))}) exitWith { false }; - [_player, _target, ["isNotSwimming", "isNotSitting"]] call ACEFUNC(common,canInteractWith); -}; - -private _childenCode = { - private _return = (call ACEFUNC(csw,reload_actionsLoad)) + (call ACEFUNC(csw,reload_actionUnload)); - _return -}; - -private _magazineLocation = getText (configFile >> "CfgVehicles" >> "Mortar_01_base_F" >> "ace_csw" >> "magazineLocation"); -private _positionCode = compile _magazineLocation; -private _ammoAction = ["ace_csw_magazine",ACELSTRING(CSW,ammoHandling_displayName), "", {}, _condition, _childenCode, [], _positionCode, 4] call ACEFUNC(interact_menu,createAction); -private _ammoActionPath = ["Mortar_01_base_F", 0, [], _ammoAction] call ACEFUNC(interact_menu,addActionToClass); - diff --git a/addons/chemical/functions/fnc_afterWait.sqf b/addons/chemical/functions/fnc_afterWait.sqf index 12304f36f..f807a46f7 100644 --- a/addons/chemical/functions/fnc_afterWait.sqf +++ b/addons/chemical/functions/fnc_afterWait.sqf @@ -14,7 +14,7 @@ * NONE * * Example: -* [player, logic, "Toxic", 50] call kat_chemical_fnc_afterWait; +* [player, logic, 0, 50] call kat_chemical_fnc_afterWait; * * Public: No */ @@ -22,37 +22,37 @@ params ["_unit", "_logic", "_gastype", "_radius_max"]; if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(clearChemicalInjuriesLocal); + [_unit] call FUNC(fullHealLocal); }; if ((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then { private _isinGas = true; [ { - params["_args", "_pfhHandler"]; + params ["_args", "_pfhHandler"]; _args params["_unit", "_logic", "_gastype", "_radius_max", "_isinGas"]; if !(_isinGas) exitwith { [_pfhHandler] call CBA_fnc_removePerFrameHandler; }; - private _timeleft = _unit getVariable[QGVAR(gasmask_durability), 10]; - _pos = _logic getVariable [QGVAR(gas_pos), [0, 0, 0]]; + private _timeleft = _unit getVariable [QGVAR(gasmask_durability), 10]; + _pos = _logic getVariable [QGVAR(gas_position), [0, 0, 0]]; if (_unit distance _pos > _radius_max || !(_logic getVariable[QGVAR(gas_active), false]) || isNull _logic) exitwith { - _unit setVariable[QGVAR(enteredPoison), false, true]; + _unit setVariable [QGVAR(enteredPoison), false, true]; _isinGas = false; }; if !((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []]) && _timeleft > 0) then { _unit setVariable [QGVAR(poisonType), _gastype, true]; switch (_gastype) do { - case "Toxic": { - _unit setVariable [QGVAR(airPoisoning), true, true]; - }; - case "CS": { + case 1: { _unit setVariable [QGVAR(CS), true, true]; [_unit, _logic, _radius_max] call FUNC(handleCSGas); }; + case 0: { + _unit setVariable [QGVAR(airPoisoning), true, true]; + }; }; [_unit] call EFUNC(breathing,handleBreathing); _isinGas = false; @@ -61,13 +61,13 @@ if ((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), [ if (_timeleft <= 0 && _unit getVariable [QGVAR(enteredPoison), false]) then { _unit setVariable [QGVAR(poisonType), _gastype, true]; switch (_gastype) do { - case "Toxic": { - _unit setVariable [QGVAR(airPoisoning), true, true]; - }; - case "CS": { + case 1: { _unit setVariable [QGVAR(CS), true, true]; [_unit, _logic, _radius_max] call FUNC(handleCSGas); }; + case 0: { + _unit setVariable [QGVAR(airPoisoning), true, true]; + }; }; [_unit] call EFUNC(breathing,handleBreathing); _isinGas = false; @@ -85,13 +85,13 @@ if ((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), [ if (_unit getVariable [QGVAR(enteredPoison), false]) then { _unit setVariable [QGVAR(poisonType), _gastype, true]; switch (_gastype) do { - case "Toxic": { - _unit setVariable [QGVAR(airPoisoning), true, true]; - }; - case "CS": { + case 1: { _unit setVariable [QGVAR(CS), true, true]; [_unit, _logic, _radius_max] call FUNC(handleCSGas); }; + case 0: { + _unit setVariable [QGVAR(airPoisoning), true, true]; + }; }; [_unit] call EFUNC(breathing,handleBreathing); }; diff --git a/addons/chemical/functions/fnc_canPutGasMask.sqf b/addons/chemical/functions/fnc_canPutGasMask.sqf index fb9ae2937..d89a4e1b7 100644 --- a/addons/chemical/functions/fnc_canPutGasMask.sqf +++ b/addons/chemical/functions/fnc_canPutGasMask.sqf @@ -17,6 +17,6 @@ params ["_medic", "_patient"]; -if(missionNamespace getVariable [QGVAR(availGasmaskList), []] isEqualTo []) exitWith {false}; +if (missionNamespace getVariable [QGVAR(availGasmaskList), []] isEqualTo []) exitWith {false}; -!(_patient call ACE_common_fnc_isAwake) && ([_medic,_patient] call FUNC(hasGasmask)) && !((goggles _patient) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) +!(_patient call ACE_common_fnc_isAwake) && ([_medic, _patient] call FUNC(hasGasmask)) && !((goggles _patient) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) diff --git a/addons/chemical/functions/fnc_clearChemicalInjuriesLocal.sqf b/addons/chemical/functions/fnc_clearChemicalInjuriesLocal.sqf deleted file mode 100644 index 8083c27d0..000000000 --- a/addons/chemical/functions/fnc_clearChemicalInjuriesLocal.sqf +++ /dev/null @@ -1,30 +0,0 @@ -#include "..\script_component.hpp" -/* -* Author: YetheSamartaka -* Clears Chemical injuries for target unit -* -* Arguments: -* 0: Target -* -* Return Value: -* NONE -* -* Example: -* [_unit] call kat_chemical_fnc_clearChemicalInjuriesLocal; -* -* Public: Yes -*/ - -params ["_unit"]; - -if (!local _unit) exitWith {}; - -_unit setVariable [QEGVAR(chemical,enteredPoison), false, true]; -_unit setVariable [QEGVAR(chemical,airPoisoning), false, true]; -_unit setVariable [QEGVAR(chemical,isTreated), true, true]; -_unit setVariable [QEGVAR(chemical,CS), false, true]; -_unit setVariable [QEGVAR(chemical,timeleft), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60], true]; - -if (_unit getVariable [QEGVAR(chemical,painEffect), 0] != 0) then { - KAT_PAIN_EFFECT ppEffectEnable false; -}; diff --git a/addons/chemical/functions/fnc_createSealAction.sqf b/addons/chemical/functions/fnc_createSealAction.sqf index d45095333..f7df5adb5 100644 --- a/addons/chemical/functions/fnc_createSealAction.sqf +++ b/addons/chemical/functions/fnc_createSealAction.sqf @@ -13,26 +13,27 @@ * * Public: No */ -params["_target"]; +params ["_target", "_logic"]; private _action = [ - "kat_gas_interaction", + QGVAR(sealLeak), LLSTRING(sealLeak), "", { - params["_target", "_player"]; + params ["_target", "_player", "_params"]; + _params params ["_logic"]; [_player, "Acts_carFixingWheel"] call ACEFUNC(common,doAnimation); //add time to addon options [ 20, - [_target,_player], + [_target,_player, _logic], { params["_args"]; - _args params ["_target","_player"]; - _target setVariable [QGVAR(gas_active), false, true]; - [_target, 0, ["ACE_MainActions", "kat_gas_interaction"]] call ACEFUNC(interact_menu,removeActionFromObject); + _args params ["_target","_player", "_logic"]; + _logic setVariable [QGVAR(gas_active), false, true]; + [_target, 0, ["ACE_MainActions", QGVAR(sealLeak)]] call ACEFUNC(interact_menu,removeActionFromObject); [_player, "kat_sealant"] call ACEFUNC(common,useItem); }, { @@ -41,7 +42,7 @@ private _action = [ [_player, "",1] call ACEFUNC(common,doAnimation); }, LLSTRING(GasModule_SealLeak), - {[_player,_player,["kat_sealant"]] call ACEFUNC(medical_treatment,hasItem);},//conditions + {[_player, _player, ["kat_sealant"]] call ACEFUNC(medical_treatment,hasItem);},//conditions ["isNotInside"] ] call ace_common_fnc_progressBar; }, @@ -52,7 +53,7 @@ private _action = [ [_player, _player, ["kat_sealant"]] call ACEFUNC(medical_treatment,hasItem); }, {}, - [] + [_logic] ] call ACEFUNC(interact_menu,createAction); [_target, 0, ["ACE_MainActions"], _action] call ACEFUNC(interact_menu,addActionToObject); diff --git a/addons/chemical/functions/fnc_createZone.sqf b/addons/chemical/functions/fnc_createZone.sqf index 55451a392..bb62c4bbd 100644 --- a/addons/chemical/functions/fnc_createZone.sqf +++ b/addons/chemical/functions/fnc_createZone.sqf @@ -17,33 +17,20 @@ * Public: No * */ -params ["_pos", "_lifetime", "_radius", "_gasLvL"]; +params ["_position", "_lifetime", "_radius", "_gasType"]; -private _logic = "ACE_LogicDummy" createVehicle _pos; +private _logic = "ACE_LogicDummy" createVehicle _position; -private _gastype = ""; -switch (_gasLvL) do { - case 1: { //CS - _gastype = "CS"; - }; - default { //toxic gas (standard) - _gastype = "Toxic"; - }; -}; - -if (_gastype isEqualTo "CS") then {[getPosASL _logic, _radius, _lifetime] call FUNC(spawnGasSmoke);}; - -[_logic, _pos, _radius, 0, _gastype] call FUNC(gasCheck); +[_logic, _position, _radius, 0, _gasType] call FUNC(gasCheck); private _currentTime = CBA_missionTime; [{ - //condition - params["_logic","_lifetime","_currentTime"]; + params ["_logic","_lifetime","_currentTime"]; + (CBA_missionTime - (_currentTime)) > _lifetime }, { - //code - params["_logic"]; + params ["_logic"]; _logic setVariable [QGVAR(gas_active), false, true]; deleteVehicle _logic; }, [_logic, _lifetime, _currentTime]] call CBA_fnc_waitUntilAndExecute; diff --git a/addons/chemical/functions/fnc_csGrenade.sqf b/addons/chemical/functions/fnc_csGrenade.sqf new file mode 100644 index 000000000..88478a636 --- /dev/null +++ b/addons/chemical/functions/fnc_csGrenade.sqf @@ -0,0 +1,90 @@ +#include "..\script_component.hpp" +/* + * Author: DiGii + * Spawns Patricles for the Gas zone + * + * Arguments: + * 0: Postiton + * 1: Radius + * 2: Lifetime + * + * Return Value: + * NONE + * + * Example: + * [getPosASL player, 25, 60] call kat_chemical_fnc_spawnGasSmoke; + * + * Public: No +*/ + +#define ALERT_NEAR_ENEMY_RANGE 60 + +#define PARTICLE_LIFE_TIME 2 +#define PARTICLE_DENSITY 20 +#define PARTICLE_SIZE 1 +#define PARTICLE_SPEED 1 + +#define PARTICLE_SMOKE_LIFE_TIME 5 +#define PARTICLE_SMOKE_DENSITY 5 +#define PARTICLE_SMOKE_SIZE 0.5 +#define PARTICLE_SMOKE_SPEED 1 +#define PARTICLE_SMOKE_LIFTING 1 +#define PARTICLE_SMOKE_WIND_EFFECT 1 + +#define EXPANSION 1 + +#define EFFECT_SIZE 1 + +params ["_projectile", "_timeToLive", "_center"]; + +private _position = position _projectile; + +[QGVAR(createZoneGlobal), [_position, _timeToLive, 6, 1]] call CBA_fnc_globalEventJIP; + +// --- AI +private _nearLocalEnemies = []; + +{ + { + if (local _x && {[_center, side _x] call BIS_fnc_sideIsEnemy}) then { // WE WANT THE OBJECTS SIDE HERE! + _nearLocalEnemies pushBackUnique _x; + }; + } forEach crew _x; +} forEach (_position nearObjects ALERT_NEAR_ENEMY_RANGE); + +{ + if (behaviour _x in ["SAFE", "AWARE"]) then { + _x setBehaviour "COMBAT"; + }; +} forEach _nearLocalEnemies; + + +private _particleSource = "#particlesource" createVehicleLocal _position; + +//Particle options +_particleSource setParticleParams [ + ["\A3\data_f\cl_basic",1,0,1], // File,Ntieth,Index,Count,Loop + "", //Animation name + "Billboard", //Type + 1, //Timer Period (We do this to spread the updates out and reduce overhead) + PARTICLE_SMOKE_LIFE_TIME, //Lifetime + [0,0,0], + [0, 0, PARTICLE_SMOKE_SPEED], //Move velocity + 5 + random 10, //Rotation velocity + 0.05, //Weight + 0.04 * PARTICLE_SMOKE_LIFTING, //Volume + 0.05 * PARTICLE_SMOKE_WIND_EFFECT, //Rubbing + [1 * PARTICLE_SMOKE_SIZE + 1, 1.8 * PARTICLE_SMOKE_SIZE + 15], //Size + [[0.9294,0.9843,1] + [0.001], [0.9294,0.9843,1] + [0.1], [1,1,1,0]], //Color + [0,0], //Animation speed + 0.1, //Random direction period + 0.08 * EXPANSION, //Random direction intensity + "", + "", //Before destroy script + _projectile //This +]; + +_particleSource setParticleRandom [PARTICLE_SMOKE_LIFE_TIME / 2, [0.5 * EFFECT_SIZE, 0.5 * EFFECT_SIZE, 0.2 * EFFECT_SIZE], [0.3,0.3,0.5], 1, 0, [0,0,0,0.06], 0, 0]; +_particleSource setDropInterval (1 / PARTICLE_SMOKE_DENSITY); + +[{deleteVehicle _this}, _particleSource, _timeToLive] call CBA_fnc_waitAndExecute; diff --git a/addons/chemical/functions/fnc_csGrenadeThrownFuze.sqf b/addons/chemical/functions/fnc_csGrenadeThrownFuze.sqf deleted file mode 100644 index 2ab8b9e90..000000000 --- a/addons/chemical/functions/fnc_csGrenadeThrownFuze.sqf +++ /dev/null @@ -1,24 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: DiGii - * - * Arguments: - * 0: Projectile - * - * Return Value: - * NONE - * - * Example: - * [projectile] call kat_chemical_fnc_csGrenadeThrownFuze; - * - * Public: No -*/ -params ["_projectile"]; - -if (alive _projectile) then { - playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 1, 1.2, 400]; - - private _lifetime = 60 + random[-5,0,9]; - - [getPosASL _projectile,_lifetime,6,1] call FUNC(createZone); -}; diff --git a/addons/chemical/functions/fnc_gasAI.sqf b/addons/chemical/functions/fnc_gasAI.sqf index 9e6a9e8a5..518ab574b 100644 --- a/addons/chemical/functions/fnc_gasAI.sqf +++ b/addons/chemical/functions/fnc_gasAI.sqf @@ -15,7 +15,7 @@ * NONE * * Example: - * [player, logic, getPos player, 50, "Toxic"] call kat_chemical_fnc_gasAI; + * [player, logic, getPos player, 50, 0] call kat_chemical_fnc_gasAI; * * Public: No */ @@ -23,14 +23,14 @@ params ["_unit", "_logic", "_pos", "_radius_max", "_gastype"]; if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(clearChemicalInjuriesLocal); + [_unit] call FUNC(fullHealLocal); }; [ { params["_args","_handler"]; _args params ["_logic","_unit"]; - if(!(_logic getVariable [QGVAR(gas_active),false]) || !(alive _unit) || isNull _unit) then { + if (!(_logic getVariable [QGVAR(gas_active),false]) || !(alive _unit) || isNull _unit) then { _unit setVariable [QGVAR(enteredPoison), false, true]; [_handler] call CBA_fnc_removePerFrameHandler; }; @@ -44,7 +44,7 @@ if (!isDamageAllowed _unit) exitWith { params["_args","_handler"]; _args params ["_unit", "_logic", "_pos", "_radius_max", "_gastype"]; - if(!(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic || !(alive _unit) || _unit getVariable ["ACE_isUnconscious", false]) exitWith { + if (!(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic || !(alive _unit) || _unit getVariable ["ACE_isUnconscious", false]) exitWith { [_handler] call CBA_fnc_removePerFrameHandler; }; @@ -53,9 +53,10 @@ if (!isDamageAllowed _unit) exitWith { private _skill = _unit skill "aimingAccuracy"; private _fnc_afterwait = { params ["_unit", "_gastype", "_pos", "_skill"]; + if !((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) exitwith { - if (_gastype isEqualTo "CS") then { - if {_unit distance _pos < 10 && _unit getVariable [QGVAR(enteredPoison), false]} do { + if (_gastype isEqualTo 1) then { + if (_unit distance _pos < 10 && _unit getVariable [QGVAR(enteredPoison), false]) then { _unit say3D QGVAR(cough_1); _unit setskill ["aimingAccuracy", 0.001]; [ @@ -95,11 +96,11 @@ if (!isDamageAllowed _unit) exitWith { [_unit, _gastype, _pos, _skill] call _fnc_afterwait; _i = 2; }; - if (_gastype isEqualto "CS") exitwith { + if (_gastype isEqualTo 1) exitwith { [_unit, _gastype, _pos, _skill] call _fnc_afterwait; _i = 2; }; - _pos = _logic getVariable [QGVAR(gas_pos), [0, 0, 0]]; + _pos = _logic getVariable [QGVAR(gas_position), [0, 0, 0]]; if (_unit distance _pos > _radius_max || !(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic) exitwith { _unit setVariable [QGVAR(enteredPoison), false, true]; _i = 2; diff --git a/addons/chemical/functions/fnc_gasCheck.sqf b/addons/chemical/functions/fnc_gasCheck.sqf index 76b9b224c..d011430c2 100644 --- a/addons/chemical/functions/fnc_gasCheck.sqf +++ b/addons/chemical/functions/fnc_gasCheck.sqf @@ -1,8 +1,7 @@ #include "..\script_component.hpp" /* * Author: DiGii - * This cant be called manualy! - * + * This cannot be called manually! * * Arguments: * 0: Module @@ -18,70 +17,79 @@ * [logic, getpos player, 50, 20, 1] call kat_chemical_fnc_gasCheck; * * Public: No -*/ + */ + +params ["_logic", "_position", "_radius_max", "_radius_min", "_gasType"]; -params ["_logic","_pos","_radius_max","_radius_min","_gastype"]; +// Set default values if needed +_radius_min = if (_radius_min isEqualTo 0) then {_radius_max / 2} else {_radius_min}; -if (_gastype isEqualTo "") then {_gastype = "Toxic"}; -if (_radius_min isEqualTo 0) then {_radius_min = _radius_max / 2}; _logic setVariable [QGVAR(gas_active), true, true]; _logic setVariable [QGVAR(gas_playerArr), [], true]; -_logic setVariable [QGVAR(gas_pos), _pos, true]; +_logic setVariable [QGVAR(gas_position), _position, true]; - -private _checkplayers = [{ +// Function to check players within the gas zone +private _checkPlayers = { params ["_args"]; - _args params ["_logic", "_pos", "_radius_max", "_radius_min", "_gastype"]; - private _playerARR = _logic getVariable [QGVAR(gas_playerArr), []]; + _args params ["_logic", "_position", "_radius_max", "_radius_min", "_gasType"]; + private _playerArr = _logic getVariable [QGVAR(gas_playerArr), []]; private _allUnits = if (missionNamespace getVariable [QGVAR(affectAI), false]) then {allUnits} else {allPlayers}; + + { if (!isDamageAllowed _x) then { - [_x] call FUNC(clearChemicalInjuriesLocal); + [_x] call FUNC(fullHealLocal); continue; }; - private _posString = toString (_pos); - private _logicPos = toString (getpos _logic); - if (_posString != _logicPos) then { _pos = getpos _logic; _logic setVariable [QGVAR(gas_pos), _pos, true];}; - private _distance = position _x distance _pos; - if (isPlayer _x) then { + _position = if ((toString (_position) != toString (getpos _logic))) then {getpos _logic} else {_position}; + _logic setVariable [QGVAR(gas_position), _position, true]; + private _distance = _x distance _position; + + if (isPlayer _x) then { if (_x getVariable [QGVAR(isTreated), false]) then { _x setVariable [QGVAR(isTreated), false, true]; - private _arrPos = _playerARR find _x; - _playerARR deleteAt _arrPos; - _logic setVariable [QGVAR(gas_playerArr), _playerARR, true]; - }; - if (_x in _playerARR && _distance > _radius_max) then { - private _arrPos = _playerARR find _x; - _playerARR deleteAt _arrPos; - _logic setVariable [QGVAR(gas_playerArr), _playerARR, true]; + _playerArr deleteAt (_playerArr find _x); + _logic setVariable [QGVAR(gas_playerArr), _playerArr, true]; }; - if (!(_x in _playerARR) && _distance < _radius_max) then { - _playerARR pushBack _x; - _logic setVariable [QGVAR(gas_playerArr), _playerARR, true]; - [QGVAR(gasCheck_local), [_x, _logic, _pos, _radius_max, _radius_min, _gastype], _x] call CBA_fnc_targetEvent; - }; + if (!(_x in _playerArr) && _distance < _radius_max) then { + _playerArr pushBack _x; + _logic setVariable [QGVAR(gas_playerArr), _playerArr, true]; + [QGVAR(gasPlayer), [_x, _logic, _position, _radius_max, _radius_min, _gasType], _x] call CBA_fnc_targetEvent; + } else { + if (_x in _playerArr && _distance > _radius_max) then { + + _playerArr deleteAt (_playerArr find _x); + _logic setVariable [QGVAR(gas_playerArr), _playerArr, true]; + }; + }; } else { if (_distance < _radius_max && alive _x && !(_x getVariable [QGVAR(enteredPoison), false])) then { - [QGVAR(gasCheck_ai), [_x, _logic, _pos, _radius_max, _gastype], _x] call CBA_fnc_targetEvent; + [QGVAR(gasAI), [_x, _logic, _position, _radius_max, _gasType], _x] call CBA_fnc_targetEvent; }; }; } forEach _allUnits; +}; -}, 3, [_logic,_pos,_radius_max,_radius_min,_gastype]] call CBA_fnc_addPerFrameHandler; - +// Add per frame handler to check players +private _handle = [_checkPlayers, 3, [_logic, _position, _radius_max, _radius_min, _gasType]] call CBA_fnc_addPerFrameHandler; +// Remove handler when logic is no longer valid +[ + { + params ["_args", "_pfhHandle"]; + _args params ["_logic", "_handle"]; -[{ - params["_args","_pfhHandle"]; - _args params["_logic","_checkplayers"]; - if (isNull _logic || !alive _logic || !(_logic getVariable [QGVAR(gas_active),false])) exitWith { - _logic setVariable [QGVAR(gas_active), false, true]; - [_checkplayers] call CBA_fnc_removePerFrameHandler; - [_pfhHandle] call CBA_fnc_removePerFrameHandler; - }; -}, 0, [_logic,_checkplayers]]call CBA_fnc_addPerFrameHandler; + if (isNull _logic || !alive _logic || !(_logic getVariable [QGVAR(gas_active), false])) exitWith { + _logic setVariable [QGVAR(gas_active), false, true]; + [_handle] call CBA_fnc_removePerFrameHandler; + [_pfhHandle] call CBA_fnc_removePerFrameHandler; + }; + }, + 0, + [_logic, _handle] +] call CBA_fnc_addPerFrameHandler; diff --git a/addons/chemical/functions/fnc_gasCheckLocal.sqf b/addons/chemical/functions/fnc_gasCheckLocal.sqf index fd871dd9c..769499f66 100644 --- a/addons/chemical/functions/fnc_gasCheckLocal.sqf +++ b/addons/chemical/functions/fnc_gasCheckLocal.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: DiGii -* This cant be called manualy! +* This cannot be called manually! * Handles the Gas effect for the player * * Arguments: @@ -16,110 +16,77 @@ * NONE * * Example: -* [player, logic, getPos player, 50, 20, "Toxic"] call kat_chemical_fnc_gasChecklocal; +* [player, logic, getPos player, 50, 20, 0] call kat_chemical_fnc_gasChecklocal; * * Public: No */ -params ["_unit", "_logic", "_pos", "_radius_max", "_radius_min", "_gastype"]; +params ["_unit", "_logic", "_position", "_radius_max", "_radius_min", "_gasType"]; if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(clearChemicalInjuriesLocal); + [_unit] call FUNC(fullHealLocal); }; -[ - { - params["_args", "_handler"]; - _args params ["_logic", "_unit", "_pos"]; - private _posstring = toString (_logic getVariable [QGVAR(gas_pos), [0, 0, 0]]); - private _logicPos = toString (getPos _logic); - if (_unit getVariable [QGVAR(isTreated), false]) exitWith { - [_handler] call CBA_fnc_removePerFrameHandler; - }; - if !(_logic getVariable [QGVAR(gas_active), false]) then { - if (_unit getVariable [QGVAR(enteredPoison), false]) then { - _unit setVariable [QGVAR(enteredPoison), false, true]; - [_handler] call CBA_fnc_removePerFrameHandler; - }; - }; - }, 3, [_logic, _unit, _pos] -] call CBA_fnc_addPerFrameHandler; +private _timeEntered = CBA_MissionTime; -[ - { - params["_args", "_handler"]; - _args params ["_unit", "_logic", "_pos", "_radius_max", "_radius_min", "_gastype"]; +// Function to handle the per-frame logic for gas effects - if(!(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic || _unit getVariable [QGVAR(isTreated), false]) exitWith { - [_handler] call CBA_fnc_removePerFrameHandler; - }; +[{ + params ["_args", "_handler"]; + _args params ["_logic", "_unit", "_position"]; - _pos = _logic getVariable [QGVAR(gas_pos), [0, 0, 0]]; - private _distance = _unit distance _pos; - private _min_to_max = _radius_max - _radius_min; - private _dis_to_min = _distance - _radius_min; - private _percent = 0; - if (_distance > _radius_min) then { - _percent = 1-(_dis_to_min / _min_to_max); - if (_percent > 1) then { - _percent = 1 - }; - } else { - _percent = 1; - }; - _unit setVariable [QGVAR(gasPercentage), _percent]; + if (_unit getVariable [QGVAR(isTreated), false] || !(_logic getVariable [QGVAR(gas_active), false])) exitWith { + _unit setVariable [QGVAR(enteredPoison), false, true]; + [_handler] call CBA_fnc_removePerFrameHandler; + }; - }, 1, [_unit, _logic, _pos, _radius_max, _radius_min, _gastype] -] call CBA_fnc_addPerFrameHandler; +}, 3, [_logic, _unit, _position]] call CBA_fnc_addPerFrameHandler; -[ - { - params["_args", "_pfhandler"]; - _args params ["_unit", "_logic", "_pos", "_radius_max", "_radius_min", "_gastype"]; +[{ + params ["_args", "_handler"]; + _args params ["_unit", "_logic", "_position", "_radius_max", "_radius_min", "_gasType", "_timeEntered"]; - if (!(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic || !(_unit in (_logic getVariable [QGVAR(gas_playerArr), []])) || !(_unit getVariable[QGVAR(enteredPoison), false])) then { - [_pfhandler] call CBA_fnc_removePerFrameHandler; - }; + if (!(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic || _unit getVariable [QGVAR(isTreated), false]) exitWith { + [_handler] call CBA_fnc_removePerFrameHandler; + }; + + _position = _logic getVariable [QGVAR(gas_position), [0, 0, 0]]; + private _distance = _unit distance _position; + private _min_to_max = _radius_max - _radius_min; + private _dis_to_min = _distance - _radius_min; + private _percent = 0; - _pos = _logic getVariable [QGVAR(gas_pos), [0, 0, 0]]; - if (_unit distance _pos <= _radius_max && !(_unit getVariable [QGVAR(enteredPoison), false]) && !(_unit getVariable ["ACE_isUnconscious", false])) then { + if (_distance > _radius_min) then { + _percent = _dis_to_min / _min_to_max; + }; + + private _timeLeft = _unit getVariable [QGVAR(timeleft), 0]; + if (_timeLeft <= 0) exitWith + { + [_handler] call CBA_fnc_removePerFrameHandler; + [QGVAR(afterWait), [_unit, _logic, _gastype, _radius_max], _unit] call CBA_fnc_targetEvent; + _unit setVariable [QGVAR(timeleft), 0]; + }; + + if (_distance < _radius_max) then { + if !(_unit getVariable [QGVAR(enteredPoison), false]) then { _unit setVariable [QGVAR(enteredPoison), true, true]; - [QGVAR(enteredPoisonEvent), [_unit], _unit] call CBA_fnc_targetEvent; + [QGVAR(enteredZone), [_unit], _unit] call CBA_fnc_targetEvent; _unit setVariable [QGVAR(Poisen_logic), _logic, true]; - private _timeEntered = CBA_missiontime; - - [ - { - params["_args", "_pfhandler"]; - _args params[ "_radius_max", "_radius_min", "_unit", "_logic", "_gastype"]; - _pos = _logic getVariable [QGVAR(gas_pos), [0, 0, 0]]; - _unittime = _unit getVariable [QGVAR(timeleft), 60]; - _percent = _unit getVariable [QGVAR(gasPercentage), 0]; - _unittime = _unittime - _percent; - _unit setVariable [QGVAR(timeleft), _unittime]; - - if (_unittime <= 0) exitwith { - [QGVAR(afterWait), [_unit, _logic, _gastype, _radius_max], _unit] call CBA_fnc_targetEvent; - _unit setVariable [QGVAR(timeleft), 0]; - [_pfhandler] call CBA_fnc_removePerFrameHandler; - }; - - if (_unit distance _pos > _radius_max || !(_logic getVariable[QGVAR(gas_active), false]) || isNull _logic) exitwith { - _unit setVariable[QGVAR(enteredPoison), false, true]; - [_pfhandler] call CBA_fnc_removePerFrameHandler; - }; - - if (_gastype isEqualto "CS") exitwith { - [_pfhandler] call CBA_fnc_removePerFrameHandler; - [QGVAR(afterWait), [_unit, _logic, _gastype, _radius_max], _unit] call CBA_fnc_targetEvent; - }; - }, - 1, - [ _radius_max, _radius_min, _unit, _logic, _gastype] - ] call CBA_fnc_addPerFrameHandler; - }; - }, - 2, - [_unit, _logic, _pos, _radius_max, _radius_min, _gastype] -] call CBA_fnc_addPerFrameHandler; + + _timeLeft = (missionNamespace getVariable [QGVAR(infectionTime),60]) - (CBA_MissionTime - _timeEntered); + _unit setVariable [QGVAR(timeleft), _timeLeft]; + }; + + if (_distance > _radius_max || !(_logic getVariable [QGVAR(gas_active), false]) || isNull _logic) then { + _unit setVariable [QGVAR(enteredPoison), false, true]; + [_handler] call CBA_fnc_removePerFrameHandler; + }; + + if (_gasType isEqualTo 1) then { + [_handler] call CBA_fnc_removePerFrameHandler; + [QGVAR(afterWait), [_unit, _logic, _gasType, _radius_max], _unit] call CBA_fnc_targetEvent; + }; + +}, 2, [_unit, _logic, _position, _radius_max, _radius_min, _gasType, _timeEntered]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/chemical/functions/fnc_gasmodule.sqf b/addons/chemical/functions/fnc_gasmodule.sqf index 112eb53f8..17dc4fe28 100644 --- a/addons/chemical/functions/fnc_gasmodule.sqf +++ b/addons/chemical/functions/fnc_gasmodule.sqf @@ -21,20 +21,18 @@ private _logic = param [0, objNull, [objNull]]; private _activated = param [2, true, [true]]; private _radius_max = _logic getVariable ["Radius_Max", 20]; private _radius_min = _logic getVariable ["Radius_Min", 10]; -private _gastype = _logic getVariable ["GAS_type", "Toxic"]; +private _gastype = _logic getVariable ["GAS_type", 0]; private _isSealable = _logic getVariable ["IsSealable", false]; if (_activated) then { if (count synchronizedObjects _logic > 0) then { private _object = (synchronizedObjects _logic) select 0; - private _pos = getPos _object; if (_isSealable) then { - [_object] call FUNC(createSealaction); + [QGVAR(createSealActionGlobal), [_object, _logic]] call CBA_fnc_globalEventJIP; }; - [_object, _pos, _radius_max, _radius_min, _gastype] spawn FUNC(gasCheck); + [_object, getPos _object, _radius_max, _radius_min, parseNumber _gastype] call FUNC(gasCheck); } else { - private _pos = getPos _logic; - [_logic, _pos, _radius_max, _radius_min, _gastype] spawn FUNC(gasCheck); + [_logic, getPos _logic, _radius_max, _radius_min, parseNumber _gastype] call FUNC(gasCheck); }; }; diff --git a/addons/chemical/functions/fnc_giveUnitGasMask.sqf b/addons/chemical/functions/fnc_giveUnitGasMask.sqf index fc0f0656f..66524eeb0 100644 --- a/addons/chemical/functions/fnc_giveUnitGasMask.sqf +++ b/addons/chemical/functions/fnc_giveUnitGasMask.sqf @@ -18,12 +18,13 @@ params ["_medic", "_patient"]; private _itemArr = _medic call ACEFUNC(common,uniqueItems); -private _playerhasGasmask = false; +private _playerHasGasmask = false; private _playerGasMask = ""; -{ if(_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_playerhasGasmask = true; _playerGasMask = _x} } forEach _itemArr; +{ if (_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_playerHasGasmask = true; _playerGasMask = _x} } forEach _itemArr; private _fnc_replaceItem = { params["_medic", "_patient", "_playerGasMask"]; + if (goggles _patient == "") then { _patient linkItem _playerGasMask; } else { @@ -33,11 +34,11 @@ private _fnc_replaceItem = { }; }; -if (_playerhasGasmask) then { +if (_playerHasGasmask) then { [_medic,_playerGasMask] call ACEFUNC(common,useItem); [_medic,_patient,_playerGasMask] call _fnc_replaceItem; } else { _itemArr = _patient call ACEFUNC(common,uniqueItems); - { if(_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_playerGasMask = _x} } forEach _itemArr; + { if (_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_playerGasMask = _x} } forEach _itemArr; [_medic,_patient,_playerGasMask] call _fnc_replaceItem; }; diff --git a/addons/chemical/functions/fnc_handleCSGas.sqf b/addons/chemical/functions/fnc_handleCSGas.sqf index c714728d4..3a4e01174 100644 --- a/addons/chemical/functions/fnc_handleCSGas.sqf +++ b/addons/chemical/functions/fnc_handleCSGas.sqf @@ -15,21 +15,22 @@ * Public: No */ params ["_unit", "_logic", "_radius"]; + [{ - params["_params","_handler"]; - _params params["_unit"]; + params["_args","_handler"]; + _args params ["_unit"]; if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(clearChemicalInjuriesLocal); + [_unit] call FUNC(fullHealLocal); }; - if (_unit getVariable[QGVAR(enteredPoison),false]) then { + if (_unit getVariable [QGVAR(enteredPoison), false]) then { if (_unit getVariable [QACEGVAR(medical,pain), 0] < 0.25) then {_unit setVariable [QACEGVAR(medical,pain), 0.41]}; if ((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_unit setVariable[QGVAR(enteredPoison), false, true]}; _unit setVariable [QGVAR(CS), true, true]; _unit say3D QGVAR(cough_1); if (hasInterface) then { - private _rndBlur = selectRandom [5, 6, 7, 8]; + private _rndBlur = selectRandom [5, 6, 7, 8]; ppBlur ppEffectAdjust [_rndBlur]; ppBlur ppEffectEnable true; ppBlur ppEffectCommit 5; @@ -44,20 +45,20 @@ params ["_unit", "_logic", "_radius"]; [_handler] call CBA_fnc_removePerFrameHandler; }; -}, 5, [player]] call CBA_fnc_addPerFrameHandler; +}, 5, [_unit]] call CBA_fnc_addPerFrameHandler; -//Pos Check +//Position Check [{ params ["_param","_handler"]; - _param params ["_logic","_radius","_unit"]; + _param params ["_logic", "_radius", "_unit"]; if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(clearChemicalInjuriesLocal); + [_unit] call FUNC(fullHealLocal); }; - private _pos = _logic getVariable [QGVAR(gas_pos),[0,0,0]]; - if ( _unit distance _pos > _radius || !(_logic getVariable[QGVAR(gas_active),false]) || isNull _logic ) exitWith { - _unit setVariable[QGVAR(enteredPoison), false, true]; + private _position = _logic getVariable [QGVAR(gas_position), [0,0,0]]; + if ( _unit distance _position > _radius || !(_logic getVariable[QGVAR(gas_active),false]) || isNull _logic ) exitWith { + _unit setVariable [QGVAR(enteredPoison), false, true]; [_handler] call CBA_fnc_removePerFrameHandler; }; -},2,[_logic, _radius, player]] call CBA_fnc_addPerFrameHandler; +}, 2, [_logic, _radius, _unit]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/chemical/functions/fnc_handleFired.sqf b/addons/chemical/functions/fnc_handleFired.sqf index 804561cf5..e77edae08 100644 --- a/addons/chemical/functions/fnc_handleFired.sqf +++ b/addons/chemical/functions/fnc_handleFired.sqf @@ -25,9 +25,7 @@ params ["_vehicle", "", "", "", "_ammo", "_magazine", "_projectile"]; // Large enough distance to not simulate any wind deflection -if (_vehicle distance ACE_player > 8000) exitwith { - false -}; +if (_vehicle distance ACE_player > 8000) exitwith {}; if !(_ammo in KAT_ProjectileCache) exitwith {}; @@ -38,14 +36,15 @@ private _radius = [_configClass, "KAT_radius", 10] call BIS_fnc_returnConfigEntr private _gasLvL = [_configClass, "KAT_toxicLvL", 1] call BIS_fnc_returnConfigEntry; [{ - params["_args", "_handler"]; - _args params ["_projectile", "_posarr", "_gasinfo"]; - _gasinfo params ["_lifetime", "_radius", "_gasLvL"]; + params ["_args", "_handler"]; + _args params ["_projectile", "_posArr", "_gasInfo"]; + _gasInfo params ["_lifetime", "_radius", "_gasLvL"]; + if (!isNull _projectile) exitwith { _args set [1, getPos _projectile]; }; - [_posarr, _lifetime, _radius, _gasLvL] call FUNC(createZone); + [QGVAR(createZoneGlobal), [_posArr, _lifetime, _radius, _gasLvL]] call CBA_fnc_globalEventJIP; [_handler] call CBA_fnc_removePerFrameHandler; }, 0, [_projectile, [0, 0, 0], [_lifetime, _radius, _gasLvL]]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/chemical/functions/fnc_handleGasMaskDur.sqf b/addons/chemical/functions/fnc_handleGasMaskDur.sqf index 36fc0d830..133fbfd2e 100644 --- a/addons/chemical/functions/fnc_handleGasMaskDur.sqf +++ b/addons/chemical/functions/fnc_handleGasMaskDur.sqf @@ -23,31 +23,31 @@ params ["_unit"]; }, { params["_unit"]; - if(_unit getVariable [QGVAR(enteredPoison), false] && (goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then { + if (_unit getVariable [QGVAR(enteredPoison), false] && (goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then { private _timeEntered = CBA_missionTime; - private _maxTime = missionNamespace getVariable [QGVAR(gasmask_durability),900]; - private _currentDurability = _unit getVariable [QGVAR(gasmask_durability),10]; + private _maxTime = missionNamespace getVariable [QGVAR(gasmask_durability), 900]; + private _currentDurability = _unit getVariable [QGVAR(gasmask_durability), 10]; [{ - params["_args","_handler"]; + params ["_args","_handler"]; _args params ["_unit","_timeEntered","_maxTime","_currentDurability"]; - private _currentDurability = _unit getVariable[QGVAR(gasmask_durability),10]; + private _currentDurability = _unit getVariable [QGVAR(gasmask_durability), 10]; - if (_unit getVariable [QGVAR(gasmask_durability_reset),false]) then { - _unit setVariable [QGVAR(gasmask_durability_reset),false,true]; + if (_unit getVariable [QGVAR(gasmask_durability_reset), false]) then { + _unit setVariable [QGVAR(gasmask_durability_reset), false, true]; [_handler] call CBA_fnc_removePerFrameHandler; [_unit] call FUNC(handleGasMaskDur); }; private _timeLeft = _maxTime - (CBA_missionTime - _timeEntered); - private _percent = round ((10/_maxTime)*_timeLeft); + private _percent = round ((10/_maxTime) * _timeLeft); - if(_currentDurability != _percent) then { - _unit setVariable [QGVAR(gasmask_durability),_percent]; + if (_currentDurability != _percent) then { + _unit setVariable [QGVAR(gasmask_durability), _percent, true]; }; - if(_currentDurability <= 0 || _percent <= 0 || !(alive _unit)) exitWith { + if (_currentDurability <= 0 || _percent <= 0 || !(alive _unit)) exitWith { [_handler] call CBA_fnc_removePerFrameHandler; - _unit setVariable [QGVAR(gasmask_durability),0]; + _unit setVariable [QGVAR(gasmask_durability), 0, true]; [_unit] call FUNC(handleGasMaskDur); }; @@ -60,7 +60,7 @@ params ["_unit"]; } else { [ { - params["_unit"]; + params ["_unit"]; _unit getVariable [QGVAR(enteredPoison), false] || (goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []]) }, { diff --git a/addons/chemical/functions/fnc_hasGasMaskON.sqf b/addons/chemical/functions/fnc_hasGasMaskON.sqf index c63c11566..59631a20a 100644 --- a/addons/chemical/functions/fnc_hasGasMaskON.sqf +++ b/addons/chemical/functions/fnc_hasGasMaskON.sqf @@ -16,6 +16,6 @@ params ["_target"]; -if(missionNamespace getVariable [QGVAR(availGasmaskList), []] isEqualTo []) exitWith {false}; +if (missionNamespace getVariable [QGVAR(availGasmaskList), []] isEqualTo []) exitWith {false}; goggles _target in (missionNamespace getVariable [QGVAR(availGasmaskList), []]); diff --git a/addons/chemical/functions/fnc_hasGasmask.sqf b/addons/chemical/functions/fnc_hasGasmask.sqf index accbbee02..5422bba97 100644 --- a/addons/chemical/functions/fnc_hasGasmask.sqf +++ b/addons/chemical/functions/fnc_hasGasmask.sqf @@ -15,15 +15,14 @@ * Public: No */ -params [["_player", objNull, [objNull]],["_patient", objNull, [objNull]]]; +params [["_player", objNull, [objNull]], ["_patient", objNull, [objNull]]]; - -private _playerarr = _player call ACEFUNC(common,uniqueItems); -private _playerhasGasmask = false; -{ if(_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_playerhasGasmask = true} } forEach _playerarr; +private _playerArr = _player call ACEFUNC(common,uniqueItems); +private _playerHasGasmask = false; +{ if (_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_playerHasGasmask = true} } forEach _playerArr; private _patientarr = _patient call ACEFUNC(common,uniqueItems); -private _patienthasGasmask = false; -{ if(_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_patienthasGasmask = true} } forEach _patientarr; +private _patientHasGasmask = false; +{ if (_x in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_patientHasGasmask = true} } forEach _patientarr; -[true, false] select (!_playerhasGasmask && !_patienthasGasmask); \ No newline at end of file +[true, false] select (!_playerHasGasmask && !_patientHasGasmask); diff --git a/addons/chemical/functions/fnc_spawnGasSmoke.sqf b/addons/chemical/functions/fnc_spawnGasSmoke.sqf deleted file mode 100644 index 0d03fb237..000000000 --- a/addons/chemical/functions/fnc_spawnGasSmoke.sqf +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: DiGii - * Spawns Patricles for the Gas zone - * - * Arguments: - * 0: Postiton - * 1: Radius - * 2: Lifetime - * - * Return Value: - * NONE - * - * Example: - * [getPosASL player, 25, 60] call kat_chemical_fnc_spawnGasSmoke; - * - * Public: No -*/ - -params ["_position", "_radius", "_lifetime"]; - -private _fnc_getEllipsoidArea = { - params ["_a", "_b", "_c"]; - - (4 * pi * (((((_a * _b) ^ 1.6) + ((_a * _c) ^ 1.6) + ((_c * _b) ^ 1.6)) / 3) ^ (1/1.6))); -}; - -//An easy little polar coordinate function -private _fnc_getSpherePolarCoordinates = { - params ["_theta", "_phi", "_distance", "_vert"]; - [_distance * (cos _theta) * (sin _phi), _distance * (sin _theta) * (sin _phi), _vert * (cos _phi) * 0.33]; -}; - -for "_i" from 1 to floor ((([_radius, _radius, 2] call _fnc_getEllipsoidArea) / 10) * 1) do { - private _particleSource = "#particlesource" createVehicle _position; - - //Particle options - _particleSource setParticleParams [ - ["\A3\data_f\cl_basic",1,0,1], // File,Ntieth,Index,Count,Loop - "", //Animation name - "Billboard", //Type - 0.1 + random 5, //Timer Period (We do this to spread the updates out and reduce overhead) - _lifetime - random 2, //Lifetime - [random 360, random 360, _radius * sqrt (random 1), 2] call _fnc_getSpherePolarCoordinates,//) + [-2 - (random _verticleSpread)], //Position relative to the particle source (Don't mind da maffs) - [0,0,(-0.003 - random 0.5)], //Move velocity - 5 + random 10, //Rotation velocity - 10, //Weight - 7.843, //Volume - 0.05 + random 0.05, //Rubbing - [5,5,5], //Size - [[0.9294,0.9843,1] + [0.001], [0.9294,0.9843,1] + [0.1], [1,1,1,0]], //Color - [0,0], //Animation speed - 0, //Random direction period - 0, //Random direction intensity - "", - "", //Before destroy script - _particleSource //This - ]; - _particleSource setDropInterval 100; - - [{deleteVehicle _this}, _particleSource, 0.5] call CBA_fnc_waitAndExecute; -}; \ No newline at end of file diff --git a/addons/chemical/functions/fnc_spawnSmoke.sqf b/addons/chemical/functions/fnc_spawnSmoke.sqf index 822c5099d..de25e2343 100644 --- a/addons/chemical/functions/fnc_spawnSmoke.sqf +++ b/addons/chemical/functions/fnc_spawnSmoke.sqf @@ -25,6 +25,4 @@ hideObjectGlobal _smoke; private _pos = [_posX,_posY,_posZ]; -[_pos,240,5,0] call FUNC(createZone); - -["KAT_tripGasTriggered", [_smoke, [_posX,_posY,_posZ]]] call CBA_fnc_globalEvent; +[QGVAR(createZoneGlobal), [_pos, 240, 5, 0]] call CBA_fnc_globalEventJIP; diff --git a/addons/chemical/functions/fnc_throwGrenade.sqf b/addons/chemical/functions/fnc_throwGrenade.sqf index d7b857e1b..45e3b617b 100644 --- a/addons/chemical/functions/fnc_throwGrenade.sqf +++ b/addons/chemical/functions/fnc_throwGrenade.sqf @@ -13,24 +13,16 @@ * * Public: No */ -params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; -if !(local _unit) exitwith {}; -private _config = configFile >> "Cfgammo" >> _ammo; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; + +private _config = configFile >> "CfgAmmo" >> _ammo; + if (getNumber (_config >> "KAT_csGas") != 1) exitwith {}; -private _fuzetimeBase = getNumber (_config >> "explosionTime"); -private _fuzetime = _fuzetimeBase + random[-0.8, 0, 1.2]; +private _timeToLive = getNumber (_config >> "timeToLive"); +private _fuzeTimeBase = getNumber (_config >> "explosionTime"); +private _fuzeTime = _fuzeTimeBase + random [-0.8, 0, 1.2]; private _currentime = CBA_missiontime; -[ - { - params ["_currentime", "_fuzetime"]; - (CBA_missiontime - _currentime) > _fuzetime - }, - { - params ["_currentime", "_fuzetime", "_projectile"]; - [_projectile] call FUNC(csGrenadethrownFuze); - }, - [_currentime, _fuzetime, _projectile] -] call CBA_fnc_waitUntilandExecute; +[FUNC(csGrenade), [_projectile, _timeToLive, side _unit], _fuzeTime] call CBA_fnc_waitAndExecute; // WE WANT THE OBJECTS SIDE HERE! diff --git a/addons/chemical/functions/fnc_treatmentAdvanced_AtropineLocal.sqf b/addons/chemical/functions/fnc_treatmentAdvanced_AtropineLocal.sqf index 17a8c7090..ede9e02ae 100644 --- a/addons/chemical/functions/fnc_treatmentAdvanced_AtropineLocal.sqf +++ b/addons/chemical/functions/fnc_treatmentAdvanced_AtropineLocal.sqf @@ -17,9 +17,9 @@ params ["_patient"]; -_patient setVariable [QGVAR(airPoisoning) ,false,true]; -_patient setVariable [QGVAR(isTreated) ,true,true]; -_patient setVariable [QGVAR(enteredPoison),false,true]; +_patient setVariable [QGVAR(airPoisoning), false, true]; +_patient setVariable [QGVAR(isTreated), true, true]; +_patient setVariable [QGVAR(enteredPoison), false, true]; _patient setVariable [QGVAR(timeleft), missionNamespace getVariable [QGVAR(infectionTime), 60], true]; if (_patient getVariable [QGVAR(painEffect),0] != 0) then { KAT_PAIN_EFFECT ppEffectEnable false; diff --git a/addons/chemical/functions/fnc_ui_gasModule.sqf b/addons/chemical/functions/fnc_ui_gasModule.sqf index cac5a1b0a..167f12e33 100644 --- a/addons/chemical/functions/fnc_ui_gasModule.sqf +++ b/addons/chemical/functions/fnc_ui_gasModule.sqf @@ -10,7 +10,7 @@ * NONE * * Example: - * [1105] call kat_chemical_fnc_spawnGasSmoke; + * [1105] call kat_chemical_fnc_ui_gasModule; * * Public: No */ @@ -18,30 +18,12 @@ params ["_control"]; private _display = ctrlParent _control; -private _ctrlButtonOK = _display displayCtrl IDC_OK; -private _ctrlButtonCancel = _display displayCtrl IDC_CANCEL; -private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull]; - +private _ctrlButtonOK = _display displayCtrl 1; +private _ctrlButtonCancel = _display displayCtrl 2; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); _control ctrlRemoveAllEventHandlers "SetFocus"; - -private _fnc_onUnload = { - private _logic = missionNamespace getVariable["BIS_fnc_initCuratorAttributes_target",objNull]; - if (isNull _logic) exitWith {}; - if !(_display getVariable [QGVAR(Confirmed), false]) then - { - if !(isNull attachedTo _logic) then - { - deleteVehicle _logic; - } else - { - detach (attachedTo _logic); - deleteVehicle _logic; - }; - }; -}; - scopeName "Main"; private _fnc_errorAndClose = { params ["_msg"]; @@ -68,54 +50,58 @@ if !(isNull attachedTo _logic) then { }; +private _fnc_onUnload = { + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); + if (isNull _logic) exitWith {}; + if !(_display getVariable [QGVAR(Confirmed), false]) then + { + if !(isNull attachedTo _logic) then + { + deleteVehicle _logic; + } else + { + detach (attachedTo _logic); + deleteVehicle _logic; + }; + }; +}; + private _fnc_onConfirm = { params [["_ctrlButtonOK", controlNull, [controlNull]]]; private _display = ctrlParent _ctrlButtonOK; if (isNull _display) exitWith {}; - private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target",objNull]; + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); if (isNull _logic) exitWith {}; - private _gasTypeValue = _display getVariable[QGVAR(ui_gastype),0]; - private _gastype = ""; - switch (_gasTypeValue) do { - case 1: { //CS - _gastype = "CS"; - }; - default { //toxic gas (default) - _gastype = "Toxic"; - }; - }; + private _gasType = _display getVariable [QGVAR(ui_gastype),0]; private _radius_max = _display getVariable [QGVAR(ui_radiusMax), 20]; private _radius_min = _display getVariable [QGVAR(ui_radiusMin), 10]; - if(_radius_min > _radius_max) then { + if (_radius_min > _radius_max) then { [CSTRING(GasModule_Needbigger)] call ACEFUNC(zeus,showMessage); } else { - private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target",objNull]; + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); if (isNull _logic) exitWith {}; if !(isNull attachedTo _logic) then { - private _object = attachedto _logic; - private _position = getPos _object; + private _object = attachedTo _logic; - [_logic,_position,_radius_max,_radius_min,_gastype] call FUNC(gasCheck); + [_logic, getPos _object, _radius_max, _radius_min, _gasType] call FUNC(gasCheck); - if (_display getVariable[QGVAR(ui_sealable),false]) then { - [_object] call FUNC(createSealAction); + if (_display getVariable [QGVAR(ui_sealable), false]) then { + [QGVAR(createSealActionGlobal), [_object, _logic]] call CBA_fnc_globalEventJIP; }; } else { - private _position = getPos _logic; - [_logic,_position,_radius_max,_radius_min,_gastype] call FUNC(gasCheck); + [_logic, getPos _logic, _radius_max, _radius_min, _gasType] call FUNC(gasCheck); }; _display setVariable [QGVAR(Confirmed), true]; }; }; - _display displayAddEventHandler ["Unload", _fnc_onUnload]; _ctrlButtonOK ctrlAddEventHandler ["ButtonClick", _fnc_onConfirm]; diff --git a/addons/chemical/script_component.hpp b/addons/chemical/script_component.hpp index 3b323b5d8..0a66b8add 100644 --- a/addons/chemical/script_component.hpp +++ b/addons/chemical/script_component.hpp @@ -16,3 +16,12 @@ #endif #include "\x\kat\addons\main\script_macros.hpp" + +// UI grid +#define SIZEX ((safeZoneW / safeZoneH) min 1.2) +#define SIZEY (SIZEX / 1.2) +#define W_PART(num) (num * (SIZEX / 40)) +#define H_PART(num) (num * (SIZEY / 25)) +#define X_PART(num) (W_PART(num) + (safeZoneX + (safeZoneW - SIZEX) / 2)) +#define Y_PART(num) (H_PART(num) + (safeZoneY + (safeZoneH - SIZEY) / 2)) +