From 6124c26585acfae74f2ad01997b25638e2b27bd3 Mon Sep 17 00:00:00 2001 From: He-Man Date: Mon, 5 Aug 2019 20:39:03 +0200 Subject: [PATCH] Vehicle Lock - differ between Base / Field + Colorized Messages --- .../@epochhive/epochconfig.hpp | 3 ++- .../EPOCH_server_lockVehicle.sqf | 23 +++++++++++++++---- .../epoch_server/init/server_variables.sqf | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Server_Install_Pack/@epochhive/epochconfig.hpp b/Server_Install_Pack/@epochhive/epochconfig.hpp index 2404871b..16fd9ef8 100644 --- a/Server_Install_Pack/@epochhive/epochconfig.hpp +++ b/Server_Install_Pack/@epochhive/epochconfig.hpp @@ -201,7 +201,8 @@ forceRestartTime = 14400; // 4 hour restarts DEBUG_VEH = "false"; // DEBUG ONLY used to debug spawing of vehicles // Hive Related - vehicleLockTime = "1800"; // Controls how many seconds it takes to allow another person/group to unlock vehicle. + vehicleLockTime = "1800"; // Controls how many seconds it takes to allow another person/group to unlock vehicle (outside your own PlotPole Range). + vehicleLockTimeHome = "259200"; // Controls how many seconds it takes to allow another person/group to unlock vehicle (inside your own PlotPole Range). expiresBuilding = "604800"; // expiration date in seconds for buildings expiresPlayer = "2592000"; // expiration date in seconds for players expiresBank = "7776000"; // expiration date in seconds for players bank diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockVehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockVehicle.sqf index da0f4be4..37d0222d 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockVehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockVehicle.sqf @@ -13,7 +13,7 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockVehicle.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_VehLockMessages","_msg","_crew","_driver","_isLocked","_lockOwner","_lockedOwner","_logic","_playerGroup","_playerUID","_response","_vehLockHiveKey","_vehSlot"]; +private ["_VehLockMessages","_msg","_crew","_driver","_isLocked","_lockOwner","_lockedOwner","_logic","_playerGroup","_playerUID","_response","_vehLockHiveKey","_vehSlot","_nearhome"]; //[[[end]]] params [ ["_vehicle",objNull,[objNull]], @@ -38,6 +38,7 @@ if (_playerGroup != "") then { }; _lockedOwner = "-1"; +_nearhome = false; _vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"]; _vehLockHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _vehSlot]; if (_vehSlot != "ABORT") then { @@ -82,7 +83,8 @@ if (_logic) then { if (_value) then { if !(_vehSlot isequalto "ABORT") then { - ["VehicleLock", _vehLockHiveKey, EPOCH_vehicleLockTime, [_lockOwner]] call EPOCH_fnc_server_hiveSETEX; + _nearhome = {(_x getVariable["BUILD_OWNER", "-1"]) in [_lockOwner] && {((_vehicle distance _x) < (getnumber (missionconfigfile >> "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))}} count Epoch_PlotPoles > 0; + ["VehicleLock", _vehLockHiveKey, if (_nearhome) then {EPOCH_vehicleLockTimeHome} else {EPOCH_vehicleLockTime}, [_lockOwner]] call EPOCH_fnc_server_hiveSETEX; } else { _vehicle setvariable ["EPOCH_LockedOwner",_lockOwner]; @@ -102,8 +104,21 @@ if (_logic) then { [_vehicle, _value] remoteExec ['EPOCH_client_lockVehicle',_vehicle]; }; if (_VehLockMessages) then { - _msg = if (_value) then {"Vehicle Locked"} else {"Vehicle unlocked"}; - [_msg,5] remoteExec ["Epoch_Message",_player]; + if (_value) then { + _msg = format ["Vehicle Locked for %1 ", + if (_nearhome && {(call compile EPOCH_vehicleLockTimeHome) > (call compile EPOCH_vehicleLockTime)}) then { + (((call compile EPOCH_vehicleLockTimeHome)/60/60) toFixed 1) + " hours - Base Lock" + } + else { + (((call compile EPOCH_vehicleLockTime)/60/60) toFixed 1) + " hours" + } + ]; + [_msg,10,[[1,0,0,0.2],[1,1,1,1]]] remoteExec ["Epoch_Message",_player]; + } + else { + _msg = "Vehicle unlocked"; + [_msg,10,[[0,1,0,0.2],[1,1,1,1]]] remoteExec ["Epoch_Message",_player]; + }; }; } else { diff --git a/Sources/epoch_server/init/server_variables.sqf b/Sources/epoch_server/init/server_variables.sqf index a1b2fc8c..1a0b310c 100644 --- a/Sources/epoch_server/init/server_variables.sqf +++ b/Sources/epoch_server/init/server_variables.sqf @@ -40,6 +40,7 @@ private _configArray = [ ["showShippingContainers", true], ["cloneCost", 100], ["vehicleLockTime", "1800"], + ["vehicleLockTimeHome", "259200"], ["antagonistChancePDeath", 0.33], ["taxRate", 0.1], ["starterTraderItems", [[], []]],