Improve air/vacuum functions. Vacuum now spreads through air. Airgen removes most air on placement, changes to airgen_empty. Remove unnecessary alpha channel from textures

master
paramat 2016-05-16 03:11:08 +01:00
parent 40c00d9094
commit 989cdeebfb
16 changed files with 115 additions and 54 deletions

View File

@ -20,6 +20,7 @@ C = default mese crystal (mese tint)
G = default glass G = default glass
S = default steel ingot S = default steel ingot
Lifesupport backpack Lifesupport backpack
SSS SSS
@ -29,6 +30,7 @@ SMS
S = default steel ingot S = default steel ingot
M = default mese block (power source) M = default mese block (power source)
Spacesuit Spacesuit
WHW WHW
@ -39,6 +41,7 @@ W = wool white (fabric)
H = moonrealm helmet H = moonrealm helmet
L = moonrealm lifesupport L = moonrealm lifesupport
Moon stone brick x 4 Moon stone brick x 4
MM MM
@ -46,6 +49,7 @@ MM
M = moon stone M = moon stone
Moon stone stair x 4 Moon stone stair x 4
M M
@ -53,12 +57,14 @@ MM
M = moon stone M = moon stone
Moon stone slab x 4 Moon stone slab x 4
MM MM
M = moon stone M = moon stone
Default furnace Default furnace
You can cook moon dust to moonrealm glass, use mese crystal as fuel. You can cook moon dust to moonrealm glass, use mese crystal as fuel.
@ -68,9 +74,11 @@ MMM
M = moon stone M = moon stone
Airgen Airgen
Place in the centre of a sealed habitat. Place in the centre of a sealed habitat.
Moonrealm air will spread to a distance of roughly 16 nodes. Will only add air to a distance of 8 nodes, if the habitat interior exceeds this
volume vacuum will remain which will then gradually spread and replace the air.
SIS SIS
IMI IMI
@ -80,6 +88,7 @@ S = default steel ingot
I = moonrealm waterice I = moonrealm waterice
M = default mese block (power source) M = default mese block (power source)
Airlock with light source Airlock with light source
Walk through it, life support air cannot pass through. Walk through it, life support air cannot pass through.
@ -90,6 +99,7 @@ S-S
S = default steel ingot S = default steel ingot
M = default mese block (power source) M = default mese block (power source)
Light x 8 Light x 8
GGG GGG
@ -99,6 +109,7 @@ GGG
G = moonrealm glass G = moonrealm glass
M = default mese block (power source) M = default mese block (power source)
Light x 1 Light x 1
G+C G+C
@ -107,6 +118,7 @@ shapeless crafting
G = moonrealm glass G = moonrealm glass
C = default mese crystal (power source) C = default mese crystal (power source)
Default water source Default water source
Ice spawns in dust at mid to low altitudes Ice spawns in dust at mid to low altitudes
@ -114,10 +126,11 @@ I
I = moonrealm waterice I = moonrealm waterice
Hydroponic liquid source Hydroponic liquid source
Hydroponic liquid will saturate the 5x5x5 node volume of dust around it, Hydroponic liquid will saturate the 5x5 node area of dust around it,
changing it to moonrealm soil. For growth a moonrealm sapling requires a changing it to moonrealm soil. For growth a moonrealm sapling requires
1 node depth of moonrealm soil and 5x5x5 nodes of moonrealm air around it. moonrealm soil and 5x5x5 nodes of moonrealm air around it.
LLL LLL
LIL LIL

View File

