tidy building registration

This commit is contained in:
tenplus1 2024-08-22 07:12:23 +01:00
parent d6df05a3b1
commit edeec7d1e8
2 changed files with 106 additions and 193 deletions

View File

@ -62,16 +62,13 @@ function nssb_register_buildings(
side, -- the mesure of the side of the schematic, it is necessary to put the dirt under it
underground, -- if true the schematic need to spawn underground
height, -- under this heigh the schematic can spawn. If nil the schematic can spawn everywhere underground
ice, -- if true fill the space under the schem with ice and not with dirt as standard
exact_height, -- exact_height=exact_eight under the surface in the correct place
portal) -- is this schematic a portal for the morlendor?
ice) -- if true fill the space under the schem with ice and not with dirt as standard
minetest.register_on_generated(function(minp, maxp)--, seed)
-- error and level checks
if not minp or not maxp
or (underground == false and maxp.y < 0)
or minp.y > 0 then
or (underground == false and maxp.y < 0) or minp.y > 0 then
return
end
@ -161,7 +158,6 @@ function nssb_register_buildings(
while bt do
--minetest.set_node(f, {name = ntu})
minetest.swap_node(f, {name = ntu})
f.y = f.y - 1
@ -174,64 +170,6 @@ function nssb_register_buildings(
end
end
if portal == true then
--[[
-- this is a portal for the morlendor
if already_spawned == 0 then
--already_spawned = 1
local name = minetest.get_node(posplace).name
minetest.chat_send_all("Non ancora creato. Nome: "..name)
if name == "ignore" then
local pmin, pmax = minetest.get_voxel_manip():read_from_map(
vector.subtract(posplace, 80), vector.add(posplace, 80))
name = minetest.get_node(posplace).name
minetest.chat_send_all("name dopo read_from_map:.."..name)
if name == "ignore" then
minetest.emerge_area(vector.subtract(posplace, 80),
vector.add(posplace, 80))
name = minetest.get_node(posplace).name
minetest.chat_send_all("name dopo emerge_area:.."..name)
end
minetest.after(25, function(posplace)
name = minetest.get_node(posplace).name
minetest.chat_send_all("name prima di place_schematic:.."..name)
minetest.place_schematic(posplace, mp
.. "/schems/memoportal.mts", "0", {}, true)
-- minetest.place_schematic(posplace, mp
.. "/schems/memoportal.mts", "0", {}, true)
--minetest.chat_send_all("3")
name = minetest.get_node(posplace).name
minetest.chat_send_all("name dopo place_schematic:.."..name)
end, posplace)
end
minetest.place_schematic(posplace, mp
.. "/schems/memoportal.mts", "0", {}, true)
end
]]--
end
else --underground == true
-- minetest.chat_send_all("Posmin: " .. (minetest.pos_to_string(minp)).." Posmax: " .. (minetest.pos_to_string(maxp)))
@ -253,9 +191,7 @@ function nssb_register_buildings(
return
end
else
if jj > 0 then
j = random(minp.y, 0)
end
if jj > 0 then j = random(minp.y, 0) end
end
local pos1 = {x = i, y = j, z = k}
@ -280,141 +216,117 @@ function nssb_register_buildings(
end)
end
-- register buildings
local jungle_dirt = "default:dirt_with_rainforest_litter"
local v6
if nssb.mymapgenis == 6 then
nssb_register_buildings("spiaggiagranchius", 2, "default:sand", 3, "default:sand", 2, "air", 3, "air", 0, false, nil, false, false, false)
nssb_register_buildings("acquagranchius", 3, "default:sand", 3, "default:sand", 12, "default:water_source", 3, "default:water_source", 0, false, nil, false, false, false)
nssb_register_buildings("ooteca", 6, "default:dirt_with_grass", 3, "default:dirt", 2, "air", 24, "default:tree", 8, false, nil, false, false, false)
nssb_register_buildings("minuscolaooteca", 6, "default:dirt_with_grass",3 , "default:dirt", 2, "air", 24, "default:tree", 2, false, nil, false, false, false)
nssb_register_buildings("piccolaooteca", 6, "default:dirt_with_grass", 2, "default:dirt", 2, "air", 24, "default:tree", 4, false, nil, false, false, false)
nssb_register_buildings("arcate", 8, "default:sand", 3, "default:sand", 13, "default:water_source", 3, "default:water_source",0, false, nil, false, false, false)
nssb_register_buildings("grandepiramide", 8, "default:dirt", 3, "default:dirt", 20, "default:water_source", 3, "default:water_source", 0, false, nil, false, false, false)
nssb_register_buildings("collina", 5, "default:dirt_with_grass", 3, "default:dirt", 2, "air", 3, "air", 12, false, nil, false, false, false)
nssb_register_buildings("megaformicaio", 7, "default:dirt_with_grass", 4, "default:dirt", 2, "air", 3, "air", 25, false, nil, false, false, false)
nssb_register_buildings("antqueenhill", 8, "default:dirt_with_grass", 4, "default:dirt", 2, "air", 3, "air", 21, false, nil, false, false, false)
nssb_register_buildings("rovine1", 4, jungle_dirt, 3, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
-- nssb_register_buildings("rovine2", 1, "default:stone", 0, "air", 0, "air", 24, "default:jungletree", 5, true, -8, false, false)
nssb_register_buildings("rovine3", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine4", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine5", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine6", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine7", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine8", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine9", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine10", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("bozzoli", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("picco", 12, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 10, false, nil, false, false, false)
nssb_register_buildings("piccoghiaccio", 12, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 10, false, nil, true, false, false)
nssb_register_buildings("icehall", 8, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 30, false, nil, true, false, false)
nssb_register_buildings("piccomoonheron", 8, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 3, false, nil, true, false, false)
nssb_register_buildings("doppiopiccoghiaccio", 11, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 7, false, nil, true, false, false)
nssb_register_buildings("doppiopiccosabbia", 11, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 7, false, nil, false, false, false)
nssb_register_buildings("piccoscrausics", 8, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 3, false, nil, false, false, false)
nssb_register_buildings("fossasand", 20, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 16, false, nil, false, false, false)
nssb_register_buildings("portal", 100, "default:dirt_with_grass", 2, "default:dirt", 2, "air", 24, "air", 11, false, nil, false, false, true)
else -- mymapgenis 7
nssb_register_buildings("spiaggiagranchius", 5, "default:sand", 3, "default:sand", 2, "air", 3, "air", 0, false, nil, false, false, false)
nssb_register_buildings("acquagranchius", 6, "default:sand", 3, "default:sand", 12,"default:water_source", 3, "default:water_source", 0, false, nil, false, false, false)
nssb_register_buildings("ooteca", 12, "default:dirt_with_grass", 3, "default:dirt", 2, "air", 24, "default:tree", 8, false, nil, false, false, false)
nssb_register_buildings("minuscolaooteca", 11, "default:dirt_with_grass",3 , "default:dirt", 2, "air", 24, "default:tree", 2, false, nil, false, false, false)
nssb_register_buildings("piccolaooteca", 11, "default:dirt_with_grass", 2, "default:dirt", 2, "air", 24, "default:tree", 4, false, nil, false, false, false)
nssb_register_buildings("arcate", 24, "default:sand", 3, "default:sand", 13, "default:water_source", 3, "default:water_source",0, false, nil, false, false, false)
nssb_register_buildings("grandepiramide", 24, "default:dirt", 3, "default:dirt", 20, "default:water_source", 3, "default:water_source", 0, false, nil, false, false, false)
nssb_register_buildings("collina", 14, "default:dirt_with_grass", 3, "default:dirt", 2, "air", 3, "air", 12, false, nil, false, false, false)
nssb_register_buildings("megaformicaio", 20, "default:dirt_with_grass", 4, "default:dirt", 2, "air", 3, "air", 25, false, nil, false, false, false)
nssb_register_buildings("antqueenhill", 22, "default:dirt_with_grass", 4, "default:dirt", 2, "air", 3, "air", 21, false, nil, false, false, false)
nssb_register_buildings("rovine1", 6, jungle_dirt, 3, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
-- nssb_register_buildings("rovine2", 1, "default:stone", 0, "air", 0, "air", 24, "default:jungletree", 5, true, -8, false, false)
nssb_register_buildings("rovine3", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine4", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine5", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine6", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine7", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine8", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine9", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("rovine10", 6, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("bozzoli", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8, "default:jungletree", 10, false, nil, false, false, false)
nssb_register_buildings("picco", 32, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 10, false, nil, false, false, false)
nssb_register_buildings("piccoghiaccio", 32, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 10, false, nil, true, false, false)
nssb_register_buildings("icehall", 40, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 30, false, nil, true, false, false)
nssb_register_buildings("piccomoonheron", 32, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 3, false, nil, true, false, false)
nssb_register_buildings("doppiopiccoghiaccio", 32, "default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 7, false, nil, true, false, false)
nssb_register_buildings("doppiopiccosabbia", 32, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 7, false, nil, false, false, false)
nssb_register_buildings("piccoscrausics", 32, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 3, false, nil, false, false, false)
nssb_register_buildings("fossasand", 50, "default:desert_sand", 1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 16, false, nil, false, false, false)
nssb_register_buildings("portal", 200, "default:dirt_with_grass", 2, "default:dirt", 2, "air", 24, "air", 11, false, nil, false, false, true)
v6 = true -- helper
end
-- schem, chance, spawnon, num_below_spawnon, downblock, num_above_spawnon, aboveblock,
-- radius, nearby, sidesize, is_underground, spawn_under_height, ice_filler
nssb_register_buildings("blocohouse", 4, "default:stone", 0, "air", 0, "air", 3, "default:stone", 5, true, -10, false, false, false)
nssb_register_buildings("spiaggiagranchius", (v6 and 2 or 5), "default:sand", 3,
"default:sand", 2, "air", 3, "air", 0, false, nil, false)
nssb_register_buildings("bigblocohouse", 4, "default:stone", 0, "air", 0, "air", 3, "default:stone", 5, true, -20, false, false, false)
nssb_register_buildings("acquagranchius", (v6 and 3 or 6), "default:sand", 3,
"default:sand", 12,"default:water_source", 3, "default:water_source", 0, false, nil, false)
nssb_register_buildings("blocobiggesthouse", 4, "default:stone", 0, "air", 0, "air", 3, "default:stone", 5, true, -30, false, false, false)
nssb_register_buildings("ooteca", (v6 and 6 or 12), "default:dirt_with_grass", 3,
"default:dirt", 2, "air", 24, "default:tree", 8, false, nil, false)
nssb_register_buildings("minuscolaooteca", (v6 and 6 or 11), "default:dirt_with_grass",
3, "default:dirt", 2, "air", 24, "default:tree", 2, false, nil, false)
nssb_register_buildings("piccolaooteca", (v6 and 6 or 11), "default:dirt_with_grass", 2,
"default:dirt", 2, "air", 24, "default:tree", 4, false, nil, false)
nssb_register_buildings("arcate", (v6 and 8 or 24), "default:sand", 3, "default:sand", 13,
"default:water_source", 3, "default:water_source",0, false, nil, false)
nssb_register_buildings("grandepiramide", (v6 and 8 or 24), "default:dirt", 3,
"default:dirt", 20, "default:water_source", 3, "default:water_source", 0, false, nil, false)
nssb_register_buildings("collina", (v6 and 5 or 14), "default:dirt_with_grass", 3,
"default:dirt", 2, "air", 3, "air", 12, false, nil, false)
nssb_register_buildings("megaformicaio", (v6 and 7 or 20), "default:dirt_with_grass", 4,
"default:dirt", 2, "air", 3, "air", 25, false, nil, false)
nssb_register_buildings("antqueenhill", (v6 and 8 or 22), "default:dirt_with_grass", 4,
"default:dirt", 2, "air", 3, "air", 21, false, nil, false)
nssb_register_buildings("rovine1", (v6 and 4 or 6), jungle_dirt, 3, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
-- nssb_register_buildings("rovine2", 1, "default:stone", 0, "air", 0, "air", 24,
--"default:jungletree", 5, true, -8)
nssb_register_buildings("rovine3", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine4", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine5", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine6", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine7", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine8", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine9", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("rovine10", (v6 and 4 or 6), jungle_dirt, 1, "default:dirt", 2,
"air", 8, "default:jungletree", 10, false, nil, false)
nssb_register_buildings("bozzoli", 4, jungle_dirt, 1, "default:dirt", 2, "air", 8,
"default:jungletree", 10, false, nil, false)
nssb_register_buildings("picco", (v6 and 12 or 32), "default:desert_sand", 1,
"default:desert_stone", 1, "air", 3, "default:desert_sand", 10, false, nil, false)
nssb_register_buildings("piccoghiaccio", (v6 and 12 or 32), "default:dirt_with_snow", 1,
"default:dirt", 1, "air", 3, "default:dirt_with_snow", 10, false, nil, true)
nssb_register_buildings("icehall", (v6 and 8 or 40), "default:dirt_with_snow", 1,
"default:dirt", 1, "air", 3, "default:dirt_with_snow", 30, false, nil, true)
nssb_register_buildings("piccomoonheron", (v6 and 8 or 32), "default:dirt_with_snow",
1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 3, false, nil, true)
nssb_register_buildings("doppiopiccoghiaccio", (v6 and 11 or 32),
"default:dirt_with_snow", 1, "default:dirt", 1, "air", 3, "default:dirt_with_snow", 7,
false, nil, true)
nssb_register_buildings("doppiopiccosabbia", (v6 and 11 or 32), "default:desert_sand",
1, "default:desert_stone", 1, "air", 3, "default:desert_sand", 7, false, nil, false)
nssb_register_buildings("piccoscrausics", (v6 and 8 or 32), "default:desert_sand", 1,
"default:desert_stone", 1, "air", 3, "default:desert_sand", 3, false, nil, false)
nssb_register_buildings("fossasand", (v6 and 20 or 50), "default:desert_sand", 1,
"default:desert_stone", 1, "air", 3, "default:desert_sand", 16, false, nil, false)
nssb_register_buildings("portal", (v6 and 100 or 200), "default:dirt_with_grass", 2,
"default:dirt", 2, "air", 24, "air", 11, false, nil, false)
nssb_register_buildings("blocohouse", 4, "default:stone", 0, "air", 0, "air", 3,
"default:stone", 5, true, -10, false)
nssb_register_buildings("bigblocohouse", 4, "default:stone", 0, "air", 0, "air", 3,
"default:stone", 5, true, -20, false)
nssb_register_buildings("blocobiggesthouse", 4, "default:stone", 0, "air", 0, "air", 3,
"default:stone", 5, true, -30, false)
-- nodes gen

View File

@ -1,3 +1,4 @@
-- Materials
minetest.register_node("nssb:memoryone", {