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/huntir.p3d b/addons/huntir/data/huntir.p3d index ebf349672e..e9b9147416 100644 Binary files a/addons/huntir/data/huntir.p3d and b/addons/huntir/data/huntir.p3d differ diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index e922b2cbc1..64bf9e37b8 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 = 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_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 91367ac864..447d5a4435 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -31,17 +31,21 @@ if (_ammo != "F_HuntIR") exitWith {}; private ["_huntir"]; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; + _huntir setVariable [QGVAR(startTime), ACE_time, true]; + // 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); - private ["_deltaT"]; if (isNull _huntir) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; 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]); - _huntir setVariable [QGVAR(lastTime), ACE_time]; + private ["_velocity"]; + _velocity = velocity _huntir; + _velocity set [2, -1 min -20 * sqrt(damage _huntir)]; + _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); + }, 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);