Big Update

This commit is contained in:
Craig 2014-05-07 16:17:17 +01:00
parent 26b125064c
commit 74799ee570
57 changed files with 7813 additions and 8443 deletions

View file

@ -1,104 +0,0 @@
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

View file

@ -1,171 +0,0 @@
-- 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,
})

View file

@ -1,312 +0,0 @@
-- 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 = 58 -- -- Gradient centre / terrain centre average level
local YMAX = 56 -- -- Approx upper limit
local FOOT = true -- -- Footprints in dust
local CENAMP = 128 -- -- 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 = 1 -- -- Noise offset exponent above gradcen, 1 = normal 3D perlin terrain
local LEXP = 1.5 -- -- 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)

View file

@ -1,14 +0,0 @@
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.

View file

@ -1,443 +0,0 @@
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,
})

View file

@ -1,513 +0,0 @@
-- mods/default/mapgen.lua
--
-- Aliases for map generator outputs
--
minetest.register_alias("mapgen_stone", "default:stone")
minetest.register_alias("mapgen_tree", "default:tree")
minetest.register_alias("mapgen_leaves", "default:leaves")
minetest.register_alias("mapgen_jungletree", "default:jungletree")
minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
minetest.register_alias("mapgen_apple", "default:apple")
minetest.register_alias("mapgen_water_source", "default:water_source")
minetest.register_alias("mapgen_dirt", "default:dirt")
minetest.register_alias("mapgen_sand", "default:sand")
minetest.register_alias("mapgen_gravel", "default:gravel")
minetest.register_alias("mapgen_clay", "default:clay")
minetest.register_alias("mapgen_lava_source", "default:lava_source")
minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
minetest.register_alias("mapgen_mese", "default:mese")
minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
--
-- Ore generation
--
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 8,
clust_size = 3,
height_min = -31000,
height_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 24*24*24,
clust_num_ores = 27,
clust_size = 6,
height_min = -31000,
height_max = 0,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 12*12*12,
clust_num_ores = 3,
clust_size = 2,
height_min = -15,
height_max = 2,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 5,
clust_size = 3,
height_min = -63,
height_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 7*7*7,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 24*24*24,
clust_num_ores = 27,
clust_size = 6,
height_min = -31000,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 18*18*18,
clust_num_ores = 3,
clust_size = 2,
height_min = -255,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 14*14*14,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:mese",
wherein = "default:stone",
clust_scarcity = 36*36*36,
clust_num_ores = 3,
clust_size = 2,
height_min = -31000,
height_max = -1024,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 15*15*15,
clust_num_ores = 3,
clust_size = 2,
height_min = -255,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 13*13*13,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 17*17*17,
clust_num_ores = 4,
clust_size = 3,
height_min = -255,
height_max = -128,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 15*15*15,
clust_num_ores = 4,
clust_size = 3,
height_min = -31000,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 12*12*12,
clust_num_ores = 4,
clust_size = 3,
height_min = -63,
height_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -64,
flags = "absheight",
})
if minetest.setting_get("mg_name") == "indev" then
-- Floatlands and high mountains springs
minetest.register_ore({
ore_type = "scatter",
ore = "default:water_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 40*40*40,
clust_num_ores = 8,
clust_size = 3,
height_min = 100,
height_max = 31000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:lava_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 50*50*50,
clust_num_ores = 5,
clust_size = 2,
height_min = 10000,
height_max = 31000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:sand",
wherein = "default:stone",
clust_scarcity = 20*20*20,
clust_num_ores = 5*5*3,
clust_size = 5,
height_min = 500,
height_max = 31000,
})
-- Underground springs
minetest.register_ore({
ore_type = "scatter",
ore = "default:water_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 25*25*25,
clust_num_ores = 8,
clust_size = 3,
height_min = -10000,
height_max = -10,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:lava_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 35*35*35,
clust_num_ores = 5,
clust_size = 2,
height_min = -31000,
height_max = -100,
})
end
minetest.register_ore({
ore_type = "scatter",
ore = "default:clay",
wherein = "default:sand",
clust_scarcity = 15*15*15,
clust_num_ores = 64,
clust_size = 5,
height_max = 0,
height_min = -10,
})
function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
minetest.log('action', "WARNING: default.generate_ore is deprecated")
if maxp.y < height_min or minp.y > height_max then
return
end
local y_min = math.max(minp.y, height_min)
local y_max = math.min(maxp.y, height_max)
if chunk_size >= y_max - y_min + 1 then
return
end
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed)
local num_chunks = math.floor(chunks_per_volume * volume)
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
--print("generate_ore num_chunks: "..dump(num_chunks))
for i=1,num_chunks do
local y0 = pr:next(y_min, y_max-chunk_size+1)
if y0 >= height_min and y0 <= height_max then
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
local p0 = {x=x0, y=y0, z=z0}
for x1=0,chunk_size-1 do
for y1=0,chunk_size-1 do
for z1=0,chunk_size-1 do
if pr:next(1,inverse_chance) == 1 then
local x2 = x0+x1
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
if minetest.get_node(p2).name == wherein then
minetest.set_node(p2, {name=name})
end
end
end
end
end
end
end
--print("generate_ore done")
end
function default.make_papyrus(pos, size)
for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.set_node(p, {name="default:papyrus"})
else
return
end
end
end
function default.make_cactus(pos, size)
for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.set_node(p, {name="default:cactus"})
else
return
end
end
end
-- facedir: 0/1/2/3 (head node facedir value)
-- length: length of rainbow tail
function default.make_nyancat(pos, facedir, length)
local tailvec = {x=0, y=0, z=0}
if facedir == 0 then
tailvec.z = 1
elseif facedir == 1 then
tailvec.x = 1
elseif facedir == 2 then
tailvec.z = -1
elseif facedir == 3 then
tailvec.x = -1
else
--print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
facedir = 0
tailvec.z = 1
end
local p = {x=pos.x, y=pos.y, z=pos.z}
minetest.set_node(p, {name="default:nyancat", param2=facedir})
for i=1,length do
p.x = p.x + tailvec.x
p.z = p.z + tailvec.z
minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir})
end
end
function generate_nyancats(seed, minp, maxp)
local height_min = -31000
local height_max = -32
if maxp.y < height_min or minp.y > height_max then
return
end
local y_min = math.max(minp.y, height_min)
local y_max = math.min(maxp.y, height_max)
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed + 9324342)
local max_num_nyancats = math.floor(volume / (16*16*16))
for i=1,max_num_nyancats do
if pr:next(0, 1000) == 0 then
local x0 = pr:next(minp.x, maxp.x)
local y0 = pr:next(minp.y, maxp.y)
local z0 = pr:next(minp.z, maxp.z)
local p0 = {x=x0, y=y0, z=z0}
default.make_nyancat(p0, pr:next(0,3), pr:next(3,15))
end
end
end
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= 2 and minp.y <= 0 then
-- Generate papyrus
local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
-- Assume X and Z lengths are equal
local divlen = 8
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine papyrus amount from perlin noise
local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20)
-- Find random positions for papyrus based on this random
local pr = PseudoRandom(seed+1)
for i=0,papyrus_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
if minetest.get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and
minetest.find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then
default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4))
end
end
end
end
-- Generate cactuses
local perlin1 = minetest.get_perlin(230, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine cactus amount from perlin noise
local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3)
-- Find random positions for cactus based on this random
local pr = PseudoRandom(seed+1)
for i=0,cactus_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
-- If desert sand, make cactus
if ground_y and minetest.get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then
default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4))
end
end
end
end
-- Generate grass
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine grass amount from perlin noise
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
-- Find random positions for grass based on this random
local pr = PseudoRandom(seed+1)
for i=0,grass_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
if ground_y then
local p = {x=x,y=ground_y+1,z=z}
local nn = minetest.get_node(p).name
-- Check if the node can be replaced
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
-- If desert sand, add dry shrub
if nn == "default:desert_sand" then
minetest.set_node(p,{name="default:dry_shrub"})
-- If dirt with grass, add grass
elseif nn == "default:dirt_with_grass" then
minetest.set_node(p,{name="default:grass_"..pr:next(1, 5)})
end
end
end
end
end
end
end
-- Generate nyan cats
generate_nyancats(seed, minp, maxp)
end)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because it is too large Load diff

