Skip to content

Commit

Permalink
Intercom - Improve Infantry Phone Limitations and add Custom Position…
Browse files Browse the repository at this point in the history
…s to Vanilla Vehicles (#1306)
  • Loading branch information
mrschick authored Jul 3, 2024
1 parent 7bca566 commit 63a34eb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
61 changes: 60 additions & 1 deletion addons/sys_intercom/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class CfgVehicles {
connectedByDefault = 1;
};
};

acre_hasInfantryPhone = 0;
acre_infantryPhoneIntercom[] = {"all"};
acre_infantryPhoneControlActions[] = {"intercom_1"};
acre_eventInfantryPhone = QFUNC(noApiFunction);
};

class LandVehicle;
Expand Down Expand Up @@ -139,6 +144,18 @@ class CfgVehicles {
connectedByDefault = 0;
};
};

acre_hasInfantryPhone = 1;
acre_infantryPhonePosition[] = {-0.70, -4.61, -1.00};
};

class AFV_Wheeled_01_base_F: Wheeled_APC_F {
acre_hasInfantryPhone = 1;
acre_infantryPhonePosition[] = {-1.24, -4.35, -0.81};
};

class AFV_Wheeled_01_up_base_F: AFV_Wheeled_01_base_F {
acre_infantryPhonePosition[] = {-1.24, -4.35, -0.92};
};

// OPFOR
Expand All @@ -147,6 +164,21 @@ class CfgVehicles {
acre_infantryPhonePosition[] = {1.38, -4.77, -1.1};
};

class O_MBT_02_railgun_base_F;
class O_MBT_02_railgun_F: O_MBT_02_railgun_base_F {
acre_infantryPhonePosition[] = {1.38, -4.77, -1.1};
};

class MBT_04_cannon_base_F;
class O_MBT_04_cannon_F: MBT_04_cannon_base_F {
acre_infantryPhonePosition[] = {-1.47, -5.68, -0.82};
};

class MBT_04_command_base_F;
class O_MBT_04_command_F: MBT_04_command_base_F {
acre_infantryPhonePosition[] = {-1.47, -5.68, -1.17};
};

class O_MBT_02_arty_base_F;
class O_MBT_02_arty_F: O_MBT_02_arty_base_F {
acre_infantryPhonePosition[] = {1.4, -5.4, -1.65};
Expand Down Expand Up @@ -182,7 +214,7 @@ class CfgVehicles {
};

class APC_Wheeled_02_base_F;
class O_APC_Wheeled_02_base_F: APC_Wheeled_02_base_F {
class APC_Wheeled_02_base_v2_F: APC_Wheeled_02_base_F {
class AcreIntercoms {
class Intercom_1 {
displayName = CSTRING(crewIntercom);
Expand All @@ -202,6 +234,9 @@ class CfgVehicles {
connectedByDefault = 0;
};
};

acre_hasInfantryPhone = 1;
acre_infantryPhonePosition[] = {1.10, -4.45, -0.65};
};

// INDEPENDENT
Expand Down Expand Up @@ -256,6 +291,30 @@ class CfgVehicles {
connectedByDefault = 0;
};
};

acre_hasInfantryPhone = 1;
acre_infantryPhonePosition[] = {-0.70, -4.51, -0.67};
};

class LT_01_base_F;
class LT_01_AA_base_F: LT_01_base_F;
class I_LT_01_AA_F: LT_01_AA_base_F {
acre_infantryPhonePosition[] = {-1.10, -1.66, -0.83};
};

class LT_01_AT_base_F: LT_01_base_F;
class I_LT_01_AT_F: LT_01_AT_base_F {
acre_infantryPhonePosition[] = {-1.10, -1.66, -0.83};
};

class LT_01_cannon_base_F: LT_01_base_F;
class I_LT_01_cannon_F: LT_01_cannon_base_F {
acre_infantryPhonePosition[] = {-1.10, -1.90, -0.78};
};

class LT_01_scout_base_F: LT_01_base_F;
class I_LT_01_scout_F: LT_01_scout_base_F {
acre_infantryPhonePosition[] = {-1.10, -1.90, -0.78};
};

class Air;
Expand Down
3 changes: 2 additions & 1 deletion addons/sys_intercom/fnc_infantryPhoneAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ private _infantryPhoneAction = [
// Only manually check distance if under main node (not a custom position on hull)
// Main interaction node is not shown on destroyed vehicle, so we only check that if not main node
//USES_VARIABLES ["_target", "_player"];
if ((_this select 2) isNotEqualTo [0, 0, 0]) exitWith {alive _target};
private _targetAlive = alive _target;
if (!_targetAlive || {(_this select 2) isNotEqualTo [0, 0, 0]}) exitWith {_targetAlive};
([_player, _target] call ace_interaction_fnc_getInteractionDistance) < PHONE_MAXDISTANCE_DEFAULT
},
{_this call FUNC(infantryPhoneChildrenActions)},
Expand Down
2 changes: 1 addition & 1 deletion addons/sys_intercom/fnc_intercomPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for "_i" from 0 to ((count _intercoms) - 1) do {
private _playerPosition = ASLToAGL (getPosASL _player);
TRACE_4("Infantry Phone PFH Check",_infantryPhonePosition,_playerPosition,_infantryPhoneMaxDistance,_player distance _infantryPhonePosition);
// Add an extra meter leeway due to 3d position check height differences and movement
if (_playerPosition distance _infantryPhonePosition >= _infantryPhoneMaxDistance + 1 || {vehicle _player == _vehicle} || {!alive _player} || {captive _player}) then {
if (_playerPosition distance _infantryPhonePosition >= _infantryPhoneMaxDistance + 1 || {vehicle _player == _vehicle} || {!alive _player} || {captive _player} || {lifeState _player isEqualTo "INCAPACITATED"}) then {
[_vehicle, _player, 0, _i] call FUNC(updateInfantryPhoneStatus);
_intercomUnits = [];
} else {
Expand Down

0 comments on commit 63a34eb

Please sign in to comment.