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_server/EPOCH_server_createTeleport.sqf b/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf index 01481498..cabd0a18 100644 --- a/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf +++ b/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf @@ -13,7 +13,7 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_server/EPOCH_server_createTeleport.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_array","_center","_class","_cloneClasses","_config","_deSimulate","_debug","_debug1","_debugLocation","_dir","_enterClass","_ep","_exitClass","_light","_lightLocation","_loadBaseTemplateConfig","_markerName","_part","_partPos","_pos","_pos1","_pro1","_pro2","_protection","_useWorldPos","_veh1","_veh2"]; +private ["_array","_center","_class","_cloneClasses","_config","_deSimulate","_debug","_debug1","_debugLocation","_dir","_dir1","_dir2","_enterClass","_ep","_exitClass","_light","_lightLocation","_loadBaseTemplateConfig","_markerName","_part","_partPos","_pos","_pos1","_pro1","_pro2","_protection","_useWorldPos","_veh1","_veh2"]; //[[[end]]] _loadBaseTemplateConfig = { private ["_partPos","_part","_array","_center","_deSimulate"]; @@ -110,12 +110,24 @@ _config = configFile >> "CfgEpoch"; _useWorldPos = (_x select 4) isEqualTo "true"; }; _pos1 = _x select 1; + + // allow forth position element to set direction if set + _dir1 = 0; + _dir2 = 0; + if (count _pos1 >= 4) then { + _dir1 = _pos1 deleteAt 3; + }; + if !(_useWorldPos) then { - _pos1 = _debug modelToWorld (_x select 1); + _pos1 = _debug modelToWorld _pos1; }; _exitClass = _x select 2; _pos = _x select 3; + // allow forth position element to set direction if set + if (count _pos >= 4) then { + _dir2 = _pos deleteAt 3; + }; // load template props for marker location if (_pos isEqualType "") then { @@ -126,20 +138,30 @@ _config = configFile >> "CfgEpoch"; _pro2 = createVehicle ["ProtectionZone_Invisible_F", _pos, [], 0, "CAN_COLLIDE"]; }; + + _pro1 = createVehicle ["ProtectionZone_Invisible_F", _pos1, [], 0, "CAN_COLLIDE"]; _veh1 = createVehicle[_enterClass, _pos1, [], 0, "CAN_COLLIDE"]; + // force addaction on any other objects that are not setup properly + if !(_veh1 isKindOf "Transport_EPOCH") then { + [_veh1, [(localize "STR_EPOCH_Teleport"), {(_this select 0) call EPOCH_EnterBuilding}, [], 1, true, true, "Action", "alive _target", 3, false, ""]] remoteExec ["addAction", -2, _veh1, true]; + }; _veh1 enableSimulationGlobal false; _veh1 allowDamage false; _veh1 setVariable["ParentBuilding", _pos]; - _veh1 setDir 0; + _veh1 setDir _dir1; _veh1 setposATL _pos1; if (_exitClass != "") then { _veh2 = createVehicle[_exitClass, _pos, [], 0, "CAN_COLLIDE"]; + // force addaction on any other objects that are not setup properly + if !(_veh2 isKindOf "Transport_EPOCH") then { + [_veh2, [(localize "STR_EPOCH_Teleport"), {(_this select 0) call EPOCH_EnterBuilding}, [], 1, true, true, "Action", "alive _target", 3, false, ""]] remoteExec ["addAction", -2, _veh1, true]; + }; _veh2 enableSimulationGlobal false; _veh2 allowDamage false; _veh2 setVariable["ParentBuilding", _pos1]; - _veh2 setDir 0; + _veh2 setDir _dir2; _veh2 setposATL _pos; }; 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