Spacesuit texture. New mese texture. Vacuum/air floodable. Code style fixes

This commit is contained in:
paramat 2016-05-12 02:42:02 +01:00
parent 095f21c312
commit 6ec0ddbdc0
7 changed files with 126 additions and 112 deletions

View File

@ -1,14 +1,14 @@
moonrealm 0.10.0 by paramat moonrealm 0.10.0 by paramat
For Minetest 0.4.14 or later For Minetest 0.4.14 or later
Depends default Depends default
Licenses: Code LGPL 2.1. Media CC BY-SA Licenses: Code LGPL 2.1. Media CC BY-SA 3.0
Crafting Crafting
-------- --------
Spacesuit Spacesuit
To avoid drowning in the vacuum nodes put a spacesuit in your inventory. To avoid asphyxiation in vacuum put a spacesuit in your inventory.
Mesetinted helmet Mesetinted helmet
-C- -C-
@ -100,4 +100,3 @@ LIL
LLL LLL
L = moonrealm appleleaf L = moonrealm appleleaf
I = moonrealm waterice I = moonrealm waterice

View File

@ -73,7 +73,7 @@ function moonrealm_appletree(pos)
vm:write_to_map() vm:write_to_map()
vm:update_map() vm:update_map()
print ("[moonrealm] moonrealm apple tree sapling grows") print ("[moonrealm] apple tree sapling grows")
end end
@ -94,6 +94,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
local data = vm:get_data() local data = vm:get_data()
local vic = area:index(x, y, z) local vic = area:index(x, y, z)
for j = -1, 1 do for j = -1, 1 do
for k = -1, 1 do for k = -1, 1 do
local vi = area:index(x - 1, y + j, z + k) local vi = area:index(x - 1, y + j, z + k)
@ -108,7 +109,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map() vm:update_map()
print ("[moonrealm] moonrealm air flows into hole") print ("[moonrealm] air flows into hole")
return return
end end
end end
@ -118,10 +119,12 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
end end
end end
data[vic] = c_vacuum data[vic] = c_vacuum
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map() vm:update_map()
print ("[moonrealm] moonrealm vacuum flows into hole")
print ("[moonrealm] vacuum flows into hole")
end) end)
@ -160,7 +163,7 @@ minetest.register_abm({
if nodid == c_vacuum then if nodid == c_vacuum then
data[vi] = c_lsair data[vi] = c_lsair
minetest.get_meta({x = x + i, y = y + j, z = z + k}):set_int("spread", (spread - 1)) minetest.get_meta({x = x + i, y = y + j, z = z + k}):set_int("spread", (spread - 1))
print ("[moonrealm] moonrealm air spreads") print ("[moonrealm] air spreads")
end end
end end
vi = vi + 1 vi = vi + 1
@ -259,13 +262,14 @@ minetest.register_abm({
end end
end end
end end
data[vic] = c_dust data[vic] = c_dust
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map() vm:update_map()
print ("[moonrealm] moonrealm soil dries") print ("[moonrealm] soil dries")
end, end,
}) })
@ -280,4 +284,3 @@ minetest.register_abm({
moonrealm_appletree(pos) moonrealm_appletree(pos)
end, end,
}) })

View File

