From 51a6ff3e315f322948e95a822309b3ed48222e78 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 10 Dec 2016 20:13:15 +0100 Subject: [PATCH 1/6] Changed back Epoch EPOCH_fnc_playerDeath Changed back Epoch EPOCH_fnc_playerDeath since setPlayerRespawnTime to prevent respawning before timer ends and display close. --- .../functions/EPOCH_fnc_playerDeath.sqf | 51 ++++++++----------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf index 3236c4b9..7b65cfd6 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf @@ -22,10 +22,8 @@ Returns: BOOL */ - - //[[[cog import generate_private_arrays ]]] -private ["_Epoch_PlayerRespawnTime","_config","_doRevenge","_playerDeathScreen","_playerKilledScreen","_playerRevengeMinAliveTime","_tapDiag"]; +private ["_config","_doRevenge","_playerDeathScreen","_playerKilledScreen","_playerRevengeMinAliveTime","_tapDiag"]; //[[[end]]] params [["_unit",objNull,[objNull]],["_killer",objNull,[objNull]] ]; _config = 'CfgEpochClient' call EPOCH_returnConfig; @@ -35,49 +33,40 @@ if (_playerDeathScreen isEqualTo "") then {_playerDeathScreen = "TapOut"}; _tapDiag = _playerDeathScreen; // diag_log format ["DEBUG: EPOCH_playerAliveTime %1",EPOCH_playerAliveTime]; _doRevenge = ((getNumber(_config >> "playerDisableRevenge") isEqualTo 0) && EPOCH_playerAliveTime >= _playerRevengeMinAliveTime); - + // test ejecting unit from vehicle if dead client side if (vehicle _unit != _unit) then { - _unit action["Eject", vehicle _unit]; + _unit action["Eject", vehicle _unit]; }; - + [player,_killer,toArray profileName,Epoch_personalToken] remoteExec ["EPOCH_server_deadPlayer",2]; - + // disable build mode EPOCH_buildMode = 0; EPOCH_snapDirection = 0; EPOCH_Target = objNull; - + // playerKilledScreen _playerKilledScreen = getText(_config >> "playerKilledScreen"); if (_playerKilledScreen isEqualTo "") then {_playerKilledScreen = "TapOut2"}; if(_doRevenge && player != _killer && (isPlayer _killer || isPlayer (effectiveCommander _killer)))then{_tapDiag = _playerKilledScreen};//TODO: vehicle check may not always be reliable - + if (Epoch_canBeRevived) then { setPlayerRespawnTime 600; - _Epoch_PlayerRespawnTime = 600; - createDialog _tapDiag; + createDialog _tapDiag; } else { setPlayerRespawnTime 15; - _Epoch_PlayerRespawnTime = 15; - ["You can be just revived once per life!", 5] call Epoch_message; + ["You can be just revived once per life!", 5] call Epoch_message; }; - -[_killer, _tapDiag, _Epoch_PlayerRespawnTime] spawn{ - params ["_killer2","_tapDiag2","_Epoch_PlayerRespawnTime"]; - while {!alive player} do { - _Epoch_PlayerRespawnTime = _Epoch_PlayerRespawnTime - 0.1; - if (playerRespawnTime < 0) then { - _Layer = 'RespawnTimer' call BIS_fnc_rscLayer; - _txt = format ["Respawn in %1 seconds",round _Epoch_PlayerRespawnTime]; - [_txt,0,0.75*safezoneH+safezoneY,0,0,0,_Layer] spawn bis_fnc_dynamicText; - }; - if (_Epoch_PlayerRespawnTime <= 1) exitWith{ (findDisplay 46) closeDisplay 0; }; - if (_Epoch_PlayerRespawnTime > 15 && !dialog) then {createDialog _tapDiag2;}; - if (isObjectHidden player) then {closeDialog 2;}; - if(player getVariable["EPOCH_doBoom",false])exitWith{player setVariable ["EPOCH_doBoom",nil]; call EPOCH_fnc_playerDeathDetonate;}; - if(player getVariable["EPOCH_doMorph",false])exitWith{player setVariable ["EPOCH_doMorph",nil];[selectRandom (getArray (getMissionConfig "CfgEpochClient" >> "deathMorphClass")),player,_killer2] call EPOCH_fnc_playerDeathMorph;}; - uiSleep 0.1; - }; + +[_killer, _tapDiag] spawn{ + params ["_killer2","_tapDiag2"]; + while {!alive player} do { + if (playerRespawnTime <= 1) exitWith{ (findDisplay 46) closeDisplay 0; }; + if (playerRespawnTime > 15 && !dialog) then {createDialog _tapDiag2;}; + if (isObjectHidden player) then {closeDialog 2;}; + if(player getVariable["EPOCH_doBoom",false])exitWith{player setVariable ["EPOCH_doBoom",nil]; call EPOCH_fnc_playerDeathDetonate;}; + if(player getVariable["EPOCH_doMorph",false])exitWith{player setVariable ["EPOCH_doMorph",nil];[selectRandom (getArray (getMissionConfig "CfgEpochClient" >> "deathMorphClass")),player,_killer2] call EPOCH_fnc_playerDeathMorph;}; + uiSleep 0.1; + }; }; -if(!isNil'BIS_DeathBlur')then{ppEffectDestroy BIS_DeathBlur;}; From f02a3ecf1b588f0dd6fadb4978127d3b0250372c Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 10 Dec 2016 20:20:40 +0100 Subject: [PATCH 2/6] Some Bugfixes in Building Script - Added Ghost Classes for Biulding-Count - Added SIM Classes for Storage-Count - 2nd Storage outsinde PlotPole range can not be set fixed - Cleanup the whole Script a bit --- .../compile/building/EPOCH_isBuildAllowed.sqf | 98 ++++++++----------- 1 file changed, 43 insertions(+), 55 deletions(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf index ca1ff449..c7de7413 100644 --- a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf @@ -28,8 +28,8 @@ private ["_alljammer","_buildingAllowed","_buildingCountLeader","_buildingCountL _buildingAllowed = true; _ownedJammerExists = false; -_scl = false; -_gcl = true; +_useSplitCountLimits = false; +_useGroupCountLimits = true; _nearestJammer = objNull; // reject building if in vehicle @@ -48,8 +48,8 @@ _storageCountPerMember = getNumber(_config >> "storageCountPerMember"); _minJammerDistance = getNumber(_config >> "minJammerDistance"); _maxBuildingHeight = getNumber(_config >> "maxBuildingHeight"); _jammerPerGroup = getNumber(_config >> "jammerPerGroup"); -if(getNumber(_config >> "useGroupCountLimits") == 0)then{_gcl=false}; -if(getNumber(_config >> "splitCountLimits") == 1)then{_scl=true}; +if(getNumber(_config >> "useGroupCountLimits") == 0)then{_useGroupCountLimits=false}; +if(getNumber(_config >> "splitCountLimits") == 1)then{_useSplitCountLimits=true}; if(_buildingJammerRange == 0)then{_buildingJammerRange = 75}; if(_buildingCountLimit == 0)then{_buildingCountLimit = 200}; if(_buildingCountLeader == 0)then{_buildingCountLeader = _buildingCountLimit}; @@ -81,68 +81,57 @@ if !(_jammer isEqualTo []) then { ["Building Disallowed: Existing Jammer Signal", 5] call Epoch_message; }; } foreach _jammer; - } else { + } + else { { if (alive _x && (_x distance player) <= _buildingJammerRange) exitWith{ _nearestJammer = _x; }; } foreach _jammer; if !(isNull _nearestJammer) then { - if ((getPosATL player) select 2 < _maxBuildingHeight) then { - if ((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) then { - _ownedJammerExists = true; - } else { - _buildingAllowed = false; - ["Building Disallowed: Frequency Blocked", 5] call Epoch_message; + if !((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) exitwith { + _buildingAllowed = false; + ["Building Disallowed: Frequency Blocked", 5] call Epoch_message; + }; + _ownedJammerExists = true; + if(_useGroupCountLimits)then{ + _membercount = 0; + if(count Epoch_my_Group > 0)then{ + _membercount = count (Epoch_my_Group select 3) + count (Epoch_my_Group select 4) }; - if(_gcl)then{ - _membercount = 0; - if(count Epoch_my_Group > 0)then{_membercount = count (Epoch_my_Group select 3) + count (Epoch_my_Group select 4)} - }; - if(_objType in ["WorkBench_EPOCH","StorageShelf_EPOCH","Tipi_EPOCH","LockBox_EPOCH","Safe_EPOCH","StorageShelf_SIM_EPOCH","LockBox_SIM_EPOCH","Safe_SIM_EPOCH","Workbench_SIM_EPOCH","Tipi_SIM_EPOCH"])then[{ - if(_scl)then{ - if(_gcl)then{ - _storageCountLimit = _storageCountLeader + (_storageCountPerMember * _membercount); - if((_storageCountLeader + _storageCountPerMember) > _storageCountLimit)then{_storageCountLimit = _storageCountLeader} - }; - if((count nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F",_ghostClass],_buildingJammerRange]) >= _storageCountLimit)then{ - _buildingAllowed = false; - [format["Building Disallowed: Max. %1 Storage Objects",_storageCountLimit],5] call Epoch_message - } - }else{ - if(_gcl)then{_buildingCountLimit = _buildingCountLeader + (_buildingCountPerMember * _membercount)}; - if((count nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F","Constructions_static_F","Constructions_foundation_F",_ghostClass],_buildingJammerRange]) >= _buildingCountLimit)then{ - _buildingAllowed = false; - [format["Building Disallowed, Frequency Overloaded: Limit %1",_buildingCountLimit],5] call Epoch_message - } - } - },{ - //a try to prevent bugusing (TODO: not working for storage objects atm) - if((count nearestObjects[_nearestJammer,[_ghostClass],_buildingJammerRange]) >= 2)exitWith{ //setting this too low may not be player-friendly. Recommend: >= 2 + }; + if (_useGroupCountLimits) then { + _storageCountLimit = _storageCountLeader + (_storageCountPerMember * _membercount); + _buildingCountLimit = _buildingCountLeader + (_buildingCountPerMember * _membercount); + }; + if (_useSplitCountLimits) then { + if(_objType in ["WorkBench_EPOCH","StorageShelf_EPOCH","Tipi_EPOCH","LockBox_EPOCH","Safe_EPOCH","StorageShelf_SIM_EPOCH","LockBox_SIM_EPOCH","Safe_SIM_EPOCH","Workbench_SIM_EPOCH","Tipi_SIM_EPOCH"]) then { + if ((count (nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F","LockBox_SIM_EPOCH","Safe_SIM_EPOCH","StorageShelf_SIM_EPOCH","WorkBench_SIM_EPOCH"],_buildingJammerRange]-[_obj])) >= _storageCountLimit) exitwith { _buildingAllowed = false; - ["Building Disallowed: Frequency Unstable, Wait A Moment",5] call Epoch_message + [format["Building Disallowed: Max. %1 Storage Objects",_storageCountLimit],5] call Epoch_message }; - - if(_gcl)then{_buildingCountLimit = _buildingCountLeader + (_buildingCountPerMember * _membercount)}; - if(_scl)then{ - if((count nearestObjects[_nearestJammer,["Constructions_static_F","Constructions_foundation_F",_ghostClass],_buildingJammerRange]) >= (_buildingCountLimit +1))then{ - _buildingAllowed = false; - [format["Building Disallowed: Max. %1 Constructions",_buildingCountLimit],5] call Epoch_message - } - }else{ - if((count nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F","Constructions_static_F","Constructions_foundation_F",_ghostClass],_buildingJammerRange]) >= (_buildingCountLimit +1))then{ - _buildingAllowed = false; - [format["Building Disallowed: Frequency Overloaded: Limit %1",_buildingCountLimit],5] call Epoch_message - } - } - }] - }else{ + } + else { + if ((count (nearestObjects[_nearestJammer,["Constructions_static_F","Constructions_foundation_F","Const_Ghost_EPOCH"],_buildingJammerRange]-[_obj])) >= _buildingCountLimit) exitwith { + _buildingAllowed = false; + [format["Building Disallowed: Max. %1 Constructions",_buildingCountLimit],5] call Epoch_message + }; + }; + } + else { + if ((count (nearestObjects [_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F","LockBox_SIM_EPOCH","Safe_SIM_EPOCH","StorageShelf_SIM_EPOCH","WorkBench_SIM_EPOCH","Constructions_static_F","Constructions_foundation_F","Const_Ghost_EPOCH"],_buildingJammerRange]-[_obj])) >= _buildingCountLimit) exitwith { + _buildingAllowed = false; + [format["Building Disallowed, Frequency Overloaded: Limit %1",_buildingCountLimit],5] call Epoch_message + }; + }; + if !((getPosATL player) select 2 < _maxBuildingHeight) exitwith { _buildingAllowed = false; ["Building Disallowed: Max building height reached",5] call Epoch_message; }; }; }; -}else{ +} +else { if (_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then { // TODO: rework not ideal to use allmissionobjects _alljammer = allmissionobjects 'PlotPole_EPOCH'; @@ -166,9 +155,8 @@ if (!_ownedJammerExists) then{ if (_limitNearby > 0) then{ // remove current target from objects - _objectCount = count (nearestObjects[player, [_staticClass, _simulClass], _buildingJammerRange] - [_obj]); - // TODO: not properly limiting simulated objects - if (_objectCount >= _limitNearby) then{ + _objectscount = count (nearestObjects[player, [_staticClass, _simulClass], _buildingJammerRange]-[_obj]); + if (_objectscount >= _limitNearby) then{ _buildingAllowed = false; [format["Building Disallowed: Limit %1", _limitNearby], 5] call Epoch_message; }; From 4a6e6b006ffb82322961c355ef0ff9d76cac2752 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 10 Dec 2016 20:24:35 +0100 Subject: [PATCH 3/6] Update EPOCH_consumeItem.sqf - removed _buildingCountLimit, because it is not needed in this script - moved "Press 1" message, so it only comes up, if building a Part --- Sources/epoch_code/compile/EPOCH_consumeItem.sqf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf index 11801dd4..4d751f9f 100644 --- a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf +++ b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf @@ -121,21 +121,23 @@ switch _interactOption do { if (_otherObjects isEqualTo []) then { _object=createVehicle[_buildClass,_pos,[],0,"CAN_COLLIDE"]; _object setDir ((getDir player) - 180); + [format["Press '%1' to drop object.", "1"], 5] call Epoch_message; if (([player, _item] call BIS_fnc_invRemove) == 1) then { [_object] spawn EPOCH_simulSwap; }; - } else { + } + else { ["Building Disallowed: Frequency Unstable", 5] call Epoch_message; }; - } else { + } + else { _object=createVehicle[_buildClass,_pos,[],0,"CAN_COLLIDE"]; _object setDir ((getDir player) - 180); + [format["Press '%1' to drop object.", "1"], 5] call Epoch_message; [_object,_item] spawn EPOCH_staticMove; }; - // _object spawn EPOCH_countdown; - [format["Press '%1' to drop object.", "1"], 5] call Epoch_message; - - } else { + } + else { ["Need Energy", 5] call Epoch_message; }; }; From 51f45645501866b8d11de31acb5dedc1200201c7 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 10 Dec 2016 20:26:32 +0100 Subject: [PATCH 4/6] Update EPOCH_staticMove.sqf Throw _object to EPOCH_isBuildAllowed, so it can be ignored in element counting --- Sources/epoch_code/compile/building/EPOCH_staticMove.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf index 83a748d5..df40071e 100644 --- a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf @@ -42,7 +42,7 @@ if (EPOCH_playerEnergy <= 0) exitWith{ }; // Remove object if not allowed -if !("" call EPOCH_isBuildAllowed) exitWith{ deleteVehicle _object }; +if !(_object call EPOCH_isBuildAllowed) exitWith{ deleteVehicle _object }; EPOCH_simulSwap_Lock = true; _objType = typeOf _object; @@ -117,7 +117,7 @@ if (_class != "") then { _rejectMove = false; if ((diag_tickTime - _lastCheckTime) > 10) then { _lastCheckTime = diag_tickTime; - _rejectMove = !(_objType call EPOCH_isBuildAllowed); + _rejectMove = !(_object call EPOCH_isBuildAllowed); }; if (_rejectMove) exitWith{ deleteVehicle EPOCH_target; From 2418d08ee5459c4a22fbf14429c21807cbb7b135 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 10 Dec 2016 20:30:50 +0100 Subject: [PATCH 5/6] Update EPOCH_simulSwap.sqf Throw _object instead of _objtype to EPOCH_isBuildAllowed, so it can be ignored by counting elements --- Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf b/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf index 09630fcd..c8725abf 100644 --- a/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_simulSwap.sqf @@ -37,7 +37,7 @@ _isSnap = false; if (EPOCH_playerEnergy <= 0) exitWith { ["Need Energy", 5] call Epoch_message; }; -if !(_objType call EPOCH_isBuildAllowed) exitWith{}; +if !(_object call EPOCH_isBuildAllowed) exitWith{}; EPOCH_simulSwap_Lock = true; _return = _object; From 24f57dd9a5122ce8cb38885de2fe0de1789dafbd Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 10 Dec 2016 20:53:52 +0100 Subject: [PATCH 6/6] Update EPOCH_isBuildAllowed.sqf --- Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf index c7de7413..7485d338 100644 --- a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf @@ -99,8 +99,6 @@ if !(_jammer isEqualTo []) then { if(count Epoch_my_Group > 0)then{ _membercount = count (Epoch_my_Group select 3) + count (Epoch_my_Group select 4) }; - }; - if (_useGroupCountLimits) then { _storageCountLimit = _storageCountLeader + (_storageCountPerMember * _membercount); _buildingCountLimit = _buildingCountLeader + (_buildingCountPerMember * _membercount); };