From 8ab05047e9e6f114d458ca916f4b8bf75658db7b Mon Sep 17 00:00:00 2001 From: He-Man Date: Thu, 30 Nov 2017 22:59:29 +0100 Subject: [PATCH] Simulation tweaks - Added an option to completely disable Simulation for specific Base Parts. - Added Base Parts without animations to this array. - Removed Base Objects Init (mpAddEventhandler "mpKilled") from indestructible Base Objects, as it is not needed. - Moved Dynamicsimulation server side (not needed client side) - Resorted epochonfig.hpp All changes are running on our Server without any problems and with a good performance boost, as the dynamicsimulationhandler has not to handle a few thousand objects anymore --- .../@epochhive/epochconfig.hpp | 226 ++++++++++-------- Sources/epoch_code/init/both_init.sqf | 15 +- .../Configs/CfgDynamicSimulation.hpp | 17 -- Sources/epoch_config/sandbox_config.hpp | 1 - .../EPOCH_server_loadBuildings.sqf | 32 ++- .../epoch_bases/EPOCH_server_saveBuilding.sqf | 31 +-- .../epoch_bases/EPOCH_server_simulSwap.sqf | 6 +- .../epoch_bases/EPOCH_server_upgradeBUILD.sqf | 4 +- .../epoch_bases/EPOCH_swapBuilding.sqf | 41 +++- .../epoch_player/EPOCH_server_loadPlayer.sqf | 2 +- .../EPOCH_server_revivePlayer.sqf | 2 +- .../EPOCH_server_createTeleport.sqf | 2 +- .../epoch_vehicle/EPOCH_load_vehicles.sqf | 3 +- .../EPOCH_server_upgrade_vehicle.sqf | 2 +- .../epoch_vehicle/EPOCH_spawn_vehicle.sqf | 2 +- Sources/epoch_server/init/server_init.sqf | 12 +- 16 files changed, 217 insertions(+), 181 deletions(-) delete mode 100644 Sources/epoch_config/Configs/CfgDynamicSimulation.hpp diff --git a/Server_Install_Pack/@epochhive/epochconfig.hpp b/Server_Install_Pack/@epochhive/epochconfig.hpp index a1be095f..c1f2228a 100644 --- a/Server_Install_Pack/@epochhive/epochconfig.hpp +++ b/Server_Install_Pack/@epochhive/epochconfig.hpp @@ -1,123 +1,153 @@ -serverRestart = "false"; // true sends #shutdown command to server after the time specified in ForceRestartTime -forceRestartTime = 14400; // 4 hour restarts - -StorageSlotsLimit = 1500; // Max storage slots allowed. Warning! Higher the number lower performance. -BuildingSlotsLimit = 1500; // Max building slots allowed. Warning! Higher the number lower performance. +serverRestart = "false"; // true sends #shutdown command to server after the time specified in ForceRestartTime +forceRestartTime = 14400; // 4 hour restarts // Time based -StaticDateTime[] = {}; // {0,0,0,8,0} would forces the server to start at 8am each time it is started while allowing the year, month and day to stay real time. Any values left at 0 will result in no change. -timeDifference = 0; // Server uses real time this will allow you to offset just the hour. -timeMultiplier = 4; // Sets a time multiplier for in-game time. The command range is now capped at 0.1 - 120 to avoid performance problems. -lootMultiplier = 0.5; // 1 = max loot bias. This controls how much loot can payout per Epoch loot container. + StaticDateTime[] = {}; // {0,0,0,8,0} would forces the server to start at 8am each time it is started while allowing the year, month and day to stay real time. Any values left at 0 will result in no change. + timeDifference = 0; // Server uses real time this will allow you to offset just the hour. + timeMultiplier = 4; // Sets a time multiplier for in-game time. The command range is now capped at 0.1 - 120 to avoid performance problems. + lootMultiplier = 0.5; // 1 = max loot bias. This controls how much loot can payout per Epoch loot container. + // Events -WeatherStaticForecast[] = {}; // Default: {75.5,0,{0,0,0},0,{1,1}}; // Clear day; {19,1,{1,1,40},1,{5,5}}; // Cold Foggy Rainy Overcast Windy; Format: {temp ,rain ,fog ,overcast ,wind } -events[] = { - { 3600, "CarnivalSpawner", 0 , 1, -1, {} ,{"VR"}}, // SECOND , EVENT , INIT 1 = run script at startup or 0 normal delay, PREPOSTFIX 1 = use pre/postfix path (inside epoch settings pbo) 0 = use full file path, RUNNUMTIMES -1 infinite, execVM payload , disallowed worlds - // { 1800, "PaydayEvent", 0, 1}, - // { 1200, "MessageServer", 0, 1}, - { 2700, "AirDrop", 0 , 1, -1, {} ,{"VR"}}, - { 2400, "EarthQuake", 0 , 1, -1, {} ,{"VR"}}, - { 2700, "Satellite", 0 , 1, -1, {} ,{"VR"}}, - { 900, "ChangeWeather", 1 , 1, -1, {} ,{"VR"}}, - { 1200, "ContainerSpawner", 0 , 1, -1, {} ,{"VR"}}, - { 1440, "GardenManager", 0 , 1, -1, {} ,{"VR"}}, - { 300, "PlantSpawner", 0 , 1 , -1, {} ,{"VR"}} //No comma on last Entry -}; + WeatherStaticForecast[] = {}; // Default: {75.5,0,{0,0,0},0,{1,1}}; // Clear day; {19,1,{1,1,40},1,{5,5}}; // Cold Foggy Rainy Overcast Windy; Format: {temp ,rain ,fog ,overcast ,wind } + events[] = { + { 3600, "CarnivalSpawner", 0 , 1, -1, {} ,{"VR"}}, // SECOND , EVENT , INIT 1 = run script at startup or 0 normal delay, PREPOSTFIX 1 = use pre/postfix path (inside epoch settings pbo) 0 = use full file path, RUNNUMTIMES -1 infinite, execVM payload , disallowed worlds + // { 1800, "PaydayEvent", 0, 1}, + // { 1200, "MessageServer", 0, 1}, + { 2700, "AirDrop", 0 , 1, -1, {} ,{"VR"}}, + { 2400, "EarthQuake", 0 , 1, -1, {} ,{"VR"}}, + { 2700, "Satellite", 0 , 1, -1, {} ,{"VR"}}, + { 900, "ChangeWeather", 1 , 1, -1, {} ,{"VR"}}, + { 1200, "ContainerSpawner", 0 , 1, -1, {} ,{"VR"}}, + { 1440, "GardenManager", 0 , 1, -1, {} ,{"VR"}}, + { 300, "PlantSpawner", 0 , 1 , -1, {} ,{"VR"}} //No comma on last Entry + }; // Antagonists -antagonistChancePDeath = 0.33; //33% chance when player was killed from a other player (selfkill doesn't count) + antagonistChancePDeath = 0.33; //33% chance when player was killed from a other player (selfkill doesn't count) // Player Related -cloneCost = 100; // debt incurred on player death -MaxBankDebitforTrade = -50000; // If Player has less money on Bank, Crypto from Trade goes directly to Bank instead to Player + cloneCost = 100; // debt incurred on player death + MaxBankDebitforTrade = -50000; // If Player has less money on Bank, Crypto from Trade goes directly to Bank instead to Player // Default Loadout -defaultUniformFemale = "U_Test_uniform"; -defaultVestFemale = "V_F41_EPOCH"; -defaultUniformMale = "U_Test1_uniform"; -defaultVestMale = "V_41_EPOCH"; -defaultGoggles = ""; -defaultHeadgear = ""; -defaultBackpack = ""; -defaultprimaryWeapon[] = {}; // {"arifle_MX_pointer_F","","acc_pointer_IR","",{"30Rnd_65x39_caseless_mag",29},{},""}; -defaultsecondaryWeapon[] = {}; // {"launch_NLAW_F","","","",{"NLAW_F",1},{},""}; -defaulthandgunWeapon[] = {}; // {"hgun_P07_F","","","",{"16Rnd_9x21_Mag",16},{},""}; -defaultuniformItems[] = {}; // {{"FAK",1},{"30Rnd_65x39_caseless_mag",2,30},{"Chemlight_green",1,1}}; -defaultvestItems[] = {}; // {{"30Rnd_65x39_caseless_mag",3,30},{"16Rnd_9x21_Mag",2,16},{"SmokeShell",1,1},{"SmokeShellGreen",1,1},{"SmokeShellBlue",1,1},{"SmokeShellOrange",1,1},{"Chemlight_green",1,1}}; -defaultbackpackItems[] = {}; // {{"Medikit",1},{"FAK",10},{{"hgun_P07_F","","","",{"16Rnd_9x21_Mag",16},{},""},1}}; -defaultassignedItems[] = {}; // {"Rangefinder","","","",{},{},""} -defaultlinkedItems[] = { - "ItemMap", // "ItemMap" - "", // "ItemGPS" or "ItemGeigerCounter_EPOCH", - "EpochRadio0", // "EpochRadio0" through "EpochRadio9" - "", // "ItemCompass" - "", // "ItemWatch" - "" // "NVG_EPOCH" or "radiation_mask_epoch" -}; + defaultUniformFemale = "U_Test_uniform"; + defaultVestFemale = "V_F41_EPOCH"; + defaultUniformMale = "U_Test1_uniform"; + defaultVestMale = "V_41_EPOCH"; + defaultGoggles = ""; + defaultHeadgear = ""; + defaultBackpack = ""; + defaultprimaryWeapon[] = {}; // {"arifle_MX_pointer_F","","acc_pointer_IR","",{"30Rnd_65x39_caseless_mag",29},{},""}; + defaultsecondaryWeapon[] = {}; // {"launch_NLAW_F","","","",{"NLAW_F",1},{},""}; + defaulthandgunWeapon[] = {}; // {"hgun_P07_F","","","",{"16Rnd_9x21_Mag",16},{},""}; + defaultuniformItems[] = {}; // {{"FAK",1},{"30Rnd_65x39_caseless_mag",2,30},{"Chemlight_green",1,1}}; + defaultvestItems[] = {}; // {{"30Rnd_65x39_caseless_mag",3,30},{"16Rnd_9x21_Mag",2,16},{"SmokeShell",1,1},{"SmokeShellGreen",1,1},{"SmokeShellBlue",1,1},{"SmokeShellOrange",1,1},{"Chemlight_green",1,1}}; + defaultbackpackItems[] = {}; // {{"Medikit",1},{"FAK",10},{{"hgun_P07_F","","","",{"16Rnd_9x21_Mag",16},{},""},1}}; + defaultassignedItems[] = {}; // {"Rangefinder","","","",{},{},""} + defaultlinkedItems[] = { + "ItemMap", // "ItemMap" + "", // "ItemGPS" or "ItemGeigerCounter_EPOCH", + "EpochRadio0", // "EpochRadio0" through "EpochRadio9" + "", // "ItemCompass" + "", // "ItemWatch" + "" // "NVG_EPOCH" or "radiation_mask_epoch" + }; // vehicles - Max vehicle slots is calculated from per vehicle limits below. Warning! Higher the number lower the performance. -disableAutoRefuel = "true"; // Removes auto refuel from all buildings at server startup. -simulationHandlerOld = "false"; // When enabled this feature disables simulation on vehicles that are not nea players. Can help improve client fps at the cost of server fps. -vehicleLockTime = 1800; // Controls how many seconds it takes to allow another person/group to unlock vehicle. -VehLockMessages = "true"; // Give players a hint, that the Vehicle is locked / unlocked -removevehweapons[] = { // remove these Weapons from spawned Vehicles - "missiles_DAR","gatling_30mm","gatling_20mm","missiles_DAGR","cannon_30mm_Plane_CAS_02_F","Missile_AA_03_Plane_CAS_02_F","Missile_AGM_01_Plane_CAS_02_F","Rocket_03_HE_Plane_CAS_02_F", - "Rocket_03_AP_Plane_CAS_02_F","Bomb_03_Plane_CAS_02_F","Bomb_04_Plane_CAS_01_F","Rocket_04_AP_Plane_CAS_01_F","Rocket_04_HE_Plane_CAS_01_F","Missile_AGM_02_Plane_CAS_01_F","Missile_AA_04_Plane_CAS_01_F", - "Gatling_30mm_Plane_CAS_01_F","GBU12BombLauncher_Plane_Fighter_03_F","missiles_ASRAAM","missiles_SCALPEL","Twin_Cannon_20mm","missiles_Zephyr","rockets_skyfire","gatling_30mm_vtol_02" -}; -removevehmagazinesturret[] = { // Remove these Magazines from the given Turret from spawned Vehicles - {"24Rnd_missiles",{-1}}, - {"200Rnd_40mm_G_belt",{0}} -}; -disableVehicleTIE = "true"; + disableAutoRefuel = "true"; // Removes auto refuel from all buildings at server startup. + simulationHandlerOld = "false"; // When enabled this feature disables simulation on vehicles that are not nea players. Can help improve client fps at the cost of server fps. + vehicleLockTime = 1800; // Controls how many seconds it takes to allow another person/group to unlock vehicle. + VehLockMessages = "true"; // Give players a hint, that the Vehicle is locked / unlocked + removevehweapons[] = { // remove these Weapons from spawned Vehicles + "missiles_DAR","gatling_30mm","gatling_20mm","missiles_DAGR","cannon_30mm_Plane_CAS_02_F","Missile_AA_03_Plane_CAS_02_F","Missile_AGM_01_Plane_CAS_02_F","Rocket_03_HE_Plane_CAS_02_F", + "Rocket_03_AP_Plane_CAS_02_F","Bomb_03_Plane_CAS_02_F","Bomb_04_Plane_CAS_01_F","Rocket_04_AP_Plane_CAS_01_F","Rocket_04_HE_Plane_CAS_01_F","Missile_AGM_02_Plane_CAS_01_F","Missile_AA_04_Plane_CAS_01_F", + "Gatling_30mm_Plane_CAS_01_F","GBU12BombLauncher_Plane_Fighter_03_F","missiles_ASRAAM","missiles_SCALPEL","Twin_Cannon_20mm","missiles_Zephyr","rockets_skyfire","gatling_30mm_vtol_02" + }; + removevehmagazinesturret[] = { // Remove these Magazines from the given Turret from spawned Vehicles + {"24Rnd_missiles",{-1}}, + {"200Rnd_40mm_G_belt",{0}} + }; + disableVehicleTIE = "true"; // BaseBuilding -UseIndestructible = "false"; // Enable / Disable Indestructible BaseObjects -IndestructibleBaseObjects[] = { // Can be Names or Classes - "Constructions_static_F", - "Buildable_Storage", - "PlotPole_EPOCH", - "LockBox_EPOCH", - "Safe_EPOCH" - }; -ExceptedBaseObjects[] = { // Not Indestructible, also if in a Class of IndestructibleBaseObjects - "CinderWallGarage_EPOCH", - "WoodLargeWallDoorL_EPOCH", - "WoodLargeWallDoor_EPOCH", - "WoodWall4_EPOCH" + StorageSlotsLimit = 1500; // Max storage slots allowed. Warning! Higher the number lower performance. + BuildingSlotsLimit = 1500; // Max building slots allowed. Warning! Higher the number lower performance. + UseIndestructible = "false"; // Enable / Disable Indestructible BaseObjects + IndestructibleBaseObjects[] = { // Can be Names or Classes + "Constructions_static_F", + "Buildable_Storage", + "PlotPole_EPOCH", + "LockBox_EPOCH", + "Safe_EPOCH" + }; + ExceptedBaseObjects[] = { // Not Indestructible, also if in a Class of IndestructibleBaseObjects + "CinderWallGarage_EPOCH", + "WoodLargeWallDoorL_EPOCH", + "WoodLargeWallDoor_EPOCH", + "WoodWall4_EPOCH" + }; + UseDeSimulateObjects = "true"; // Disable Simulation for specifed Base Objects + DeSimulateObjects[] = { // Base Objects to disable Simulation. Can be Names or Classes + "PlotPole_EPOCH", + "WoodFoundation_EPOCH","Foundation_EPOCH", + "WoodQuarterFloor_EPOCH","WoodHalfFloor_EPOCH","WoodFloor_EPOCH", + "MetalQuarterFloor_EPOCH","MetalHalfFloor_EPOCH","MetalFloor_EPOCH", + "CinderQuarterFloor_EPOCH","CinderHalfFloor_EPOCH","CinderFloor_EPOCH", + "WoodLargeWall_EPOCH","WoodLargeWallDoorway_EPOCH","WoodLargeWallCor_EPOCH","WoodWall1_EPOCH","WoodWall2_EPOCH","WoodWallWindow_EPOCH", + "CinderWallHalf_EPOCH","CinderWall_EPOCH", + "WoodRamp_EPOCH","WoodStairs_EPOCH","WoodStairs2_EPOCH", + "SolarGen_EPOCH","SandbagWall_EPOCH","BarbedWire_EPOCH","Sink_EPOCH","BagBunker_EPOCH","WaterPump_EPOCH","Scaffolding_EPOCH","SunShade_EPOCH","WatchTower_EPOCH","SandbagWallLong_EPOCH","TankTrap_EPOCH" + }; + ExceptedDeSymObjects[] = { // Not Desymulated, also if in a Class of DeSimulateObjects }; +// Dynamic Simulation System + enableDynamicSimulationSystem = "true"; // enable / disable the complete dynamic simulation system + //Individual toggles for testing + vehicleDynamicSimulationSystem = "true"; // type car, air, boat + playerDynamicSimulationSystem = "true"; // clients + baseDynamicSimulationSystem = "true"; // plot pole and base pieces + // Distances and Coef + isMovingCoefValue = 2; + groupDynSimDistance = 500; + vehicleDynSimDistance = 350; + emptyVehicleDynSimDistance = 250; + propDynSimDistance = 50; + // Traders -taxRate = 0.1; // controls the price increase for purchases -starterTraderItems[] = { { "ItemSodaBurst", "meatballs_epoch", "MortarBucket", "CinderBlocks", "VehicleRepair", "CircuitParts", "ItemCorrugated", "PartPlankPack", "ItemRock", "ItemRope", "ItemStick" }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 } }; // Starter Items for fresh spawned trader first array is classnames second is quantity. -NPCSlotsLimit = 30; // Max number of traders static or dynamic. Warning! Higher the number lower performance. -forceStaticTraders = "true"; // disables traders moving from work to home + taxRate = 0.1; // controls the price increase for purchases + starterTraderItems[] = { // Starter Items for fresh spawned trader first array is classnames second is quantity. + {"ItemSodaBurst","meatballs_epoch","MortarBucket","CinderBlocks","VehicleRepair","CircuitParts","ItemCorrugated","PartPlankPack","ItemRock","ItemRope","ItemStick"}, + {5,5,5,5,5,5,5,5,5,5,5} + }; + NPCSlotsLimit = 30; // Max number of traders static or dynamic. Warning! Higher the number lower performance. + forceStaticTraders = "true"; // disables traders moving from work to home -forcedVehicleSpawnTable = ""; // leave blank for default. Options: "allowedVehiclesList","allowedVehiclesList_CUP","allowedVehiclesList_MAD","allowedVehiclesList_MADCUP" -forcedLootSpawnTable = ""; // leave blank for default. Options: "CfgLootTable","CfgLootTable_CUP","CfgLootTable_MAD","CfgLootTable_MADCUP" + forcedVehicleSpawnTable = ""; // leave blank for default. Options: "allowedVehiclesList","allowedVehiclesList_CUP","allowedVehiclesList_MAD","allowedVehiclesList_MADCUP" + forcedLootSpawnTable = ""; // leave blank for default. Options: "CfgLootTable","CfgLootTable_CUP","CfgLootTable_MAD","CfgLootTable_MADCUP" // Markers -showEarthQuakes = "true"; // show mineral viens caused by earthquakes -showSatellites = "true"; // show crashed Satellites -showShippingContainers = "true"; // Show location of events based loots (plants, shipping container, Carnival) -SHOW_TRADERS = "true"; // Show locations of traders -SHOW_JAMMERS = "false"; // Shows location of base jammers -SHOW_BOATLOOT = "true"; // Shows the location of shipwreck loot -DEBUG_VEH = "false"; // DEBUG ONLY used to debug spawing of vehicles + showEarthQuakes = "true"; // show mineral viens caused by earthquakes + showSatellites = "true"; // show crashed Satellites + showShippingContainers = "true"; // Show location of events based loots (plants, shipping container, Carnival) + SHOW_TRADERS = "true"; // Show locations of traders + SHOW_JAMMERS = "false"; // Shows location of base jammers + SHOW_BOATLOOT = "true"; // Shows the location of shipwreck loot + DEBUG_VEH = "false"; // DEBUG ONLY used to debug spawing of vehicles // Hive Related -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 -expiresVehicle = "604800"; // expiration date in seconds for vehicles -expiresAIdata = "604800"; // expiration date in seconds for NPC Trader inventory -expiresCommunityStats = "7776000"; // expiration date in seconds for players community stats + 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 + expiresVehicle = "604800"; // expiration date in seconds for vehicles + expiresAIdata = "604800"; // expiration date in seconds for NPC Trader inventory + expiresCommunityStats = "7776000"; // expiration date in seconds for players community stats // Admin Features -hiveAdminCmdExec = "false"; // true = enables extra (To Be Released) feature to allow execution of code via hive. -hiveAdminSavePlayerList = "true"; // true = enables saving of playerUID array to hive value PLAYERS:#InstanceID. -hiveAdminCmdTime = 5; // how many seconds between each command queue call. + hiveAdminCmdExec = "false"; // true = enables extra (To Be Released) feature to allow execution of code via hive. + hiveAdminSavePlayerList = "true"; // true = enables saving of playerUID array to hive value PLAYERS:#InstanceID. + hiveAdminCmdTime = 5; // how many seconds between each command queue call. // DEBUG -useOldLoadVehicles = "false"; -enableUnitTestOnStart = 1; // enable extra debug for database calls. 1 = enabled. + useOldLoadVehicles = "false"; + enableUnitTestOnStart = 1; // enable extra debug for database calls. 1 = enabled. diff --git a/Sources/epoch_code/init/both_init.sqf b/Sources/epoch_code/init/both_init.sqf index 50094a96..eb161e1a 100644 --- a/Sources/epoch_code/init/both_init.sqf +++ b/Sources/epoch_code/init/both_init.sqf @@ -13,7 +13,7 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/init/both_init.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_cfgDynamicSimulation","_communityStatsInit","_customVarsInit","_dynSimToggle"]; +private ["_communityStatsInit","_customVarsInit","_dynSimToggle"]; //[[[end]]] // Check if Advanced Vehicle Repair is enabled @@ -71,16 +71,3 @@ EPOCH_group_upgrade_lvl = ["CfgEpochClient", "group_upgrade_lvl", [4,"100",6,"30 // disable remote sensors on server and client as all Epoch AI is local to the side controlling it. disableRemoteSensors (["CfgEpochClient", "disableRemoteSensors", true] call EPOCH_fnc_returnConfigEntryV2); -// Enable Dynamic simulation on both server and clients (maybe only needed server side) -// DynSim is handled locally and yes server and clients will need these configurations -_dynSimToggle = ["CfgDynamicSimulation", "enableDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2; -enableDynamicSimulationSystem _dynSimToggle; -if(_dynSimToggle)then -{ - _cfgDynamicSimulation = 'CfgDynamicSimulation' call EPOCH_returnConfig; - "IsMoving" setDynamicSimulationDistanceCoef getNumber(_cfgDynamicSimulation >> "isMovingCoefValue"); - "Group" setDynamicSimulationDistance getNumber(_cfgDynamicSimulation >> "groupDynSimDistance"); - "Vehicle" setDynamicSimulationDistance getNumber(_cfgDynamicSimulation >> "vehicleDynSimDistance"); - "EmptyVehicle" setDynamicSimulationDistance getNumber(_cfgDynamicSimulation >> "emptyVehicleDynSimDistance"); - "Prop" setDynamicSimulationDistance getNumber(_cfgDynamicSimulation >> "propDynSimDistance"); -}; diff --git a/Sources/epoch_config/Configs/CfgDynamicSimulation.hpp b/Sources/epoch_config/Configs/CfgDynamicSimulation.hpp deleted file mode 100644 index 268d8ef4..00000000 --- a/Sources/epoch_config/Configs/CfgDynamicSimulation.hpp +++ /dev/null @@ -1,17 +0,0 @@ -class CfgDynamicSimulation -{ - //If this is false none of the below settings matter - enableDynamicSimulationSystem = true; - - //Individual toggles for testing - vehicleDynamicSimulationSystem = true; // type car, air, boat - playerDynamicSimulationSystem = true; // clients - baseDynamicSimulationSystem = true; // plot pole and base pieces - - // Distances and Coef - isMovingCoefValue = 3; - groupDynSimDistance = 1600; - vehicleDynSimDistance = 1600; - emptyVehicleDynSimDistance = 1600; - propDynSimDistance = 1600; -}; diff --git a/Sources/epoch_config/sandbox_config.hpp b/Sources/epoch_config/sandbox_config.hpp index d9da3aa9..90637cc1 100644 --- a/Sources/epoch_config/sandbox_config.hpp +++ b/Sources/epoch_config/sandbox_config.hpp @@ -88,7 +88,6 @@ showHUD[] = #include "Configs\CfgSwitchMovehandler.hpp" #include "Configs\CfgVehicleUpgrades.hpp" #include "Configs\CfgReadingDocuments.hpp" -#include "Configs\CfgDynamicSimulation.hpp" #include "Configs\CfgMarkerSets.hpp" // A3 specific configs diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf index 729994ee..6c24d02d 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf @@ -13,13 +13,17 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_ExceptedBaseObjects","_IndestructibleBaseObjects","_UseIndestructible","_VAL","_ammoClass","_ammoObj","_anims","_animsData","_arr","_arrCount","_baseObj","_buildingJammerRange","_cfgBaseBuilding","_cfgEpochClient","_class","_color","_damage","_location","_marker","_maxTTL","_owner","_response","_serverSettingsConfig","_storageSlot","_textureSlot","_ttl","_vehHiveKey","_worldspace"]; +private ["_Simulated","_DamageAllowed","_ExceptedBaseObjects","_IndestructibleBaseObjects","_UseIndestructible","_VAL","_ammoClass","_ammoObj","_anims","_animsData","_arr","_arrCount","_baseObj","_buildingJammerRange","_cfgBaseBuilding","_cfgEpochClient","_class","_color","_damage","_location","_marker","_maxTTL","_owner","_response","_serverSettingsConfig","_storageSlot","_textureSlot","_ttl","_vehHiveKey","_worldspace"]; //[[[end]]] _maxTTL = parseNumber EPOCH_expiresBuilding; _serverSettingsConfig = configFile >> "CfgEpochServer"; +_baseDynamicSimulationSystem = [_serverSettingsConfig, "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry; _UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry; _IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry; _ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry; +_UseDeSimulateObjects = [_serverSettingsConfig, "UseDeSimulateObjects", true] call EPOCH_fnc_returnConfigEntry; +_DeSimulateObjects = [_serverSettingsConfig, "DeSimulateObjects", []] call EPOCH_fnc_returnConfigEntry; +_ExceptedDeSymObjects = [_serverSettingsConfig, "ExceptedDeSymObjects", []] call EPOCH_fnc_returnConfigEntry; _cfgEpochClient = 'CfgEpochClient' call EPOCH_returnConfig; _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; _buildingJammerRange = getNumber(_cfgEpochClient >> "buildingJammerRange"); @@ -30,6 +34,8 @@ _VAL = ["", [], "", "", 0, []]; for "_i" from 0 to _this do { _vehHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID),_i]; _response = ["Building", _vehHiveKey] call EPOCH_fnc_server_hiveGETTTL; + _Simulated = true; + _DamageAllowed = true; if ((_response select 0) == 1 && (_response select 1) isEqualType [] && !((_response select 1) isEqualTo [])) then { _arr = _response select 1; @@ -81,20 +87,30 @@ for "_i" from 0 to _this do { _baseObj = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"]; if (_UseIndestructible) then { - if ({_baseObj iskindof _x} count _ExceptedBaseObjects == 0) then { + if ({_class iskindof _x} count _ExceptedBaseObjects == 0) then { { - if (_baseObj iskindof _x) exitwith { + if (_class iskindof _x) exitwith { _baseObj allowdamage false; + _DamageAllowed = false; }; } foreach _IndestructibleBaseObjects; }; }; + if (_UseDeSimulateObjects) then { + if ({_class iskindof _x} count _ExceptedDeSymObjects == 0) then { + { + if (_class iskindof _x) exitwith { + _baseObj enablesimulationglobal false; + _Simulated = false; + }; + } foreach _DeSimulateObjects; + }; + }; _baseObj setposATL _location; _baseObj setVectorDirAndUp _worldspace; - // new Dynamicsimulation - if(["CfgDynamicSimulation", "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then - { + if (_Simulated && _baseDynamicSimulationSystem) then { // Only needed, if simulation is not disabled + // new Dynamicsimulation _baseObj enableSimulationGlobal false; // turn off sim on server start, let dynSim activate it to true _baseObj enableDynamicSimulation true; _baseObj triggerDynamicSimulation false; // this object doesnt need to turn anything on in the server @@ -138,7 +154,9 @@ for "_i" from 0 to _this do { }; _baseObj setDamage _damage; - _baseObj call EPOCH_server_buildingInit; + if (_DamageAllowed) then { // Only needed, if damage is allowed + _baseObj call EPOCH_server_buildingInit; + }; _baseObj setVariable ["BUILD_SLOT", _i, true]; if (_owner != "-1") then { diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf index fa7237ee..36d97aa4 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf @@ -13,7 +13,7 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_ExceptedBaseObjects","_IndestructibleBaseObjects","_UseIndestructible","_cfgBaseBuilding","_findnextslot","_newVehicle","_objSlot","_oemType","_playerUID","_serverSettingsConfig","_slot","_staticClass","_staticClassConfig","_storageObj","_vehiclePos"]; +private ["_cfgBaseBuilding","_findnextslot","_newVehicle","_objSlot","_oemType","_playerUID","_serverSettingsConfig","_slot","_staticClass","_staticClassConfig","_storageObj","_vehiclePos"]; //[[[end]]] params ["_vehicle", "_player", ["_token","",[""]] ]; @@ -25,10 +25,6 @@ _playerUID = getPlayerUID _player; if (!isNull ropeAttachedTo _vehicle) exitWith{}; _oemType = typeOf _vehicle; -_serverSettingsConfig = configFile >> "CfgEpochServer"; -_UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry; -_IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry; -_ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry; _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; _staticClassConfig = (_cfgBaseBuilding >> _oemType >> "staticClass"); if (isText _staticClassConfig) then { @@ -51,16 +47,6 @@ if (isText _staticClassConfig) then { EPOCH_activeGardens pushBackUnique _storageObj; }; - if (_UseIndestructible) then { - if ({_storageObj iskindof _x} count _ExceptedBaseObjects == 0) then { - { - if (_storageObj iskindof _x) exitwith { - _storageObj allowdamage false; - }; - } foreach _IndestructibleBaseObjects; - }; - }; - if (getNumber(_cfgBaseBuilding >> _staticClass >> "isSecureStorage") == 1) then{ _storageObj setVariable["EPOCH_Locked", false, true]; }; @@ -70,8 +56,9 @@ if (isText _staticClassConfig) then { _storageObj setVariable["STORAGE_SLOT", _slot, true]; _storageObj call EPOCH_server_save_storage; - _storageObj call EPOCH_server_storageInit; - + if (isDamageAllowed _storageObj) then { // Only needed, if damage is allowed + _storageObj call EPOCH_server_storageInit; + }; diag_log format["Epoch: STORAGE: %1 created storage %2 at %3 with slot %4", _playerUID, _staticClass, _vehiclePos, _slot]; }; @@ -95,16 +82,6 @@ if (isText _staticClassConfig) then { if (_objSlot != -1) then { _newVehicle = [_vehicle, false] call EPOCH_server_simulSwap; - if (_UseIndestructible) then { - if ({_newVehicle iskindof _x} count _ExceptedBaseObjects == 0) then { - { - if (_newVehicle iskindof _x) exitwith { - _newVehicle allowdamage false; - }; - } foreach _IndestructibleBaseObjects; - }; - }; - _newVehicle setVariable["BUILD_OWNER", _playerUID, true]; _newVehicle call EPOCH_saveBuilding; }; diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_simulSwap.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_simulSwap.sqf index 91988f24..89c6b2cd 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_simulSwap.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_simulSwap.sqf @@ -35,12 +35,12 @@ if (_objSlot != -1) then { _textureSlot = _object getVariable["TEXTURE_SLOT", 0]; _damage = damage _object; - //_worldspace = [getposATL _object,vectordir _object,vectorup _object]; - //_newObj = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"]; _newObj = [_class,_object] call EPOCH_swapBuilding; _newObj setVariable ["BUILD_SLOT",_objSlot,true]; - _newObj call EPOCH_server_buildingInit; + if (isDamageAllowed _newObj) then { // Only needed, if damage is allowed + _newObj call EPOCH_server_buildingInit; + }; if (_textureSlot != 0) then { // get texture path from index diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_upgradeBUILD.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_upgradeBUILD.sqf index 9d7fb5f7..767ea248 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_upgradeBUILD.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_upgradeBUILD.sqf @@ -29,7 +29,9 @@ if (_objSlot != -1) then { _class = _upgrade select 0; _newObj = [_class,_object] call EPOCH_swapBuilding; _newObj setVariable ["BUILD_SLOT",_objSlot,true]; - _newObj call EPOCH_server_buildingInit; + if (isDamageAllowed _newObj) then { // Only needed, if damage is allowed + _newObj call EPOCH_server_buildingInit; + }; _newObj call EPOCH_saveBuilding; }; } else { diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf index dbcfb0b2..7c78b309 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf @@ -10,13 +10,42 @@ if (!isNull _object && !(_class isEqualTo "")) then { if (!isNull _newObj) then { _object hideObjectGlobal true; - // new Dynamicsimulation - if(["CfgDynamicSimulation", "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then - { - _newObj enableDynamicSimulation true; - _newObj triggerDynamicSimulation false; // this object doesnt need to turn anything on in the server + _serverSettingsConfig = configFile >> "CfgEpochServer"; + _UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry; + _IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry; + _ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry; + _UseDeSimulateObjects = [_serverSettingsConfig, "UseDeSimulateObjects", true] call EPOCH_fnc_returnConfigEntry; + _DeSimulateObjects = [_serverSettingsConfig, "DeSimulateObjects", []] call EPOCH_fnc_returnConfigEntry; + _ExceptedDeSymObjects = [_serverSettingsConfig, "ExceptedDeSymObjects", []] call EPOCH_fnc_returnConfigEntry; + _Simulated = true; + if (_UseIndestructible) then { + if ({_class iskindof _x} count _ExceptedBaseObjects == 0) then { + { + if (_class iskindof _x) exitwith { + _newObj allowdamage false; + }; + } foreach _IndestructibleBaseObjects; + }; }; - + if (_UseDeSimulateObjects) then { + if ({_class iskindof _x} count _ExceptedDeSymObjects == 0) then { + { + if (_class iskindof _x) exitwith { + _newObj enablesimulationglobal false; + _Simulated = false; + }; + } foreach _DeSimulateObjects; + }; + }; + if (_Simulated) then { // Only needed, if simulation is not disabled + // new Dynamicsimulation + if([configFile >> "CfgEpochServer", "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then + { + _newObj enableDynamicSimulation true; + _newObj triggerDynamicSimulation false; // this object doesnt need to turn anything on in the server + }; + }; + switch (_method) do { case 0: { _newObj setposATL (getPosATL _object); 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 c72a7bce..d1bf022c 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf @@ -369,7 +369,7 @@ if (!isNull _player) then { // [] remoteExec ["bis_fnc_reviveInit",_player]; // new Dynamicsimulation - if(["CfgDynamicSimulation", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + if([configFile >> "CfgEpochServer", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then { _newPlyr enableDynamicSimulation true; _newPlyr triggerDynamicSimulation true; diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf index b6f657e6..0e025846 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf @@ -102,7 +102,7 @@ if (!local _player) then { _newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"]; // new Dynamicsimulation - if(["CfgDynamicSimulation", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + if([configFile >> "CfgEpochServer", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then { _newPlyr enableDynamicSimulation true; _newPlyr triggerDynamicSimulation true; diff --git a/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf b/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf index 10bcc469..2fa303e5 100644 --- a/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf +++ b/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf @@ -102,7 +102,7 @@ if !(_debugBox isEqualTo "") then { if((_deSimulate) || (_disableSim isEqualTo "true"))then{ _ep enableSimulationGlobal false; }; - if(["CfgDynamicSimulation", "enableDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then{ + if([configFile >> "CfgEpochServer", "enableDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then _ep enableDynamicSimulation (_dynSim isEqualTo "true"); }; _ep allowDamage (_allowDmg isEqualTo "true"); diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf index ae9185de..ff5ac7e7 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -29,6 +29,7 @@ _jammerRange = getNumber(_config >> "buildingJammerRange"); _serverSettingsConfig = configFile >> "CfgEpochServer"; _immuneIfStartInBase = [_serverSettingsConfig, "immuneIfStartInBase", true] call EPOCH_fnc_returnConfigEntry; +_vehicleDynamicSimulationSystem = [_serverSettingsConfig, "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry; _removeweapons = [_serverSettingsConfig, "removevehweapons", []] call EPOCH_fnc_returnConfigEntry; _removemagazinesturret = [_serverSettingsConfig, "removevehmagazinesturret", []] call EPOCH_fnc_returnConfigEntry; @@ -213,7 +214,7 @@ for "_i" from 1 to _maxVehicleLimit do { }; // new Dynamicsimulation - if(["CfgDynamicSimulation", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + if(_vehicleDynamicSimulationSystem)then { _vehicle enableSimulationGlobal false; // turn it off until activated by dynamicSim _vehicle enableDynamicSimulation true; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf index 95c86838..7c4c8de4 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf @@ -99,7 +99,7 @@ _newHitpoints = getAllHitPointsDamage _newVeh; } foreach (_OldHitPoints select 0); // new Dynamicsimulation -if(["CfgDynamicSimulation", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then +if([configFile >> "CfgEpochServer", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then { _newveh enableSimulationGlobal false; // turn it off until activated by dynamicSim _newveh enableDynamicSimulation true; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf index b28e4f43..2435f2e0 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf @@ -115,7 +115,7 @@ if !(isNull _vehObj) then{ }; // new Dynamicsimulation - if(["CfgDynamicSimulation", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + if([configFile >> "CfgEpochServer", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then { _vehObj enableSimulationGlobal false; // turn it off until activated by dynamicSim _vehObj enableDynamicSimulation true; diff --git a/Sources/epoch_server/init/server_init.sqf b/Sources/epoch_server/init/server_init.sqf index b018e9ae..13596588 100644 --- a/Sources/epoch_server/init/server_init.sqf +++ b/Sources/epoch_server/init/server_init.sqf @@ -91,7 +91,17 @@ diag_log "Epoch: Init Variables"; call compile preprocessFileLineNumbers "\epoch_server\init\server_variables.sqf"; call compile preprocessFileLineNumbers "\epoch_server\init\server_securityfunctions.sqf"; - +// Enable Dynamic simulation +_dynSimToggle = [_serverSettingsConfig, "enableDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry; +enableDynamicSimulationSystem _dynSimToggle; +if(_dynSimToggle)then +{ + "IsMoving" setDynamicSimulationDistanceCoef ([_serverSettingsConfig, "isMovingCoefValue", 2] call EPOCH_fnc_returnConfigEntry); + "Group" setDynamicSimulationDistance ([_serverSettingsConfig, "groupDynSimDistance", 500] call EPOCH_fnc_returnConfigEntry); + "Vehicle" setDynamicSimulationDistance ([_serverSettingsConfig, "vehicleDynSimDistance", 350] call EPOCH_fnc_returnConfigEntry); + "EmptyVehicle" setDynamicSimulationDistance ([_serverSettingsConfig, "emptyVehicleDynSimDistance", 250] call EPOCH_fnc_returnConfigEntry); + "Prop" setDynamicSimulationDistance ([_serverSettingsConfig, "propDynSimDistance", 500] call EPOCH_fnc_returnConfigEntry); +}; ["I", _instanceID, "86400", ["CONTINUE"]] call EPOCH_fnc_server_hiveSETEX; diag_log format["Epoch: Start Hive, Instance ID: '%1'", _instanceID];