if (_damage < 1) then { // create object
diag_log("Spawned: " + str(_ObjectID) + " " + _class);
// for tents: non colliding position
_entity = createVehicle [_class, _point, [], 0,
if (_class=="TentStorage") then {"NONE"} else {"CAN_COLLIDE"}
];
_entity setVariable ["lastUpdate",time];
// Don't set objects for deployables to ensure proper inventory updates
if (_CharacterID == "0") then {
_entity setVariable ["ObjectID", str(_ObjectID), true];
} else {
_entity setVariable ["ObjectUID",_worldspace call dayz_objectUID2 , true];
};
_entity setVariable ["CharacterID", _CharacterID, true];
if (_class == "TentStorage" || _class == "CamoNet_DZ") then {
_entity addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
_entity setDamage _damage;
//diag_log ("DW_DEBUG " + _class + " #" + str(_ObjectID) + " pos=" + (_point call fa_coor2str) + ", damage=" + str(_damage) );
// ##### BASE BUILDING 1.2 Server Side ##### - START
// This sets objects to appear properly once server restarts
//_object setVariable ["ObjectUID", _worldspace call dayz_objectUID2, true]; // Optional (REMOVE // lines before _object) May fix DayZ.ST issues, or issues related to Panel codes not working thanks nullpo
//the following is happening on every server restart
_code = _fuel * 1000; //it is necessary cause we get only the converted fuel variable from the database, so we got to calculate back to code format
_entity setVariable ["Code", _code,true]; //set Code to the Object
_entity setVariable ["Classname", _type, true]; //set Classname to the Object
diag_log ("classname: " + _type);
_entity setVariable ["ObjectID", str(_ObjectID), true]; //set ObjectID to the Object
_entity setVariable ["ObjectUID", _worldspace call dayz_objectUID2, true]; //set ObjectUID to the Object
if ((_entity isKindOf "Static") && !(_entity isKindOf "TentStorage")) then {
_entity setpos [(getposATL _entity select 0),(getposATL _entity select 1), 0];
};
//Set Variable
if (_entity isKindOf "Infostand_2_EP1" && !(_entity isKindOf "Infostand_1_EP1")) then {
_entity setVariable ["Code", _code, true]; //changed to _code instead of _worldspace call dayz_objectUID2
};
// Set whether or not buildable is destructable
if (typeOf(_entity) in allbuildables_class) then {
diag_log ("SERVER: in allbuildables_class:" + typeOf(_entity) + " !");
for "_i" from 0 to ((count allbuildables) - 1) do
{
_classname = (allbuildables select _i) select _i - _i + 1;
_result = [_classname,typeOf(_entity)] call BIS_fnc_areEqual;
if (_result) then {
_requirements = (allbuildables select _i) select _i - _i + 2;
_isDestructable = _requirements select 13;
diag_log ("SERVER: " + typeOf(_entity) + " _isDestructable = " + str(_isDestructable));
if (!_isDestructable) then {
diag_log("Spawned: " + typeOf(_entity) + " Handle Damage False");
_entity addEventHandler ["HandleDamage", {false}];
};
};
};
//gateKeypad = _entity addaction ["Defuse", "\z\addons\dayz_server\compile\enterCode.sqf"];
};
// ##### BASE BUILDING 1.2 Server Side ##### - END