Ignatz_Tools/Tools/Export_EdenToCode.sqf

65 lines
1.8 KiB
Plaintext
Raw Normal View History

2019-07-28 14:50:10 +00:00
_allobj = (allmissionobjects "") select {!(isplayer _x) && !(_x iskindof "logic") && !(_x iskindof "CamCurator") && !(_x iskindof "CBA_NamespaceDummy") && !(_x iskindof "MAN") && !(_x iskindof "Bird") && !(_x iskindof "ThingEffect") && !((typeof _x) isEqualTo "#mark")};
2018-12-07 16:19:51 +00:00
_offset = 0;
_ExportObjects = [];
{
_pos = getposWorld _x;
_pos set [2,(_pos select 2)+_offset];
_type = typeof _x;
2019-07-28 14:50:10 +00:00
if (_type isequalto "" || (_type find "_IG_Workaround" > -1)) then {
_type = (getmodelinfo _x) select 1;
2018-12-07 16:19:51 +00:00
};
_obj = [_type,_pos,getdir _x,[vectorDir _x, vectorup _x]];
_ExportObjects pushback _obj;
} foreach _allobj;
_createcode = "
if (!isserver) exitwith {};
{
private ['_object'];
_x params ['_type','_pos','_dir','_vectordirandup'];
2019-02-28 09:19:27 +00:00
_simple = true;
2018-12-07 16:19:51 +00:00
_allowdamage = true;
_object = objnull;
if (_type iskindof 'house') then {
if (_type in ['Land_Pier_F']) exitwith {
2019-02-28 09:19:27 +00:00
_simple = true;
2018-12-07 16:19:51 +00:00
};
2019-02-28 09:19:27 +00:00
_simple = false;
2018-12-07 16:19:51 +00:00
}
else {
{
if !(((tolower _type) find (tolower _x)) isequalto -1) exitwith {
2019-02-28 09:19:27 +00:00
_simple = false;
2018-12-07 16:19:51 +00:00
_allowdamage = false;
};
2019-02-28 09:19:27 +00:00
} foreach ['lamp','light','fuel','fire','gate','helipad','weapon'];
2018-12-07 16:19:51 +00:00
};
2019-02-28 09:19:27 +00:00
if !(_simple) then {
_simulate = true;
{
if !(((tolower _type) find (tolower _x)) isequalto -1) exitwith {
_simulate = false;
_allowdamage = false;
};
} foreach ['weapon'];
2018-12-07 16:19:51 +00:00
_object = createVehicle [_type,[0,0,0],[],0,'CAN_COLLIDE'];
if (!_allowdamage) then {
_object allowdamage false;
};
2019-02-28 09:19:27 +00:00
if (!_simulate) then {
_object enablesimulationglobal false;
};
2018-12-07 16:19:51 +00:00
}
else {
_object = createsimpleobject [_type,[0,0,0]];
};
_object setPosWorld _pos;
_object setdir _dir;
_object setVectorDirAndUp _vectordirandup;
} forEach _objects;
";
_ExportCode = "_objects = " + (str _ExportObjects) + ";" + _createcode;
copytoclipboard _ExportCode;