Auto per player gravity, bugfixes

master
paramat 2014-01-27 08:24:17 +00:00
parent e6636576ff
commit 86e98cfdb4
8 changed files with 231 additions and 157 deletions

View File

@ -1,58 +1,52 @@
moonrealm 0.6.0 by paramat
moonrealm 0.6.1 by paramat
For latest stable Minetest and back to 0.4.8
Depends default
Licenses: code WTFPL, textures CC BY-SA
Crafting
--------
default water source
Default water source.
I
I = waterice
I = moonrealm waterice
luxnode
CCC
CCC
CCC
C = luxcrystal
airgen
Airgen. Place in a sealed habitat away from exterior walls.
SIS
ILI
IMI
SIS
S = steel ingot
I = waterice
L = luxnode
S = default steel ingot
I = moonrealm waterice
M = default mese block
hlsource
Hydroponic liquid source.
LLL
LIL
LLL
L = moonrealm:leaves
I = waterice
L = moonrealm leaves
I = moonrealm waterice
airlock
Airlock with light source, walk through it, life support air cannot pass through.
S-S
SLS
SMS
S-S
S = steel ingot
L = luxnode
S = default steel ingot
M = default mese block
moonstonebrick x 4
Moon stone brick x 4.
MM
MM
M = moonstone
M = moon stone
moonstonestair x 4
Moon stone stair x 4.
M
MM
M = moonstone
M = moon stone
moonstoneslab x 4
Moon stone slab x 4.
MM
M = moonstone
M = moon stone
default furnace
Default furnace, use mese crystal as fuel.
MMM
M-M
MMM
M = moonstone
M = moon stone

View File

@ -33,18 +33,4 @@ function moonrealm_appletree(pos)
minetest.add_node({x=pos.x,y=pos.y+j,z=pos.z},{name="default:tree"})
end
print ("[moonrealm] Appletree sapling grows ("..x.." "..y.." "..z..")")
end
-- Globalstep function
minetest.register_globalstep(function(dtime)
for _, player in ipairs(minetest.get_connected_players()) do
if math.random() > 0.1 then
return
end
if player:get_inventory():contains_item("main", "moonrealm:spacesuit")
and player:get_breath() < 10 then
player:set_breath(10)
end
end
end)
end

193
init.lua
View File

