From e52fc1ee2548956980068060133dc202ae82af24 Mon Sep 17 00:00:00 2001 From: "DESKTOP-UH65DCE\\MusTanG" Date: Mon, 24 Jul 2017 12:34:58 -0500 Subject: [PATCH] DynSim #3 Configs Added cfgDynamicSimulation. Toggle entire system. Toggle individual sections player/bases/vehicles Set mulitpliers and distances. Will continue to add to these configs as BIS adds more scripting commands for us to use. --- Sources/epoch_code/init/both_init.sqf | 17 +++++++++++------ .../Configs/CfgDynamicSimulation.hpp | 16 ++++++++++++++++ Sources/epoch_config/sandbox_config.hpp | 1 + .../epoch_bases/EPOCH_server_loadBuildings.sqf | 9 ++++++--- .../compile/epoch_bases/EPOCH_swapBuilding.sqf | 9 ++++++--- .../epoch_player/EPOCH_server_loadPlayer.sqf | 7 +++++-- .../epoch_player/EPOCH_server_revivePlayer.sqf | 7 +++++-- .../epoch_vehicle/EPOCH_load_vehicles.sqf | 7 +++++-- .../EPOCH_server_upgrade_vehicle.sqf | 7 +++++-- .../epoch_vehicle/EPOCH_spawn_vehicle.sqf | 7 +++++-- 10 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 Sources/epoch_config/Configs/CfgDynamicSimulation.hpp diff --git a/Sources/epoch_code/init/both_init.sqf b/Sources/epoch_code/init/both_init.sqf index f2cd737c..eb530b3e 100644 --- a/Sources/epoch_code/init/both_init.sqf +++ b/Sources/epoch_code/init/both_init.sqf @@ -113,9 +113,14 @@ _say3dsounds = "isClass _x" configClasses (_say3dsoundsConfig); 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 -enableDynamicSimulationSystem true; -"Group" setDynamicSimulationDistance 1600; -"Vehicle" setDynamicSimulationDistance 1600; -"EmptyVehicle" setDynamicSimulationDistance 1600; -"Prop" setDynamicSimulationDistance 1600; -"IsMoving" setDynamicSimulationDistanceCoef 1.5; \ No newline at end of file +_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"); +}; \ No newline at end of file diff --git a/Sources/epoch_config/Configs/CfgDynamicSimulation.hpp b/Sources/epoch_config/Configs/CfgDynamicSimulation.hpp new file mode 100644 index 00000000..2f716b87 --- /dev/null +++ b/Sources/epoch_config/Configs/CfgDynamicSimulation.hpp @@ -0,0 +1,16 @@ +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 + groupDynSimDistance = 1600; + vehicleDynSimDistance = 1600; + emptyVehicleDynSimDistance = 1600; + propDynSimDistance = 1600; +}; \ No newline at end of file diff --git a/Sources/epoch_config/sandbox_config.hpp b/Sources/epoch_config/sandbox_config.hpp index 40ca4e61..b1e6a9a5 100644 --- a/Sources/epoch_config/sandbox_config.hpp +++ b/Sources/epoch_config/sandbox_config.hpp @@ -76,6 +76,7 @@ disableRandomization[] = {"All"}; #include "Configs\CfgSwitchMovehandler.hpp" #include "Configs\CfgVehicleUpgrades.hpp" #include "Configs\CfgReadingDocuments.hpp" +#include "Configs\CfgDynamicSimulation.hpp" // A3 specific configs #include "Configs\CfgFunctions.hpp" 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 478e8c21..5f7b9edd 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_loadBuildings.sqf @@ -93,9 +93,12 @@ for "_i" from 0 to _this do { _baseObj setposATL _location; // 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 + if(["CfgDynamicSimulation", "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + { + _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 + }; // spawn additional object for trap _ammoClass = (_cfgBaseBuilding >> _class >> "ammoClass"); diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf index d37ae116..bc207f70 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf @@ -11,9 +11,12 @@ if (!isNull _object && !(_class isEqualTo "")) then { _object hideObjectGlobal true; // new Dynamicsimulation - _newObj enableDynamicSimulation true; - _newObj triggerDynamicSimulation false; // this object doesnt need to turn anything on in the server - + 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 + }; + switch (_method) do { case 0: { _newObj setVectorDirAndUp [vectordir _object, vectorup _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 0905c413..89d0e77f 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf @@ -320,8 +320,11 @@ if (!isNull _player) then { _newPlyr setUnitLoadout (getUnitLoadout _newPlyr); // if this works, possibly replace all inventory code with with get|setUnitLoadout // new Dynamicsimulation - _newPlyr enableDynamicSimulation true; - _newPlyr triggerDynamicSimulation true; + if(["CfgDynamicSimulation", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + { + _newPlyr enableDynamicSimulation true; + _newPlyr triggerDynamicSimulation true; + }; }; } else { diag_log format["LOGIN FAILED UNIT NULL: %1 [%2|%3]", _player, _group, count allgroups]; 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 fe96b5ba..7793456a 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf @@ -112,8 +112,11 @@ if (!local _player) then { _newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"]; // new Dynamicsimulation - _newPlyr enableDynamicSimulation true; - _newPlyr triggerDynamicSimulation true; + if(["CfgDynamicSimulation", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + { + _newPlyr enableDynamicSimulation true; + _newPlyr triggerDynamicSimulation true; + }; addToRemainsCollector[_newPlyr]; 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 556070be..4b0dad2a 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -213,8 +213,11 @@ for "_i" from 1 to _maxVehicleLimit do { }; // new Dynamicsimulation - _vehicle enableSimulationGlobal false; // turn it off until activated by dynamicSim - _vehicle enableDynamicSimulation true; + if(["CfgDynamicSimulation", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + { + _vehicle enableSimulationGlobal false; // turn it off until activated by dynamicSim + _vehicle enableDynamicSimulation true; + }; // turrets /* 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 8f6625ca..db2c0fae 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,8 +99,11 @@ if !(_allHitpoints isEqualTo []) then{ }; // new Dynamicsimulation -_newveh enableSimulationGlobal false; // turn it off until activated by dynamicSim -_newveh enableDynamicSimulation true; +if(["CfgDynamicSimulation", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then +{ + _newveh enableSimulationGlobal false; // turn it off until activated by dynamicSim + _newveh enableDynamicSimulation true; +}; // add back old inventory 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 78c8c99a..074badb0 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf @@ -109,8 +109,11 @@ if !(isNull _vehObj) then{ }; // new Dynamicsimulation - _vehObj enableSimulationGlobal false; // turn it off until activated by dynamicSim - _vehObj enableDynamicSimulation true; + if(["CfgDynamicSimulation", "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntryV2)then + { + _vehObj enableSimulationGlobal false; // turn it off until activated by dynamicSim + _vehObj enableDynamicSimulation true; + }; // SAVE VEHICLE