1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-11-14 13:50:18 +01:00

make shrubs and moss furnace burnable and remove ws values saving, l got a memory error

This commit is contained in:
HybridDog 2015-06-19 19:07:38 +02:00
parent 6dbbf90f34
commit 4286299c0e
2 changed files with 5 additions and 22 deletions

View File

@ -36,27 +36,11 @@ local function do_ws_func(a, x)
local n = x/(16000)
local y = 0
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
return y
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 function is_plantlike(id)
@ -365,11 +349,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
if test > 0 then
local maxh = math.floor(test*10)%10+1
if maxh ~= 1 then
if not wsz then
wsz = get_ws_list(5, z0)
wsx = get_ws_list(2, x0)
end
local h = math.floor(wsx[x]+wsz[z]*5)%10+1
local h = math.floor( do_ws_func(2, x) + do_ws_func(5, z)*5)%10+1
if h ~= 1 then
-- search for nearby snow
y = y+1

View File

@ -157,6 +157,7 @@ minetest.register_node("snow:moss", {
},
is_ground_content = true,
groups = {crumbly=3, attached_node=1},
furnace_burntime = 3,
})
-- Shrub(s)
@ -178,6 +179,7 @@ nodedef = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, -5/16, 0.3},
},
furnace_burntime = 5,
}
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.wield_image = "snow_shrub.png^snow_shrub_covering.png"
nodedef.drop = "snow:shrub"
nodedef.furnace_burntime = 3
minetest.register_node("snow:shrub_covered", nodedef)