diff --git a/Changelogs/0.3.7.0.txt b/Changelogs/0.3.7.0.txt index c00ae9a1..bd02ae2a 100644 --- a/Changelogs/0.3.7.0.txt +++ b/Changelogs/0.3.7.0.txt @@ -15,11 +15,13 @@ [ADDED-WIP] Copper Bars (ItemCopperBar). [ADDED-WIP] Tin Bars (ItemTinBar). [ADDED-WIP] Plywood sheets in small and large stacks (ItemPlywood,ItemPlywoodPack). +[Changed] Debug monitor now shows all custom stats dynamically based on config. [Changed] Increased angle that the player is able to aim up. [Changed] Drinking Alcohol increases the new "Alcohol" stat instead of directly effecting blood pressure. [Changed] Crafting Hesco barrier now require 3x Burlap. -[Changed] Crafting wood and meta spike traps now require 2x Sticks. +[Changed] Crafting wood and metal spike traps now require 2x Sticks. [Changed] Change all publicVariableServer calls to use remoteExec calls for better performance. +[Fixed] Reworked login to prevent getting stuck at "waiting for inventory". [Fixed] Prevented death just after revive due still having high blood pressure. [Fixed] Incorrectly being able to sell/buy items from a dead trader. [Fixed] Snakes now require line of sight to bite player. diff --git a/Server_Install_Pack/sc/battleye/scripts.txt b/Server_Install_Pack/sc/battleye/scripts.txt index 05481760..31aeadad 100644 --- a/Server_Install_Pack/sc/battleye/scripts.txt +++ b/Server_Install_Pack/sc/battleye/scripts.txt @@ -21,7 +21,7 @@ 7 allowDamage !="_unit allowDamage false;" !="_unit allowDamage true;" !="player allowDamage true;" !="vehicle player allowDamage true;" !="player allowDamage false;" 7 addWeaponCargo !="_acceptHolder addWeaponCargo [_wWeapon, 1] ;" 7 onMapSingleClick !="onMapSingleClick '';" -7 addMagazine !"addMagazineCargo" !="player addMagazine _interactReturnOnUse;" !="player addMagazine _craftItem;" !="player addMagazine \"jerrycanE_epoch\";" !="player addMagazine \"emptyjar_epoch\";" !="player addMagazine \"jerrycan_epoch\";" !="player addMagazine \"Hatchet_swing\";" !="player addMagazine [(_x select 0),(_x select 1)]" !="player addMagazine _x;" !="if !(player canAdd (_x select 0)) exitWith {};\nplayer addMagazine[_x select 0, _x select 1];" +7 addMagazine !"addMagazineCargo" !="player addMagazine _craftItem;" !="player addMagazine \"jerrycanE_epoch\";" !="player addMagazine \"emptyjar_epoch\";" !="player addMagazine \"jerrycan_epoch\";" !="player addMagazine \"Hatchet_swing\";" !="player addMagazine [(_x select 0),(_x select 1)]" !="player addMagazine _x;" !="if !(player canAdd (_x select 0)) exitWith {};\nplayer addMagazine[_x select 0, _x select 1];" 7 addMagazineCargo !"_dogHolder addMagazineCargo [\"RabbitCarcass_EPOCH\", 1]" !"_dogHolder addMagazineCargo [\"Pelt_EPOCH\", 1]" !"_dogHolder addMagazineCargo [\"Venom_EPOCH\", 1]" !"_dogHolder addMagazineCargo [\"SnakeCarcass_EPOCH\", 1]" !"_dogHolder addMagazineCargo [\"ChickenCarcass_EPOCH\", 1]" !="_acceptHolder addMagazineCargo [_wAmmo, 1] ;" 7 addItem !="player addItem _item;" !="player addItem _craftItem;" !="player addItem _x;" !="_plyr addItemToVest _missionItem;" !="axeVIP addItemToVest _item;" !="_plyr addItemToVest _missionItem;" !="EPOCH_fnc_addItemOverflow" 7 addBackPack diff --git a/Sources/epoch_code/System/player_login.fsm b/Sources/epoch_code/System/player_login.fsm index e43e7690..dd8c87e1 100644 --- a/Sources/epoch_code/System/player_login.fsm +++ b/Sources/epoch_code/System/player_login.fsm @@ -2,7 +2,7 @@ /*%FSM*/ /* item0[] = {"INIT",0,250,-25.000000,-375.000000,75.000000,-325.000000,0.000000,"INIT"}; -item1[] = {"FINISH",1,4346,-25.000000,1475.000000,75.000000,1525.000000,0.000000,"FINISH"}; +item1[] = {"FINISH",1,250,-25.000000,1475.000000,75.000000,1525.000000,0.000000,"FINISH"}; item2[] = {"true",8,218,-150.000000,-125.000000,-50.000000,-75.000000,0.000000,"true"}; item3[] = {"Version_Check",2,250,-25.000000,-75.000000,75.000000,-25.000000,0.000000,"Version Check"}; item4[] = {"Player_Object_Re",4,218,-150.000000,75.000000,-50.000000,125.000000,0.000000,"Player" \n "Object Ready"}; @@ -28,7 +28,7 @@ item23[] = {"Wrong_Server_Ver",4,218,125.000000,475.000000,225.000000,525.000000 item24[] = {"true",8,218,-150.000000,1125.000000,-50.000000,1175.000000,0.000000,"true"}; item25[] = {"ERROR_Wrong_Server",2,250,275.000000,475.000000,375.000000,525.000000,0.000000,"ERROR" \n "Wrong" \n "Server Version"}; item26[] = {"Display_Message",4,218,600.000000,1150.000000,700.000000,1200.000000,0.000000,"" \n "Display Message" \n "Wait..."}; -item27[] = {"Setup_Player_Obj",2,250,-25.000000,975.000000,75.000000,1025.000000,0.000000,"Setup Player" \n "Object"}; +item27[] = {"Setup_Player_Obj",2,4346,-25.000000,975.000000,75.000000,1025.000000,0.000000,"Setup Player" \n "Object"}; item28[] = {"Check_if_Player",4,218,750.000000,1225.000000,850.000000,1275.000000,0.000000,"Check if" \n "Player got Kicked"}; item29[] = {"Preload_done",8,218,-150.000000,1425.000000,-50.000000,1475.000000,0.000000,"Preload" \n "done"}; item30[] = {"",7,210,471.000000,796.000000,479.000000,804.000000,0.000000,""}; @@ -62,7 +62,7 @@ item57[] = {"Select_Weapon",2,250,150.000000,1300.000000,250.000000,1350.000000, item58[] = {"true",8,218,225.000000,1375.000000,325.000000,1425.000000,0.000000,"true"}; item59[] = {"Do_nothing",2,250,300.000000,1300.000000,400.000000,1350.000000,0.000000,"Do nothing"}; item60[] = {"Check_New_Player",2,250,-25.000000,875.000000,75.000000,925.000000,0.000000,"Check" \n "New Player" \n "Setup"}; -item61[] = {"Wait_mag_count_m",4,218,-150.000000,925.000000,-50.000000,975.000000,0.000000,"Wait" \n "mag count match"}; +item61[] = {"check_new__player",4,218,-150.000000,925.000000,-50.000000,975.000000,0.000000,"check new " \n "player not null"}; item62[] = {"true",8,218,-150.000000,-325.000000,-50.000000,-275.000000,0.000000,"true"}; item63[] = {"Process_1",2,250,-25.000000,-275.000000,75.000000,-225.000000,0.000000,"Process"}; item64[] = {"Wait_ArmA_Loading",4,218,-150.000000,-225.000000,-50.000000,-175.000000,0.000000,"Wait ArmA" \n "Loading Screen" \n "Done"}; @@ -190,8 +190,8 @@ link97[] = {85,79}; link98[] = {86,16}; link99[] = {86,22}; link100[] = {87,31}; -globals[] = {0.000000,0,0,0,0,640,480,1,244,6316128,1,-35.555386,526.032166,1670.387451,1066.632935,586,630,1}; -window[] = {2,-1,-1,-1,-1,994,182,1474,182,3,604}; +globals[] = {0.000000,0,0,0,0,640,480,1,244,6316128,1,-207.564026,582.257507,1595.816406,409.736633,586,880,1}; +window[] = {2,-1,-1,-1,-1,890,78,1370,78,3,604}; *//*%FSM*/ class FSM { @@ -588,6 +588,10 @@ class FSM name = "Setup_Player_Obj"; init = /*%FSM*/"_ply = player;" \n "_group = group player;" \n + "" \n + "player reveal _playerObject;" \n + "_playerPos = getposATL _playerObject;" \n + "" \n "selectPlayer _playerObject;" \n "" \n "deleteVehicle _ply;" \n @@ -931,7 +935,7 @@ class FSM priority = 0.000000; to="FINISH"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"preloadCamera (getposATL player)"/*%FSM*/; + condition=/*%FSM*/"preloadCamera _playerPos"/*%FSM*/; action=/*%FSM*/"call compile _playerGroupOnline;"/*%FSM*/; }; /*%FSM*/ @@ -1020,9 +1024,6 @@ class FSM { name = "Check_New_Player"; init = /*%FSM*/"_myTime = diag_tickTime;" \n - "" \n - "// player reveal [_playerObject, 4];" \n - "" \n "" \n """Loading Player Inventory... Please wait!"" call Epoch_updateLoadingScreen;" \n "progressLoadingScreen 0.6;" \n @@ -1030,13 +1031,13 @@ class FSM precondition = /*%FSM*/""/*%FSM*/; class Links { - /*%FSM*/ - class Wait_mag_count_m + /*%FSM*/ + class check_new__player { priority = 0.000000; to="Setup_Player_Obj"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_magCount == count (magazines _playerObject)"/*%FSM*/; + condition=/*%FSM*/"!(isNull _playerObject)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ diff --git a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf index 0b09e28e..bf7c86aa 100644 --- a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf +++ b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf @@ -210,7 +210,7 @@ switch _interactOption do { _newFuel = _newFuel / _fuelCapacity; if (_item call _removeItem) then { - player addMagazine _interactReturnOnUse; + _interactReturnOnUse call EPOCH_fnc_addItemOverflow; // send [_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2]; @@ -228,7 +228,9 @@ switch _interactOption do { _newFuel = (((fuel _vehicle) * _fuelCapacity) - _canCapacity) / _fuelCapacity; if (_newFuel > 0) then { if (_item call _removeItem) then { - player addMagazine _interactReturnOnUse; + + _interactReturnOnUse call EPOCH_fnc_addItemOverflow; + [_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2]; _dt = ["Fuel Siphoned", 0, 1, 5, 2, 0, 1] spawn bis_fnc_dynamictext; }; diff --git a/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf b/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf index f00c2b8c..67a582ee 100644 --- a/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf +++ b/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf @@ -15,57 +15,48 @@ private["_hours"]; _hours = floor(servertime/60/60); +_customVars = ""; +{ + if !(_x in ["AliveTime","SpawnArray","HitPoints"]) then { + _customVars = _customVars + format["%1: %2
", _x,missionNamespace getVariable [format ["EPOCH_player%1",_x],EPOCH_defaultVars select _forEachIndex]]; + } +}forEach EPOCH_customVars; + hintSilent parseText format [" Welcome to Epoch Alpha
- Current Version: %22
- Temp: %1
- Blood Pressure: %2
- Hunger: %3
- Thirst: %4
- Energy: %5
- Wet: %6
- Soiled: %7
- Immunity: %8
- Toxicity: %9
- Stamina: %10
- Fatigue: %11
- Damage: %12
- Bleeding: %13
- Bleed Time: %14
- Oxygen: %15
+ Current Version: %1
+ + " + _customVars + "
- Air Temp: %16
- Water Temp: %17
- Rain: %18
- Overcast: %19
+ + Fatigue: %2
+ Damage: %3
+ Bleeding: %4
+ Bleed Time: %5
+ Oxygen: %6

- Crypto: %20
- Hours Alive: %21
- FPS: %23
- Server uptime: %24h %25m
- Server FPS: %26
", - EPOCH_playerTemp, - EPOCH_playerBloodP, - EPOCH_playerHunger, - EPOCH_playerThirst, - EPOCH_playerEnergy, - EPOCH_playerWet, - EPOCH_playerSoiled, - EPOCH_playerImmunity, - EPOCH_playerToxicity, - EPOCH_playerStamina, + Air Temp: %7
+ Water Temp: %8
+ Rain: %9
+ Overcast: %10
+
+ Hours Alive: %11
+ FPS: %12
+ Server uptime: %13h %14m
+ Server FPS: %15
", + getText(configFile >> "CfgMods" >> "Epoch" >> "version"), (getFatigue player), (damage player), (isBleeding player), (getBleedingRemaining player), (getOxygenRemaining player), + EPOCH_CURRENT_WEATHER, (EPOCH_CURRENT_WEATHER/2), rain, overcast, - EPOCH_playerCrypto, + round(EPOCH_playerAliveTime/360)/10, - getText(configFile >> "CfgMods" >> "Epoch" >> "version"), round diag_fps, _hours, round((serverTime/60)-(_hours*60)), diff --git a/Sources/epoch_code/compile/setup/EPOCH_client_publicEH.sqf b/Sources/epoch_code/compile/setup/EPOCH_client_publicEH.sqf index b843c05f..e61938a8 100644 --- a/Sources/epoch_code/compile/setup/EPOCH_client_publicEH.sqf +++ b/Sources/epoch_code/compile/setup/EPOCH_client_publicEH.sqf @@ -44,7 +44,7 @@ call compile (" case "+str(_this select 16)+": { Epoch_my_GroupUID = _data }; case "+str(_this select 17)+": { _data call EPOCH_Group_invitePlayer }; case "+str(_this select 18)+": { _data call EPOCH_handleServerMessage }; - case "+str(_this select 19)+": { {missionNamespace setVariable[format['EPOCH_player%1', _x], EPOCH_defaultVars select(EPOCH_customVars find _x)]} forEach['Temp','Hunger','Thirst','Toxicity','Stamina','HitPoints','BloodP']}; + case "+str(_this select 19)+": { {missionNamespace setVariable[format['EPOCH_player%1', _x], EPOCH_defaultVars select(EPOCH_customVars find _x)]} forEach['Temp','Hunger','Thirst','Toxicity','Stamina','HitPoints','BloodP','Alcohol','Radiation']}; case "+str(_this select 20)+": { _data call EPOCH_mission_returnObj }; }; }; diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf index acc8a276..f740f09c 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf @@ -1,142 +1,138 @@ - - // current target - - _currentTarget = objNull; - _cursorTarget = ([10] call EPOCH_fnc_cursorTarget); - if (!isNull _cursorTarget && {!(EPOCH_target isEqualTo _cursorTarget)}) then { - if (_cursorTarget isKindOf "ThingX" || _cursorTarget isKindOf "Constructions_static_F" || _cursorTarget isKindOf "Constructions_foundation_F" || _cursorTarget isKindOf "WeaponHolder" || _cursorTarget isKindOf "AllVehicles" || _cursorTarget isKindOf "PlotPole_EPOCH") then{ - if (_cursorTarget isKindOf "Animal_Base_F") then { - if !(alive _cursorTarget) then { - _currentTarget = _cursorTarget; - }; - } else { - _currentTarget = _cursorTarget; - }; - }; - }; - EPOCH_currentTarget = _currentTarget; - - _increaseStamina = false; - _vehicle = vehicle player; - if (_vehicle == player) then { - _val = log(abs(speed player)); - _staminaThreshold = 0.7; - if (EPOCH_playerIsSwimming) then {_staminaThreshold = 0.3}; - if (_val>_staminaThreshold) then { - EPOCH_playerStamina = (EPOCH_playerStamina - (_val/4)) max 0; - } else { - _increaseStamina = true; +_currentTarget = objNull; +_cursorTarget = ([10] call EPOCH_fnc_cursorTarget); +if (!isNull _cursorTarget && {!(EPOCH_target isEqualTo _cursorTarget)}) then { + if (_cursorTarget isKindOf "ThingX" || _cursorTarget isKindOf "Constructions_static_F" || _cursorTarget isKindOf "Constructions_foundation_F" || _cursorTarget isKindOf "WeaponHolder" || _cursorTarget isKindOf "AllVehicles" || _cursorTarget isKindOf "PlotPole_EPOCH") then{ + if (_cursorTarget isKindOf "Animal_Base_F") then { + if !(alive _cursorTarget) then { + _currentTarget = _cursorTarget; }; } else { - if (EPOCH_buildMode > 0) then { - EPOCH_buildMode = 0; - EPOCH_snapDirection = 0; - hintsilent "BUILD MODE: DISABLED"; - EPOCH_Target = objNull; - // EPOCH_SURVEY = []; - }; - _increaseStamina = true; - - switch (typeOf _vehicle) do { - case "jetski_epoch": { - _clock_hour10 = floor ((date select 3)/10); - _clock_minute10 = floor ((date select 4)/10); - { - _vehicle setObjectTexture [_forEachIndex,_x]; - }forEach[ - format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",_clock_hour10], - format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",(date select 3)-(_clock_hour10*10)], - format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",_clock_minute10], - format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",(date select 4)-(_clock_minute10*10)], - format["\x\addons\a3_epoch_vehicles\data\fuel%1_ca.paa",floor(fuel _vehicle*10)] - ]; - }; - case "ebike_epoch": { - { - _vehicle setObjectTexture [_forEachIndex,_x]; - }forEach[ - format["\x\addons\a3_epoch_vehicles\data\speed%1_ca.paa",floor(speed _vehicle/9) max 0], - format["\x\addons\a3_epoch_vehicles\data\energ%1_ca.paa",floor(fuel _vehicle*14)] - ]; - }; + _currentTarget = _cursorTarget; + }; + }; +}; +EPOCH_currentTarget = _currentTarget; + +_increaseStamina = false; +_vehicle = vehicle player; +if (_vehicle == player) then { + _val = log(abs(speed player)); + _staminaThreshold = 0.7; + if (EPOCH_playerIsSwimming) then {_staminaThreshold = 0.3}; + if (_val>_staminaThreshold) then { + EPOCH_playerStamina = (EPOCH_playerStamina - (_val/4)) max 0; + } else { + _increaseStamina = true; + }; +} else { + if (EPOCH_buildMode > 0) then { + EPOCH_buildMode = 0; + EPOCH_snapDirection = 0; + hintsilent "BUILD MODE: DISABLED"; + EPOCH_Target = objNull; + // EPOCH_SURVEY = []; + }; + _increaseStamina = true; + + switch (typeOf _vehicle) do { + case "jetski_epoch": { + _clock_hour10 = floor ((date select 3)/10); + _clock_minute10 = floor ((date select 4)/10); + { + _vehicle setObjectTexture [_forEachIndex,_x]; + }forEach[ + format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",_clock_hour10], + format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",(date select 3)-(_clock_hour10*10)], + format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",_clock_minute10], + format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",(date select 4)-(_clock_minute10*10)], + format["\x\addons\a3_epoch_vehicles\data\fuel%1_ca.paa",floor(fuel _vehicle*10)] + ]; + }; + case "ebike_epoch": { + { + _vehicle setObjectTexture [_forEachIndex,_x]; + }forEach[ + format["\x\addons\a3_epoch_vehicles\data\speed%1_ca.paa",floor(speed _vehicle/9) max 0], + format["\x\addons\a3_epoch_vehicles\data\energ%1_ca.paa",floor(fuel _vehicle*14)] + ]; + }; + }; +}; + +_envCold = EPOCH_playerTemp <= 95.0; +_envHot = EPOCH_playerTemp >= 106.7; +_hungry = EPOCH_playerHunger <= 0; +_thirsty = EPOCH_playerThirst <= 0; +_warnbloodPressure = EPOCH_playerBloodP > 120; + +_thirst ctrlShow (EPOCH_playerThirst <= 625); +if (ctrlShown _thirst) then { + [_thirst,_thirsty] call _fadeUI; + _thirstScale = linearConversion [0,EPOCH_playerThirst,2500,0.01,1,true]; + _thirst ctrlSetTextColor [_thirstScale, _thirstScale, 0.9, 1]; +}; + +_hunger ctrlShow (EPOCH_playerHunger <= 1250); +if (ctrlShown _hunger) then { + [_hunger,_hungry] call _fadeUI; + _hungerScale = linearConversion [0,EPOCH_playerHunger,5000,0.01,1,true]; + _hunger ctrlSetTextColor [1, _hungerScale, _hungerScale, 1]; +}; + +_playerOxygen = getOxygenRemaining player; +_oxygen ctrlShow (_playerOxygen < 1); +if (ctrlShown _oxygen) then { + [_oxygen,(_playerOxygen <= 0.55)] call _fadeUI; + _oxygen ctrlSetTextColor [1, _playerOxygen, _playerOxygen, 1]; +}; + +_hazzard ctrlShow (EPOCH_playerToxicity > 1); +if (ctrlShown _hazzard) then { + [_hazzard,(EPOCH_playerToxicity >= 55)] call _fadeUI; + _toxicScale = 1-linearConversion [0,EPOCH_playerToxicity,100,0.01,1,true]; + _hazzard ctrlSetTextColor [_toxicScale, 1, _toxicScale, 1]; +}; + +_broken ctrlShow ((player getHitPointDamage "HitLegs") >= 0.5); +if (ctrlShown _broken) then { + [_broken,true] call _fadeUI; +}; + +if (_envCold || _envHot || _hungry || _thirsty) then { + if (_envHot || _envCold) then { + player setFatigue 1; + }; + EPOCH_playerBloodP = (EPOCH_playerBloodP + 0.05) min 190; + _increaseStamina = false; +} else { + if (EPOCH_playerStamina > 0) then { + if !(_panic) then { + if (!_warnbloodPressure) then { + player setFatigue 0; }; + EPOCH_playerBloodP = EPOCH_playerBloodP - 1 max 100; }; + }; +}; - _envCold = EPOCH_playerTemp <= 95.0; - _envHot = EPOCH_playerTemp >= 106.7; - _hungry = EPOCH_playerHunger <= 0; - _thirsty = EPOCH_playerThirst <= 0; - _warnbloodPressure = EPOCH_playerBloodP > 120; +_critical = (damage player >= 0.7 || _warnbloodPressure); +_emergency ctrlShow _critical; +if (ctrlShown _emergency) then { + [_emergency,(EPOCH_playerBloodP > 140)] call _fadeUI; + _emergencyScale = 1-linearConversion [0,EPOCH_playerBloodP,180,0.01,1,true]; + _emergency ctrlSetTextColor [1, _emergencyScale, _emergencyScale, 1]; +}; - _thirst ctrlShow (EPOCH_playerThirst <= 625); - if (ctrlShown _thirst) then { - [_thirst,_thirsty] call _fadeUI; - _thirstScale = linearConversion [0,EPOCH_playerThirst,2500,0.01,1,true]; - _thirst ctrlSetTextColor [_thirstScale, _thirstScale, 0.9, 1]; - }; +if (EPOCH_playerBloodP >= 180) then { + true call EPOCH_pushCustomVar; +}; +if (_increaseStamina && (getFatigue player) == 0) then { + EPOCH_playerStamina = (EPOCH_playerStamina + 0.5) min EPOCH_playerStaminaMax; +}; +if (EPOCH_debugMode) then { + call EPOCH_debugMonitor; +}; - _hunger ctrlShow (EPOCH_playerHunger <= 1250); - if (ctrlShown _hunger) then { - [_hunger,_hungry] call _fadeUI; - _hungerScale = linearConversion [0,EPOCH_playerHunger,5000,0.01,1,true]; - _hunger ctrlSetTextColor [1, _hungerScale, _hungerScale, 1]; - }; +call EPOCH_TradeLoop; - _playerOxygen = getOxygenRemaining player; - _oxygen ctrlShow (_playerOxygen < 1); - if (ctrlShown _oxygen) then { - [_oxygen,(_playerOxygen <= 0.55)] call _fadeUI; - _oxygen ctrlSetTextColor [1, _playerOxygen, _playerOxygen, 1]; - }; - - _hazzard ctrlShow (EPOCH_playerToxicity > 1); - if (ctrlShown _hazzard) then { - [_hazzard,(EPOCH_playerToxicity >= 55)] call _fadeUI; - _toxicScale = 1-linearConversion [0,EPOCH_playerToxicity,100,0.01,1,true]; - _hazzard ctrlSetTextColor [_toxicScale, 1, _toxicScale, 1]; - }; - - _broken ctrlShow ((player getHitPointDamage "HitLegs") >= 0.5); - if (ctrlShown _broken) then { - [_broken,true] call _fadeUI; - }; - - if (_envCold || _envHot || _hungry || _thirsty) then { - if (_envHot || _envCold) then { - player setFatigue 1; - }; - EPOCH_playerBloodP = (EPOCH_playerBloodP + 0.05) min 190; - _increaseStamina = false; - } else { - if (EPOCH_playerStamina > 0) then { - if !(_panic) then { - if (!_warnbloodPressure) then { - player setFatigue 0; - }; - EPOCH_playerBloodP = EPOCH_playerBloodP - 1 max 100; - }; - }; - }; - - _critical = (damage player >= 0.7 || _warnbloodPressure); - _emergency ctrlShow _critical; - if (ctrlShown _emergency) then { - [_emergency,(EPOCH_playerBloodP > 140)] call _fadeUI; - _emergencyScale = 1-linearConversion [0,EPOCH_playerBloodP,180,0.01,1,true]; - _emergency ctrlSetTextColor [1, _emergencyScale, _emergencyScale, 1]; - }; - - if (EPOCH_playerBloodP >= 180) then { - true call EPOCH_pushCustomVar; - }; - if (_increaseStamina && (getFatigue player) == 0) then { - EPOCH_playerStamina = (EPOCH_playerStamina + 0.5) min EPOCH_playerStaminaMax; - }; - if (EPOCH_debugMode) then { - call EPOCH_debugMonitor; - }; - - call EPOCH_TradeLoop; - - - onEachFrame EPOCH_onEachFrame; +onEachFrame EPOCH_onEachFrame; diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf index b0148650..022e9c61 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf @@ -1,97 +1,103 @@ +if !(EPOCH_arr_interactedObjs isEqualTo[]) then { + EPOCH_arr_interactedObjs remoteExec["EPOCH_server_save_vehicles", 2]; + EPOCH_arr_interactedObjs = []; +}; - if !(EPOCH_arr_interactedObjs isEqualTo[]) then { - EPOCH_arr_interactedObjs remoteExec["EPOCH_server_save_vehicles", 2]; - EPOCH_arr_interactedObjs = []; - }; +if (damage player != _damagePlayer) then { + if (alive player) then { + true call EPOCH_pushCustomVar; + _damagePlayer = damage player; + }; +}; - if (damage player != _damagePlayer) then { - if (alive player) then { - true call EPOCH_pushCustomVar; - _damagePlayer = damage player; - }; - }; +// this fixes issues with players being unable to ride in the same vehicle +if ((rating player) < 0) then { + player addRating abs(rating player); +}; - if ((rating player) < 0) then { - player addRating abs(rating player); - }; +// calculate total available power +// 1. number of power production devices within range 75m - // calculate total available power - // 1. number of power production devices within range 75m +// find share of power based on factors +// 1. number of players +// 2. Other sources of drain (Lights) - // find share of power based on factors - // 1. number of players - // 2. Other sources of drain (Lights) +_energyValue = EPOCH_chargeRate min _energyRegenMax; +_vehicle = vehicle player; +if (_vehicle != player && isEngineOn _vehicle) then { + _energyValue = _energyValue + 5; +}; - _energyValue = EPOCH_chargeRate min _energyRegenMax; - _vehicle = vehicle player; - if (_vehicle != player && isEngineOn _vehicle) then { - _energyValue = _energyValue + 5; - }; +if (currentVisionMode player == 1) then { //NV enabled + _energyValue = _energyValue - _energyCostNV; + if (EPOCH_playerEnergy == 0) then { + player action["nvGogglesOff", player]; + }; +}; - if (currentVisionMode player == 1) then { //NV enabled - _energyValue = _energyValue - _energyCostNV; - if (EPOCH_playerEnergy == 0) then { - player action["nvGogglesOff", player]; - }; - }; +// Sets visual effect +if (EPOCH_playerAlcohol > 20) then { + _drunkVal = linearConversion [0,100,EPOCH_playerAlcohol,0.1,1,true]; + [(round(_drunkVal * 10)/10), 2] call epoch_setDrunk; + diag_log format["DEBUG: _drunkVal: %1",_drunkVal]; +} else { + [0, 2] call epoch_setDrunk; +}; - EPOCH_playerEnergy = ((EPOCH_playerEnergy + _energyValue) min EPOCH_playerEnergyMax) max 0; +EPOCH_playerEnergy = ((EPOCH_playerEnergy + _energyValue) min EPOCH_playerEnergyMax) max 0; - if !(EPOCH_playerEnergy isEqualTo _prevEnergy) then { - 9993 cutRsc["EpochGameUI3", "PLAIN", 0, false]; - _display3 = uiNamespace getVariable "EPOCH_EpochGameUI3"; - _energyDiff = round(EPOCH_playerEnergy - _prevEnergy); - _diffText = if (_energyDiff > 0) then {format["+%1",_energyDiff]} else {format["%1",_energyDiff]}; - // hint str [_energyValue,_prevEnergy,EPOCH_playerEnergy]; - (_display3 displayCtrl 21210) ctrlSetText format["%1/%2 %3", round(EPOCH_playerEnergy), EPOCH_playerEnergyMax, _diffText]; - _prevEnergy = EPOCH_playerEnergy; - }; +if !(EPOCH_playerEnergy isEqualTo _prevEnergy) then { + 9993 cutRsc["EpochGameUI3", "PLAIN", 0, false]; + _display3 = uiNamespace getVariable "EPOCH_EpochGameUI3"; + _energyDiff = round(EPOCH_playerEnergy - _prevEnergy); + _diffText = if (_energyDiff > 0) then {format["+%1",_energyDiff]} else {format["%1",_energyDiff]}; + // hint str [_energyValue,_prevEnergy,EPOCH_playerEnergy]; + (_display3 displayCtrl 21210) ctrlSetText format["%1/%2 %3", round(EPOCH_playerEnergy), EPOCH_playerEnergyMax, _diffText]; + _prevEnergy = EPOCH_playerEnergy; +}; - if (EPOCH_playerEnergy == 0) then { - if (EPOCH_buildMode > 0) then { - EPOCH_buildMode = 0; - EPOCH_snapDirection = 0; - _dt = ["Build Mode Disabled: Need Energy< / t>", 0, 1, 5, 2, 0, 1] spawn bis_fnc_dynamictext; - EPOCH_Target = objNull; - EPOCH_Z_OFFSET = 0; - EPOCH_X_OFFSET = 0; - EPOCH_Y_OFFSET = 5; - }; - }; +if (EPOCH_playerEnergy == 0) then { + if (EPOCH_buildMode > 0) then { + EPOCH_buildMode = 0; + EPOCH_snapDirection = 0; + _dt = ["Build Mode Disabled: Need Energy< / t>", 0, 1, 5, 2, 0, 1] spawn bis_fnc_dynamictext; + EPOCH_Target = objNull; + EPOCH_Z_OFFSET = 0; + EPOCH_X_OFFSET = 0; + EPOCH_Y_OFFSET = 5; + }; +}; - _attackers = player nearEntities[["Snake_random_EPOCH", "GreatWhite_F", "Epoch_Cloak_F"], 30]; - if !(_attackers isEqualTo[]) then { - (_attackers select 0) call EPOCH_client_bitePlayer; - _panic = true; - } else { - // custom poision - _toxicObjs = player nearobjects["SmokeShellCustom", 6]; - if!(_toxicObjs IsEqualTo[]) then { - (_toxicObjs select 0) call EPOCH_client_bitePlayer; - _panic = true; - } else { - _panic = false; - }; - }; +_attackers = player nearEntities[["Snake_random_EPOCH", "GreatWhite_F", "Epoch_Cloak_F"], 30]; +if !(_attackers isEqualTo[]) then { + (_attackers select 0) call EPOCH_client_bitePlayer; + _panic = true; +} else { + // custom poision + _toxicObjs = player nearobjects["SmokeShellCustom", 6]; + if!(_toxicObjs IsEqualTo[]) then { + (_toxicObjs select 0) call EPOCH_client_bitePlayer; + _panic = true; + } else { + _panic = false; + }; +}; - call EPOCH_fnc_Weather; +call EPOCH_fnc_Weather; - // Hunger / Thirst - _HTlossRate = _baseHTLoss; - if (EPOCH_playerStamina < 100) then { - if ((getFatigue player) > 0) then { - _HTlossRate = _HTlossRate + (_HTlossRate*(getFatigue player)); - }; - } else { - _HTlossRate = (_HTlossRate / 2); - }; +// Hunger / Thirst +_HTlossRate = _baseHTLoss; +if (EPOCH_playerStamina < 100) then { + if ((getFatigue player) > 0) then { + _HTlossRate = _HTlossRate + (_HTlossRate*(getFatigue player)); + }; +} else { + _HTlossRate = (_HTlossRate / 2); +}; - EPOCH_playerHunger = (EPOCH_playerHunger - _HTlossRate) max 0; - EPOCH_playerThirst = (EPOCH_playerThirst - _HTlossRate) max 0; +EPOCH_playerHunger = (EPOCH_playerHunger - _HTlossRate) max 0; +EPOCH_playerThirst = (EPOCH_playerThirst - _HTlossRate) max 0; - call _lootBubble; +call _lootBubble; - EPOCH_playerStaminaMax = (100 * (round(EPOCH_playerAliveTime/360)/10)) min 2500; - - //player setAnimSpeedCoef 0.75; - //player setCustomAimCoef 1; +EPOCH_playerStaminaMax = (100 * (round(EPOCH_playerAliveTime/360)/10)) min 2500; diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event3.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event3.sqf index 70c3bc34..f9eb85c9 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event3.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event3.sqf @@ -1,6 +1,5 @@ - - if !(_prevEquippedItem isEqualTo EPOCH_equippedItem_PVS) then { - _EPOCH_15 = _tickTime; - _prevEquippedItem = EPOCH_equippedItem_PVS; - EPOCH_equippedItem_PVS remoteExec ["EPOCH_server_equippedItem",2]; - }; +if !(_prevEquippedItem isEqualTo EPOCH_equippedItem_PVS) then { + _EPOCH_15 = _tickTime; + _prevEquippedItem = EPOCH_equippedItem_PVS; + EPOCH_equippedItem_PVS remoteExec ["EPOCH_server_equippedItem",2]; +}; diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event4.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event4.sqf index da2292d3..87b9e90c 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event4.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event4.sqf @@ -1,17 +1,15 @@ +_nearByBobbersLocal = []; +_nearByBobbers = player nearEntities[["Bobber_EPOCH"], 12]; +{ + if (local _x) then { + _nearByBobbersLocal pushBack _x + } +} forEach _nearByBobbers; - _nearByBobbersLocal = []; - _nearByBobbers = player nearEntities[["Bobber_EPOCH"], 12]; - { - if (local _x) then { - _nearByBobbersLocal pushBack _x - } - } forEach _nearByBobbers; - - if !(_nearByBobbersLocal isEqualTo []) then { - if ((random 100) < 50) then { - _bobber = _nearByBobbersLocal select floor(random(count _nearByBobbers)); - _bobber setVelocity [0,-1,-1]; - _bobber setVariable ["EPOCH_fishOnLine" , diag_tickTime]; - }; - - }; +if !(_nearByBobbersLocal isEqualTo []) then { + if ((random 100) < 50) then { + _bobber = _nearByBobbersLocal select floor(random(count _nearByBobbers)); + _bobber setVelocity [0,-1,-1]; + _bobber setVariable ["EPOCH_fishOnLine" , diag_tickTime]; + }; +}; diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf index 42a39402..c68c9df6 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf @@ -1,6 +1,7 @@ _position = getPosATL player; EPOCH_nearestLocations = nearestLocations[player, ["NameCityCapital", "NameCity", "Airport"], 300]; + EPOCH_playerIsSwimming = false; if !(surfaceIsWater _position) then { @@ -14,9 +15,7 @@ if !(surfaceIsWater _position) then { // spawn shark if player is deep water and not in vehicle if (vehicle player == player) then{ _offsetZ = ((_position vectorDiff getPosASL player) select 2); - if (_offsetZ > 1.7) then { - EPOCH_playerIsSwimming = true; - }; + EPOCH_playerIsSwimming = (_offsetZ > 1.7); if (_offsetZ > 50) then { "GreatWhite_F" call EPOCH_unitSpawn; }; @@ -55,6 +54,8 @@ if !(_powerSources isEqualTo[]) then { EPOCH_nearPower = true; }; }; +// downtick Alcohol +EPOCH_playerAlcohol = ((EPOCH_playerAlcohol - 1) min 100) max 0; EPOCH_playerAliveTime = round(EPOCH_playerAliveTime + (_tickTime - EPOCH_clientAliveTimer)); EPOCH_clientAliveTimer = _tickTime; diff --git a/Sources/epoch_code/compile/setup/masterLoop/init.sqf b/Sources/epoch_code/compile/setup/masterLoop/init.sqf index e4cc32bd..247c56fd 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/init.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/init.sqf @@ -13,6 +13,7 @@ _energyRegenMax = ["CfgEpochClient", "energyRegenMax", 5] call EPOCH_fnc_returnC _energyRange = ["CfgEpochClient", "energyRange", 75] call EPOCH_fnc_returnConfigEntryV2; EPOCH_chargeRate = 0; +EPOCH_playerIsSwimming = false; // default data if mismatch if (count EPOCH_playerSpawnArray != count EPOCH_spawnIndex) then{ diff --git a/Sources/epoch_code/gui/scripts/post_process/Epoch_setDrunk.sqf b/Sources/epoch_code/gui/scripts/post_process/Epoch_setDrunk.sqf index 5d9af587..267de6bd 100644 --- a/Sources/epoch_code/gui/scripts/post_process/Epoch_setDrunk.sqf +++ b/Sources/epoch_code/gui/scripts/post_process/Epoch_setDrunk.sqf @@ -11,11 +11,11 @@ private ["_level","_speed"]; params [["_level",0,[0]],["_speed",0,[0]]]; if (isNil "rmx_var_drunkHandles") then { - + _priority = 15; _wd = ["wetdistortion",_priority] call epoch_postProcessCreate; _db = ["dynamicBlur",_priority] call epoch_postProcessCreate; - + rmx_var_drunkHandles = [_wd,_db]; }; @@ -71,4 +71,4 @@ switch _level do { [(rmx_var_drunkHandles select 0), _speed, [1,0.0723131,-0.0433885,1,-0.592987,-0.811979,-1,0.882248,-1,1,1,0,0,0.373996,-1]] call epoch_postprocessAdjust; [(rmx_var_drunkHandles select 1), _speed, [0.151864]] call epoch_postprocessAdjust; }; -}; \ No newline at end of file +};