@ -108,9 +108,7 @@ dofile(minetest.get_modpath("moonrealm").."/functions.lua")
-- Set mapgen parameters -- Set mapgen parameters
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname = "singlenode", water_level = -32000}) minetest.set_mapgen_params({mgname = "singlenode", water_level = -32000})
end)
-- Player positions, spacesuit texture status -- Player positions, spacesuit texture status
@ -301,8 +299,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
local ni3d = 1 local ni3d = 1
local ni2d = 1 local ni2d = 1
local stable = {} local stable = {}
for z = z0, z1 do for z = z0, z1 do
local viu = area:index(x0, y0 - 1, z) local viu = area:index(x0, y0 - 1, z)
for x = x0, x1 do for x = x0, x1 do
local si = x - x0 + 1 local si = x - x0 + 1
local nodid = data[viu] local nodid = data[viu]
@ -313,32 +313,37 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
viu = viu + 1 viu = viu + 1
end end
for y = y0, y1 do for y = y0, y1 do
local vi = area:index(x0, y, z) -- LVM index for first node in x row local vi = area:index(x0, y, z) -- LVM index for first node in x row
local icecha = ICECHA * (1 + (GRADCEN - y) / ICEGRAD) local icecha = ICECHA * (1 + (GRADCEN - y) / ICEGRAD)
for x = x0, x1 do for x = x0, x1 do
local nodid = data[vi] local nodid = data[vi]
local empty = (nodid == c_air or nodid == c_ignore) local empty = (nodid == c_air or nodid == c_ignore)
local grad local grad
local density local density
local si = x - x0 + 1 local si = x - x0 + 1
local terblen = math.max(math.min(math.abs(nvals_terblen[ni2d]) * 4, local terblen = math.max(math.min(
1.5), 0.5) - 0.5 math.abs(nvals_terblen[ni2d]) * 4, 1.5), 0.5) - 0.5
local gradcen = GRADCEN + nvals_gradcen[ni2d] * CENAMP local gradcen = GRADCEN + nvals_gradcen[ni2d] * CENAMP
if y > gradcen then if y > gradcen then
grad = -((y - gradcen) / HIGRAD) ^ HEXP grad = -((y - gradcen) / HIGRAD) ^ HEXP
else else
grad = ((gradcen - y) / LOGRAD) ^ LEXP grad = ((gradcen - y) / LOGRAD) ^ LEXP
end end
if nvals_fault[ni3d] >= 0 then if nvals_fault[ni3d] >= 0 then
density = (nvals_terrain[ni3d] + density = (nvals_terrain[ni3d] +
nvals_terralt[ni3d]) / 2 * (1 - terblen) nvals_terralt[ni3d]) / 2 * (1 - terblen) +
+ nvals_smooth[ni3d] * terblen + grad nvals_smooth[ni3d] * terblen + grad
else else
density = (nvals_terrain[ni3d] - density = (nvals_terrain[ni3d] -
nvals_terralt[ni3d]) / 2 * (1 - terblen) nvals_terralt[ni3d]) / 2 * (1 - terblen) -
- nvals_smooth[ni3d] * terblen + grad nvals_smooth[ni3d] * terblen + grad
end end
if density > 0 and empty then -- if terrain and node empty if density > 0 and empty then -- if terrain and node empty
local nofis = false local nofis = false
if math.abs(nvals_fissure[ni3d]) > TFIS then if math.abs(nvals_fissure[ni3d]) > TFIS then
@ -383,6 +388,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
stable[si] = false stable[si] = false
end end
ni3d = ni3d + 1 ni3d = ni3d + 1
ni2d = ni2d + 1 ni2d = ni2d + 1
vi = vi + 1 vi = vi + 1
@ -453,29 +459,33 @@ function moonrealm_spawnplayer(player)
local ni3d = 1 local ni3d = 1
local ni2d = 1 local ni2d = 1
local stable = {} local stable = {}
for z = z0, z1 do for z = z0, z1 do
for y = y0, y1 do for y = y0, y1 do
for x = x0, x1 do for x = x0, x1 do
local si = x - x0 + 1 local si = x - x0 + 1
local grad local grad
local density local density
local terblen = math.max(math.min(math.abs(nvals_terblen[ni2d]) * 4, local terblen = math.max(math.min(
1.5), 0.5) - 0.5 math.abs(nvals_terblen[ni2d]) * 4, 1.5), 0.5) - 0.5
local gradcen = GRADCEN + nvals_gradcen[ni2d] * CENAMP local gradcen = GRADCEN + nvals_gradcen[ni2d] * CENAMP
if y > gradcen then if y > gradcen then
grad = -((y - gradcen) / HIGRAD) ^ HEXP grad = -((y - gradcen) / HIGRAD) ^ HEXP
else else
grad = ((gradcen - y) / LOGRAD) ^ LEXP grad = ((gradcen - y) / LOGRAD) ^ LEXP
end end
if nvals_fault[ni3d] >= 0 then if nvals_fault[ni3d] >= 0 then
density = (nvals_terrain[ni3d] + density = (nvals_terrain[ni3d] +
nvals_terralt[ni3d]) / 2 * (1 - terblen) nvals_terralt[ni3d]) / 2 * (1 - terblen) +
+ nvals_smooth[ni3d] * terblen + grad nvals_smooth[ni3d] * terblen + grad
else else
density = (nvals_terrain[ni3d] - density = (nvals_terrain[ni3d] -
nvals_terralt[ni3d]) / 2 * (1 - terblen) nvals_terralt[ni3d]) / 2 * (1 - terblen) -
- nvals_smooth[ni3d] * terblen + grad nvals_smooth[ni3d] * terblen + grad
end end
if density >= STOT then if density >= STOT then
stable[si] = true stable[si] = true
elseif stable[si] and density < 0 and terblen == 1 then elseif stable[si] and density < 0 and terblen == 1 then
@ -484,6 +494,7 @@ function moonrealm_spawnplayer(player)
zsp = z zsp = z
break break
end end
ni3d = ni3d + 1 ni3d = ni3d + 1
ni2d = ni2d + 1 ni2d = ni2d + 1
end end
@ -547,6 +558,7 @@ function moonrealm_spawnplayer(player)
end end
end end
end end
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
vm:update_map() vm:update_map()
@ -561,4 +573,3 @@ minetest.register_on_respawnplayer(function(player)
moonrealm_spawnplayer(player) moonrealm_spawnplayer(player)
return true return true
end) end)

View File

