Skip to content

Commit

Permalink
Merge pull request #1622 from acemod/huntirHitpoints
Browse files Browse the repository at this point in the history
Added 'parachute' and 'camera' hitpoints to the HuntIR model:
  • Loading branch information
ulteq committed Jun 18, 2015
2 parents 95ae42e + 32f02b7 commit c3fea42
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 38 deletions.
37 changes: 33 additions & 4 deletions addons/huntir/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,45 @@ class CfgVehicles {

class Parachute_02_base_F;
class ACE_HuntIR: Parachute_02_base_F {
scope = 1;
author = ECSTRING(common,ACETeam);
castDriverShadow = 0;
destrType = "DestructDefault";
displayName = "HuntIR";
model = PATHTOF(data\huntir.p3d);
castDriverShadow = 0;
soundEnviron[] = {"z\ace\addons\apl\sounds\padak_let", 0.316228, 1, 80};
scope = 1;
soundCrash[] = {"", db-30, 1 };
soundEnviron[] = {"z\ace\addons\apl\sounds\padak_let", 0.316228, 1, 80};
soundLandCrash[] = {"", db-30, 1 };
soundWaterCrash[] = {"", db10, 1 };
mapSize = 0;
class HitPoints {
class HitEngine {
armor = 0;
material = -1;
name = "";
visual = "";
radius = 0;
passThrough = 0;
explosionShielding = 0;
};
class HitParachute {
armor = 0.0001;
material = -1;
name = "parachute";
visual = "";
radius = 0.2;
passThrough = 1;
explosionShielding = 0;
};
class HitCamera {
armor = 0.001;
material = -1;
name = "camera";
visual = "";
radius = 0.025;
passThrough = 1;
explosionShielding = 1;
};
};
};

class Item_Base_F;
Expand Down
1 change: 0 additions & 1 deletion addons/huntir/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
ADDON = false;

PREP(cam);
PREP(handleDamage);
PREP(handleFired);
PREP(huntir);
PREP(huntirCompass);
Expand Down
Binary file modified addons/huntir/data/huntir.p3d
Binary file not shown.
4 changes: 2 additions & 2 deletions addons/huntir/functions/fnc_cam.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ GVAR(no_cams) sort true;
[{
GVAR(nearHuntIRs) = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE];
{
if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))} && {damage _x < 0.5}) then {
if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))} && {_x getHitPointDamage "HitCamera" < 0.25}) then {
GVAR(no_cams) pushBack _x;
};
} forEach GVAR(nearHuntIRs);
{
if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))} || {damage _x >= 0.5}) then {
if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))} || {_x getHitPointDamage "HitCamera" >= 0.25}) then {
GVAR(no_cams) deleteAt _forEachIndex;
if (_forEachIndex < GVAR(cur_cam)) then {
GVAR(cur_cam) = GVAR(cur_cam) - 1;
Expand Down
25 changes: 0 additions & 25 deletions addons/huntir/functions/fnc_handleDamage.sqf

This file was deleted.

9 changes: 4 additions & 5 deletions addons/huntir/functions/fnc_handleFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ if (_ammo != "F_HuntIR") exitWith {};
_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);
if (isNull _huntir) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
if (damage _huntir > 0) then {
private ["_velocity"];
private ["_parachuteDamage", "_velocity"];
_parachuteDamage = _huntir getHitPointDamage "HitParachute";
if (_parachuteDamage > 0) then {
_velocity = velocity _huntir;
_velocity set [2, -1 min -20 * sqrt(damage _huntir)];
_velocity set [2, -1 min -20 * sqrt(_parachuteDamage)];
_huntir setVelocity _velocity;
_huntir setVectorUp [0, 0, 1];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/huntir/functions/fnc_huntir.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ createDialog "ace_huntir_cam_dialog_off";
if (_elapsedTime > 10) then {
GVAR(state) = "noGDS";
};
if (_elapsedTime > 5 && {count _nearestHuntIRs > 0}) then {
if (_elapsedTime > 5 && {{_x getHitPointDamage "HitCamera" < 0.25} count _nearestHuntIRs > 0}) then {
GVAR(state) = "connecting";
};
};
Expand Down

0 comments on commit c3fea42

Please sign in to comment.