mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Tweaked SwapBuilding
- Removed disable Simulation here, because desimulated objects need a long time to broadcast the correct position. So we only desimulate them on next restart - Removed reveal, because it has no effect in my tests. - Moved the position set code more to the top of this script, as it has a positive effect on position set performance
This commit is contained in:
parent
f61dfa7117
commit
c615d93ba6
@ -1,6 +1,6 @@
|
|||||||
// _newObj = [_class,_object] call EPOCH_swapBuilding;
|
// _newObj = [_class,_object] call EPOCH_swapBuilding;
|
||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[cog import generate_private_arrays ]]]
|
||||||
private ["_newObj","_objectPos","_playersNear"];
|
private ["_newObj","_objectPos"];
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
params [["_class",""],["_object",objNull],["_method",0]];
|
params [["_class",""],["_object",objNull],["_method",0]];
|
||||||
_newObj = objNull;
|
_newObj = objNull;
|
||||||
@ -9,43 +9,6 @@ if (!isNull _object && !(_class isEqualTo "")) then {
|
|||||||
_newObj = createVehicle [_class, ASLtoAGL _objectPos, [], 0, "CAN_COLLIDE"];
|
_newObj = createVehicle [_class, ASLtoAGL _objectPos, [], 0, "CAN_COLLIDE"];
|
||||||
if (!isNull _newObj) then {
|
if (!isNull _newObj) then {
|
||||||
_object hideObjectGlobal true;
|
_object hideObjectGlobal true;
|
||||||
|
|
||||||
_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 {
|
switch (_method) do {
|
||||||
case 0: {
|
case 0: {
|
||||||
_newObj setposATL (getPosATL _object);
|
_newObj setposATL (getPosATL _object);
|
||||||
@ -65,10 +28,25 @@ if (!isNull _object && !(_class isEqualTo "")) then {
|
|||||||
};
|
};
|
||||||
deleteVehicle _object;
|
deleteVehicle _object;
|
||||||
|
|
||||||
// force nearby players to reveal new object faster
|
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||||
_playersNear = _newObj nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 300];
|
_UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry;
|
||||||
[_newObj, {player reveal _this}] remoteExec ["call", _playersNear];
|
_IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||||
|
_ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||||
|
if (_UseIndestructible) then {
|
||||||
|
if ({_class iskindof _x} count _ExceptedBaseObjects == 0) then {
|
||||||
|
{
|
||||||
|
if (_class iskindof _x) exitwith {
|
||||||
|
_newObj allowdamage false;
|
||||||
|
};
|
||||||
|
} foreach _IndestructibleBaseObjects;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// 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
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_newObj
|
_newObj
|
||||||
|
Loading…
Reference in New Issue
Block a user