@ -1,6 +1,6 @@
License of source code License of source code
---------------------- ----------------------
Copyright (C) 2014-2015 paramat Copyright (C) 2014-2016 paramat
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
@ -18,7 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
License of media (textures) License of media (textures)
--------------------------- ---------------------------
Copyright (C) 2014-2015 paramat Copyright (C) 2014-2016 paramat
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -95,6 +95,7 @@ minetest.register_node("moonrealm:vacuum", {
pointable = false, pointable = false,
diggable = false, diggable = false,
buildable_to = true, buildable_to = true,
floodable = true,
drowning = 1, drowning = 1,
}) })
@ -109,6 +110,7 @@ minetest.register_node("moonrealm:air", {
pointable = false, pointable = false,
diggable = false, diggable = false,
buildable_to = true, buildable_to = true,
floodable = true,
}) })
minetest.register_node("moonrealm:airgen", { minetest.register_node("moonrealm:airgen", {
@ -159,12 +161,14 @@ minetest.register_node("moonrealm:hlflowing", {
{ {
image="moonrealm_hlflowing_animated.png", image="moonrealm_hlflowing_animated.png",
backface_culling = false, backface_culling = false,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2} animation = {type = "vertical_frames",
aspect_w = 16, aspect_h = 16, length = 2}
}, },
{ {
image = "moonrealm_hlflowing_animated.png", image = "moonrealm_hlflowing_animated.png",
backface_culling = true, backface_culling = true,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2} animation = {type = "vertical_frames",
aspect_w = 16, aspect_h = 16, length = 2}
}, },
}, },
alpha = 224, alpha = 224,
@ -179,7 +183,7 @@ minetest.register_node("moonrealm:hlflowing", {
liquid_alternative_source = "moonrealm:hlsource", liquid_alternative_source = "moonrealm:hlsource",
liquid_viscosity = 1, liquid_viscosity = 1,
post_effect_color = {a = 224, r = 115, g = 55, b = 24}, 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}, groups = {water = 3, liquid = 3, puts_out_fire = 1},
}) })
minetest.register_node("moonrealm:hlsource", { minetest.register_node("moonrealm:hlsource", {
@ -205,7 +209,7 @@ minetest.register_node("moonrealm:soil", {
description = "Moonsoil", description = "Moonsoil",
tiles = {"moonrealm_soil.png"}, tiles = {"moonrealm_soil.png"},
is_ground_content = false, is_ground_content = false,
groups = {crumbly=3}, groups = {crumbly = 3, soil = 1},
drop = "moonrealm:dust", drop = "moonrealm:dust",
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -217,7 +221,7 @@ minetest.register_node("moonrealm:airlock", {
light_source = 14, light_source = 14,
is_ground_content = false, is_ground_content = false,
walkable = false, walkable = false,
post_effect_color = {a=255, r=0, g=0, b=0}, post_effect_color = {a = 255, r = 181, g = 181, b = 181},
groups = {cracky = 3}, groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
@ -229,7 +233,7 @@ minetest.register_node("moonrealm:glass", {
paramtype = "light", paramtype = "light",
is_ground_content = false, is_ground_content = false,
sunlight_propagates = true, sunlight_propagates = true,
groups = {cracky=3, oddly_breakable_by_hand=3}, groups = {cracky = 3},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
@ -254,7 +258,7 @@ minetest.register_node("moonrealm:appleleaf", {
tiles = {"default_leaves.png"}, tiles = {"default_leaves.png"},
paramtype = "light", paramtype = "light",
is_ground_content = false, is_ground_content = false,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, groups = {snappy = 3, flammable = 2, leaves = 1},
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
@ -271,7 +275,7 @@ minetest.register_node("moonrealm:light", {
paramtype = "light", paramtype = "light",
light_source = 14, light_source = 14,
is_ground_content = false, is_ground_content = false,
groups = {cracky=3, oddly_breakable_by_hand=3}, groups = {cracky = 3},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
@ -291,7 +295,6 @@ minetest.register_node("moonrealm:stoneslab", {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
is_ground_content = false, is_ground_content = false,
--sunlight_propagates = true,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -338,7 +341,7 @@ minetest.register_node("moonrealm:shell", {
description = "Spawn Shell", description = "Spawn Shell",
tiles = {"moonrealm_shell.png"}, tiles = {"moonrealm_shell.png"},
is_ground_content = false, is_ground_content = false,
groups = {cracky=3, oddly_breakable_by_hand=1}, groups = {cracky = 3},
drop = "", drop = "",
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
@ -348,7 +351,6 @@ minetest.register_node("moonrealm:shell", {
minetest.register_craftitem("moonrealm:spacesuit", { minetest.register_craftitem("moonrealm:spacesuit", {
description = "Spacesuit", description = "Spacesuit",
inventory_image = "moonrealm_spacesuit.png", inventory_image = "moonrealm_spacesuit.png",
groups = {not_in_creative_inventory=1},
}) })
minetest.register_craftitem("moonrealm:helmet", { minetest.register_craftitem("moonrealm:helmet", {
@ -487,4 +489,3 @@ minetest.register_craft({
recipe = "default:mese_crystal", recipe = "default:mese_crystal",
burntime = 50, burntime = 50,
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB