Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Commit

Permalink
Singlenode mode. Disable clouds. Spawn egg with spacesuit. No falling…
Browse files Browse the repository at this point in the history
… nodes
  • Loading branch information
paramat committed May 26, 2014
1 parent 19e2d52 commit 73cd059
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.txt
@@ -1,4 +1,4 @@
moonrealm 0.6.6 by paramat
moonrealm 0.7.0 by paramat
For latest stable Minetest and back to 0.4.8
Depends default
Licenses: code WTFPL, textures CC BY-SA
Expand Down
41 changes: 29 additions & 12 deletions functions.lua
Expand Up @@ -179,6 +179,14 @@ if SINGLENODE then
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode", water_level=-33000})
end)

minetest.register_on_joinplayer(function(player)
minetest.setting_set("enable_clouds", "false")
end)

minetest.register_on_leaveplayer(function(player)
minetest.setting_set("enable_clouds", "true")
end)

-- Spawn player

Expand All @@ -190,7 +198,7 @@ if SINGLENODE then
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 PSCA = 4 -- Player scatter from world centre in chunks (80 nodes).
local PSCA = 16 -- Player scatter from world centre in chunks (80 nodes).
local xsp
local ysp
local zsp
Expand Down Expand Up @@ -289,8 +297,8 @@ if SINGLENODE then
end
if density >= STOT then
stable[si] = true
elseif stable[si] and density < 0 then
ysp = y + 8
elseif stable[si] and density < 0 and terblen == 1 then
ysp = y + 4
xsp = x
zsp = z
break
Expand All @@ -314,22 +322,31 @@ if SINGLENODE then
end
print ("[moonrealm] spawn player ("..xsp.." "..ysp.." "..zsp..")")
player:setpos({x=xsp, y=ysp, z=zsp})
minetest.add_item({x=xsp, y=ysp, z=zsp}, "moonrealm:spacesuit")
local vm = minetest.get_voxel_manip()
local pos1 = {x=xsp-2, y=ysp-2, z=zsp-2}
local pos2 = {x=xsp+2, y=ysp+2, z=zsp+2}
local pos1 = {x=xsp-3, y=ysp-3, z=zsp-3}
local pos2 = {x=xsp+3, y=ysp+6, z=zsp+3}
local emin, emax = vm:read_from_map(pos1, pos2)
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local data = vm:get_data()
local c_glass = minetest.get_content_id("default:glass")
local c_shell = minetest.get_content_id("moonrealm:shell")
local c_lsair = minetest.get_content_id("moonrealm:air")
for i = -2, 2 do
for j = -2, 2 do
for k = -2, 2 do
for i = -3, 3 do
for j = -3, 6 do
for k = -3, 3 do
local vi = area:index(xsp + i, ysp + j, zsp + k)
if i ^ 2 + j ^ 2 + k ^ 2 >= 4 then
data[vi] = c_glass
local rad
if j <= 0 then
rad = math.sqrt(i ^ 2 + j ^ 2 + k ^ 2)
else
data[vi] = c_lsair
rad = math.sqrt(i ^ 2 + j ^ 2 * 0.33 + k ^ 2)
end
if rad <= 3.5 then
if rad >= 2 then
data[vi] = c_shell
else
data[vi] = c_lsair
end
end
end
end
Expand Down
16 changes: 12 additions & 4 deletions init.lua
@@ -1,9 +1,15 @@
-- moonrealm 0.6.6 by paramat
-- moonrealm 0.7.0 by paramat
-- For latest stable Minetest and back to 0.4.8
-- Depends default
-- Licenses: code WTFPL, textures CC BY-SA

-- singlenode mode with spawn chamber
-- singlenode mode:
-- disable clouds
-- spawn egg with provided spacesuit
-- non falling dust nodes

-- TODO
-- LVM sapligs

-- Parameters

Expand Down Expand Up @@ -249,9 +255,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
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
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
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
Expand Down
21 changes: 15 additions & 6 deletions nodes.lua
Expand Up @@ -46,31 +46,31 @@ minetest.register_node("moonrealm:dust", {
description = "Moon Dust",
tiles = {"moonrealm_dust.png"},
is_ground_content = false,
groups = {crumbly=3, falling_node=1},
groups = {crumbly=3},
sounds = default.node_sound_sand_defaults({
footstep = {name="default_sand_footstep", gain=0.1},
footstep = {name="default_sand_footstep", gain=0.05},
}),
})

minetest.register_node("moonrealm:dustprint1", {
description = "Moon Dust Footprint1",
tiles = {"moonrealm_dustprint1.png", "moonrealm_dust.png"},
is_ground_content = false,
groups = {crumbly=3, falling_node=1},
groups = {crumbly=3},
drop = "moonrealm:dust",
sounds = default.node_sound_sand_defaults({
footstep = {name="default_sand_footstep", gain=0.1},
footstep = {name="default_sand_footstep", gain=0.05},
}),
})

minetest.register_node("moonrealm:dustprint2", {
description = "Moon Dust Footprint2",
tiles = {"moonrealm_dustprint2.png", "moonrealm_dust.png"},
is_ground_content = false,
groups = {crumbly=3, falling_node=1},
groups = {crumbly=3},
drop = "moonrealm:dust",
sounds = default.node_sound_sand_defaults({
footstep = {name="default_sand_footstep", gain=0.1},
footstep = {name="default_sand_footstep", gain=0.05},
}),
})

Expand Down Expand Up @@ -319,6 +319,15 @@ minetest.register_node("moonrealm:stonestair", {
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("moonrealm:shell", {
description = "Spawn Shell",
tiles = {"moonrealm_shell.png"},
light_source = 3,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=1},
sounds = default.node_sound_stone_defaults(),
})

-- Items

minetest.register_craftitem("moonrealm:spacesuit", {
Expand Down
Binary file added textures/moonrealm_shell.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 73cd059

Please sign in to comment.