forked from mtcontrib/minetest-mod-snow
make shrubs and moss furnace burnable and remove ws values saving, l got a memory error
This commit is contained in:
parent
6dbbf90f34
commit
4286299c0e
@ -36,27 +36,11 @@ local function do_ws_func(a, x)
|
|||||||
local n = x/(16000)
|
local n = x/(16000)
|
||||||
local y = 0
|
local y = 0
|
||||||
for k=1,1000 do
|
for k=1,1000 do
|
||||||
y = y + 1000*(math.sin(math.pi * k^a * n)/(math.pi * k^a))
|
y = y + 1000*math.sin(math.pi * k^a * n)/(math.pi * k^a)
|
||||||
end
|
end
|
||||||
return y
|
return y
|
||||||
end
|
end
|
||||||
|
|
||||||
local ws_lists = {}
|
|
||||||
local function get_ws_list(a,x)
|
|
||||||
ws_lists[a] = ws_lists[a] or {}
|
|
||||||
local v = ws_lists[a][x]
|
|
||||||
if v then
|
|
||||||
return v
|
|
||||||
end
|
|
||||||
v = {}
|
|
||||||
for x=x,x + (80 - 1) do
|
|
||||||
local y = do_ws_func(a, x)
|
|
||||||
v[x] = y
|
|
||||||
end
|
|
||||||
ws_lists[a][x] = v
|
|
||||||
return v
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local plantlike_ids = {}
|
local plantlike_ids = {}
|
||||||
local function is_plantlike(id)
|
local function is_plantlike(id)
|
||||||
@ -365,11 +349,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if test > 0 then
|
if test > 0 then
|
||||||
local maxh = math.floor(test*10)%10+1
|
local maxh = math.floor(test*10)%10+1
|
||||||
if maxh ~= 1 then
|
if maxh ~= 1 then
|
||||||
if not wsz then
|
local h = math.floor( do_ws_func(2, x) + do_ws_func(5, z)*5)%10+1
|
||||||
wsz = get_ws_list(5, z0)
|
|
||||||
wsx = get_ws_list(2, x0)
|
|
||||||
end
|
|
||||||
local h = math.floor(wsx[x]+wsz[z]*5)%10+1
|
|
||||||
if h ~= 1 then
|
if h ~= 1 then
|
||||||
-- search for nearby snow
|
-- search for nearby snow
|
||||||
y = y+1
|
y = y+1
|
||||||
|
@ -157,6 +157,7 @@ minetest.register_node("snow:moss", {
|
|||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3, attached_node=1},
|
groups = {crumbly=3, attached_node=1},
|
||||||
|
furnace_burntime = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Shrub(s)
|
-- Shrub(s)
|
||||||
@ -178,6 +179,7 @@ nodedef = {
|
|||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.3, -0.5, -0.3, 0.3, -5/16, 0.3},
|
fixed = {-0.3, -0.5, -0.3, 0.3, -5/16, 0.3},
|
||||||
},
|
},
|
||||||
|
furnace_burntime = 5,
|
||||||
}
|
}
|
||||||
minetest.register_node("snow:shrub", table.copy(nodedef))
|
minetest.register_node("snow:shrub", table.copy(nodedef))
|
||||||
|
|
||||||
@ -185,6 +187,7 @@ nodedef.tiles = {"snow_shrub.png^snow_shrub_covering.png"}
|
|||||||
nodedef.inventory_image = "snow_shrub.png^snow_shrub_covering.png"
|
nodedef.inventory_image = "snow_shrub.png^snow_shrub_covering.png"
|
||||||
nodedef.wield_image = "snow_shrub.png^snow_shrub_covering.png"
|
nodedef.wield_image = "snow_shrub.png^snow_shrub_covering.png"
|
||||||
nodedef.drop = "snow:shrub"
|
nodedef.drop = "snow:shrub"
|
||||||
|
nodedef.furnace_burntime = 3
|
||||||
minetest.register_node("snow:shrub_covered", nodedef)
|
minetest.register_node("snow:shrub_covered", nodedef)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user