Give generators relative position and area size instead of seed
This commit is contained in:
parent
b296febac7
commit
f7432118a8
@ -1,21 +1,21 @@
|
||||
build_0gb_us.register_generator("woodchecker", function(seed)
|
||||
if seed%2==0 then
|
||||
build_0gb_us.register_generator("woodchecker", function(pos, size)
|
||||
if (pos.x+pos.y+pos.z)%2 == 0 then
|
||||
return "default:tree"
|
||||
else
|
||||
return "default:wood"
|
||||
end
|
||||
end)
|
||||
|
||||
build_0gb_us.register_generator("cactuschecker", function(seed)
|
||||
if seed%2==0 then
|
||||
build_0gb_us.register_generator("cactuschecker", function(pos, size)
|
||||
if (pos.x+pos.y+pos.z)%2 == 0 then
|
||||
return "default:cobble"
|
||||
else
|
||||
return "default:cactus"
|
||||
end
|
||||
end)
|
||||
|
||||
build_0gb_us.register_generator("furnacechests", function(seed)
|
||||
if seed%2==0 then
|
||||
build_0gb_us.register_generator("furnacechests", function(pos, size)
|
||||
if (pos.x+pos.y+pos.z)%2 == 0 then
|
||||
return "default:chest"
|
||||
else
|
||||
return "default:furnace"
|
||||
|
@ -88,16 +88,15 @@ end,
|
||||
fillpattern = function(player, pos0, pos1, pattern, dir)
|
||||
local seed=0
|
||||
local min, max = build_0gb_us.normalize(pos0, pos1)
|
||||
local size = {x=max.x-min.x, y=max.y-min.y, z=max.z-min.z}
|
||||
if build_0gb_us.generators[pattern] then
|
||||
for y = min.y, max.y do
|
||||
for x = min.x, max.x do
|
||||
for x = min.x, max.x do
|
||||
for y = min.y, max.y do
|
||||
for z = min.z, max.z do
|
||||
build_0gb_us.place(player, {x=x,y=y,z=z}, build_0gb_us.generators[pattern](seed), dir)
|
||||
seed = seed + 1
|
||||
build_0gb_us.place(player, {x=x,y=y,z=z}, build_0gb_us.generators[pattern]({x=x-min.x, y=y-min.y, z=z-min.z}, size), dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user