Significant behaviour changes.
- Add new group types. - Made non-optic nodes falling nodes. - Beginning of charge/discharge behaviour in portal maintenance. - Metadata-mediated charge group, accessed to check for available lux energy and for loading/unloading. - Experimenting with some better function management approaches, perhaps some more in-function function declaration. - New animated eggcorn design (The lols obtained were worth the time spent making it work). - New Vestibule node for collection and dissemination of lux energy. - Added temporary canvas2.png texture, will be removed in a future update. ~ - Better separation of files to endeavor towards < 336 LoC in all files. - Addition of testbed code from debug sessions. Will be removed before official release. ~ - Avimaster
parent
e868f29b0d
commit
d9857ef796
64
barrier.lua
64
barrier.lua
|
@ -1,46 +1,4 @@
|
|||
--FUNCTIONS--
|
||||
|
||||
function cf.portalBuild(pos, rad, is_fill)
|
||||
if(not is_fill)then
|
||||
local poses = {{x = pos.x + rad, y = pos.y, z = pos.z + rad},
|
||||
{x = pos.x - rad, y = pos.y, z = pos.z - rad},
|
||||
{x = pos.x - rad, y = pos.y, z = pos.z + rad},
|
||||
{x = pos.x + rad, y = pos.y, z = pos.z - rad}}
|
||||
|
||||
for n = 1, 4, 1 do
|
||||
minetest.set_node(poses[n], {name = tm.."barrier_a"})
|
||||
end
|
||||
|
||||
local pool = {2,2,-1,-3}
|
||||
for n = 1, 4, 1 do
|
||||
local no = pool[n] + n
|
||||
|
||||
local ar = minetest.find_nodes_in_area(poses[n],poses[no], "air")
|
||||
if(ar and #ar >= 1)then
|
||||
for a = 1, #ar, 1 do
|
||||
minetest.set_node(ar[a], {name = tm.."barrier_a"})
|
||||
end
|
||||
else end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
elseif(is_fill == true)then -- For Roofing things, like Jaycee does.
|
||||
local ar = minetest.find_nodes_in_area({x = pos.x + rad, y = pos.y, z = pos.z + rad},{x = pos.x - rad, y = pos.y, z = pos.z - rad}, "air")
|
||||
if(ar and #ar >= 1)then
|
||||
for a = 1, #ar, 1 do
|
||||
minetest.set_node(ar[a], {name = tm.."barrier_a"})
|
||||
end
|
||||
else end
|
||||
else
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
------FUNCTIONS-------
|
||||
|
||||
|
||||
|
||||
|
@ -50,7 +8,7 @@ minetest.register_node(tm.."barrier",{
|
|||
tiles = {"detail.png","barrier.png"},
|
||||
drawtype = "glasslike_framed",
|
||||
--mesh = "director.obj",
|
||||
groups = {oddly_breakable_by_hand = 1},
|
||||
groups = {oddly_breakable_by_hand = 1, cf_barrier = 1},
|
||||
on_punch = function(pos)
|
||||
local ppos = {x = pos.x, y = pos.y, z = pos.z}
|
||||
local rad = 26
|
||||
|
@ -82,13 +40,25 @@ minetest.register_node(tm.."barrier_a",{
|
|||
{
|
||||
type = "sheet_2d",
|
||||
frames_w = 1,
|
||||
frames_h = 19,
|
||||
frames_h = 14,
|
||||
frame_length = 0.3,}
|
||||
}},
|
||||
groups = {oddly_breakable_by_hand = 1},
|
||||
groups = {oddly_breakable_by_hand = 1,damage_radiant = 99, cf_barrier = 2},
|
||||
light_source = 8,
|
||||
on_construct = function(pos)
|
||||
minetest.get_meta(pos):set_int("cf_energy", 6)
|
||||
end,
|
||||
|
||||
--[[on_timer = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("cf_energy", meta:get_int("cf_energy") - 1)
|
||||
if(meta:get_int("cf_energy") < 1)then
|
||||
minetest.remove_node(pos)
|
||||
else end
|
||||
end,]]
|
||||
on_punch = function(pos)
|
||||
minetest.remove_node(pos)
|
||||
|
||||
minetest.chat_send_all(minetest.get_meta(pos):get_int("cf_energy"))
|
||||
end
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
@ -34,9 +34,10 @@ minetest.register_node(tm.."controller", {
|
|||
{0.375, 0.3125, -0.375, 0.4375, 0.4375, 0.375}, -- NodeBox48
|
||||
}
|
||||
},
|
||||
groups = {cracky = 5, cf_charge = 2},
|
||||
groups = {cracky = 5, cf_charge = 2,falling_node = 1},
|
||||
on_punch = function(pos)
|
||||
--minetest.set_node(pos, {name = tm .. "controller", param2 = minetest.get_node(pos).param2 + 1})
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
|
||||
|
|
23
director.lua
23
director.lua
|
@ -24,10 +24,23 @@ minetest.register_node(tm.."director_charged",{
|
|||
drawtype = "mesh",
|
||||
sunlight_propagates = true,
|
||||
mesh = "director.obj",
|
||||
groups = {oddly_breakable_by_hand = 1},
|
||||
groups = {oddly_breakable_by_hand = 1, cf_charge = 1},
|
||||
on_construct = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local face = nodecore.facedirs[node.param2]
|
||||
local ahe = vector.add(face.k, pos)
|
||||
local tn = minetest.get_node(ahe)
|
||||
local out_b = vector.add(vector.multiply(face.k, {x = -1, y = 1, z = -1}), pos)
|
||||
local nt = minetest.get_node(out_b)
|
||||
|
||||
cf.spark1({x = pos.x, y = pos.y, z = pos.z})
|
||||
minetest.after(0.5, function() minetest.set_node(pos, {name = tm.."director", param2 = minetest.get_node(pos).param2}) end)
|
||||
if(minetest.get_node_group(tn.name, "cf_charge") > 0) then
|
||||
local meta = minetest.get_meta(ahe)
|
||||
local mmeta = minetest.get_meta(pos)
|
||||
meta:set_int("cf_charge", meta:get_int("cf_charge") + minetest.registered_nodes[nt.name]["light_source"])
|
||||
|
||||
else end
|
||||
minetest.after(0.1, function() minetest.set_node(pos, {name = tm.."director", param2 = minetest.get_node(pos).param2}) end)
|
||||
end,
|
||||
on_punch = function(pos)
|
||||
minetest.remove_node(pos)
|
||||
|
@ -37,7 +50,7 @@ minetest.register_node(tm.."director_charged",{
|
|||
|
||||
nodecore.register_limited_abm({
|
||||
label = "Lens focusing to Director",
|
||||
interval = 2,
|
||||
interval = 0.1,
|
||||
chance = 1,
|
||||
nodenames = {tm .. "director"},
|
||||
action = function(pos, node)
|
||||
|
@ -49,9 +62,9 @@ nodecore.register_limited_abm({
|
|||
local tdef = minetest.registered_items[tn.name] or {}
|
||||
if(minetest.registered_nodes[tn.name]["light_source"] > 0)then
|
||||
minetest.set_node(pos, {name = tm.."director_charged", param2 = minetest.get_node(pos).param2})
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
--meta:set_int("cf_charge", meta:get_int("cf_charge") + minetest.registered_nodes[tn.name]["light_source"])
|
||||
else minetest.chat_send_all(minetest.registered_nodes[tn.name]["light_source"]) end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
|
152
dock.lua
152
dock.lua
|
@ -1,3 +1,62 @@
|
|||
--FUNCTIONS--
|
||||
|
||||
function cf.portalBuild(pos, rad, is_fill)
|
||||
if(not is_fill)then
|
||||
local poses = {{x = pos.x + rad, y = pos.y, z = pos.z + rad},
|
||||
{x = pos.x - rad, y = pos.y, z = pos.z - rad},
|
||||
{x = pos.x - rad, y = pos.y, z = pos.z + rad},
|
||||
{x = pos.x + rad, y = pos.y, z = pos.z - rad}}
|
||||
|
||||
for n = 1, 4, 1 do
|
||||
minetest.set_node(poses[n], {name = tm.."barrier_a"})
|
||||
end
|
||||
|
||||
local pool = {2,2,-1,-3}
|
||||
for n = 1, 4, 1 do
|
||||
local no = pool[n] + n
|
||||
|
||||
local ar = minetest.find_nodes_in_area(poses[n],poses[no], "air")
|
||||
if(ar and #ar >= 1)then
|
||||
for a = 1, #ar, 1 do
|
||||
minetest.set_node(ar[a], {name = tm.."barrier_a"})
|
||||
end
|
||||
else end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
elseif(is_fill == true)then -- For Roofing things, like Jaycee does.
|
||||
local ar = minetest.find_nodes_in_area({x = pos.x + rad, y = pos.y, z = pos.z + rad},{x = pos.x - rad, y = pos.y, z = pos.z - rad}, "air")
|
||||
if(ar and #ar >= 1)then
|
||||
for a = 1, #ar, 1 do
|
||||
minetest.set_node(ar[a], {name = tm.."barrier_a"})
|
||||
end
|
||||
else end
|
||||
else
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local entomb = function(pos, rad)
|
||||
local ppos,ppos2 = {x = pos.x, y = pos.y, z = pos.z},{x = pos.x, y = pos.y, z = pos.z}
|
||||
for n = 1, rad, 1 do
|
||||
|
||||
if(n < rad)then
|
||||
cf.portalBuild(ppos, rad)
|
||||
ppos.y = pos.y + n
|
||||
ppos2.y = pos.y - n
|
||||
cf.portalBuild(ppos2, rad)
|
||||
elseif(n >= rad)then
|
||||
cf.portalBuild(ppos,rad,true)
|
||||
cf.portalBuild(ppos2,rad,true)
|
||||
else end
|
||||
end
|
||||
end
|
||||
|
||||
------FUNCTIONS-------
|
||||
|
||||
minetest.register_node(tm.."port",{
|
||||
|
||||
description = "Port",
|
||||
|
@ -19,6 +78,38 @@ minetest.register_node(tm.."port",{
|
|||
|
||||
})
|
||||
|
||||
|
||||
local function barrier_wax(pos, rad)
|
||||
|
||||
local function support_field(pos, cost)
|
||||
local below = {x = pos.x, y = pos.y - 1, z = pos.z}-- or cf.nullvector
|
||||
if(below and cost)then
|
||||
local meta = minetest.get_meta(below)
|
||||
meta:set_int("cf_charge", meta:get_int("cf_charge") - cost)
|
||||
else end
|
||||
end
|
||||
|
||||
|
||||
local function clear_field(area)
|
||||
if(area)then
|
||||
for n = 1, #area, 1 do
|
||||
minetest.remove_node(area[n])
|
||||
end
|
||||
else end
|
||||
end
|
||||
|
||||
local nodes = minetest.find_nodes_in_area({x=pos.x-rad,y=pos.y-rad,z=pos.z-rad},{x=pos.x+rad,y=pos.y+rad,z=pos.z+rad}, "group:cf_barrier")
|
||||
local cost = nodes and #nodes/100 or nil
|
||||
local charge = minetest.get_meta({x = pos.x, y = pos.y - 1, z = pos.z}):get_int("cf_charge")
|
||||
local nb = cost and cost <= charge and true or nil
|
||||
if(nb)then
|
||||
support_field(pos,cost)
|
||||
else clear_field(nodes)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_node(tm.."port_occ",{
|
||||
|
||||
description = "Occupied Port",
|
||||
|
@ -28,30 +119,55 @@ minetest.register_node(tm.."port_occ",{
|
|||
sunlight_propagates = true,
|
||||
mesh = "port_occ.obj",
|
||||
groups = {oddly_breakable_by_hand = 1},
|
||||
on_punch = function(pos)
|
||||
minetest.set_node(pos, {name = tm.."port"})
|
||||
on_punch = function(pos,_,puncher)
|
||||
local rad = 26
|
||||
if(puncher:get_player_control().sneak == false)then
|
||||
local thresh = 10
|
||||
local below = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||
if(minetest.get_meta(below):get_int("cf_charge") >= thresh)then
|
||||
|
||||
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
else minetest.chat_send_all("why")
|
||||
end
|
||||
elseif(puncher:get_player_control().sneak == true)then
|
||||
minetest.get_meta(pos):set_int("cf_radius", rad)
|
||||
else
|
||||
end
|
||||
end,
|
||||
on_construct = function (pos)
|
||||
local rad = 26
|
||||
minetest.get_meta(pos):set_int("cf_radius", rad)
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
end,
|
||||
on_timer = function(pos)
|
||||
local ppos,ppos2 = {x = pos.x, y = pos.y, z = pos.z},{x = pos.x, y = pos.y, z = pos.z}
|
||||
local rad = 26
|
||||
for n = 1, rad, 1 do
|
||||
|
||||
if(n < rad)then
|
||||
cf.portalBuild(ppos, rad)
|
||||
ppos.y = pos.y + n
|
||||
ppos2.y = pos.y - n
|
||||
cf.portalBuild(ppos2, rad)
|
||||
elseif(n >= rad)then
|
||||
cf.portalBuild(ppos,rad,true)
|
||||
cf.portalBuild(ppos2,rad,true)
|
||||
else end
|
||||
end
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local rad = meta:get_int("cf_radius")
|
||||
|
||||
barrier_wax(pos,rad)
|
||||
minetest.get_node_timer(pos):start(3.5)
|
||||
end,
|
||||
on_rightclick = function(pos)
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{
|
||||
label = "Barrier Filling",
|
||||
|
||||
nodenames = {tm.."port_occ"},
|
||||
|
||||
neighbors = {"air"},
|
||||
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
entomb(pos,minetest.get_meta(pos):get_int("cf_radius"))
|
||||
end
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 680 B |
|
@ -30,6 +30,11 @@ minetest.register_node(tm.."vestibule", {
|
|||
{0.25, -0.0625, 0.375, 0.3125, 0.125, 0.5}, -- NodeBox24
|
||||
}
|
||||
},
|
||||
groups = {silica_clear = 1, cracky = 4, cf_charge = 1, cf_charge_entry = 1}
|
||||
groups = {silica_clear = 1, cracky = 4, cf_charge = 1, falling_node = 2},
|
||||
on_punch = function(pos)
|
||||
--minetest.remove_node(pos)
|
||||
minetest.chat_send_all(minetest.get_meta(pos):get_int("cf_charge"))
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue