From eff31db1286dc535fe38bae61eb974d1edd1dff3 Mon Sep 17 00:00:00 2001 From: ulteq Date: Thu, 11 Jun 2015 21:50:43 +0200 Subject: [PATCH 1/5] HuntIR parachute falling speed experiment --- addons/huntir/functions/fnc_cam.sqf | 5 ++--- addons/huntir/functions/fnc_handleFired.sqf | 11 ++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index e922b2cbc1..70291951ed 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -125,7 +125,7 @@ GVAR(no_cams) sort true; }; }; - private ["_cam_coord_y", "_cam_coord_x", "_speed", "_cam_time", "_cam_pos"]; + private ["_cam_coord_y", "_cam_coord_x", "_cam_time", "_cam_pos"]; GVAR(logic) setPosATL (GVAR(pos) vectorAdd [0, 0, -5]); GVAR(logic) setDir GVAR(ROTATE); @@ -138,8 +138,7 @@ GVAR(no_cams) sort true; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; - _speed = 1 max abs((velocity GVAR(huntIR)) select 2); - _cam_time = ((GVAR(pos) select 2) - 20) / _speed; + _cam_time = (GVAR(pos) select 2) - 20; ctrlSetText [3, format["%1 s", round(_cam_time)]]; _cam_pos = getPosVisual GVAR(huntIR); _cam_pos = format ["X = %1, Y = %2", round (_cam_pos select 0), round (_cam_pos select 1)]; diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 91367ac864..c21a7f8b93 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -33,15 +33,20 @@ if (_ammo != "F_HuntIR") exitWith {}; _huntir setPosATL _position; [{ EXPLODE_1_PVT(_this select 0,_huntir); - private ["_deltaT"]; if (isNull _huntir) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + private ["_deltaT", "_velocity"]; + _velocity = velocity _huntir; if (damage _huntir > 0) then { _deltaT = ACE_time - (_huntir getVariable [QGVAR(lastTime), ACE_time]); - _huntir setVelocity (velocity _huntir vectorAdd [0, 0, -9.8066 * (damage _huntir) * _deltaT]); + _velocity = _velocity vectorAdd [0, 0, -9.8066 * (damage _huntir) * _deltaT]; _huntir setVariable [QGVAR(lastTime), ACE_time]; + } else { + _velocity set [2, -1]; }; + _huntir setVelocity _velocity; + _huntir setVectorUp [0, 0, 1]; }, 0.1, [_huntir]] call CBA_fnc_addPerFrameHandler; - }, [getPosATL _projectile vectorAdd [0, 0, 400]], 5, 0] call EFUNC(common,waitAndExecute); + }, [getPosATL _projectile vectorAdd [0, 0, 50]], 2, 0] call EFUNC(common,waitAndExecute); }, [_projectile], 5, 0] call EFUNC(common,waitAndExecute); From 4b0c4b9dd623bebf403a50338457938fef3858b9 Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 12 Jun 2015 18:01:53 +0200 Subject: [PATCH 2/5] handleDamage EH for the HuntIR --- addons/huntir/XEH_preInit.sqf | 1 + addons/huntir/data/model.cfg | 29 ++++++++++++++++++++ addons/huntir/functions/fnc_handleDamage.sqf | 25 +++++++++++++++++ addons/huntir/functions/fnc_handleFired.sqf | 1 + 4 files changed, 56 insertions(+) create mode 100644 addons/huntir/data/model.cfg create mode 100644 addons/huntir/functions/fnc_handleDamage.sqf diff --git a/addons/huntir/XEH_preInit.sqf b/addons/huntir/XEH_preInit.sqf index 0ae45c1540..7737030571 100644 --- a/addons/huntir/XEH_preInit.sqf +++ b/addons/huntir/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(cam); +PREP(handleDamage); PREP(handleFired); PREP(huntir); PREP(huntirCompass); diff --git a/addons/huntir/data/model.cfg b/addons/huntir/data/model.cfg new file mode 100644 index 0000000000..98d5c173c9 --- /dev/null +++ b/addons/huntir/data/model.cfg @@ -0,0 +1,29 @@ +class CfgModels +{ + class Default + { + sectionsInherit=""; + sections[]={}; + skeletonName=""; + }; + class ACE_HuntIR: Default + { + sectionsInherit="Default"; + sections[]={}; + skeletonName="ACE_HuntIR_Skeleton"; + }; +}; +class CfgSkeletons +{ + class Default + { + isDiscrete=1; + skeletonInherit=""; + skeletonBones[]={}; + }; + class ACE_HuntIR_Skeleton: Default + { + skeletonInherit="Default"; + skeletonBones[]={}; + }; +}; diff --git a/addons/huntir/functions/fnc_handleDamage.sqf b/addons/huntir/functions/fnc_handleDamage.sqf new file mode 100644 index 0000000000..34772d8a66 --- /dev/null +++ b/addons/huntir/functions/fnc_handleDamage.sqf @@ -0,0 +1,25 @@ +/* + * Author: Ruthberg + * + * Handles huntir damage + * + * Arguments: + * 0: huntir + * 1: selectionName + * 2: damage + * 3: source + * 4: projectile + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_5(_huntir,_selectionName,_damage,_source,_projectile); + +systemChat format["Selection: %1; Damage: %2", _selectionName, _damage]; + +_damage diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index c21a7f8b93..d3e9939b46 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -31,6 +31,7 @@ if (_ammo != "F_HuntIR") exitWith {}; private ["_huntir"]; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; + _huntir addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; [{ EXPLODE_1_PVT(_this select 0,_huntir); if (isNull _huntir) exitWith { From 1393b79a82b97d6d4aced15bfdc3d387b359cdde Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 12 Jun 2015 20:22:09 +0200 Subject: [PATCH 3/5] Reduced the descending speed of the parachute: * Adjusted the geometry LOD mass in the huntir.p3d * Fixed the calculating of the recording time --- addons/huntir/data/huntir.p3d | Bin 185724 -> 185724 bytes addons/huntir/functions/fnc_cam.sqf | 2 +- addons/huntir/functions/fnc_handleFired.sqf | 17 +++++++---------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/addons/huntir/data/huntir.p3d b/addons/huntir/data/huntir.p3d index ebf349672e3a22dcb39057b9e179b943d92c337a..e9b914741687a55f5453a27dcbd154efa01bdc33 100644 GIT binary patch delta 167 zcmeyfiu=zh?uHh|Elh{cOgE@!;+Y(~MG3^<+Wz|tQ$BP3qCIVP)WV^mruL*@M&;1$ KFE21nW&r@7z(@K3 delta 157 zcmeyfiu=zh?uHh|Elh{cOfJ}Bx&6->rab0)%U{dvsfAzsoa0CeW>gN{{_+CTWEKD^ Ck61te diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index 70291951ed..64bf9e37b8 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -138,7 +138,7 @@ GVAR(no_cams) sort true; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; - _cam_time = (GVAR(pos) select 2) - 20; + _cam_time = ACE_time - (GVAR(huntIR) getVariable [QGVAR(startTime), ACE_time]); ctrlSetText [3, format["%1 s", round(_cam_time)]]; _cam_pos = getPosVisual GVAR(huntIR); _cam_pos = format ["X = %1, Y = %2", round (_cam_pos select 0), round (_cam_pos select 1)]; diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index d3e9939b46..cf2454f173 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -31,23 +31,20 @@ if (_ammo != "F_HuntIR") exitWith {}; private ["_huntir"]; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; + _huntir setVariable [QGVAR(startTime), ACE_time, true]; _huntir addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; [{ EXPLODE_1_PVT(_this select 0,_huntir); if (isNull _huntir) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; - private ["_deltaT", "_velocity"]; - _velocity = velocity _huntir; if (damage _huntir > 0) then { - _deltaT = ACE_time - (_huntir getVariable [QGVAR(lastTime), ACE_time]); - _velocity = _velocity vectorAdd [0, 0, -9.8066 * (damage _huntir) * _deltaT]; - _huntir setVariable [QGVAR(lastTime), ACE_time]; - } else { - _velocity set [2, -1]; + private ["_velocity"]; + _velocity = velocity _huntir; + _velocity set [2, -1 min -20 * sqrt(damage _huntir)]; + _huntir setVelocity _velocity; + _huntir setVectorUp [0, 0, 1]; }; - _huntir setVelocity _velocity; - _huntir setVectorUp [0, 0, 1]; - }, 0.1, [_huntir]] call CBA_fnc_addPerFrameHandler; + }, 0, [_huntir]] call CBA_fnc_addPerFrameHandler; }, [getPosATL _projectile vectorAdd [0, 0, 50]], 2, 0] call EFUNC(common,waitAndExecute); }, [_projectile], 5, 0] call EFUNC(common,waitAndExecute); From 6fe7b1583218f7181034008ff1f7f60d73209d2f Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 12 Jun 2015 21:40:44 +0200 Subject: [PATCH 4/5] Removed debug output --- addons/huntir/functions/fnc_handleFired.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index cf2454f173..447d5a4435 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -32,7 +32,8 @@ if (_ammo != "F_HuntIR") exitWith {}; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; _huntir setVariable [QGVAR(startTime), ACE_time, true]; - _huntir addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; + // TODO: Edit the .p3d to allow doing the following _huntir getHit "camera"; _huntir getHit "parachute"; + //_huntir addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; [{ EXPLODE_1_PVT(_this select 0,_huntir); if (isNull _huntir) exitWith { From 62fc0a90e6abde0fb4be5fc0e3a53ce290cee2fd Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 12 Jun 2015 21:41:17 +0200 Subject: [PATCH 5/5] Removed the model.cfg --- addons/huntir/data/model.cfg | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 addons/huntir/data/model.cfg diff --git a/addons/huntir/data/model.cfg b/addons/huntir/data/model.cfg deleted file mode 100644 index 98d5c173c9..0000000000 --- a/addons/huntir/data/model.cfg +++ /dev/null @@ -1,29 +0,0 @@ -class CfgModels -{ - class Default - { - sectionsInherit=""; - sections[]={}; - skeletonName=""; - }; - class ACE_HuntIR: Default - { - sectionsInherit="Default"; - sections[]={}; - skeletonName="ACE_HuntIR_Skeleton"; - }; -}; -class CfgSkeletons -{ - class Default - { - isDiscrete=1; - skeletonInherit=""; - skeletonBones[]={}; - }; - class ACE_HuntIR_Skeleton: Default - { - skeletonInherit="Default"; - skeletonBones[]={}; - }; -};