Merge 988fdd093c
into 1a9362afed
|
@ -1 +1 @@
|
|||
name = Minetest
|
||||
name = Moontest
|
||||
|
|
|
@ -17,6 +17,6 @@ dofile(minetest.get_modpath("default").."/nodes.lua")
|
|||
dofile(minetest.get_modpath("default").."/tools.lua")
|
||||
dofile(minetest.get_modpath("default").."/craftitems.lua")
|
||||
dofile(minetest.get_modpath("default").."/crafting.lua")
|
||||
dofile(minetest.get_modpath("default").."/mapgen.lua")
|
||||
-- dofile(minetest.get_modpath("default").."/mapgen.lua")
|
||||
dofile(minetest.get_modpath("default").."/player.lua")
|
||||
dofile(minetest.get_modpath("default").."/trees.lua")
|
||||
|
|
104
mods/moonrealm/README.txt
Normal file
|
@ -0,0 +1,104 @@
|
|||
moonrealm 0.6.5 by paramat
|
||||
For latest stable Minetest and back to 0.4.8
|
||||
Depends default
|
||||
Licenses: code WTFPL, textures CC BY-SA
|
||||
|
||||
Preparation crafting
|
||||
--------------------
|
||||
|
||||
Spacesuit.
|
||||
To avoid drowning in the vacuum nodes put a spacesuit in your inventory.
|
||||
|
||||
Mesetint helmet.
|
||||
-C-
|
||||
-G-
|
||||
-S-
|
||||
C = default mese crystal (mese tint)
|
||||
G = default glass
|
||||
S = default steel ingot
|
||||
|
||||
Lifesupport backpack.
|
||||
SSS
|
||||
S-S
|
||||
SMS
|
||||
S = default steel ingot
|
||||
M = default mese block (power source)
|
||||
|
||||
Spacesuit.
|
||||
WHW
|
||||
-L-
|
||||
W-W
|
||||
W = wool white (fabric)
|
||||
H = moonrealm helmet
|
||||
L = moonrealm lifesupport
|
||||
|
||||
|
||||
Moonrealm sapling.
|
||||
-C-
|
||||
-S-
|
||||
C = default mese crystal
|
||||
S = sapling
|
||||
|
||||
Moonrealm crafting
|
||||
------------------
|
||||
|
||||
Moon stone brick x 4.
|
||||
MM
|
||||
MM
|
||||
M = moon stone
|
||||
|
||||
Moon stone stair x 4.
|
||||
M
|
||||
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.
|
||||
MMM
|
||||
M-M
|
||||
MMM
|
||||
M = moon stone
|
||||
|
||||
Airgen.
|
||||
Place in the centre of a sealed habitat.
|
||||
Moonrealm air will spread to a distance of roughly 16 nodes.
|
||||
SIS
|
||||
IMI
|
||||
SIS
|
||||
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.
|
||||
S-S
|
||||
SMS
|
||||
S-S
|
||||
S = default steel ingot
|
||||
M = default mese block (power source)
|
||||
|
||||
Light x 8
|
||||
GGG
|
||||
GMG
|
||||
GGG
|
||||
G = moonrealm glass
|
||||
M = default mese block (power source)
|
||||
|
||||
Default water source.
|
||||
Ice spawns in dust at mid to low altitudes.
|
||||
I
|
||||
I = moonrealm waterice
|
||||
|
||||
Hydroponic liquid source.
|
||||
Hydroponic liquid will saturate the 5x5 node area of dust around it, to a depth of 5 nodes,
|
||||
changing it to moonrealm soil. You can grow any farming mod crop in the soil.
|
||||
A depth of 2 soil nodes with moonrealm air above is needed for a moonrealm sapling to grow.
|
||||
LLL
|
||||
LIL
|
||||
LLL
|
||||
L = moonrealm leaves
|
||||
I = moonrealm waterice
|
1
mods/moonrealm/depends.txt
Normal file
|
@ -0,0 +1 @@
|
|||
default
|
172
mods/moonrealm/functions.lua
Normal file
|
@ -0,0 +1,172 @@
|
|||
-- Space apple tree
|
||||
|
||||
function moonrealm_appletree(pos)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
for j = -2, -1 do
|
||||
local nodename = minetest.get_node({x=x,y=y+j,z=z}).name
|
||||
if nodename ~= "moonrealm:soil" then
|
||||
return
|
||||
end
|
||||
end
|
||||
for j = 1, 5 do
|
||||
local nodename = minetest.get_node({x=x,y=y+j,z=z}).name
|
||||
if nodename ~= "moonrealm:air" then
|
||||
return
|
||||
end
|
||||
end
|
||||
for j = -2, 4 do
|
||||
if j >= 1 then
|
||||
for i = -2, 2 do
|
||||
for k = -2, 2 do
|
||||
local nodename = minetest.get_node({x=x+i,y=y+j+1,z=z+k}).name
|
||||
if math.random() > (math.abs(i) + math.abs(k)) / 16 then
|
||||
if math.random(13) == 2 then
|
||||
minetest.add_node({x=pos.x+i,y=pos.y+j+1,z=pos.z+k},{name="default:apple"})
|
||||
else
|
||||
minetest.add_node({x=pos.x+i,y=pos.y+j+1,z=pos.z+k},{name="moonrealm:leaves"})
|
||||
end
|
||||
else
|
||||
minetest.add_node({x=x+i,y=y+j+1,z=z+k},{name="moonrealm:air"})
|
||||
minetest.get_meta({x=x+i,y=y+j+1,z=z+k}):set_int("spread", 16)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.add_node({x=pos.x,y=pos.y+j,z=pos.z},{name="default:tree"})
|
||||
end
|
||||
print ("[moonrealm] Appletree sapling grows")
|
||||
end
|
||||
|
||||
-- Vacuum or air flows into a dug hole
|
||||
|
||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
for i = -1,1 do
|
||||
for j = -1,1 do
|
||||
for k = -1,1 do
|
||||
if not (i == 0 and j == 0 and k == 0) then
|
||||
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
|
||||
if nodename == "moonrealm:air" then
|
||||
local spread = minetest.get_meta({x=x+i,y=y+j,z=z+k}):get_int("spread")
|
||||
if spread > 0 then
|
||||
minetest.add_node({x=x,y=y,z=z},{name="moonrealm:air"})
|
||||
minetest.get_meta(pos):set_int("spread", (spread - 1))
|
||||
print ("[moonrealm] MR air flows into hole "..(spread - 1))
|
||||
return
|
||||
end
|
||||
elseif nodename == "moonrealm:vacuum" then
|
||||
minetest.add_node({x=x,y=y,z=z},{name="moonrealm:vacuum"})
|
||||
print ("[moonrealm] Vacuum flows into hole")
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- ABMs
|
||||
|
||||
-- Air spreads
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"moonrealm:air"},
|
||||
neighbors = {"moonrealm:vacuum", "air"},
|
||||
interval = 11,
|
||||
chance = 9,
|
||||
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
|
||||
for i = -1,1 do
|
||||
for j = -1,1 do
|
||||
for k = -1,1 do
|
||||
if not (i == 0 and j == 0 and k == 0) then
|
||||
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
|
||||
if nodename == "moonrealm:vacuum"
|
||||
or nodename == "air" then
|
||||
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="moonrealm:air"})
|
||||
minetest.get_meta({x=x+i,y=y+j,z=z+k}):set_int("spread", (spread - 1))
|
||||
print ("[moonrealm] MR air spreads "..(spread - 1))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Hydroponic saturation
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"moonrealm:hlsource", "moonrealm:hlflowing"},
|
||||
neighbors = {"moonrealm:dust", "moonrealm:dustprint1", "moonrealm:dustprint2"},
|
||||
interval = 29,
|
||||
chance = 9,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
for i = -2,2 do
|
||||
for j = -4,0 do -- saturates out and downwards to pos.y - 4, a 5x5 cube.
|
||||
for k = -2,2 do
|
||||
if not (i == 0 and j == 0 and k == 0) then
|
||||
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
|
||||
if nodename == "moonrealm:dust"
|
||||
or nodename == "moonrealm:dustprint1"
|
||||
or nodename == "moonrealm:dustprint2" then
|
||||
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="moonrealm:soil"})
|
||||
print ("[moonrealm] Hydroponic liquid saturates")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Soil drying
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"moonrealm:soil"},
|
||||
interval = 31,
|
||||
chance = 27,
|
||||
action = function(pos, node)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
for i = -2, 2 do
|
||||
for j = 0, 4 do -- search above for liquid
|
||||
for k = -2, 2 do
|
||||
if not (i == 0 and j == 0 and k == 0) then
|
||||
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
|
||||
if nodename == "moonrealm:hlsource" or nodename == "moonrealm:hlflowing" then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.add_node(pos,{name="moonrealm:dust"})
|
||||
print ("[moonrealm] Moon soil dries")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Space appletree from sapling
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"moonrealm:sapling"},
|
||||
interval = 57,
|
||||
chance = 3,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
moonrealm_appletree(pos)
|
||||
end,
|
||||
})
|
312
mods/moonrealm/init.lua
Normal file
|
@ -0,0 +1,312 @@
|
|||
-- moonrealm 0.6.5 by paramat
|
||||
-- For latest stable Minetest and back to 0.4.8
|
||||
-- Depends default
|
||||
-- Licenses: code WTFPL, textures CC BY-SA
|
||||
|
||||
-- TODO
|
||||
-- Craters
|
||||
-- Exclusive ores
|
||||
|
||||
-- Parameters
|
||||
|
||||
local XMIN = -33000 -- -- Approx horizontal limits
|
||||
local XMAX = 33000
|
||||
local ZMIN = -33000
|
||||
local ZMAX = 33000
|
||||
|
||||
local YMIN = -33000 -- -- Approx lower limit
|
||||
local GRADCEN = 1 -- -- Gradient centre / terrain centre average level
|
||||
local YMAX = 150 -- -- Approx upper limit
|
||||
|
||||
local FOOT = true -- -- Footprints in dust
|
||||
local CENAMP = 64 -- -- Grad centre amplitude, terrain centre is varied by this
|
||||
local HIGRAD = 128 -- -- Surface generating noise gradient above gradcen, controls depth of upper terrain
|
||||
local LOGRAD = 128 -- -- Surface generating noise gradient below gradcen, controls depth of lower terrain
|
||||
local HEXP = 0.5 -- -- Noise offset exponent above gradcen, 1 = normal 3D perlin terrain
|
||||
local LEXP = 2 -- -- Noise offset exponent below gradcen
|
||||
local STOT = 1 -- -- Stone density threshold, depth of dust
|
||||
local ICECHA = 1 / (13*13*13) -- -- Ice chance per dust node at terrain centre, decreases with altitude
|
||||
local ICEGRAD = 128 -- -- Ice gradient, vertical distance for no ice
|
||||
local ORECHA = 7*7*7 -- -- Ore 1/x chance per stone node
|
||||
|
||||
local FISTS = 0 -- -- Fissure threshold at surface. Controls size of fissure entrances at surface
|
||||
local FISEXP = 0.05 -- -- Fissure expansion rate under surface
|
||||
|
||||
|
||||
-- 3D noise for terrain
|
||||
|
||||
local np_terrain = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=512, y=512, z=512},
|
||||
seed = 58588900033,
|
||||
octaves = 6,
|
||||
persist = 0.67
|
||||
}
|
||||
|
||||
-- 3D noise for alt terrain, 414 / 256 = golden ratio
|
||||
|
||||
local np_terralt = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=414, y=414, z=414},
|
||||
seed = 13331930910,
|
||||
octaves = 6,
|
||||
persist = 0.67
|
||||
}
|
||||
|
||||
-- 3D noise for smooth terrain
|
||||
|
||||
local np_smooth = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=828, y=828, z=828},
|
||||
seed = 113,
|
||||
octaves = 4,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- 3D noise for fissures
|
||||
|
||||
local np_fissure = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=256, y=256, z=256},
|
||||
seed = 8181112,
|
||||
octaves = 5,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
|
||||
-- 3D noise for faults
|
||||
|
||||
local np_fault = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=414, y=828, z=414},
|
||||
seed = 14440002,
|
||||
octaves = 4,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
-- 2D noise for terrain centre
|
||||
|
||||
local np_gradcen = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=1024, y=1024, z=1024},
|
||||
seed = 9344,
|
||||
octaves = 4,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- 2D noise for terrain blend
|
||||
|
||||
local np_terblen = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=2048, y=2048, z=2048},
|
||||
seed = -13002,
|
||||
octaves = 3,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- Stuff
|
||||
|
||||
moonrealm = {}
|
||||
|
||||
dofile(minetest.get_modpath("moonrealm").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("moonrealm").."/functions.lua")
|
||||
|
||||
-- Player positions
|
||||
|
||||
local player_pos = {}
|
||||
local player_pos_previous = {}
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player_pos_previous[player:get_player_name()] = {x=0,y=0,z=0}
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
player_pos_previous[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
-- Globalstep function
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if FOOT and math.random() < 0.3 and player_pos_previous[player:get_player_name()] ~= nil then -- eternal footprints
|
||||
local pos = player:getpos()
|
||||
player_pos[player:get_player_name()] = {x=math.floor(pos.x+0.5),y=math.floor(pos.y+0.2),z=math.floor(pos.z+0.5)}
|
||||
local p_ground = {x=math.floor(pos.x+0.5),y=math.floor(pos.y+0.4),z=math.floor(pos.z+0.5)}
|
||||
local n_ground = minetest.get_node(p_ground).name
|
||||
local p_groundpl = {x=math.floor(pos.x+0.5),y=math.floor(pos.y-0.5),z=math.floor(pos.z+0.5)}
|
||||
if player_pos[player:get_player_name()].x ~= player_pos_previous[player:get_player_name()].x
|
||||
or player_pos[player:get_player_name()].y < player_pos_previous[player:get_player_name()].y
|
||||
or player_pos[player:get_player_name()].z ~= player_pos_previous[player:get_player_name()].z then
|
||||
if n_ground == "moonrealm:dust" then
|
||||
if math.random() < 0.5 then
|
||||
minetest.add_node(p_groundpl,{name="moonrealm:dustprint1"})
|
||||
else
|
||||
minetest.add_node(p_groundpl,{name="moonrealm:dustprint2"})
|
||||
end
|
||||
end
|
||||
end
|
||||
player_pos_previous[player:get_player_name()] = {
|
||||
x=player_pos[player:get_player_name()].x,
|
||||
y=player_pos[player:get_player_name()].y,
|
||||
z=player_pos[player:get_player_name()].z
|
||||
}
|
||||
end
|
||||
if math.random() < 0.1 then
|
||||
if player:get_inventory():contains_item("main", "moonrealm:spacesuit")
|
||||
and player:get_breath() < 10 then
|
||||
player:set_breath(10)
|
||||
end
|
||||
end
|
||||
if math.random() > 0.99 then
|
||||
local pos = player:getpos()
|
||||
if pos.y > YMIN and pos.y < YMAX then
|
||||
player:set_physics_override(1, 0.6, 0.2)
|
||||
else
|
||||
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- On generated function
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if minp.x < XMIN or maxp.x > XMAX
|
||||
or minp.y < YMIN or maxp.y > YMAX
|
||||
or minp.z < ZMIN or maxp.z > ZMAX then
|
||||
return
|
||||
end
|
||||
|
||||
local t1 = os.clock()
|
||||
local x1 = maxp.x
|
||||
local y1 = maxp.y
|
||||
local z1 = maxp.z
|
||||
local x0 = minp.x
|
||||
local y0 = minp.y
|
||||
local z0 = minp.z
|
||||
|
||||
print ("[moonrealm] chunk minp ("..x0.." "..y0.." "..z0..")")
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local data = vm:get_data()
|
||||
|
||||
local c_mese = minetest.get_content_id("default:mese")
|
||||
local c_mrironore = minetest.get_content_id("moonrealm:ironore")
|
||||
local c_mrcopperore = minetest.get_content_id("moonrealm:copperore")
|
||||
local c_mrgoldore = minetest.get_content_id("moonrealm:goldore")
|
||||
local c_mrdiamondore = minetest.get_content_id("moonrealm:diamondore")
|
||||
local c_mrstone = minetest.get_content_id("moonrealm:stone")
|
||||
local c_waterice = minetest.get_content_id("moonrealm:waterice")
|
||||
local c_dust = minetest.get_content_id("moonrealm:dust")
|
||||
local c_vacuum = minetest.get_content_id("moonrealm:vacuum")
|
||||
|
||||
local sidelen = x1 - x0 + 1
|
||||
local chulens = {x=sidelen, y=sidelen, z=sidelen}
|
||||
local minpos = {x=x0, y=y0, z=z0}
|
||||
local minposd = {x=x0, y=z0}
|
||||
|
||||
local nvals_terrain = minetest.get_perlin_map(np_terrain, chulens):get3dMap_flat(minpos)
|
||||
local nvals_terralt = minetest.get_perlin_map(np_terralt, chulens):get3dMap_flat(minpos)
|
||||
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minpos)
|
||||
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minpos)
|
||||
local nvals_fault = minetest.get_perlin_map(np_fault, chulens):get3dMap_flat(minpos)
|
||||
|
||||
local nvals_terblen = minetest.get_perlin_map(np_terblen, chulens):get2dMap_flat(minposd)
|
||||
local nvals_gradcen = minetest.get_perlin_map(np_gradcen, chulens):get2dMap_flat(minposd)
|
||||
|
||||
local ni = 1
|
||||
local nid = 1 -- 2D noise index
|
||||
local stable = {}
|
||||
for z = z0, z1 do
|
||||
for x = x0, x1 do
|
||||
local si = x - x0 + 1
|
||||
local nodename = minetest.get_node({x=x,y=y0-1,z=z}).name
|
||||
if nodename == "moonrealm:vacuum" then
|
||||
stable[si] = false
|
||||
else -- solid nodes and ignore in ungenerated chunks
|
||||
stable[si] = true
|
||||
end
|
||||
end
|
||||
for y = y0, y1 do
|
||||
local vi = area:index(x0, y, z) -- LVM index for first node in x row
|
||||
local icecha = ICECHA * (1 + (GRADCEN - y) / ICEGRAD)
|
||||
for x = x0, x1 do -- for each node
|
||||
local grad
|
||||
local density
|
||||
local si = x - x0 + 1 -- indexes start from 1
|
||||
local terblen = math.max(math.min(math.abs(nvals_terblen[nid]) * 4, 1.5), 0.5) - 0.5 -- terrain blend with smooth
|
||||
local gradcen = GRADCEN + nvals_gradcen[nid] * CENAMP
|
||||
if y > gradcen then
|
||||
grad = -((y - gradcen) / HIGRAD) ^ HEXP
|
||||
else
|
||||
grad = ((gradcen - y) / LOGRAD) ^ LEXP
|
||||
end
|
||||
if nvals_fault[ni] >= 0 then
|
||||
density = (nvals_terrain[ni] + nvals_terralt[ni]) / 2 * (1 - terblen) + nvals_smooth[ni] * terblen + grad
|
||||
else
|
||||
density = (nvals_terrain[ni] - nvals_terralt[ni]) / 2 * (1 - terblen) - nvals_smooth[ni] * terblen + grad
|
||||
end
|
||||
if density > 0 then -- if terrain
|
||||
local nofis = false
|
||||
if math.abs(nvals_fissure[ni]) > FISTS + math.sqrt(density) * FISEXP then
|
||||
nofis = true
|
||||
end
|
||||
if density >= STOT and nofis then -- stone, ores
|
||||
if math.random(ORECHA) == 2 then
|
||||
local osel = math.random(25)
|
||||
if osel == 25 then
|
||||
data[vi] = c_mese
|
||||
elseif osel >= 22 then
|
||||
data[vi] = c_mrdiamondore
|
||||
elseif osel >= 19 then
|
||||
data[vi] = c_mrgoldore
|
||||
elseif osel >= 10 then
|
||||
data[vi] = c_mrcopperore
|
||||
else
|
||||
data[vi] = c_mrironore
|
||||
end
|
||||
else
|
||||
data[vi] = c_mrstone
|
||||
end
|
||||
stable[si] = true
|
||||
elseif density < STOT then -- fine materials
|
||||
if nofis and stable[si] then
|
||||
if math.random() < icecha then
|
||||
data[vi] = c_waterice
|
||||
else
|
||||
data[vi] = c_dust
|
||||
end
|
||||
else -- fissure
|
||||
data[vi] = c_vacuum
|
||||
stable[si] = false
|
||||
end
|
||||
else -- fissure or unstable missing node
|
||||
data[vi] = c_vacuum
|
||||
stable[si] = false
|
||||
end
|
||||
else -- vacuum
|
||||
data[vi] = c_vacuum
|
||||
stable[si] = false
|
||||
end
|
||||
ni = ni + 1
|
||||
nid = nid + 1
|
||||
vi = vi + 1
|
||||
end
|
||||
nid = nid - 80
|
||||
end
|
||||
nid = nid + 80
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
vm:set_lighting({day=0, night=0})
|
||||
vm:calc_lighting()
|
||||
vm:write_to_map(data)
|
||||
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||
print ("[moonrealm] "..chugent.." ms")
|
||||
end)
|
14
mods/moonrealm/license.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
443
mods/moonrealm/nodes.lua
Normal file
|
@ -0,0 +1,443 @@
|
|||
minetest.register_node("moonrealm:stone", {
|
||||
description = "Moon Stone",
|
||||
tiles = {"moonrealm_stone.png"},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:ironore", {
|
||||
description = "MR Iron Ore",
|
||||
tiles = {"moonrealm_stone.png^default_mineral_iron.png"},
|
||||
groups = {cracky=2},
|
||||
drop = "default:iron_lump",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:copperore", {
|
||||
description = "MR Copper Ore",
|
||||
tiles = {"moonrealm_stone.png^default_mineral_copper.png"},
|
||||
groups = {cracky=2},
|
||||
drop = "default:copper_lump",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:goldore", {
|
||||
description = "MR Gold Ore",
|
||||
tiles = {"moonrealm_stone.png^default_mineral_gold.png"},
|
||||
groups = {cracky=2},
|
||||
drop = "default:gold_lump",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:diamondore", {
|
||||
description = "MR Diamond Ore",
|
||||
tiles = {"moonrealm_stone.png^default_mineral_diamond.png"},
|
||||
groups = {cracky=1},
|
||||
drop = "default:diamond",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:dust", {
|
||||
description = "Moon Dust",
|
||||
tiles = {"moonrealm_dust.png"},
|
||||
groups = {crumbly=3, falling_node=1},
|
||||
sounds = default.node_sound_sand_defaults({
|
||||
footstep = {name="default_sand_footstep", gain=0.1},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:dustprint1", {
|
||||
description = "Moon Dust Footprint1",
|
||||
tiles = {"moonrealm_dustprint1.png", "moonrealm_dust.png"},
|
||||
groups = {crumbly=3, falling_node=1},
|
||||
drop = "moonrealm:dust",
|
||||
sounds = default.node_sound_sand_defaults({
|
||||
footstep = {name="default_sand_footstep", gain=0.1},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:dustprint2", {
|
||||
description = "Moon Dust Footprint2",
|
||||
tiles = {"moonrealm_dustprint2.png", "moonrealm_dust.png"},
|
||||
groups = {crumbly=3, falling_node=1},
|
||||
drop = "moonrealm:dust",
|
||||
sounds = default.node_sound_sand_defaults({
|
||||
footstep = {name="default_sand_footstep", gain=0.1},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:vacuum", {
|
||||
description = "Vacuum",
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drowning = 1,
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:air", {
|
||||
description = "Life Support Air",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"moonrealm_air.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:airgen", {
|
||||
description = "Air Generator",
|
||||
tiles = {"moonrealm_airgen.png"},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
for i = -1,1 do
|
||||
for j = -1,1 do
|
||||
for k = -1,1 do
|
||||
if not (i == 0 and j == 0 and k == 0) then
|
||||
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
|
||||
if nodename == "moonrealm:vacuum" then
|
||||
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="moonrealm:air"})
|
||||
minetest.get_meta({x=x+i,y=y+j,z=z+k}):set_int("spread", 16)
|
||||
print ("[moonrealm] Added MR air node")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:waterice", {
|
||||
description = "Water Ice",
|
||||
tiles = {"moonrealm_waterice.png"},
|
||||
light_source = 1,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=3,melts=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:hlflowing", {
|
||||
description = "Flowing Hydroponics",
|
||||
inventory_image = minetest.inventorycube("moonrealm_hl.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"moonrealm_hl.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="moonrealm_hlflowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2}
|
||||
},
|
||||
{
|
||||
image="moonrealm_hlflowing_animated.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2}
|
||||
},
|
||||
},
|
||||
alpha = 224,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "moonrealm:hlflowing",
|
||||
liquid_alternative_source = "moonrealm:hlsource",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a=224, r=115, g=55, b=24},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:hlsource", {
|
||||
description = "Hydroponic Source",
|
||||
inventory_image = minetest.inventorycube("moonrealm_hl.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {"moonrealm_hl.png"},
|
||||
alpha = 224,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "moonrealm:hlflowing",
|
||||
liquid_alternative_source = "moonrealm:hlsource",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a=224, r=115, g=55, b=24},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:soil", {
|
||||
description = "Moonsoil",
|
||||
tiles = {"moonrealm_soil.png"},
|
||||
groups = {crumbly=3, falling_node=1, soil=3},
|
||||
drop = "moonrealm:dust",
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:airlock", {
|
||||
description = "Airlock",
|
||||
tiles = {"moonrealm_airlock.png"},
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
post_effect_color = {a=255, r=0, g=0, b=0},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:glass", {
|
||||
description = "MR Glass",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"default_obsidian_glass.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:sapling", {
|
||||
description = "MR Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_sapling.png"},
|
||||
inventory_image = "default_sapling.png",
|
||||
wield_image = "default_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:leaves", {
|
||||
description = "MR Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_leaves.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"moonrealm:sapling"},rarity = 20,},
|
||||
{items = {"moonrealm:leaves"},}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:light", {
|
||||
description = "Light",
|
||||
tiles = {"moonrealm_light.png"},
|
||||
light_source = 14,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:stonebrick", {
|
||||
description = "Moon Stone Brick",
|
||||
tiles = {"moonrealm_stonebricktop.png", "moonrealm_stonebrickbot.png", "moonrealm_stonebrick.png"},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:stoneslab", {
|
||||
description = "Moon Stone Slab",
|
||||
tiles = {"moonrealm_stonebricktop.png", "moonrealm_stonebrickbot.png", "moonrealm_stonebrick.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
buildable_to = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moonrealm:stonestair", {
|
||||
description = "Moon Stone Stair",
|
||||
tiles = {"moonrealm_stonebricktop.png", "moonrealm_stonebrickbot.png", "moonrealm_stonebrick.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
-- Items
|
||||
|
||||
minetest.register_craftitem("moonrealm:spacesuit", {
|
||||
description = "MR Spacesuit",
|
||||
inventory_image = "moonrealm_spacesuit.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("moonrealm:helmet", {
|
||||
description = "MR Mesetint Helmet",
|
||||
inventory_image = "moonrealm_helmet.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("moonrealm:lifesupport", {
|
||||
description = "MR Life Support",
|
||||
inventory_image = "moonrealm_lifesupport.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
-- Crafting
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:airlock",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:airgen",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "moonrealm:waterice", "default:steel_ingot"},
|
||||
{"moonrealm:waterice", "default:mese", "moonrealm:waterice"},
|
||||
{"default:steel_ingot", "moonrealm:waterice", "default:steel_ingot"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:water_source",
|
||||
recipe = {
|
||||
{"moonrealm:waterice"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:hlsource",
|
||||
recipe = {
|
||||
{"moonrealm:leaves", "moonrealm:leaves", "moonrealm:leaves"},
|
||||
{"moonrealm:leaves", "moonrealm:waterice", "moonrealm:leaves"},
|
||||
{"moonrealm:leaves", "moonrealm:leaves", "moonrealm:leaves"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:stonebrick 4",
|
||||
recipe = {
|
||||
{"moonrealm:stone", "moonrealm:stone"},
|
||||
{"moonrealm:stone", "moonrealm:stone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:furnace",
|
||||
recipe = {
|
||||
{"moonrealm:stone", "moonrealm:stone", "moonrealm:stone"},
|
||||
{"moonrealm:stone", "", "moonrealm:stone"},
|
||||
{"moonrealm:stone", "moonrealm:stone", "moonrealm:stone"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:stoneslab 4",
|
||||
recipe = {
|
||||
{"moonrealm:stone", "moonrealm:stone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:stonestair 4",
|
||||
recipe = {
|
||||
{"moonrealm:stone", ""},
|
||||
{"moonrealm:stone", "moonrealm:stone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:helmet",
|
||||
recipe = {
|
||||
{"default:mese_crystal"},
|
||||
{"default:glass"},
|
||||
{"default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:lifesupport",
|
||||
recipe = {
|
||||
{"default:steel_ingot","default:steel_ingot" , "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:spacesuit",
|
||||
recipe = {
|
||||
{"wool:white", "moonrealm:helmet", "wool:white"},
|
||||
{"", "moonrealm:lifesupport", ""},
|
||||
{"wool:white", "", "wool:white"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:light 8",
|
||||
recipe = {
|
||||
{"moonrealm:glass", "moonrealm:glass", "moonrealm:glass"},
|
||||
{"moonrealm:glass", "default:mese", "moonrealm:glass"},
|
||||
{"moonrealm:glass", "moonrealm:glass", "moonrealm:glass"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moonrealm:sapling",
|
||||
recipe = {
|
||||
{"default:mese_crystal"},
|
||||
{"default:sapling"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Cooking
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "moonrealm:glass",
|
||||
recipe = "moonrealm:dust",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:mese_crystal",
|
||||
burntime = 50,
|
||||
})
|
BIN
mods/moonrealm/textures/moonrealm_air.png
Normal file
After Width: | Height: | Size: 169 B |
BIN
mods/moonrealm/textures/moonrealm_airgen.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
mods/moonrealm/textures/moonrealm_airlock.png
Normal file
After Width: | Height: | Size: 156 B |
BIN
mods/moonrealm/textures/moonrealm_dust.png
Normal file
After Width: | Height: | Size: 554 B |
BIN
mods/moonrealm/textures/moonrealm_dustprint1.png
Normal file
After Width: | Height: | Size: 536 B |
BIN
mods/moonrealm/textures/moonrealm_dustprint2.png
Normal file
After Width: | Height: | Size: 527 B |
BIN
mods/moonrealm/textures/moonrealm_helmet.png
Normal file
After Width: | Height: | Size: 164 B |
BIN
mods/moonrealm/textures/moonrealm_hl.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
mods/moonrealm/textures/moonrealm_hlflowing_animated.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
mods/moonrealm/textures/moonrealm_lifesupport.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
mods/moonrealm/textures/moonrealm_light.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
mods/moonrealm/textures/moonrealm_soil.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
mods/moonrealm/textures/moonrealm_spacesuit.png
Normal file
After Width: | Height: | Size: 205 B |
BIN
mods/moonrealm/textures/moonrealm_stone.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
mods/moonrealm/textures/moonrealm_stonebrick.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
mods/moonrealm/textures/moonrealm_stonebrickbot.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
mods/moonrealm/textures/moonrealm_stonebricktop.png
Normal file
After Width: | Height: | Size: 159 B |
BIN
mods/moonrealm/textures/moonrealm_waterice.png
Normal file
After Width: | Height: | Size: 490 B |