View file

@ -650,6 +650,10 @@ minetest.register_node("default:sign_wall", {
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
if minetest.is_protected(pos, sender:get_player_name()) then
minetest.record_protection_violation(pos, sender:get_player_name())
return
end
local meta = minetest.get_meta(pos)
fields.text = fields.text or ""
minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
@ -891,8 +895,23 @@ minetest.register_node("default:furnace", {
minetest.register_node("default:furnace_active", {
description = "Furnace",
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
tiles = {
"default_furnace_top.png",
"default_furnace_bottom.png",
"default_furnace_side.png",
"default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}
},
paramtype2 = "facedir",
light_source = 8,
drop = "default:furnace",
@ -1038,7 +1057,7 @@ minetest.register_abm({
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if fuel.time <= 0 then
if not fuel or fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)

View file

@ -141,6 +141,7 @@ end
-- Update appearance when the player joins
minetest.register_on_joinplayer(function(player)
default.player_set_model(player, "character.x")
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
end)
minetest.register_on_leaveplayer(function(player)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 826 B

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -1 +0,0 @@
default

View file

@ -1,625 +1,233 @@
dofile(minetest.get_modpath("mapgen").."/mapgen.lua")
-- moonrealm 0.6.5 by paramat
-- Licenses: code WTFPL, textures CC BY-SA
minetest.register_alias("mapgen_water_source", "mapgen:vacuum")
minetest.register_alias("mapgen_lava_source", "default:lava_source")
minetest.register_alias("mapgen_stone", "mapgen:stone")
minetest.register_alias("mapgen_dirt", "mapgen:compressed_dust")
minetest.register_alias("mapgen_dirt_with_grass", "air")
mapgen = {}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:coalore",
wherein = "mapgen:stone",
clust_scarcity = 8*8*8,
clust_num_ores = 8,
clust_size = 3,
height_min = -31000,
height_max = 64,
})
-- Horizontal
local XMIN = -33000
local XMAX = 33000
local ZMIN = -33000
local ZMAX = 33000
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:coalore",
wherein = "mapgen:stone",
clust_scarcity = 24*24*24,
clust_num_ores = 27,
clust_size = 6,
height_min = -31000,
height_max = 0,
flags = "absheight",
})
-- Vertical
local YMIN = -500
local GRADCEN = 0
local YMAX = 500
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:ironore",
wherein = "mapgen:stone",
clust_scarcity = 12*12*12,
clust_num_ores = 3,
clust_size = 2,
height_min = -15,
height_max = 2,
})
-- Footprints in dust
local FOOT = true
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:ironore",
wherein = "mapgen:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 5,
clust_size = 3,
height_min = -63,
height_max = -16,
})
-- Other configs
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 = 0.04 -- -- 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
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:ironore",
wherein = "mapgen:stone",
clust_scarcity = 7*7*7,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -64,
flags = "absheight",
})
-- Generate
local np_terrain = {
offset = 0,
scale = 1,
spread = {x=512, y=512, z=512},
seed = 58588900033,
octaves = 6,
persist = 0.67
}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:ironore",
wherein = "mapgen:stone",
clust_scarcity = 24*24*24,
clust_num_ores = 27,
clust_size = 6,
height_min = -31000,
height_max = -64,
flags = "absheight",
})
local np_terralt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = 13331930910,
octaves = 6,
persist = 0.67
}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:meseore",
wherein = "mapgen:stone",
clust_scarcity = 18*18*18,
clust_num_ores = 3,
clust_size = 2,
height_min = -255,
height_max = -64,
flags = "absheight",
})
local np_smooth = {
offset = 0,
scale = 1,
spread = {x=828, y=828, z=828},
seed = 113,
octaves = 4,
persist = 0.4
}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:meseore",
wherein = "mapgen:stone",
clust_scarcity = 14*14*14,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -256,
flags = "absheight",
})
local np_fissure = {
offset = 0,
scale = 1,
spread = {x=256, y=256, z=256},
seed = 8181112,
octaves = 5,
persist = 0.5
}
minetest.register_ore({
ore_type = "scatter",
ore = "default:mese",
wherein = "mapgen:stone",
clust_scarcity = 36*36*36,
clust_num_ores = 3,
clust_size = 2,
height_min = -31000,
height_max = -1024,
flags = "absheight",
})
local np_fault = {
offset = 0,
scale = 1,
spread = {x=414, y=828, z=414},
seed = 14440002,
octaves = 4,
persist = 0.5
}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:goldore",
wherein = "mapgen:stone",
clust_scarcity = 15*15*15,
clust_num_ores = 3,
clust_size = 2,
height_min = -255,
height_max = -64,
flags = "absheight",
})
local np_gradcen = {
offset = 0,
scale = 1,
spread = {x=1024, y=1024, z=1024},
seed = 9344,
octaves = 4,
persist = 0.4
}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:goldore",
wherein = "mapgen:stone",
clust_scarcity = 13*13*13,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -256,
flags = "absheight",
})
local np_terblen = {
offset = 0,
scale = 1,
spread = {x=2048, y=2048, z=2048},
seed = -13002,
octaves = 3,
persist = 0.4
}
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:diamondore",
wherein = "mapgen:stone",
clust_scarcity = 17*17*17,
clust_num_ores = 4,
clust_size = 3,
height_min = -255,
height_max = -128,
flags = "absheight",
})
-- On generated function
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:diamondore",
wherein = "mapgen:stone",
clust_scarcity = 15*15*15,
clust_num_ores = 4,
clust_size = 3,
height_min = -31000,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:copperore",
wherein = "mapgen:stone",
clust_scarcity = 12*12*12,
clust_num_ores = 4,
clust_size = 3,
height_min = -63,
height_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "mapgen:copperore",
wherein = "mapgen:stone",
clust_scarcity = 9*9*9,
clust_num_ores = 5,
clust_size = 3,
height_min = -31000,
height_max = -64,
flags = "absheight",
})
minetest.register_node("mapgen:stone", {
description = "Moon Stone",
tiles = {"mapgen_stone.png"},
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:ironore", {
description = "MR Iron Ore",
tiles = {"mapgen_stone.png^default_mineral_iron.png"},
groups = {cracky=2},
drop = "default:iron_lump",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:copperore", {
description = "MR Copper Ore",
tiles = {"mapgen_stone.png^default_mineral_copper.png"},
groups = {cracky=2},
drop = "default:copper_lump",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:goldore", {
description = "MR Gold Ore",
tiles = {"mapgen_stone.png^default_mineral_gold.png"},
groups = {cracky=2},
drop = "default:gold_lump",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:diamondore", {
description = "MR Diamond Ore",
tiles = {"mapgen_stone.png^default_mineral_diamond.png"},
groups = {cracky=1},
drop = "default:diamond",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:meseore", {
description = "MR Mese Ore",
tiles = {"mapgen_stone.png^default_mineral_mese.png"},
groups = {cracky=1},
drop = "default:mese_crystal",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:dust", {
description = "Moon Dust",
tiles = {"mapgen_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("mapgen:compressed_dust", {
description = "Compressed Moon Dust",
tiles = {"mapgen_compressed_dust.png"},
groups = {crumbly=3},
sounds = default.node_sound_sand_defaults({
footstep = {name="default_sand_footstep", gain=0.1},
}),
})
minetest.register_node("mapgen:vacuum", {
description = "Vacuum",
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drowning = 1,
})
minetest.register_node("mapgen:air", {
description = "Life Support Air",
drawtype = "glasslike",
tiles = {"mapgen_air.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
})
minetest.register_node("mapgen:airgen", {
description = "Air Generator",
tiles = {"mapgen_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 == "mapgen:vacuum" then
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="mapgen:air"})
minetest.get_meta({x=x+i,y=y+j,z=z+k}):set_int("spread", 16)
print ("[mapgen] Added MR air node")
end
end
end
end
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 ("[mapgen] 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("moontest:ironore")
local c_mrcopperore = minetest.get_content_id("moontest:copperore")
local c_mrgoldore = minetest.get_content_id("moontest:goldore")
local c_mrdiamondore = minetest.get_content_id("moontest:diamondore")
local c_mrstone = minetest.get_content_id("moontest:stone")
local c_waterice = minetest.get_content_id("moontest:waterice")
local c_dust = minetest.get_content_id("moontest:dust")
local c_vacuum = minetest.get_content_id("moontest: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 == "moontest: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
})
minetest.register_node("mapgen:waterice", {
description = "Water Ice",
tiles = {"mapgen_waterice.png"},
light_source = 1,
paramtype = "light",
sunlight_propagates = true,
groups = {cracky=3,melts=1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("mapgen:hlflowing", {
description = "Flowing Hydroponics",
inventory_image = minetest.inventorycube("mapgen_hl.png"),
drawtype = "flowingliquid",
tiles = {"mapgen_hl.png"},
special_tiles = {
{
image="mapgen_hlflowing_animated.png",
backface_culling=false,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2}
},
{
image="mapgen_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 = "mapgen:hlflowing",
liquid_alternative_source = "mapgen: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("mapgen:hlsource", {
description = "Hydroponic Source",
inventory_image = minetest.inventorycube("mapgen_hl.png"),
drawtype = "liquid",
tiles = {"mapgen_hl.png"},
alpha = 224,
paramtype = "light",
walkable = false,
pointable = false,
buildable_to = true,
liquidtype = "source",
liquid_alternative_flowing = "mapgen:hlflowing",
liquid_alternative_source = "mapgen: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("mapgen:soil", {
description = "Moonsoil",
tiles = {"mapgen_soil.png"},
groups = {crumbly=3, falling_node=1, soil=3},
drop = "mapgen:dust",
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("mapgen:airlock", {
description = "Airlock",
tiles = {"mapgen_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("mapgen: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("mapgen: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("mapgen: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 = {"mapgen:sapling"},rarity = 20,},
{items = {"mapgen:leaves"},}
}
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mapgen:light", {
description = "Light",
tiles = {"mapgen_light.png"},
light_source = 14,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("mapgen:stonebrick", {
description = "Moon Stone Brick",
tiles = {"mapgen_stonebricktop.png", "mapgen_stonebrickbot.png", "mapgen_stonebrick.png"},
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mapgen:stoneslab", {
description = "Moon Stone Slab",
tiles = {"mapgen_stonebricktop.png", "mapgen_stonebrickbot.png", "mapgen_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("mapgen:stonestair", {
description = "Moon Stone Stair",
tiles = {"mapgen_stonebricktop.png", "mapgen_stonebrickbot.png", "mapgen_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("mapgen:spacesuit", {
description = "MR Spacesuit",
inventory_image = "mapgen_spacesuit.png",
groups = {not_in_creative_inventory=1},
})
minetest.register_craftitem("mapgen:helmet", {
description = "MR Mesetint Helmet",
inventory_image = "mapgen_helmet.png",
groups = {not_in_creative_inventory=1},
})
minetest.register_craftitem("mapgen:lifesupport", {
description = "MR Life Support",
inventory_image = "mapgen_lifesupport.png",
groups = {not_in_creative_inventory=1},
})
-- Crafting
minetest.register_craft({
output = "mapgen: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 = "mapgen:airgen",
recipe = {
{"default:steel_ingot", "mapgen:waterice", "default:steel_ingot"},
{"mapgen:waterice", "default:mese", "mapgen:waterice"},
{"default:steel_ingot", "mapgen:waterice", "default:steel_ingot"},
},
})
minetest.register_craft({
output = "default:water_source",
recipe = {
{"mapgen:waterice"},
},
})
minetest.register_craft({
output = "mapgen:hlsource",
recipe = {
{"mapgen:leaves", "mapgen:leaves", "mapgen:leaves"},
{"mapgen:leaves", "mapgen:waterice", "mapgen:leaves"},
{"mapgen:leaves", "mapgen:leaves", "mapgen:leaves"},
},
})
minetest.register_craft({
output = "mapgen:stonebrick 4",
recipe = {
{"mapgen:stone", "mapgen:stone"},
{"mapgen:stone", "mapgen:stone"},
}
})
minetest.register_craft({
output = "default:furnace",
recipe = {
{"mapgen:stone", "mapgen:stone", "mapgen:stone"},
{"mapgen:stone", "", "mapgen:stone"},
{"mapgen:stone", "mapgen:stone", "mapgen:stone"},
},
})
minetest.register_craft({
output = "mapgen:stoneslab 4",
recipe = {
{"mapgen:stone", "mapgen:stone"},
}
})
minetest.register_craft({
output = "mapgen:stonestair 4",
recipe = {
{"mapgen:stone", ""},
{"mapgen:stone", "mapgen:stone"},
}
})
minetest.register_craft({
output = "mapgen:helmet",
recipe = {
{"default:mese_crystal"},
{"default:glass"},
{"default:steel_ingot"},
}
})
minetest.register_craft({
output = "mapgen: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 = "mapgen:spacesuit",
recipe = {
{"wool:white", "mapgen:helmet", "wool:white"},
{"", "mapgen:lifesupport", ""},
{"wool:white", "", "wool:white"},
}
})
minetest.register_craft({
output = "mapgen:light 8",
recipe = {
{"mapgen:glass", "mapgen:glass", "mapgen:glass"},
{"mapgen:glass", "default:mese", "mapgen:glass"},
{"mapgen:glass", "mapgen:glass", "mapgen:glass"},
},
})
minetest.register_craft({
output = "mapgen:sapling",
recipe = {
{"default:mese_crystal"},
{"default:sapling"},
}
})
-- Cooking
minetest.register_craft({
type = "cooking",
output = "mapgen:glass",
recipe = "mapgen:dust",
})
minetest.register_craft({
type = "fuel",
recipe = "default:mese_crystal",
burntime = 50,
})
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 ("[mapgen] "..chugent.." ms")
end)

View file

@ -1,12 +0,0 @@
minetest.register_biome({
name = "plains",
node_top = "mapgen:dust",
node_bottom = "mapgen:stone",
depth_top = 2,
node_dust = "air",
height_min = -10,
height_max = 160,
heat_point = 45,
humidity_point = 45,
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

125
mods/moontest/crafting.lua Normal file
View file

@ -0,0 +1,125 @@
-- Crafting
minetest.register_craft({
output = "moontest: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 = "moontest:airgen",
recipe = {
{"default:steel_ingot", "moontest:waterice", "default:steel_ingot"},
{"moontest:waterice", "default:mese", "moontest:waterice"},
{"default:steel_ingot", "moontest:waterice", "default:steel_ingot"},
},
})
minetest.register_craft({
output = "default:water_source",
recipe = {
{"moontest:waterice"},
},
})
minetest.register_craft({
output = "moontest:hlsource",
recipe = {
{"moontest:leaves", "moontest:leaves", "moontest:leaves"},
{"moontest:leaves", "moontest:waterice", "moontest:leaves"},
{"moontest:leaves", "moontest:leaves", "moontest:leaves"},
},
})
minetest.register_craft({
output = "moontest:stonebrick 4",
recipe = {
{"moontest:stone", "moontest:stone"},
{"moontest:stone", "moontest:stone"},
}
})
minetest.register_craft({
output = "default:furnace",
recipe = {
{"moontest:stone", "moontest:stone", "moontest:stone"},
{"moontest:stone", "", "moontest:stone"},
{"moontest:stone", "moontest:stone", "moontest:stone"},
},
})
minetest.register_craft({
output = "moontest:stoneslab 4",
recipe = {
{"moontest:stone", "moontest:stone"},
}
})
minetest.register_craft({
output = "moontest:stonestair 4",
recipe = {
{"moontest:stone", ""},
{"moontest:stone", "moontest:stone"},
}
})
minetest.register_craft({
output = "moontest:helmet",
recipe = {
{"default:mese_crystal"},
{"default:glass"},
{"default:steel_ingot"},
}
})
minetest.register_craft({
output = "moontest: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 = "moontest:spacesuit",
recipe = {
{"wool:white", "moontest:helmet", "wool:white"},
{"", "moontest:lifesupport", ""},
{"wool:white", "", "wool:white"},
}
})
minetest.register_craft({
output = "moontest:light 8",
recipe = {
{"moontest:glass", "moontest:glass", "moontest:glass"},
{"moontest:glass", "default:mese", "moontest:glass"},
{"moontest:glass", "moontest:glass", "moontest:glass"},
},
})
minetest.register_craft({
output = "moontest:sapling",
recipe = {
{"default:mese_crystal"},
{"default:sapling"},
}
})
-- Cooking
minetest.register_craft({
type = "cooking",
output = "moontest:glass",
recipe = "moontest:dust",
})
minetest.register_craft({
type = "fuel",
recipe = "default:mese_crystal",
burntime = 50,
})

View file

@ -1,5 +1,14 @@
local YMIN = -33000
local YMAX = 33000
-- moontest 0.6.5 by paramat
-- Licenses: code WTFPL, textures CC BY-SA
moontest = {}
local player_pos = {}
local player_pos_previous = {}
dofile(minetest.get_modpath("moontest").."/nodes.lua")
-- 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
@ -11,11 +20,11 @@ minetest.register_globalstep(function(dtime)
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 == "mapgen:dust" then
if n_ground == "moontest:dust" then
if math.random() < 0.5 then
minetest.add_node(p_groundpl,{name="mapgen:dustprint1"})
minetest.add_node(p_groundpl,{name="moontest:dustprint1"})
else
minetest.add_node(p_groundpl,{name="mapgen:dustprint2"})
minetest.add_node(p_groundpl,{name="moontest:dustprint2"})
end
end
end
@ -26,38 +35,32 @@ minetest.register_globalstep(function(dtime)
}
end
if math.random() < 0.1 then
if player:get_inventory():contains_item("main", "mapgen:spacesuit")
if player:get_inventory():contains_item("main", "moontest: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)
-- Space apple tree
function moonrealm_appletree(pos)
function moontest_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 ~= "mapgen:soil" then
if nodename ~= "moontest: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 ~= "mapgen:air" then
if nodename ~= "moontest:air" then
return
end
end
@ -70,10 +73,10 @@ function moonrealm_appletree(pos)
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="mapgen:leaves"})
minetest.add_node({x=pos.x+i,y=pos.y+j+1,z=pos.z+k},{name="moontest:leaves"})
end
else
minetest.add_node({x=x+i,y=y+j+1,z=z+k},{name="mapgen:air"})
minetest.add_node({x=x+i,y=y+j+1,z=z+k},{name="moontest:air"})
minetest.get_meta({x=x+i,y=y+j+1,z=z+k}):set_int("spread", 16)
end
end
@ -81,7 +84,7 @@ function moonrealm_appletree(pos)
end
minetest.add_node({x=pos.x,y=pos.y+j,z=pos.z},{name="default:tree"})
end
print ("[moonrealm] Appletree sapling grows")
print ("[moontest] Appletree sapling grows")
end
-- Vacuum or air flows into a dug hole
@ -95,17 +98,17 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
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 == "mapgen:air" then
if nodename == "moontest: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="mapgen:air"})
minetest.add_node({x=x,y=y,z=z},{name="moontest:air"})
minetest.get_meta(pos):set_int("spread", (spread - 1))
print ("[moonrealm] MR air flows into hole "..(spread - 1))
print ("[moontest] MR air flows into hole "..(spread - 1))
return
end
elseif nodename == "mapgen:vacuum" then
minetest.add_node({x=x,y=y,z=z},{name="mapgen:vacuum"})
print ("[moonrealm] Vacuum flows into hole")
elseif nodename == "moontest:vacuum" then
minetest.add_node({x=x,y=y,z=z},{name="moontest:vacuum"})
print ("[moontest] Vacuum flows into hole")
return
end
end
@ -113,13 +116,12 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
end
end
end)
-- ABMs
-- Air spreads
minetest.register_abm({
nodenames = {"mapgen:air"},
neighbors = {"mapgen:vacuum", "air"},
nodenames = {"moontest:air"},
neighbors = {"moontest:vacuum", "air"},
interval = 11,
chance = 9,
action = function(pos, node, active_object_count, active_object_count_wider)
@ -135,11 +137,11 @@ minetest.register_abm({
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 == "mapgen:vacuum"
if nodename == "moontest:vacuum"
or nodename == "air" then
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="mapgen:air"})
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="moontest: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))
print ("[moontest] MR air spreads "..(spread - 1))
end
end
end
@ -151,8 +153,8 @@ minetest.register_abm({
-- Hydroponic saturation
minetest.register_abm({
nodenames = {"mapgen:hlsource", "mapgen:hlflowing"},
neighbors = {"mapgen:dust", "mapgen:dustprint1", "mapgen:dustprint2"},
nodenames = {"moontest:hlsource", "moontest:hlflowing"},
neighbors = {"moontest:dust", "moontest:dustprint1", "moontest:dustprint2"},
interval = 29,
chance = 9,
action = function(pos, node, active_object_count, active_object_count_wider)
@ -164,11 +166,11 @@ minetest.register_abm({
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 == "mapgen:dust"
or nodename == "mapgen:dustprint1"
or nodename == "mapgen:dustprint2" then
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="mapgen:soil"})
print ("[moonrealm] Hydroponic liquid saturates")
if nodename == "moontest:dust"
or nodename == "moontest:dustprint1"
or nodename == "moontest:dustprint2" then
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="moontest:soil"})
print ("[moontest] Hydroponic liquid saturates")
end
end
end
@ -180,7 +182,7 @@ minetest.register_abm({
-- Soil drying
minetest.register_abm({
nodenames = {"mapgen:soil"},
nodenames = {"moontest:soil"},
interval = 31,
chance = 27,
action = function(pos, node)
@ -192,25 +194,25 @@ minetest.register_abm({
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 == "mapgen:hlsource" or nodename == "mapgen:hlflowing" then
if nodename == "moontest:hlsource" or nodename == "moontest:hlflowing" then
return
end
end
end
end
end
minetest.add_node(pos,{name="mapgen:dust"})
print ("[moonrealm] Moon soil dries")
minetest.add_node(pos,{name="moontest:dust"})
print ("[moontest] Moon soil dries")
end,
})
-- Space appletree from sapling
minetest.register_abm({
nodenames = {"mapgen:sapling"},
nodenames = {"moontest:sapling"},
interval = 57,
chance = 3,
action = function(pos, node, active_object_count, active_object_count_wider)
moonrealm_appletree(pos)
moontest_appletree(pos)
end,
})

285
mods/moontest/nodes.lua Normal file
View file

@ -0,0 +1,285 @@
minetest.register_node("moontest:stone", {
description = "Moon Stone",
tiles = {"moontest_stone.png"},
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("moontest:dust", {
description = "Moon Dust",
tiles = {"moontest_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("moontest:dustprint1", {
description = "Moon Dust Footprint1",
tiles = {"moontest_dustprint1.png", "moontest_dust.png"},
groups = {crumbly=3, falling_node=1},
drop = "moontest:dust",
sounds = default.node_sound_sand_defaults({
footstep = {name="default_sand_footstep", gain=0.1},
}),
})
minetest.register_node("moontest:dustprint2", {
description = "Moon Dust Footprint2",
tiles = {"moontest_dustprint2.png", "moontest_dust.png"},
groups = {crumbly=3, falling_node=1},
drop = "moontest:dust",
sounds = default.node_sound_sand_defaults({
footstep = {name="default_sand_footstep", gain=0.1},
}),
})
minetest.register_node("moontest:vacuum", {
description = "Vacuum",
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drowning = 1,
})
minetest.register_node("moontest:air", {
description = "Life Support Air",
drawtype = "glasslike",
tiles = {"moontest_air.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
})
minetest.register_node("moontest:airgen", {
description = "Air Generator",
tiles = {"moontest_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 == "moontest:vacuum" then
minetest.add_node({x=x+i,y=y+j,z=z+k},{name="moontest:air"})
minetest.get_meta({x=x+i,y=y+j,z=z+k}):set_int("spread", 16)
print ("[moontest] Added MR air node")
end
end
end
end
end
end
})
minetest.register_node("moontest:waterice", {
description = "Water Ice",
tiles = {"moontest_waterice.png"},
light_source = 1,
paramtype = "light",
sunlight_propagates = true,
groups = {cracky=3,melts=1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("moontest:hlflowing", {
description = "Flowing Hydroponics",
inventory_image = minetest.inventorycube("moontest_hl.png"),
drawtype = "flowingliquid",
tiles = {"moontest_hl.png"},
special_tiles = {
{
image="moontest_hlflowing_animated.png",
backface_culling=false,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2}
},
{
image="moontest_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 = "moontest:hlflowing",
liquid_alternative_source = "moontest: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("moontest:hlsource", {
description = "Hydroponic Source",
inventory_image = minetest.inventorycube("moontest_hl.png"),
drawtype = "liquid",
tiles = {"moontest_hl.png"},
alpha = 224,
paramtype = "light",
walkable = false,
pointable = false,
buildable_to = true,
liquidtype = "source",
liquid_alternative_flowing = "moontest:hlflowing",
liquid_alternative_source = "moontest: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("moontest:soil", {
description = "Moonsoil",
tiles = {"moontest_soil.png"},
groups = {crumbly=3, falling_node=1, soil=3},
drop = "moontest:dust",
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("moontest:airlock", {
description = "Airlock",
tiles = {"moontest_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("moontest: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("moontest:sapling", {
description = "Moon 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("moontest:leaves", {
description = "Moon 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 = {"moontest:sapling"},rarity = 20,},
{items = {"moontest:leaves"},}
}
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("moontest:light", {
description = "Light",
tiles = {"moontest_light.png"},
light_source = 14,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("moontest:stonebrick", {
description = "Moon Stone Brick",
tiles = {"moontest_stonebricktop.png", "moontest_stonebrickbot.png", "moontest_stonebrick.png"},
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("moontest:stoneslab", {
description = "Moon Stone Slab",
tiles = {"moontest_stonebricktop.png", "moontest_stonebrickbot.png", "moontest_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("moontest:stonestair", {
description = "Moon Stone Stair",
tiles = {"moontest_stonebricktop.png", "moontest_stonebrickbot.png", "moontest_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("moontest:spacesuit", {
description = "Spacesuit",
inventory_image = "moontest_spacesuit.png",
groups = {not_in_creative_inventory=1},
})
minetest.register_craftitem("moontest:helmet", {
description = "Helmet",
inventory_image = "moontest_helmet.png",
groups = {not_in_creative_inventory=1},
})
minetest.register_craftitem("moontest:lifesupport", {
description = "Life Support",
inventory_image = "moontest_lifesupport.png",
groups = {not_in_creative_inventory=1},
})

View file

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

View file

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 174 B

View file

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View file

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 554 B

View file

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

View file

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

View file

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

View file

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

View file

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View file

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

View file

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View file

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 601 B

View file

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

View file

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 514 B

View file

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 173 B

View file

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

View file

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

View file

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B