@ -21,6 +21,7 @@ function moonrealm_appletree(pos)
if data[area:index(px, py - 1, pz)] ~= c_soil then if data[area:index(px, py - 1, pz)] ~= c_soil then
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
return return
end end
@ -32,6 +33,7 @@ function moonrealm_appletree(pos)
if data[vi] ~= c_air then if data[vi] ~= c_air then
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
return return
end end
vi = vi + 1 vi = vi + 1
@ -90,18 +92,25 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
local data = vm:get_data() local data = vm:get_data()
local vip = area:index(px, py, pz) local vip = area:index(px, py, pz)
local vacuum_at_face = false
for z = pos1.z, pos2.z do for z = pos1.z, pos2.z do
for y = pos1.y, pos2.y do for y = pos1.y, pos2.y do
local vi = area:index(pos1.x, y, z) local vi = area:index(pos1.x, y, z)
for x = pos1.x, pos2.x do for x = pos1.x, pos2.x do
if not (x == px and y == py and z == pz) then -- if face connected neighbour
if data[vi] == c_air then if math.abs(x - px) + math.abs(y - py) + math.abs(z - pz) == 1 then
local nodid = data[vi]
if nodid == c_air then
-- air gets priority
data[vip] = c_air data[vip] = c_air
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
print ("[moonrealm] air flows into hole") print ("[moonrealm] air flows into hole")
return return
elseif nodid == c_vacuum then
vacuum_at_face = true
end end
end end
vi = vi + 1 vi = vi + 1
@ -109,52 +118,55 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
end end
end end
data[vip] = c_vacuum -- no air detected, place vacuum if detected
if vacuum_at_face then
data[vip] = c_vacuum
print ("[moonrealm] vacuum flows into hole")
end
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
print ("[moonrealm] vacuum flows into hole")
end) end)
-- Air spread ABM -- Vacuum spread ABM (through cube faces only)
--[[minetest.register_abm({ minetest.register_abm({
nodenames = {"moonrealm:air"}, nodenames = {"moonrealm:air"},
neighbors = {"moonrealm:vacuum"}, neighbors = {"moonrealm:vacuum"},
interval = 13, interval = 2,
chance = 9, chance = 64,
catch_up = false, catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local spread = minetest.get_meta(pos):get_int("spread") local px = pos.x
if spread <= 0 then local py = pos.y
return local pz = pos.z
end local c_air = minetest.get_content_id("moonrealm:air")
local x = pos.x
local y = pos.y
local z = pos.z
local c_lsair = minetest.get_content_id("moonrealm:air")
local c_vacuum = minetest.get_content_id("moonrealm:vacuum") local c_vacuum = minetest.get_content_id("moonrealm:vacuum")
local vm = minetest.get_voxel_manip() local vm = minetest.get_voxel_manip()
local pos1 = {x = x - 1, y = y - 1, z = z - 1} local pos1 = {x = px - 1, y = py - 1, z = pz - 1}
local pos2 = {x = x + 1, y = y + 1, z = z + 1} local pos2 = {x = px + 1, y = py + 1, z = pz + 1}
local emin, emax = vm:read_from_map(pos1, pos2) local emin, emax = vm:read_from_map(pos1, pos2)
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax}) local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data() local data = vm:get_data()
for j = -1, 1 do local vip = area:index(px, py, pz)
for k = -1, 1 do
local vi = area:index(x - 1, y + j, z + k) for z = pos1.z, pos2.z do
for i = -1, 1 do for y = pos1.y, pos2.y do
if not (i == 0 and j == 0 and k == 0) then local vi = area:index(pos1.x, y, z)
local nodid = data[vi] for x = pos1.x, pos2.x do
if nodid == c_vacuum then -- if face connected neighbour
data[vi] = c_lsair if math.abs(x - px) + math.abs(y - py) + math.abs(z - pz) == 1 then
minetest.get_meta({x = x + i, y = y + j, z = z + k}):set_int("spread", (spread - 1)) if data[vi] == c_vacuum then
print ("[moonrealm] air spreads") data[vip] = c_vacuum
vm:set_data(data)
vm:write_to_map()
vm:update_map()
print ("[moonrealm] vacuum spreads")
return
end end
end end
vi = vi + 1 vi = vi + 1
@ -162,11 +174,12 @@ end)
end end
end end
-- no face connected vacuum detected
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
--vm:update_map() not needed as no effect on lighting vm:update_map()
end end
})--]] })
-- Hydroponic saturation ABM -- Hydroponic saturation ABM
@ -196,14 +209,11 @@ minetest.register_abm({
for z = pos1.z, pos2.z do for z = pos1.z, pos2.z do
local vi = area:index(pos1.x, py, z) local vi = area:index(pos1.x, py, z)
for x = pos1.x, pos2.x do for x = pos1.x, pos2.x do
if not (x == px and z == pz) then local nodid = data[vi]
local nodid = data[vi] if nodid == c_dust or
if nodid == c_dust nodid == c_dustp1 or
or nodid == c_dustp1 nodid == c_dustp2 then
or nodid == c_dustp2 then data[vi] = c_soil
data[vi] = c_soil
print ("[moonrealm] hydroponic liquid saturates")
end
end end
vi = vi + 1 vi = vi + 1
end end
@ -211,6 +221,9 @@ minetest.register_abm({
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
print ("[moonrealm] hydroponic liquid saturates")
end end
}) })
@ -245,17 +258,20 @@ minetest.register_abm({
local nodid = data[vi] local nodid = data[vi]
if nodid == c_hlsource or nodid == c_hlflowing then if nodid == c_hlsource or nodid == c_hlflowing then
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
return return
end end
vi = vi + 1 vi = vi + 1
end end
end end
-- no hydroponic liquids detected
data[vip] = c_dust data[vip] = c_dust
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map()
print ("[moonrealm] soil dries") print ("[moonrealm] soil dries")
end, end,

View File

@ -122,22 +122,25 @@ minetest.register_node("moonrealm:airgen", {
groups = {cracky = 3}, groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos) on_construct = function(pos)
local xa = pos.x local px = pos.x
local ya = pos.y local py = pos.y
local za = pos.z local pz = pos.z
local c_air = minetest.get_content_id("moonrealm:air") local c_air = minetest.get_content_id("moonrealm:air")
local c_vacuum = minetest.get_content_id("moonrealm:vacuum") local c_vacuum = minetest.get_content_id("moonrealm:vacuum")
local c_airgen_empty = minetest.get_content_id("moonrealm:airgen_empty")
local vm = minetest.get_voxel_manip() local vm = minetest.get_voxel_manip()
local pos1 = {x = xa - 16, y = ya - 16, z = za - 16} local pos1 = {x = px - 8, y = py - 8, z = pz - 8}
local pos2 = {x = xa + 16, y = ya + 16, z = za + 16} local pos2 = {x = px + 8, y = py + 9, z = pz + 8}
local emin, emax = vm:read_from_map(pos1, pos2) local emin, emax = vm:read_from_map(pos1, pos2)
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax}) local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data() local data = vm:get_data()
local viystride = emax.x - emin.x + 1
-- replace vaccum with air in all but top layer
for z = pos1.z, pos2.z do for z = pos1.z, pos2.z do
for y = pos1.y, pos2.y do for y = pos1.y, pos2.y - 1 do
local vi = area:index(pos1.x, y, z) local vi = area:index(pos1.x, y, z)
for x = pos1.x, pos2.x do for x = pos1.x, pos2.x do
if data[vi] == c_vacuum then if data[vi] == c_vacuum then
@ -148,14 +151,44 @@ minetest.register_node("moonrealm:airgen", {
end end
end end
-- spread vacuum down through columns to remove most air
for z = pos1.z, pos2.z do
for x = pos1.x, pos2.x do
local vi = area:index(x, pos2.y, z)
-- if vacuum at column top
if data[vi] == c_vacuum then
vi = vi - viystride
for y = pos2.y - 1, pos1.y, -1 do
if data[vi] == c_air then
data[vi] = c_vacuum
else
break
end
vi = vi - viystride
end
end
end
end
-- replace with empty airgen
data[area:index(px, py, pz)] = c_airgen_empty
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
--vm:update_map() not needed as no effect on lighting vm:update_map()
print ("[moonrealm] air generated") print ("[moonrealm] air generated")
end end
}) })
minetest.register_node("moonrealm:airgen_empty", {
description = "Air Generator Empty",
tiles = {"moonrealm_airgen_empty.png"},
is_ground_content = false,
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("moonrealm:waterice", { minetest.register_node("moonrealm:waterice", {
description = "Water Ice", description = "Water Ice",
tiles = {"default_ice.png"}, tiles = {"default_ice.png"},
@ -236,7 +269,6 @@ minetest.register_node("moonrealm:airlock", {
light_source = 14, light_source = 14,
is_ground_content = false, is_ground_content = false,
walkable = false, walkable = false,
post_effect_color = {a = 255, r = 181, g = 181, b = 181},
groups = {cracky = 3}, groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 141 B