forked from Kimapr/nodecore-skyblock
Fix some bugs, add /reset cmd, change stone sieve recipe to be actually be stone and not wood with cobble surface
This commit is contained in:
parent
ead3d3a7fc
commit
0ec00d9ac7
|
@ -10,10 +10,12 @@ local side = "nc_tree_tree_side.png"
|
||||||
local top = wmodname.. "_plank.png"
|
local top = wmodname.. "_plank.png"
|
||||||
local top_sieve = wmodname .. "_plank.png^[mask:"..modname.."_sieve.png^nc_tree_leaves.png"
|
local top_sieve = wmodname .. "_plank.png^[mask:"..modname.."_sieve.png^nc_tree_leaves.png"
|
||||||
|
|
||||||
|
local stop = "nc_terrain_stone.png"
|
||||||
local sside = "nc_terrain_stone.png"
|
local sside = "nc_terrain_stone.png"
|
||||||
local stop_sieve = "nc_terrain_stone.png^[mask:"..modname.."_sieve.png^nc_terrain_cobble.png"
|
local stop_sieve = "nc_terrain_stone.png^[mask:"..modname.."_sieve.png^nc_terrain_cobble.png"
|
||||||
|
|
||||||
minetest.register_node(modname .. ":table", {
|
function regsieve(suff,top,side,top_sieve,groups)
|
||||||
|
minetest.register_node(modname .. ":table"..suff, {
|
||||||
description = "Wooden Table",
|
description = "Wooden Table",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = nodecore.fixedbox(
|
node_box = nodecore.fixedbox(
|
||||||
|
@ -26,16 +28,12 @@ minetest.register_node(modname .. ":table", {
|
||||||
selection_box = nodecore.fixedbox(),
|
selection_box = nodecore.fixedbox(),
|
||||||
collision_box = nodecore.fixedbox(),
|
collision_box = nodecore.fixedbox(),
|
||||||
tiles = { top, top, side },
|
tiles = { top, top, side },
|
||||||
groups = {
|
groups = groups,
|
||||||
choppy = 1,
|
|
||||||
flammable = 2,
|
|
||||||
fire_fuel = 3,
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sounds = nodecore.sounds("nc_tree_woody"),
|
sounds = nodecore.sounds("nc_tree_woody"),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(modname .. ":table_broken", {
|
minetest.register_node(modname .. ":table_broken"..suff, {
|
||||||
description = "Broken Wooden Table",
|
description = "Broken Wooden Table",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = nodecore.fixedbox(
|
node_box = nodecore.fixedbox(
|
||||||
|
@ -51,15 +49,11 @@ minetest.register_node(modname .. ":table_broken", {
|
||||||
selection_box = nodecore.fixedbox(),
|
selection_box = nodecore.fixedbox(),
|
||||||
collision_box = nodecore.fixedbox(),
|
collision_box = nodecore.fixedbox(),
|
||||||
tiles = { top, top, side },
|
tiles = { top, top, side },
|
||||||
groups = {
|
groups = groups,
|
||||||
choppy = 1,
|
|
||||||
flammable = 2,
|
|
||||||
fire_fuel = 3,
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sounds = nodecore.sounds("nc_tree_woody"),
|
sounds = nodecore.sounds("nc_tree_woody"),
|
||||||
})
|
})
|
||||||
minetest.register_node(modname .. ":sieve", {
|
minetest.register_node(modname .. ":sieve"..suff, {
|
||||||
description = "Wooden Sieve",
|
description = "Wooden Sieve",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
|
@ -77,38 +71,21 @@ minetest.register_node(modname .. ":sieve", {
|
||||||
selection_box = nodecore.fixedbox(),
|
selection_box = nodecore.fixedbox(),
|
||||||
collision_box = nodecore.fixedbox(),
|
collision_box = nodecore.fixedbox(),
|
||||||
tiles = { top_sieve, top_sieve, side },
|
tiles = { top_sieve, top_sieve, side },
|
||||||
groups = {
|
groups = groups,
|
||||||
choppy = 1,
|
|
||||||
flammable = 2,
|
|
||||||
fire_fuel = 3,
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sounds = nodecore.sounds("nc_tree_woody"),
|
sounds = nodecore.sounds("nc_tree_woody"),
|
||||||
})
|
})
|
||||||
minetest.register_node(modname .. ":sieve_stone", {
|
end
|
||||||
description = "Stone Sieve",
|
|
||||||
drawtype = "nodebox",
|
regsieve("",top,side,top_sieve,{
|
||||||
use_texture_alpha = true,
|
choppy = 1,
|
||||||
node_box = nodecore.fixedbox(
|
flammable = 2,
|
||||||
{-4/16,7/16,-4/16,4/16,0.5,4/16},
|
fire_fuel = 3,
|
||||||
{-0.5, 7/16, -0.5, -0.5+4/16,0.5,0.5},
|
})
|
||||||
{0.5-4/16, 7/16, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
{-8/32, 7/16, 8/32, 8/32, 0.5, 0.5},
|
regsieve("_stone",stop,sside,stop_sieve,{
|
||||||
{-8/32, 7/16, -0.5, 8/32, 0.5, -8/32},
|
cracky = 2,
|
||||||
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
|
})
|
||||||
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
|
|
||||||
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
|
|
||||||
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
|
|
||||||
),
|
|
||||||
selection_box = nodecore.fixedbox(),
|
|
||||||
collision_box = nodecore.fixedbox(),
|
|
||||||
tiles = { stop_sieve, stop_sieve, sside },
|
|
||||||
groups = {
|
|
||||||
cracky = 2,
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
sounds = nodecore.sounds("nc_terrain_stony"),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem(modname..":random_dust",{
|
minetest.register_craftitem(modname..":random_dust",{
|
||||||
description = "Dust of random minerals",
|
description = "Dust of random minerals",
|
||||||
|
@ -124,6 +101,15 @@ nodecore.register_craft({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
nodecore.register_craft({
|
||||||
|
label = "break a table",
|
||||||
|
action = "pummel",
|
||||||
|
toolgroups = {cracky = 2},
|
||||||
|
nodes = {
|
||||||
|
{match = modname .. ":table_stone", replace = modname .. ":table_broken_stone"}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
local dio = {
|
local dio = {
|
||||||
items={{name = "nc_stonework:chip", count = 4, scatter = 2}}
|
items={{name = "nc_stonework:chip", count = 4, scatter = 2}}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +153,7 @@ local dirtss = {
|
||||||
["nc_terrain:gravel_loose"] = duo2,
|
["nc_terrain:gravel_loose"] = duo2,
|
||||||
["nc_terrain:sand"] = duo3,
|
["nc_terrain:sand"] = duo3,
|
||||||
["nc_terrain:sand_loose"] = duo3,
|
["nc_terrain:sand_loose"] = duo3,
|
||||||
["nc_tree:leaves_loose"] = {node = "nc_terrain:water_source"},
|
["nc_tree:leaves_loose"] = {node = "nc_terrain:hm_water_source"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for k,v in pairs(dirts) do
|
for k,v in pairs(dirts) do
|
||||||
|
@ -240,7 +226,7 @@ nodecore.register_craft({
|
||||||
label = "assemble stone sieve",
|
label = "assemble stone sieve",
|
||||||
norotate = true,
|
norotate = true,
|
||||||
nodes = {
|
nodes = {
|
||||||
{y = -1, match = modname .. ":table_broken", replace = modname .. ":sieve_stone"},
|
{y = -1, match = modname .. ":table_broken_stone", replace = modname .. ":sieve_stone"},
|
||||||
{match = "nc_terrain:cobble_loose", replace = "air"},
|
{match = "nc_terrain:cobble_loose", replace = "air"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -268,3 +254,34 @@ nodecore.register_craft({
|
||||||
{x = 1, z = 0, match = wmodname .. ":staff", replace = "air"},
|
{x = 1, z = 0, match = wmodname .. ":staff", replace = "air"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
nodecore.register_craft({
|
||||||
|
label = "assemble stone table",
|
||||||
|
action = "pummel",
|
||||||
|
toolgroups = {thumpy = 3},
|
||||||
|
priority = 1,
|
||||||
|
norotate = true,
|
||||||
|
nodes = {
|
||||||
|
{match = "nc_terrain:cobble_loose", replace = modname .. ":table_stone"},
|
||||||
|
{x = -1, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
{x = 1, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
{x = -1, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
{x = 1, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
nodecore.register_craft({
|
||||||
|
label = "assemble stone table",
|
||||||
|
action = "pummel",
|
||||||
|
toolgroups = {thumpy = 3},
|
||||||
|
priority = 1,
|
||||||
|
norotate = true,
|
||||||
|
nodes = {
|
||||||
|
{match = "nc_terrain:cobble_loose", replace = modname .. ":table_stone"},
|
||||||
|
{x = 0, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
{x = 0, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
{x = -1, z = 0, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
{x = 1, z = 0, match = "nc_lode:rod_annealed", replace = "air"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
--nothing--
|
--nothing--
|
||||||
local grass = "nc_terrain:dirt_with_grass"
|
local grass = "nc_terrain:dirt_with_grass"
|
||||||
local dirt = "nc_terrain:dirt"
|
local dirt = "nc_terrain:dirt"
|
||||||
|
local tree = "nc_tree:eggcorn_planted"
|
||||||
local stone = "nc_terrain:stone"
|
local stone = "nc_terrain:stone"
|
||||||
local queue = {}
|
local queue = {}
|
||||||
|
|
||||||
minetest.register_globalstep(function(dt)
|
|
||||||
for f,_ in pairs(queue) do
|
|
||||||
if not coroutine.resume(f) then
|
|
||||||
queue[f]=nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local function maxval(octaves,persistence,scale)
|
local function maxval(octaves,persistence,scale)
|
||||||
local m = scale
|
local m = scale
|
||||||
local poc = scale
|
local poc = scale
|
||||||
|
@ -25,15 +18,11 @@ local function maxval(octaves,persistence,scale)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function island(pos,r)
|
local function island(pos,r)
|
||||||
minetest.after(2,function()--queue[coroutine.create(function()
|
local x,y,z = pos.x,pos.y,pos.z
|
||||||
local noise = PerlinNoise({
|
minetest.emerge_area({x=x-r,y=y-r,z=z-r},{x=x+r,y=y+r,z=z+r},function(bp,act,crem)
|
||||||
seed = math.random(10000),
|
if crem > 0 then
|
||||||
octaves = 3,
|
return
|
||||||
spread = {x=r/2,y=r/2,z=r/2},
|
end
|
||||||
lacunarity = 2,
|
|
||||||
persistence = 0.5,
|
|
||||||
flags = "absvalue"
|
|
||||||
})
|
|
||||||
local n = 0
|
local n = 0
|
||||||
local c = 0
|
local c = 0
|
||||||
local cm = (r*2+1)^3
|
local cm = (r*2+1)^3
|
||||||
|
@ -43,17 +32,15 @@ local function island(pos,r)
|
||||||
local hdist = (x*x+z*z)^0.5
|
local hdist = (x*x+z*z)^0.5
|
||||||
local uhdist = (math.max(0,r-hdist)/r)^((1-uvdist)^3*5)
|
local uhdist = (math.max(0,r-hdist)/r)^((1-uvdist)^3*5)
|
||||||
local udist = math.max(0,r-dist)/r
|
local udist = math.max(0,r-dist)/r
|
||||||
if math.min(1,math.max(0,uhdist^2)) ~= uhdist^2 then
|
|
||||||
print(uhdist^2)
|
|
||||||
end
|
|
||||||
local m = ((math.max(r-(hdist),0)/r)^0.1*(uhdist^2))-uhdist*uvdist^3
|
local m = ((math.max(r-(hdist),0)/r)^0.1*(uhdist^2))-uhdist*uvdist^3
|
||||||
return m
|
return m
|
||||||
end
|
end
|
||||||
|
local grasses = {}
|
||||||
for x=-r,r do
|
for x=-r,r do
|
||||||
for z=-r,r do
|
for z=-r,r do
|
||||||
for y=-r,r do
|
for y=-r,r do
|
||||||
local xx,yy,zz = pos.x+x,pos.y+y,pos.z+z
|
local xx,yy,zz = pos.x+x,pos.y+y,pos.z+z
|
||||||
o,o2 = geto(x,y,z),geto(x,y+1,z)
|
local o,o2 = geto(x,y,z),geto(x,y+1,z)
|
||||||
local oc = (o > 0.4)
|
local oc = (o > 0.4)
|
||||||
local oc2 = o2 > 0.4
|
local oc2 = o2 > 0.4
|
||||||
local og = (o > 0.6)
|
local og = (o > 0.6)
|
||||||
|
@ -62,6 +49,7 @@ local function island(pos,r)
|
||||||
local nam = dirt
|
local nam = dirt
|
||||||
if not og and not oc2 then
|
if not og and not oc2 then
|
||||||
nam = grass
|
nam = grass
|
||||||
|
table.insert(grasses,{x=xx,y=yy,z=zz})
|
||||||
end
|
end
|
||||||
if og then
|
if og then
|
||||||
nam = stone
|
nam = stone
|
||||||
|
@ -77,15 +65,21 @@ local function island(pos,r)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.set_node({x=pos.x,y=pos.y+10,z=pos.z},{name="nc_tree:eggcorn_planted"})
|
for n=1,4 do
|
||||||
end)--end)] = true
|
if #grasses > 1 then
|
||||||
|
local n = math.random(1,#grasses)
|
||||||
|
local v = table.remove(grasses,n)
|
||||||
|
minetest.set_node(v,{name=tree})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
local f = math.floor
|
local f = math.floor
|
||||||
local function spawn_island(name,pos)
|
local function spawn_island(name,pos)
|
||||||
local ref = minetest.get_player_by_name(name)
|
local ref = minetest.get_player_by_name(name)
|
||||||
pos = {x=f(pos.x),y=f(pos.y),z=f(pos.z)}
|
pos = {x=f(pos.x),y=f(pos.y),z=f(pos.z)}
|
||||||
island(pos,16,name)
|
island(pos,16,name)
|
||||||
ref:set_pos({x=pos.x,y=pos.y+30,z=pos.z})
|
ref:set_pos({x=pos.x,y=pos.y+256,z=pos.z})
|
||||||
end
|
end
|
||||||
local store = minetest.get_mod_storage()
|
local store = minetest.get_mod_storage()
|
||||||
local function pid(x,z)
|
local function pid(x,z)
|
||||||
|
@ -104,13 +98,89 @@ local function gen_island_pos(name)
|
||||||
ok = checkpos(x,z)
|
ok = checkpos(x,z)
|
||||||
end
|
end
|
||||||
store:set_string(pid(x,z),name)
|
store:set_string(pid(x,z),name)
|
||||||
spawn_island(name,{x=x*128,y=256,z=z*128})
|
local range = {min={x=x*128-64,y=256-64,z=z*128-64},max={x=x*128+64,y=256+64,z=z*128+64}}
|
||||||
return pid(x,z)
|
local ip = {x=x*128+math.random(-32,32),y=256,z=z*128+math.random(-32,32)}
|
||||||
|
spawn_island(name,ip)
|
||||||
|
return pid(x,z),ip,range
|
||||||
end
|
end
|
||||||
|
local updrate = 0.5
|
||||||
|
local to_upd = updrate
|
||||||
|
minetest.register_globalstep(function(dt)
|
||||||
|
for f,_ in pairs(queue) do
|
||||||
|
local ok,err = coroutine.resume(f)
|
||||||
|
if not ok then
|
||||||
|
print(err)
|
||||||
|
queue[f]=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
to_upd = to_upd-dt
|
||||||
|
if to_upd <= 0 then
|
||||||
|
to_upd = to_upd+updrate
|
||||||
|
for k,ref in pairs(minetest.get_connected_players()) do
|
||||||
|
local p = ref:get_pos()
|
||||||
|
if p.y < 0 then
|
||||||
|
ref:set_hp(ref:get_hp()-2,{reason="set_hp"})
|
||||||
|
if p.y < -128 then
|
||||||
|
local meta = ref:get_meta()
|
||||||
|
local pos = minetest.string_to_pos(meta:get_string("islandpos"))
|
||||||
|
if pos then
|
||||||
|
pos.y=pos.y+256
|
||||||
|
ref:set_pos(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_chatcommand("reset",{
|
||||||
|
description = "Reset your island",
|
||||||
|
func = function(name,param)
|
||||||
|
local ref = minetest.get_player_by_name(name)
|
||||||
|
local meta = ref:get_meta()
|
||||||
|
local r = meta:get_string("islandrange")
|
||||||
|
r = minetest.deserialize(r)
|
||||||
|
minetest.emerge_area(r.min,r.max,function(bp,act,crem)
|
||||||
|
if crem > 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ref = minetest.get_player_by_name(name)
|
||||||
|
local meta = ref:get_meta()
|
||||||
|
local pos = minetest.string_to_pos(meta:get_string("islandpos"))
|
||||||
|
if pos then
|
||||||
|
local r = meta:get_string("islandrange")
|
||||||
|
r = minetest.deserialize(r)
|
||||||
|
print("PREVM")
|
||||||
|
air_c = minetest.get_content_id("air")
|
||||||
|
local vm = VoxelManip(r.min,r.max)
|
||||||
|
local rmi,rma = vm:get_emerged_area()
|
||||||
|
local var = VoxelArea:new{MinEdge=rmi,MaxEdge=rma}
|
||||||
|
local d = vm:get_data()
|
||||||
|
for x=r.min.x,r.max.x do
|
||||||
|
for y=r.min.y,r.max.y do
|
||||||
|
for z=r.min.z,r.max.z do
|
||||||
|
local i = var:index(x,y,z)
|
||||||
|
d[i] = air_c
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vm:set_data(d)
|
||||||
|
print("PREWRITE")
|
||||||
|
vm:write_to_map()
|
||||||
|
print("POSTVM")
|
||||||
|
spawn_island(name,pos)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(ref)
|
minetest.register_on_joinplayer(function(ref)
|
||||||
local meta = ref:get_meta()
|
local meta = ref:get_meta()
|
||||||
local name = ref:get_player_name()
|
local name = ref:get_player_name()
|
||||||
if meta:get_string("island") == "" then
|
if meta:get_string("island") == "" then
|
||||||
meta:set_string("island",gen_island_pos(name))
|
local p,ip,r = gen_island_pos(name)
|
||||||
|
meta:set_string("island",p)
|
||||||
|
meta:set_string("islandpos",minetest.pos_to_string(ip))
|
||||||
|
meta:set_string("islandrange",minetest.serialize(r))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
|
@ -230,6 +230,26 @@ regliquid({
|
||||||
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||||
sounds = nodecore.sounds("nc_terrain_watery")
|
sounds = nodecore.sounds("nc_terrain_watery")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
regliquid({
|
||||||
|
description = "HM Water",
|
||||||
|
mapgen = {},
|
||||||
|
tiles = {"nc_terrain_water.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
liquid_viscosity = 1,
|
||||||
|
liquid_renewable = false,
|
||||||
|
alpha = 160,
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
drowning = 1,
|
||||||
|
drop = "",
|
||||||
|
groups = { coolant = 1, water = 2, moist = 2 },
|
||||||
|
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||||
|
sounds = nodecore.sounds("nc_terrain_watery")
|
||||||
|
})
|
||||||
|
|
||||||
regliquid({
|
regliquid({
|
||||||
name = "lava",
|
name = "lava",
|
||||||
description = "Molten Rock",
|
description = "Molten Rock",
|
||||||
|
@ -250,8 +270,8 @@ regliquid({
|
||||||
sounds = nodecore.sounds("nc_terrain_bubbly")
|
sounds = nodecore.sounds("nc_terrain_bubbly")
|
||||||
})
|
})
|
||||||
|
|
||||||
local src = modname..":water_source"
|
local src = modname..":hm_water_source"
|
||||||
local flow = modname..":water_flowing"
|
local flow = modname..":hm_water_flowing"
|
||||||
|
|
||||||
|
|
||||||
nodecore.register_limited_abm({
|
nodecore.register_limited_abm({
|
||||||
|
|
Loading…
Reference in New Issue