diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf index 3220fb8d..3cba8dfc 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf @@ -55,7 +55,32 @@ if(_deathMarkerON && ('ItemGPS' in (assignedItems _unit)))then{ profileNameSpace setVariable["EPOCHLastKnownDeath",getPos _unit]; }; -[player,_killer,toArray profileName,Epoch_personalToken] remoteExec ["EPOCH_server_deadPlayer",2]; +// Check, if Player got killed by another Player (opponent) in his Base +_homekill = false; +if (_unit !=_killer) then { + if (isplayer _killer) then { + if !(_killer in (units (group Player))) then { + _SupressBaseSpawnOnHomekillTime = ["CfgEpochClient", "SupressBaseSpawnOnHomekillTime", 0] call EPOCH_fnc_returnConfigEntryV2; + if (_SupressBaseSpawnOnHomekillTime > 0) then { + _jammer = nearestObjects[player, call EPOCH_JammerClasses, ["CfgEpochClient", "minJammerDistance", 650] call EPOCH_fnc_returnConfigEntryV2]; + if !(_jammer isEqualTo []) then { + _nearestJammer = _jammer select 0; + if ((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) then { + _CfgEpochClient = 'CfgEpochClient' call EPOCH_returnConfig; + _JammerConfig = (_CfgEpochClient >> "CfgJammers" >> (typeof _nearestJammer)); + _buildingJammerRange = getnumber (_JammerConfig >> "buildingJammerRange"); + if (_unit distance _nearestJammer < _buildingJammerRange) then { + _homekill = true; + [format ["Base Spawn disabled for %1 minutes (killed in your Territory)",(_SupressBaseSpawnOnHomekillTime/60) tofixed 1],5] call Epoch_Message; + }; + }; + }; + }; + }; + }; +}; + +[player,_killer,toArray profileName,Epoch_personalToken,_homekill] remoteExec ["EPOCH_server_deadPlayer",2]; // disable build mode EPOCH_buildMode = 0; diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 54a8a909..ddbd3ae0 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -41,6 +41,7 @@ class CfgEpochClient baseThirstLoss = 2; // increase number to speed up rate of Thirst loss accelerateHTALoss = "false"; // use server's time acceleration to increase the rate of Hunger, Thirst and Alcohol loss + SupressBaseSpawnOnHomekillTime = 1200; // Suppress Base Spawn for xxx seconds, when Player got Killed by an opponent in his own Territory buildingNearbyMilitary = 0; //1 to allow building nearby buildingNearbyMilitaryRange = 300; //Define radius of blocked area buildingNearbyMilitaryClasses[] = {"Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"}; diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayer.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayer.sqf index 4aebfb27..7ec46c38 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayer.sqf @@ -15,7 +15,7 @@ //[[[cog import generate_private_arrays ]]] private ["_bankBalance","_bankData","_cIndex","_current_crypto","_defaultVars","_playerName","_playerUID","_pos","_response","_triggerType","_vars","_killerUID","_deathType","_killerCommunityStats","_mIndex","_current_murders","_communityStats","_sIndex","_current_suicides","_dIndex","_current_deaths","_playerKarmaAdj","_killerKarmaAdj","_kIndex","_playerCStats","_playerKarma","_playerIsNeutral","_playerIsBandit","_playerIsHero","_killerCStats","_killerKarma","_karmaLimitsArray","_lowKarmaLevel1","_highKarmaLevel1"]; //[[[end]]] -params ["_playerObj","_killer","_playerName",["_token","",[""]] ]; +params ["_playerObj","_killer","_playerName",["_token","",[""]], ["_homekill",false]]; // handle token check and isnull for _player if !([_playerObj, _token] call EPOCH_server_getPToken) exitWith{}; @@ -141,3 +141,20 @@ if (EPOCH_cloneCost > 0) then { ["Bank", _playerUID, EPOCH_expiresBank, [_bankBalance]] call EPOCH_fnc_server_hiveSETEX; }; }; + +// Check for BaseKill and skip Base Spawn for the next xxx seconds +if (_homekill) then { + _SupressBaseSpawnOnHomekillTime = ["CfgEpochClient", "SupressBaseSpawnOnHomekillTime", 0] call EPOCH_fnc_returnConfigEntryV2; + if (isnil "Epoch_BaseSpawnSkips") then { + Epoch_BaseSpawnSkips = [[],[]]; + }; + Epoch_BaseSpawnSkips params ["_SpawnSkipUIDs","_SpawnSkipTimers"]; + _idx = _SpawnSkipUIDs find _playerUID; + if (_idx > -1) then { + _SpawnSkipTimers set [_idx,diag_ticktime + _SupressBaseSpawnOnHomekillTime]; + } + else { + _SpawnSkipUIDs pushback _playerUID; + _SpawnSkipTimers pushback (diag_ticktime + _SupressBaseSpawnOnHomekillTime); + }; +}; diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf index 63971599..112dbc7d 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf @@ -145,6 +145,16 @@ if (!isNull _player) then { }; }; if (_newLocation isEqualType [] && {(count _newLocation) == 3}) then { + + // Check for BaseKill and skip Base Spawn + Epoch_BaseSpawnSkips params ["_SpawnSkipUIDs","_SpawnSkipTimers"]; + _SpawnSkipTime = 0; + _idx = _SpawnSkipUIDs find _playerUID; + if (_idx > -1) then { + _SpawnSkipTime = _SpawnSkipTimers select _idx; + }; + if (_SpawnSkipTime > diag_ticktime) exitwith {}; + _CheckLocation = _newLocation; if (surfaceiswater _newLocation) then { _CheckLocation = ATLToASL _newLocation;