Add files via upload
parent
a0a36d3b5d
commit
46cc97eb91
|
@ -0,0 +1,16 @@
|
|||
-------------------------------------------------
|
||||
--------------------\ TO-DO /--------------------
|
||||
-------------------------------------------------
|
||||
|
||||
Make lava and water source nodes movable by doors.
|
||||
Fix water not being displaced by falling entities and itemstacks.
|
||||
Fix water displacement 'floodable' scan to extend past 1 node around.
|
||||
Fix Luxlamp incremental charging speed bug.
|
||||
Fix Tempered Glass Recipe
|
||||
|
||||
Add lode adzes/rakes
|
||||
Add lode frames
|
||||
Add lode doors
|
||||
Add glass doors
|
||||
Add tongs
|
||||
Add mallaxe
|
|
@ -0,0 +1,190 @@
|
|||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local minetest, nodecore, pairs, ipairs
|
||||
= minetest, nodecore, pairs, ipairs
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
local get_node = minetest.get_node
|
||||
local set_node = minetest.swap_node
|
||||
|
||||
local all_direction_permutations = { -- table of all possible permutations of horizontal direction to avoid lots of redundant calculations.
|
||||
{{x=0,z=1},{x=0,z=-1},{x=1,z=0},{x=-1,z=0}},
|
||||
{{x=0,z=1},{x=0,z=-1},{x=-1,z=0},{x=1,z=0}},
|
||||
{{x=0,z=1},{x=1,z=0},{x=0,z=-1},{x=-1,z=0}},
|
||||
{{x=0,z=1},{x=1,z=0},{x=-1,z=0},{x=0,z=-1}},
|
||||
{{x=0,z=1},{x=-1,z=0},{x=0,z=-1},{x=1,z=0}},
|
||||
{{x=0,z=1},{x=-1,z=0},{x=1,z=0},{x=0,z=-1}},
|
||||
{{x=0,z=-1},{x=0,z=1},{x=-1,z=0},{x=1,z=0}},
|
||||
{{x=0,z=-1},{x=0,z=1},{x=1,z=0},{x=-1,z=0}},
|
||||
{{x=0,z=-1},{x=1,z=0},{x=-1,z=0},{x=0,z=1}},
|
||||
{{x=0,z=-1},{x=1,z=0},{x=0,z=1},{x=-1,z=0}},
|
||||
{{x=0,z=-1},{x=-1,z=0},{x=1,z=0},{x=0,z=1}},
|
||||
{{x=0,z=-1},{x=-1,z=0},{x=0,z=1},{x=1,z=0}},
|
||||
{{x=1,z=0},{x=0,z=1},{x=0,z=-1},{x=-1,z=0}},
|
||||
{{x=1,z=0},{x=0,z=1},{x=-1,z=0},{x=0,z=-1}},
|
||||
{{x=1,z=0},{x=0,z=-1},{x=0,z=1},{x=-1,z=0}},
|
||||
{{x=1,z=0},{x=0,z=-1},{x=-1,z=0},{x=0,z=1}},
|
||||
{{x=1,z=0},{x=-1,z=0},{x=0,z=1},{x=0,z=-1}},
|
||||
{{x=1,z=0},{x=-1,z=0},{x=0,z=-1},{x=0,z=1}},
|
||||
{{x=-1,z=0},{x=0,z=1},{x=1,z=0},{x=0,z=-1}},
|
||||
{{x=-1,z=0},{x=0,z=1},{x=0,z=-1},{x=1,z=0}},
|
||||
{{x=-1,z=0},{x=0,z=-1},{x=1,z=0},{x=0,z=1}},
|
||||
{{x=-1,z=0},{x=0,z=-1},{x=0,z=1},{x=1,z=0}},
|
||||
{{x=-1,z=0},{x=1,z=0},{x=0,z=-1},{x=0,z=1}},
|
||||
{{x=-1,z=0},{x=1,z=0},{x=0,z=1},{x=0,z=-1}},
|
||||
}
|
||||
|
||||
--------------------Steam Particles--------------------
|
||||
local particles = minetest.setting_getbool("enable_particles")
|
||||
particles = particles or particles == nil -- default true
|
||||
|
||||
local steam = function(pos)
|
||||
if particles then
|
||||
minetest.add_particlespawner({
|
||||
amount = 6,
|
||||
time = 1,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=0, z=-2},
|
||||
maxvel = {x=2, y=1, z=2},
|
||||
minacc = {x=0, y=2, z=0},
|
||||
maxacc = {x=0, y=2, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 4,
|
||||
minsize = 16,
|
||||
maxsize = 16,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
texture = "smoke_puff.png",
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
--------------------Making Water Finite--------------------
|
||||
local override_def = {liquid_renewable = false}
|
||||
minetest.override_item("nc_terrain:water_source", override_def)
|
||||
minetest.override_item("nc_terrain:water_flowing", override_def)
|
||||
|
||||
--------------------Making Water Dynamic--------------------
|
||||
nodecore.register_limited_abm({
|
||||
label = "hydrodynamics",
|
||||
nodenames = {"nc_terrain:water_source"},
|
||||
neighbors = {"nc_terrain:water_flowing"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos,node) -- Do everything possible to optimize this method
|
||||
local check_pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local check_node = get_node(check_pos)
|
||||
local check_node_name = check_node.name
|
||||
if check_node_name == "nc_terrain:water_flowing" or check_node_name == "air" then
|
||||
set_node(pos, check_node)
|
||||
set_node(check_pos, node)
|
||||
return
|
||||
end
|
||||
local perm = all_direction_permutations[math.random(24)]
|
||||
local dirs -- declare outside of loop so it won't keep entering/exiting scope
|
||||
for i=1,4 do
|
||||
dirs = perm[i]
|
||||
-- reuse check_pos to avoid allocating a new table
|
||||
check_pos.x = pos.x + dirs.x
|
||||
check_pos.y = pos.y
|
||||
check_pos.z = pos.z + dirs.z
|
||||
check_node = get_node(check_pos)
|
||||
check_node_name = check_node.name
|
||||
if check_node_name == "nc_terrain:water_flowing" or check_node_name == "air" then
|
||||
set_node(pos, check_node)
|
||||
set_node(check_pos, node)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--------------------Making Lava Dynamic--------------------
|
||||
nodecore.register_limited_abm({
|
||||
label = "lavadynamics",
|
||||
nodenames = {"nc_terrain:lava_source"},
|
||||
neighbors = {"nc_terrain:lava_flowing"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos,node) -- Do everything possible to optimize this method
|
||||
local check_pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local check_node = get_node(check_pos)
|
||||
local check_node_name = check_node.name
|
||||
if check_node_name == "nc_terrain:lava_flowing" or check_node_name == "air" then
|
||||
set_node(pos, check_node)
|
||||
set_node(check_pos, node)
|
||||
return
|
||||
end
|
||||
local perm = all_direction_permutations[math.random(24)]
|
||||
local dirs -- declare outside of loop so it won't keep entering/exiting scope
|
||||
for i=1,4 do
|
||||
dirs = perm[i]
|
||||
-- reuse check_pos to avoid allocating a new table
|
||||
check_pos.x = pos.x + dirs.x
|
||||
check_pos.y = pos.y
|
||||
check_pos.z = pos.z + dirs.z
|
||||
check_node = get_node(check_pos)
|
||||
check_node_name = check_node.name
|
||||
if check_node_name == "nc_terrain:lava_flowing" or check_node_name == "air" then
|
||||
set_node(pos, check_node)
|
||||
set_node(check_pos, node)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--------------------Liquid Displacement--------------------
|
||||
local cardinal_dirs = {
|
||||
{x= 0, y=0, z= 1},
|
||||
{x= 1, y=0, z= 0},
|
||||
{x= 0, y=0, z=-1},
|
||||
{x=-1, y=0, z= 0},
|
||||
{x= 0, y=-1, z= 0},
|
||||
{x= 0, y=1, z= 0},
|
||||
}
|
||||
-- breadth-first search passing through liquid searching for air or flowing liquid.
|
||||
local flood_search_outlet = function(start_pos, source, flowing)
|
||||
local start_node = minetest.get_node(start_pos)
|
||||
local start_node_name = start_node.name
|
||||
if start_node_name == "air" or start_node_name == "nc_terrain:water_flowing" then
|
||||
return start_pos
|
||||
end
|
||||
|
||||
local visited = {}
|
||||
visited[minetest.hash_node_position(start_pos)] = true
|
||||
local queue = {start_pos}
|
||||
local queue_pointer = 1
|
||||
|
||||
while #queue >= queue_pointer do
|
||||
local current_pos = queue[queue_pointer]
|
||||
queue_pointer = queue_pointer + 1
|
||||
for _, cardinal_dir in ipairs(cardinal_dirs) do
|
||||
local new_pos = vector.add(current_pos, cardinal_dir)
|
||||
local new_hash = minetest.hash_node_position(new_pos)
|
||||
if visited[new_hash] == nil then
|
||||
local new_node = minetest.get_node(new_pos)
|
||||
local new_node_name = new_node.name
|
||||
if new_node_name == "air" or new_node_name == "nc_terrain:water_flowing" then
|
||||
return new_pos
|
||||
end
|
||||
visited[new_hash] = true
|
||||
if new_node_name == source then
|
||||
table.insert(queue, new_pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Conserve liquids, when placing nodes in liquids try to find a place to displace the liquid to.
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||
local flowing = "nc_terrain:water_flowing"
|
||||
if flowing ~= nil then
|
||||
local dest = flood_search_outlet(pos, oldnode.name, flowing)
|
||||
if dest ~= nil then
|
||||
minetest.swap_node(dest, oldnode)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
|
@ -0,0 +1,93 @@
|
|||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local minetest, nodecore
|
||||
= minetest, nodecore
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
|
||||
local function near(pos, crit)
|
||||
return #nodecore.find_nodes_around(pos, crit, {1, 1, 1}, {1, 0, 1}) > 0
|
||||
end
|
||||
|
||||
--------------------Node Registry--------------------
|
||||
|
||||
minetest.register_node(modname .. ":glass_hard", {
|
||||
description = "Tempered Glass",
|
||||
drawtype = "glasslike_framed_optional",
|
||||
use_texture_alpha = true,
|
||||
tiles = {
|
||||
modname .. "_glass_mesh.png^nc_optics_glass_edges.png",
|
||||
modname .. "_glass_mesh.png"
|
||||
},
|
||||
groups = {
|
||||
silica = 1,
|
||||
silica_clear = 1,
|
||||
cracky = 5,
|
||||
scaling_time = 200
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
sounds = nodecore.sounds("nc_optics_glassy")
|
||||
})
|
||||
|
||||
minetest.register_node(modname .. ":glass_warm", {
|
||||
description = "Hot Float Glass",
|
||||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {
|
||||
"nc_optics_glass_edges.png",
|
||||
"[combine:16x16"
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
groups = {
|
||||
silica = 1,
|
||||
silica_clear = 1,
|
||||
cracky = 3,
|
||||
scaling_time = 300
|
||||
},
|
||||
sounds = nodecore.sounds("nc_optics_glassy")
|
||||
})
|
||||
|
||||
--------------------Heating--------------------
|
||||
|
||||
nodecore.register_craft({
|
||||
label = "Heat Float Glass",
|
||||
action = "cook",
|
||||
touchgroups = {
|
||||
coolant = 0,
|
||||
flame = 3
|
||||
},
|
||||
duration = 20,
|
||||
cookfx = true,
|
||||
indexkeys = {"nc_optics:glass_float"},
|
||||
nodes = {
|
||||
{
|
||||
match = {"nc_optics:glass_float"},
|
||||
replace = {modname .. ":glass_warm"}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
nodecore.register_cook_abm({
|
||||
nodenames = {"nc_optics:glass_float"},
|
||||
neighbors = {"group:flame"}
|
||||
})
|
||||
|
||||
--------------------Cooling--------------------
|
||||
|
||||
nodecore.register_craft({
|
||||
label = "quench tempered glass",
|
||||
action = "cook",
|
||||
cookfx = true,
|
||||
check = function(pos)
|
||||
return (not near(pos, {flow}))
|
||||
and nodecore.quenched(pos)
|
||||
end,
|
||||
indexkeys = {modname .. ":glass_warm"},
|
||||
nodes = {
|
||||
{
|
||||
match = modname .. ":glass_warm",
|
||||
replace = modname .. ":glass_hard"
|
||||
}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,14 @@
|
|||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local include, nodecore
|
||||
= include, nodecore
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
|
||||
--include("lodze")
|
||||
--include("tongs")
|
||||
include("glass")
|
||||
--include("frame")
|
||||
include("luxlamp")
|
||||
--include("mallaxe")
|
||||
include("dynamics")
|
||||
--include("moredoor")
|
|
@ -0,0 +1,144 @@
|
|||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local minetest, nodecore, math
|
||||
= minetest, nodecore, math
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
local modname = minetest.get_current_modname()
|
||||
|
||||
local function luxlamp (desc, id, power, light)
|
||||
local delum = power-1
|
||||
local flux = power+1
|
||||
local charge = power*100
|
||||
local vlux = power*60
|
||||
|
||||
local particle = "nc_lux_base.png^[mask:nc_lux_dot_mask.png^[opacity:32"
|
||||
|
||||
minetest.register_node(modname .. ":luxlamp_" .. id, {
|
||||
description = desc.. " Luxlamp",
|
||||
tiles = {"nc_optics_glass_frost.png^(nc_lux_base.png^[opacity:" .. vlux .. ")^(nc_lode_tempered.png^[mask:" .. modname .. "_mask_lamp.png)"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
light_source = light,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.3125, -0.3125, -0.3125, 0.3125, 0.3125, 0.3125}, -- Core
|
||||
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- Pole_X
|
||||
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.5}, -- Pole_Z
|
||||
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- Pole_Y
|
||||
}
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
groups = {
|
||||
stack_as_node = 1,
|
||||
cracky = 1,
|
||||
luxlamp = 1
|
||||
},
|
||||
stack_max = 1,
|
||||
sounds = nodecore.sounds("nc_optics_glassy"),
|
||||
})
|
||||
|
||||
---------------------------------------
|
||||
-----------Luxlamp Crafting------------
|
||||
nodecore.register_craft({
|
||||
label = "assemble luxlamp",
|
||||
nodes = {
|
||||
{match = "nc_optics:glass_opaque", replace = modname .. ":luxlamp_0"},
|
||||
{x = -1, z = -1, match = "nc_lode:rod_tempered", replace = "air"},
|
||||
{x = 1, z = -1, match = "nc_lode:rod_tempered", replace = "air"},
|
||||
{x = -1, z = 1, match = "nc_lode:rod_tempered", replace = "air"},
|
||||
{x = 1, z = 1, match = "nc_lode:rod_tempered", replace = "air"},
|
||||
{y = -1, match = {groups = {lux_cobble = true}}},
|
||||
}
|
||||
})
|
||||
|
||||
---------------------------------------
|
||||
-----------Luxlamp Recycling-----------
|
||||
nodecore.register_craft({
|
||||
label = "break luxlamp apart",
|
||||
action = "pummel",
|
||||
toolgroups = {choppy = 5},
|
||||
nodes = {
|
||||
{
|
||||
match = {groups = {luxlamp = true}},
|
||||
replace = "nc_optics:glass_crude"
|
||||
}
|
||||
},
|
||||
items = {
|
||||
{name = "nc_lode:rod_tempered", count = 4, scatter = flux},
|
||||
{name = "nc_lux:flux_flowing", count = flux, scatter = flux}
|
||||
},
|
||||
itemscatter = flux
|
||||
})
|
||||
|
||||
---------------------------------------
|
||||
----------Luxlamp Diminishing----------
|
||||
nodecore.register_abm({
|
||||
label = "Luxlamp Delumination",
|
||||
interval = charge,
|
||||
chance = 1,
|
||||
nodenames = {modname .. ":luxlamp_" .. id},
|
||||
action = function(pos)
|
||||
if minetest.find_node_near(pos,
|
||||
1, {"group:lux_fluid"}) then
|
||||
return false
|
||||
end
|
||||
if power > 0 then
|
||||
return minetest.set_node(pos, {name = modname .. ":luxlamp_" .. delum})
|
||||
end
|
||||
end
|
||||
})
|
||||
---------------------------------------
|
||||
nodecore.register_aism({
|
||||
label = "Stack Delumination",
|
||||
interval = charge,
|
||||
chance = 1,
|
||||
itemnames = {modname .. ":luxlamp_" .. id},
|
||||
action = function(stack, data)
|
||||
if power > 0 then
|
||||
stack:set_name(modname .. ":luxlamp_" .. delum)
|
||||
return stack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
---------------------------------------
|
||||
-----------Luxlamp Charging------------
|
||||
|
||||
do
|
||||
local charge = {}
|
||||
for i = 0, 3 do charge[modname .. ":luxlamp_" .. i] = modname .. ":luxlamp_" .. (i + 1) end
|
||||
nodecore.register_abm({
|
||||
label = "Luxlamp Charging",
|
||||
nodenames = {"group:luxlamp"},
|
||||
neighbors = {"nc_lux:flux_source", "nc_lux:flux_flowing"},
|
||||
interval = 60, --temporary, as a mysterious bug causes serious issue with this value
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
node.name = charge[node.name]
|
||||
if node.name then nodecore.set_node(pos, node) end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
nodecore.register_aism({
|
||||
label = "Stack Charging",
|
||||
interval = 60,
|
||||
chance = 1,
|
||||
itemnames = {modname .. ":luxlamp_" .. id},
|
||||
action = function(stack, data)
|
||||
if power < 4 then
|
||||
stack:set_name(modname .. ":luxlamp_" .. flux)
|
||||
return stack
|
||||
end
|
||||
end
|
||||
})
|
||||
---------------------------------------
|
||||
|
||||
---------------------------------------
|
||||
end
|
||||
luxlamp("Dull", "0", 0, 2)
|
||||
luxlamp("Dim", "1", 1, 4)
|
||||
luxlamp("Lambent", "2", 2, 8)
|
||||
luxlamp("Radiant", "3", 3, 12)
|
||||
luxlamp("Brilliant", "4", 4, 15)
|
||||
|
|
@ -0,0 +1 @@
|
|||
depends = nc_api_all, nc_items, nc_fire, nc_optics, nc_lux, nc_lode, nc_terrain
|
Binary file not shown.
After Width: | Height: | Size: 807 B |
Binary file not shown.
After Width: | Height: | Size: 119 B |
Loading…
Reference in New Issue