Skip to content

Instantly share code, notes, and snippets.

@AugustoMoura AugustoMoura/block_2_6.blk.lua Secret
Created Jul 11, 2015

Embed
What would you like to do?
block =
{
object_names =
{ -- used to keep the file small, useful when you have multiple instances of the same object name
"/mygame/data/houses/house1";
"/mygame/data/houses/house2";
"/mygame/data/houses/building1";
"/mygame/data/houses/building2";
"/mygame/data/props/computer_case";
"/mygame/data/props/sofa";
"/mygame/data/props/tv";
"/mygame/data/props/food_ktcn01";
};
objects = {
{ -- OBJECT #1:
2; -- object ID, from the object_names
"myCustomHouseName01"; -- the instance name
vec(105.1032, 210.2568, 0); -- position inside the block
quat(1, 0, 0, 0); -- orientation
vec(1, 1, 1); -- scale
{ -- custom properties, per instance
colour = vec(1, 0.9, 0);
playerCanEnter = true;
buildNavMesh = false;
usePreBuildNavMesh = true; -- uses a pre generated navigation mesh (mesh_name.nav)
castShadows = true;
renderingDistance = 10000; -- the distance when the object is not rendered anymore
lodDistances =
{ -- means that this object have 4 LODs
350; -- LOD0 max distance
1200; -- LOD1 max distance
2000; -- LOD2 max distance
}
loadInternalObjectsPerDistance = 200; -- in this case, this house loads the internal objects by distance, because have huge transparent windows, so you can see through
};
childs =
{ -- here are added the child objects, with its properties
{ -- OBJECT #1 child #1:
7;
"myTV01";
vec(10.18, 15, 1.5); -- relative position inside the parent house
quat(1, 0, 0, 0); -- relative orientation to parent orientation
vec(1, 1, 1);
{
castShadows = true;
renderingDistance = 250;
lodDistances =
{
50; -- This one have just two LODs, so after this distance the lowpoly is loaded
}
};
};
{ -- OBJECT #1 child #2:
8;
"myFood01";
vec(10.1032, 7.2, 1.1);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
castShadows = true;
renderingDistance = 200;
lodDistances =
{
35;
}
};
};
};
};
{ -- OBJECT #2:
3;
"myCustomBuildingName01";
vec(50.25, 120.6, -74.56);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
colour = vec(1, 1, 1);
playerCanEnter = false;
buildNavMesh = true; -- build the navigation mesh in realtime, not recommended but needs to be available
castShadows = true;
renderingDistance = 150000;
lodDistances =
{
1000;
5000;
10000;
}
};
-- this is an empty building, no childs
};
{ -- OBJECT #3:
4;
"myCustomBuildingName02";
vec(160.51, 120.6, -74.52);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
colour = vec(0.8, 0.9, 1);
playerCanEnter = true;
usePreBuildNavMesh = true;
castShadows = true;
renderingDistance = 150000;
lodDistances =
{
1000;
5000;
10000;
}
};
childs =
{
{
5;
"mycomputer01";
vec(4, 6, 1.5);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
castShadows = true;
renderingDistance = 200;
lodDistances =
{
45;
}
};
};
{
6;
"mySofa01";
vec(10.1032, 9, 0);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
castShadows = true;
renderingDistance = 400;
lodDistances =
{
80;
}
};
};
{ -- a trigger to load internal objects
6;
"triggerBuilding02_1";
vec(12, -22, 0);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
touch = function() World:getObjectByName("myCustomBuildingName02"):loadInternalObjects() end
};
};
{ -- a trigger to unload internal objects, outside of the door
6;
"triggerBuilding02_2";
vec(12, -24, 0);
quat(1, 0, 0, 0);
vec(1, 1, 1);
{
touch = function() World:getObjectByName("myCustomBuildingName02"):unloadInternalObjects() end
};
};
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.