Epoch/Sources/epoch_server/compile/epoch_bases/EPOCH_swapBuilding.sqf
DESKTOP-UH65DCE\MusTanG e52fc1ee25 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.
2017-07-24 12:34:58 -05:00

40 lines
1.3 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;
// 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
};
switch (_method) do {
case 0: {
_newObj setVectorDirAndUp [vectordir _object, vectorup _object];
_newObj setPosWorld _objectPos;
};
case 1: {
_newObj attachTo [_object,[0,0,0]];
};
};
deleteVehicle _object;
// force nearby players to reveal new object faster
_playersNear = _newObj nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 300];
{
[_x, _newObj] remoteExec ['reveal',_x];
}forEach _playersNear;
};
};
_newObj