pszczelaszkov
Member
hmm i'll try this way and see brushes reactions.
local function drillDungeon(itemid)
for x = startPos.x,endPos.x do
for y = startPos.y,endPos.y do
for z = startPos.z,endPos.z do
pos = {x = x,y = y,z = z,stackpos = 1}
thing = getThingFromPos(pos,false)
if thing.itemid == itemid then
tempPos = {x = x,y = y,z = z+1,stackpos = 1}
placeBrush(19,math.random(0,360),0,tempPos)
doRemoveItem(thing.uid,1)
doCreateItem(8595,1,pos)
doCreateItem(8599,1,tempPos)
end
end
end
end
end
function isPathable(pos)
if queryTileAddThing(getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).uid, {x = pos.x, y = pos.y, z = pos.z}) == RETURNVALUE_NOERROR then
return true
else
return false
end
end
function doCreateItem_Pathable(id, count, pos)
if isPathable(pos) then
doCreateItem(id, count, pos)
return true
else
return false
end
end
function doDetails(id, items, cpt, row, level, turnid)
local inst_tier = pits_event_config.caves[id]
if turnid == inst_turn[id] then
for map_row = 0, inst_tier.map_size[1] - 1 do
if math.random(1, 1000) <= cpt then
if getTileItemById({x = inst_tier.map_corner.x + map_row,y = inst_tier.map_corner.y + row,z = inst_tier.map_corner.z + level}, 1387).uid == 0 then
can_detail_here = true
for str_excluded = 1, #generated_structures[id] do
if isInRange({x = inst_tier.map_corner.x + map_row,y = inst_tier.map_corner.y + row,z = inst_tier.map_corner.z + level},{x = generated_structures[id][str_excluded][1], y = generated_structures[id][str_excluded][2], z = generated_structures[id][str_excluded][3]},{x = generated_structures[id][str_excluded][4], y = generated_structures[id][str_excluded][5], z = generated_structures[id][str_excluded][6]}) then
can_detail_here = false
break
end
end
if can_detail_here then
doCreateItem_Pathable(items[math.random(1, #items)], 1, {x = inst_tier.map_corner.x + map_row,y = inst_tier.map_corner.y + row,z = inst_tier.map_corner.z + level})
end
end
end
end
end
end
-- lib
ARRAY_OLD_TREES = {2709, 2710, 2719, 2720, 2721, 2770, 2784, 3323, 5392, 5396}
...
-- config
pits_event_config = {
caves = {
[1] = {
details = {
[1] = {chance_per_tile = 30, ARRAY_OLD_TREES,ARRAY_CAVE,ARRAY_UNWALKABLE_STONES,ARRAY_DEBRIS,ARRAY_CAMPFIRES,ARRAY_PILLARS,ARRAY_BLACK_JAGGED,ARRAY_SKULLS,ARRAY_RAND_STUFF,ARRAY_BONES,ARRAY_STONE_PILES},
...
-- core
local inst_tier = pits_event_config.caves[id]
...
-- core
if inst_tier.details ~= nil then
for i_types = 1, #inst_tier.details do
world_details[id] = {}
if pits_event_config.main.output then
global_gen_delay[id] = global_gen_delay[id] + pits_event_config.main.chunk_update_interval
addEvent(sendChannelMessage_Turn, global_gen_delay[id], pits_event_config.main.output_channel_id, TALKTYPE_CHANNEL_O, "["..inst_tier.map_name.."]: Generating details... layer "..i_types.."/"..#inst_tier.details..".",id, inst_turn[id])
end
for i_arrays = 1, #inst_tier.details[i_types] do
for i_details = 1, #inst_tier.details[i_types][i_arrays] do
table.insert(world_details[id], inst_tier.details[i_types][i_arrays][i_details])
end
end
table.sort(world_details[id])
for detail_row = 0, inst_tier.map_size[2]-1 do
for detail_level = 0, inst_tier.map_size[3]-1 do
addEvent(doDetails,global_gen_delay[id],id,world_details[id],inst_tier.details[i_types].chance_per_tile,detail_row,detail_level, inst_turn[id]) -- turn id is number to avoid spawning details after closing area
global_gen_delay[id] = global_gen_delay[id] + pits_event_config.main.chunk_update_interval
end
end
if pits_event_config.main.output then
addEvent(sendChannelMessage_Turn, global_gen_delay[id], pits_event_config.main.output_channel_id, TALKTYPE_CHANNEL_O, "["..inst_tier.map_name.."]: Generating details... layer "..i_types.." completed.",id, inst_turn[id])
end
end
end
if you downgrade tfs 1.0, it should workawesome! works for 8.6`?
did it?