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

View File

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

View File

@ -122,22 +122,25 @@ minetest.register_node("moonrealm:airgen", {
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local xa = pos.x
local ya = pos.y
local za = pos.z
local px = pos.x
local py = pos.y
local pz = pos.z
local c_air = minetest.get_content_id("moonrealm:air")
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 pos1 = {x = xa - 16, y = ya - 16, z = za - 16}
local pos2 = {x = xa + 16, y = ya + 16, z = za + 16}
local pos1 = {x = px - 8, y = py - 8, z = pz - 8}
local pos2 = {x = px + 8, y = py + 9, z = pz + 8}
local emin, emax = vm:read_from_map(pos1, pos2)
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
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 y = pos1.y, pos2.y do
for y = pos1.y, pos2.y - 1 do
local vi = area:index(pos1.x, y, z)
for x = pos1.x, pos2.x do
if data[vi] == c_vacuum then
@ -148,14 +151,44 @@ minetest.register_node("moonrealm:airgen", {
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:write_to_map()
--vm:update_map() not needed as no effect on lighting
vm:update_map()
print ("[moonrealm] air generated")
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", {
description = "Water Ice",
tiles = {"default_ice.png"},
@ -236,7 +269,6 @@ minetest.register_node("moonrealm:airlock", {
light_source = 14,
is_ground_content = false,
walkable = false,
post_effect_color = {a = 255, r = 181, g = 181, b = 181},
groups = {cracky = 3},
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