mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
8ab05047e9
- 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
75 lines
2.8 KiB
Plaintext
75 lines
2.8 KiB
Plaintext
// _newObj = [_class,_object] call EPOCH_swapBuilding;
|
|
//[[[cog import generate_private_arrays ]]]
|
|
private ["_newObj","_objectPos","_playersNear"];
|
|
//[[[end]]]
|
|
params [["_class",""],["_object",objNull],["_method",0]];
|
|
_newObj = objNull;
|
|
if (!isNull _object && !(_class isEqualTo "")) then {
|
|
_objectPos = getPosWorld _object;
|
|
_newObj = createVehicle [_class, ASLtoAGL _objectPos, [], 0, "CAN_COLLIDE"];
|
|
if (!isNull _newObj) then {
|
|
_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 {
|
|
case 0: {
|
|
_newObj setposATL (getPosATL _object);
|
|
_newObj setDir (getDir _object);
|
|
_newObj setVectorDirAndUp [vectorDir _object, vectorUP _object];
|
|
};
|
|
case 1: {
|
|
_newObj attachTo [_object,[0,0,0]];
|
|
};
|
|
/*
|
|
case 2: {
|
|
_newObj setPosWorld _objectPos;
|
|
_newObj setDir (getDir _object);
|
|
_newObj setVectorUp (vectorup _object);
|
|
};
|
|
*/
|
|
};
|
|
deleteVehicle _object;
|
|
|
|
// force nearby players to reveal new object faster
|
|
_playersNear = _newObj nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 300];
|
|
[_newObj, {player reveal _this}] remoteExec ["call", _playersNear];
|
|
|
|
};
|
|
};
|
|
_newObj
|