diff --git a/Sources/epoch_code/compile/event_handlers/EPOCH_getInMan.sqf b/Sources/epoch_code/compile/event_handlers/EPOCH_getInMan.sqf index 86e357c3..dc2bb453 100644 --- a/Sources/epoch_code/compile/event_handlers/EPOCH_getInMan.sqf +++ b/Sources/epoch_code/compile/event_handlers/EPOCH_getInMan.sqf @@ -23,8 +23,10 @@ if (_unit == player) then { EPOCH_Target = objNull; }; if (missionnamespace getvariable ["EPOCH_AutoEarplug",false]) then { - systemchat 'Earplugs have been auto-inserted...'; - EPOCH_Earplugsin = true; - 1 fadeSound 0.15; + if !(EPOCH_Earplugsin) then { + systemchat 'Earplugs have been auto-inserted...'; + EPOCH_Earplugsin = true; + 1 fadeSound 0.15; + }; }; }; diff --git a/Sources/epoch_code/compile/event_handlers/EPOCH_getOutMan.sqf b/Sources/epoch_code/compile/event_handlers/EPOCH_getOutMan.sqf index 1c83e26f..b8ca5712 100644 --- a/Sources/epoch_code/compile/event_handlers/EPOCH_getOutMan.sqf +++ b/Sources/epoch_code/compile/event_handlers/EPOCH_getOutMan.sqf @@ -37,8 +37,10 @@ if (_unit == player) then { } forEach lineintersectsobjs [_start, _end, player, _vehicle, true, 2]; }; if (missionnamespace getvariable ["EPOCH_AutoEarplug",false]) then { - systemchat 'Earplugs have been auto-removed...'; - EPOCH_Earplugsin = false; - 1 fadeSound 1; + if (EPOCH_Earplugsin) then { + systemchat 'Earplugs have been auto-removed...'; + EPOCH_Earplugsin = false; + 1 fadeSound 1; + }; }; }; diff --git a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf index ccc372a0..467e59a4 100644 --- a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf +++ b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf @@ -106,6 +106,17 @@ if (_dikCode == EPOCH_keysEPad) then { }; }; +if (_dikCode == EPOCH_Earplugs) then { + if (EPOCH_Earplugsin) then { + EPOCH_Earplugsin = false; + 1 fadeSound 1; + } + else { + EPOCH_Earplugsin = true; + 1 fadeSound 0.15; + }; +}; + //Action Menu if (_dikCode == EPOCH_keysAction) then { //_handled = true; @@ -255,16 +266,6 @@ if (vehicle player == player) then { player switchMove ""; }; }; - if (_dikCode == EPOCH_Earplugs) then { - if (EPOCH_Earplugsin) then { - EPOCH_Earplugsin = false; - 1 fadeSound 1; - } - else { - EPOCH_Earplugsin = true; - 1 fadeSound 0.15; - }; - }; }; // end player only code EPOCH_favBar_itemConsumed = false; diff --git a/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearPlayers.sqf b/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearPlayers.sqf index 7752888f..3447dc70 100644 --- a/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearPlayers.sqf +++ b/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearPlayers.sqf @@ -1,14 +1,23 @@ -//[[[cog import generate_private_arrays ]]] -private ["_plyr","_plyrs","_trdrMsg"]; -//[[[end]]] -_trdrMsg = "Do I look like the local Neighbourhood Watch..? No, I do not !"; -_plyrs = []; -_plyrs = player nearEntities [["Epoch_Man_base_F","Epoch_Female_base_F"], 250]; -if (count _plyrs < 2) then { - _trdrMsg = format["Apart from you %1. %2",name player, selectRandom ["I haven't seen any round these parts for a long while.","It has been very quiet around here,","There is not much to report !"]]; -} else { - _plyrs deleteAt 0; - _plyr = selectRandom _plyrs; - _trdrMsg = format["%2 %1.",name _plyr, selectRandom ["The last person picked up by the UAV was","I did spot someone earlier, their name was","I heard there was somebody new in the area, "]]; +params [["_EnergyRequired",250],["_radius",250]]; +if (missionnamespace getvariable ["Epoch_PlayerScanActive",false]) exitwith {}; +if (EPOCH_playerEnergy - _EnergyRequired < 0) exitwith { + [format ['You need %1 Energy to scan for near Players',_EnergyRequired], 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; }; -[_trdrMsg, 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; +Epoch_PlayerScanActive = true; +["Energy",-_EnergyRequired] call Epoch_GiveAttributes; +_radius spawn { + private ["_plyr","_plyrs","_trdrMsg"]; + ["Scanning for near Players... Please wait...", 10,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; + uisleep (5 + random 3); + _trdrMsg = ""; + _plyrs = (player nearEntities _this) select {isplayer _x}; + if (count _plyrs < 2) then { + _trdrMsg = format["Apart from you %1. %2",name player, selectRandom ["I haven't seen any round these parts for a long while.","It has been very quiet around here,","There is not much to report !"]]; + } else { + _plyrs deleteAt 0; + _plyr = selectRandom _plyrs; + _trdrMsg = format["%2 %1.",name _plyr, selectRandom ["The last person picked up by the UAV was","I did spot someone earlier, their name was","I heard there was somebody new in the area, "]]; + }; + [_trdrMsg, 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; + Epoch_PlayerScanActive = nil; +}; \ No newline at end of file diff --git a/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearVehicles.sqf b/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearVehicles.sqf index 0cba4977..173c60a4 100644 --- a/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearVehicles.sqf +++ b/Sources/epoch_code/gui/scripts/e_pad/Apps/traderDiag_nearVehicles.sqf @@ -1,15 +1,23 @@ -//[[[cog import generate_private_arrays ]]] -private ["_dist","_plyr","_trdrMsg","_veh","_vehs"]; -//[[[end]]] -_trdrMsg = "Hey, there is a garage down the road.. Well, there used to be."; -_vehs = []; -_plyr = player; -_vehs = nearestObjects [_plyr, ["CAR","AIR"], 1000]; -if (count _vehs < 1) then { - _trdrMsg = format["%2 %1.",name _plyr,selectRandom["I haven't seen anything lately","There is nothing around here","The last time the UAV went out it found nothing"]]; -} else { - _veh = _vehs select (floor (random count _vehs)); - _dist = _veh distance _plyr; - _trdrMsg = format["I know of at least one vehicle within about %1m. It looks like a %2.",round (_dist/2 + (random _dist)) , (typeof _veh) call EPOCH_itemDisplayName]; +params [["_EnergyRequired",250],["_radius",250]]; +if (missionnamespace getvariable ["Epoch_VehicleScanActive",false]) exitwith {}; +if (EPOCH_playerEnergy - _EnergyRequired < 0) exitwith { + [format ['You need %1 Energy to scan for near Players',_EnergyRequired], 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; +}; +Epoch_VehicleScanActive = true; +["Energy",-_EnergyRequired] call Epoch_GiveAttributes; +_radius spawn { + private ["_dist","_trdrMsg","_veh","_vehs"]; + ["Scanning for near Vehicles... Please wait...", 10,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; + uisleep (5 + random 3); + _trdrMsg = ""; + _vehs = player nearEntities [["Landvehicle","SHIP","AIR","TANK"],_this]; + if (count _vehs < 1) then { + _trdrMsg = format["%2 %1.",name player,selectRandom["I haven't seen anything lately","There is nothing around here","The last time the UAV went out it found nothing"]]; + } else { + _veh = selectrandom _vehs; + _dist = ceil ((_veh distance player) / 100) * 100; + _trdrMsg = format["I know of at least one vehicle within about %1m. It looks like a %2.",_dist, (typeof _veh) call EPOCH_itemDisplayName]; + }; + [_trdrMsg, 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; + Epoch_VehicleScanActive = nil; }; -[_trdrMsg, 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message; diff --git a/Sources/epoch_config/Configs/CfgEPad.hpp b/Sources/epoch_config/Configs/CfgEPad.hpp index 8fd84806..c88823d3 100644 --- a/Sources/epoch_config/Configs/CfgEPad.hpp +++ b/Sources/epoch_config/Configs/CfgEPad.hpp @@ -177,8 +177,8 @@ class e_pad_config Icon = ""; color[] = {1,1,1,1}; colortoggled[] = {0,1,0,1}; - action = "call compile preprocessfilelinenumbers ""epoch_code\gui\scripts\e_pad\Apps\traderDiag_nearVehicles.sqf"""; - Tooltip = "Vehicles Nearby?"; + action = "[250,1000] call compile preprocessfilelinenumbers ""epoch_code\gui\scripts\e_pad\Apps\traderDiag_nearVehicles.sqf"""; + Tooltip = "Scan for near Vehicles (costs 250 energy)"; ToggleVar = ""; ToggleAble = "false"; }; @@ -189,8 +189,8 @@ class e_pad_config Icon = ""; color[] = {1,1,1,1}; colortoggled[] = {0,1,0,1}; - action = "call compile preprocessfilelinenumbers ""epoch_code\gui\scripts\e_pad\Apps\traderDiag_nearPlayers.sqf"""; - Tooltip = "Players Nearby?"; + action = "[250,250] call compile preprocessfilelinenumbers ""epoch_code\gui\scripts\e_pad\Apps\traderDiag_nearPlayers.sqf"""; + Tooltip = "Scan for near Players (costs 250 energy)"; ToggleVar = ""; ToggleAble = "false"; };