@ -1,13 +1,12 @@
-- moonrealm 0.6.0 by paramat
-- moonrealm 0.6.1 by paramat
-- For latest stable Minetest and back to 0.4.8
-- Depends default
-- Licenses: code WTFPL, textures CC BY-SA
-- TODO
-- Footprints
-- Smooth terrain with blend?
-- Craters, old eroded massive plus fresh small plus random strikes
-- Vacuum nodes with damage unless spacesuit
-- Smooth terrain
-- Craters
-- Parameters
@ -17,8 +16,8 @@ local ZMIN = -33000
local ZMAX = 33000
local YMIN = 14000 -- -- Approx lower limit
local GRADCEN = 15024 -- -- Grad centre / terrain centre average level
local YMAX = 16000 -- -- Approx top of atmosphere
local GRADCEN = 15000 -- -- Grad centre / terrain centre average level
local YMAX = 16000 -- -- Approx upper limit
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
@ -29,12 +28,11 @@ local LEXP = 2 -- -- Noise offset exponent below gradcen
local FISTS = 0 -- -- Fissure threshold at surface. Controls size of fissure entrances at surface
local FISEXP = 0.05 -- -- Fissure expansion rate under surface
local STOT = 0.04 -- -- Stone density threshold, depth of dust at lake level
local STOT = 0.04 -- -- Stone density threshold, depth of dust at terrain centre
local THIDIS = 192 -- -- Vertical thinning distance for dust
local ICECHA = 13*13*13 -- -- Ice 1/x chance per dust node
local ORECHA = 7*7*7 -- -- Ore 1/x chance per moonstone node
local MESCHA = 32 -- -- Mese block 1/x chance, else ironore
local ORECHA = 7*7*7 -- -- Ore 1/x chance per stone node
-- 3D noise for terrain
@ -63,7 +61,7 @@ local np_terralt = {
local np_fissure = {
offset = 0,
scale = 1,
spread = {x=207, y=207, z=207},
spread = {x=256, y=256, z=256},
seed = 8181112,
octaves = 5,
persist = 0.5
@ -98,83 +96,100 @@ moonrealm = {}
dofile(minetest.get_modpath("moonrealm").."/nodes.lua")
dofile(minetest.get_modpath("moonrealm").."/functions.lua")
-- On dignode function, vacuum or air flows into a dug hole from face-connected neighbours only
-- Globalstep function
if ATMOS then
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 math.abs(i) + math.abs(j) + math.abs(k) == 1 then
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
if nodename == "moonrealm:vacuum" then -- vacuum has priority to avoid air lweaks
minetest.add_node({x=x,y=y,z=z},{name="moonrealm:vacuum"})
print ("[moonrealm] Vacuum flows into hole")
return
elseif nodename == "moonrealm:air" then
minetest.add_node({x=x,y=y,z=z},{name="moonrealm:air"})
print ("[moonrealm] Air flows into hole")
return
end
minetest.register_globalstep(function(dtime)
for _, player in ipairs(minetest.get_connected_players()) do
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 dignode function, vacuum or air flows into a dug hole from face-connected neighbours only
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 math.abs(i) + math.abs(j) + math.abs(k) == 1 then
local nodename = minetest.get_node({x=x+i,y=y+j,z=z+k}).name
if nodename == "moonrealm:vacuum" then -- vacuum has priority to avoid air lweaks
minetest.add_node({x=x,y=y,z=z},{name="moonrealm:vacuum"})
print ("[moonrealm] Vacuum flows into hole")
return
elseif nodename == "moonrealm:air" then
minetest.add_node({x=x,y=y,z=z},{name="moonrealm:air"})
print ("[moonrealm] Air flows into hole")
return
end
end
end)
end
end
end
end
end)
-- ABMs
-- Air spreads into face-connected neighbours
if ATMOS and AIRGEN then
minetest.register_abm({
nodenames = {"moonrealm:air"},
neighbors = {"moonrealm:vacuum"},
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
local nodair = 0
local nodvac = 0
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
nodair = nodair + 1
elseif nodename == "moonrealm:vacuum" then
nodair = nodvac + 1
end
minetest.register_abm({
nodenames = {"moonrealm:air"},
neighbors = {"moonrealm:vacuum"},
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
local nodair = 0
local nodvac = 0
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
nodair = nodair + 1
elseif nodename == "moonrealm:vacuum" then
nodair = nodvac + 1
end
end
end
end
if nodair == 0 or nodvac >= 17 then
return
end
for i = -1,1 do
for j = -1,1 do
for k = -1,1 do
if math.abs(i) + math.abs(j) + math.abs(k) == 1 then -- face connected neighbours
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"})
print ("[moonrealm] Air spreads")
end
end
end
end
end
end
})
end
end
end
if nodair == 0 or nodvac >= 17 then
return
end
for i = -1,1 do
for j = -1,1 do
for k = -1,1 do
if math.abs(i) + math.abs(j) + math.abs(k) == 1 then -- face connected neighbours
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"})
print ("[moonrealm] Air spreads")
end
end
end
end
end
end
})
-- Hydroponics, saturation and drying
@ -224,7 +239,7 @@ minetest.register_abm({
end
end
minetest.add_node(pos,{name="moonrealm:dust"})
print ("[moonrealm] Moonsoil dries ("..x.." "..y.." "..z..")")
print ("[moonrealm] Moon soil dries ("..x.." "..y.." "..z..")")
end,
})
@ -263,10 +278,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
local data = vm:get_data()
local c_mese = minetest.get_content_id("default:mese")
local c_ironore = minetest.get_content_id("moonrealm:ironore")
local c_mstone = minetest.get_content_id("moonrealm:stone")
local c_watice = minetest.get_content_id("moonrealm:waterice")
local c_mdust = minetest.get_content_id("moonrealm:dust")
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
@ -318,21 +336,28 @@ minetest.register_on_generated(function(minp, maxp, seed)
if density >= stot and nofis then -- stone, ores
if math.random(ORECHA) == 2 then
if math.random(MESCHA) == 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_ironore
data[vi] = c_mrironore
end
else
data[vi] = c_mstone
data[vi] = c_mrstone
end
stable[si] = true
elseif density < stot then -- fine materials
if nofis and stable[si] then
if math.random(ICECHA) == 2 then
data[vi] = c_watice
data[vi] = c_waterice
else
data[vi] = c_mdust
data[vi] = c_dust
end
else -- fissure
data[vi] = c_vacuum

127
nodes.lua
View File

@ -1,5 +1,5 @@
minetest.register_node("moonrealm:stone", {
description = "Moonstone",
description = "Moon Stone",
tiles = {"moonrealm_stone.png"},
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -13,12 +13,36 @@ minetest.register_node("moonrealm:ironore", {
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 = "Moondust",
description = "Moon Dust",
tiles = {"moonrealm_dust.png"},
groups = {crumbly=3, falling_node=1},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.05},
footstep = {name="default_gravel_footstep", gain=0.1},
}),
})
@ -133,7 +157,7 @@ minetest.register_node("moonrealm:hlsource", {
groups = {water=3, liquid=3, puts_out_fire=1},
})
minetest.register_node("moonrealm:moonsoil", {
minetest.register_node("moonrealm:soil", {
description = "Moonsoil",
tiles = {"moonrealm_soil.png"},
groups = {crumbly=3, falling_node=1},
@ -152,12 +176,12 @@ minetest.register_node("moonrealm:airlock", {
})
minetest.register_node("moonrealm:glass", {
description = "Moonglass",
description = "MR Glass",
drawtype = "glasslike",
tiles = {"moonrealm_glass.png"},
tiles = {"default_obsidian_glass.png"},
paramtype = "light",
sunlight_propagates = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
})
@ -192,14 +216,14 @@ minetest.register_node("moonrealm:leaves", {
})
minetest.register_node("moonrealm:stonebrick", {
description = "Moonstone Brick",
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 = "Moonstone Slab",
description = "Moon Stone Slab",
tiles = {"moonrealm_stonebricktop.png", "moonrealm_stonebrickbot.png", "moonrealm_stonebrick.png"},
drawtype = "nodebox",
paramtype = "light",
@ -222,7 +246,7 @@ minetest.register_node("moonrealm:stoneslab", {
})
minetest.register_node("moonrealm:stonestair", {
description = "Moonstone Stair",
description = "Moon Stone Stair",
tiles = {"moonrealm_stonebricktop.png", "moonrealm_stonebrickbot.png", "moonrealm_stonebrick.png"},
drawtype = "nodebox",
paramtype = "light",
@ -250,16 +274,37 @@ minetest.register_node("moonrealm:stonestair", {
minetest.register_craftitem("moonrealm:spacesuit", {
description = "MR Spacesuit",
inventory_image = "moonrealm_spacesuit.png",
--groups = {not_in_creative_inventory=1},
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", "", "moonrealm:waterice"},
{"moonrealm:waterice", "default:mese", "moonrealm:waterice"},
{"default:steel_ingot", "moonrealm:waterice", "default:steel_ingot"},
},
})
@ -288,23 +333,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "moonrealm:stonestair 4",
recipe = {
{"moonrealm:stone", ""},
{"moonrealm:stone", "moonrealm:stone"},
}
})
minetest.register_craft({
output = "moonrealm:airlock",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
},
})
minetest.register_craft({
output = "default:furnace",
recipe = {
@ -321,10 +349,51 @@ minetest.register_craft({
}
})
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"},
}
})
-- Cooking
minetest.register_craft({
type = "cooking",
output = "moonrealm:glass",
recipe = "moonrealm:dust",
})
minetest.register_craft({
type = "fuel",
recipe = "default:mese_crystal",
burntime = 50,
})

BIN
textures/moonrealm_dust.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

BIN
textures/moonrealm_soil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B