mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1585 from acemod/huntirParachuteSpeed
HuntIR parachute falling speed experiment
This commit is contained in:
commit
1cbe972999
@ -3,6 +3,7 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(cam);
|
||||
PREP(handleDamage);
|
||||
PREP(handleFired);
|
||||
PREP(huntir);
|
||||
PREP(huntirCompass);
|
||||
|
Binary file not shown.
@ -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)];
|
||||
|
25
addons/huntir/functions/fnc_handleDamage.sqf
Normal file
25
addons/huntir/functions/fnc_handleDamage.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Handles huntir damage
|
||||
*
|
||||
* Arguments:
|
||||
* 0: huntir <OBJECT>
|
||||
* 1: selectionName <STRING>
|
||||
* 2: damage <NUMBER>
|
||||
* 3: source <OBJECT>
|
||||
* 4: projectile <STRING>
|
||||
*
|
||||
* 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
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user