From b74175ec9e0054155268bde7648cf22ca6cc8339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 17:24:24 -0300 Subject: [PATCH 1/7] Don't allow adjusting range if only rangefinder is available --- addons/fcs/initKeybinds.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index dd1a94b78e..cbda9bdecc 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -51,7 +51,7 @@ _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + if !(FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange); @@ -69,7 +69,7 @@ _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + if !(FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange); From cb15a7106cd01927a62946b4ee56009ed2fcd04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 17:26:08 -0300 Subject: [PATCH 2/7] Allow adding FCS to static weapons --- addons/fcs/CfgEventHandlers.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 961a05b27d..a03ca847ea 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -36,6 +36,11 @@ class Extended_Init_EventHandlers { serverInit = QUOTE(_this call FUNC(vehicleInit)); }; }; + class StaticWeapon { + class ADDON { + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; }; class Extended_Respawn_EventHandlers { @@ -64,6 +69,11 @@ class Extended_Respawn_EventHandlers { respawn = QUOTE(_this call FUNC(vehicleInit)); }; }; + class StaticWeapon { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; }; class Extended_FiredBIS_EventHandlers { @@ -92,4 +102,9 @@ class Extended_FiredBIS_EventHandlers { firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; + class StaticWeapon { + class ADDON { + firedBIS = QUOTE(_this call FUNC(firedEH)); + }; + }; }; From 08af51c4a78f0c0264b56e98a50a77d209da2d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 17:29:54 -0300 Subject: [PATCH 3/7] Allow overpressure for static weapons --- addons/overpressure/CfgEventHandlers.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 40c3b32a57..fa70cab5ea 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -43,4 +43,9 @@ class Extended_FiredBIS_EventHandlers { firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; + class StaticWeapons { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; }; From 2105bc18db2d11d71782cc182ade12b781f72dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 17:43:57 -0300 Subject: [PATCH 4/7] Fixes for the FCS; it was missing a lot of `call`s before `FUNC`s. That made the rangefinder only work once. The flag for preventing holding is not needed becase GVAR(enabled) serving the same purpose. --- addons/fcs/functions/fnc_keyDown.sqf | 2 +- addons/fcs/initKeybinds.sqf | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index 7699b82a20..5e2fabccc9 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -19,7 +19,7 @@ _turret = _this select 1; _distance = call FUNC(getRange); -if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; +if !(!GVAR(enabled) && [] call FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; GVAR(Time) = time; diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index cbda9bdecc..b9ca0a927a 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -7,11 +7,7 @@ _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; - - // prevent holding down - if (GETGVAR(isDownStateKey1,false)) exitWith {false}; - GVAR(isDownStateKey1) = true; + if !((!GVAR(enabled) && [] call FUNC(canUseFCS)) || [] call FUNC(canUseRangefinder)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyDown); @@ -26,14 +22,11 @@ ["ACE3", localize "STR_ACE_FCS_LaseTarget", { - // prevent holding down - GVAR(isDownStateKey1) = false; - // Conditions: canInteract _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; + if !(GVAR(enabled) && [] call FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp); @@ -51,7 +44,7 @@ _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(FUNC(canUseFCS)) exitWith {false}; + if !([] call FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange); @@ -69,7 +62,7 @@ _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(FUNC(canUseFCS)) exitWith {false}; + if !([] call FUNC(canUseFCS)) exitWith {false}; // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange); From a1e5931f4ef0579411ce71e54baf806508e2feab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 18:06:17 -0300 Subject: [PATCH 5/7] avoid having to compute distance when it's already passed as a parameter --- addons/fcs/functions/fnc_keyDown.sqf | 3 ++- addons/fcs/functions/fnc_keyUp.sqf | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index 5e2fabccc9..24e4a7611d 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -19,7 +19,8 @@ _turret = _this select 1; _distance = call FUNC(getRange); -if !(!GVAR(enabled) && [] call FUNC(canUseFCS)) exitWith {}; +if (GVAR(Enabled)) exitWith {}; +if !([] call FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; GVAR(Time) = time; diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 1e5878f0b5..b893262e88 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -19,18 +19,22 @@ _turret = _this select 1; _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); -_distance = call FUNC(getRange); +_distance = 0; +if (count _this > 2) then { + _distance = _this select 2; +} else { + _distance = call FUNC(getRange); + if (_distance == 0) then { + _distance = [ + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) + ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision + }; +}; _magazines = _vehicle magazinesTurret _turret; -if (_distance == 0) then { - _distance = [ - getNumber (_turretConfig >> QGVAR(DistanceInterval)), - getNumber (_turretConfig >> QGVAR(MaxDistance)), - getNumber (_turretConfig >> QGVAR(MinDistance)) - ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision -}; - private ["_weaponDirection", "_angleTarget"]; _weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets @@ -45,10 +49,6 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr _angleTarget = asin (_weaponDirection select 2); -if (count _this > 2) then { - _distance = _this select 2; -}; - if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalculation))}) then { terminate GVAR(backgroundCalculation); }; From d7430065669c586c0dcf48e983bce72a586c86f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 18:38:08 -0300 Subject: [PATCH 6/7] make vector keybinds return false so they don't block fcs keyup EH --- addons/vector/initKeybinds.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/vector/initKeybinds.sqf b/addons/vector/initKeybinds.sqf index f81c280905..fb00e7acb3 100644 --- a/addons/vector/initKeybinds.sqf +++ b/addons/vector/initKeybinds.sqf @@ -15,7 +15,7 @@ // Statement ["azimuth"] call FUNC(onKeyDown); - true + false }, [15, [false, false, false]], false, @@ -34,7 +34,7 @@ // Statement ["azimuth"] call FUNC(onKeyUp); - true + false }, [15, [false, false, false]], false, From 4235bd8b912291258b847c33a0f407f291f10905 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 18 Mar 2015 17:57:55 +0100 Subject: [PATCH 7/7] restore lost files? --- .../fnc_actionCheckBloodPressure.sqf | 18 ++++++ .../fnc_actionCheckBloodPressureLocal.sqf | 60 +++++++++++++++++++ .../functions/fnc_actionCheckPulse.sqf | 18 ++++++ 3 files changed, 96 insertions(+) create mode 100644 addons/medical/functions/fnc_actionCheckBloodPressure.sqf create mode 100644 addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf create mode 100644 addons/medical/functions/fnc_actionCheckPulse.sqf diff --git a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf new file mode 100644 index 0000000000..7db155483e --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf @@ -0,0 +1,18 @@ +/* +* Author: Glowbal +* Action for checking the blood pressure of the patient +* +* Arguments: +* 0: The medic +* 1: The patient +* +* Return Value: +* NONE +* +* Public: No +*/ +#include "script_component.hpp" +private ["_caller","_target"]; +_caller = _this select 0; +_target = _this select 1; +[[_caller, _target], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf new file mode 100644 index 0000000000..f2d01573f0 --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -0,0 +1,60 @@ +/* + * Author: Glowbal + * Local callback for checking the blood pressure of a patient + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller","_target","_bloodPressure","_bloodPressureHigh","_bloodPressureLow","_title","_content"]; +_caller = _this select 0; +_target = _this select 1; + +_bloodPressure = [_target] call FUNC(getBloodPressure); +if (!alive _target) then { + _bloodPressure = [0,0]; +}; + +_bloodPressureHigh = _bloodPressure select 1; +_bloodPressureLow = _bloodPressure select 0; +_output = ""; +_logOutPut = ""; +if ([_caller] call FUNC(isMedic)) then { + _output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_1"; + _logOutPut = format["%1/%2",round(_bloodPressureHigh),round(_bloodPressureLow)]; +} else { + if (_bloodPressureHigh > 20) then { + _output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_2"; + _logOutPut = "Low"; + if (_bloodPressureHigh > 100) then { + _output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_3"; + _logOutPut = "Normal"; + if (_bloodPressureHigh > 160) then { + _output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_4"; + _logOutPut = "High"; + }; + + }; + } else { + if (random(10) > 3) then { + _output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_5"; + _logOutPut = "No Blood Pressure"; + } else { + _output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_6"; + }; + }; +}; + +["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent); + +if (_logOutPut != "") then { + [_target,"examine", format["%1 checked Blood Pressure: %2", [_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); +}; diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf new file mode 100644 index 0000000000..9fa79b2183 --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -0,0 +1,18 @@ +/* +* Author: Glowbal +* Action for checking the pulse or heart rate of the patient +* +* Arguments: +* 0: The medic +* 1: The patient +* +* Return Value: +* NONE +* +* Public: No +*/ +#include "script_component.hpp" +private ["_caller","_target","_title","_content"]; +_caller = _this select 0; +_target = _this select 1; +[[_caller, _target], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */