3dmesh beds (by @kilbith), new sponge mod, minor fixes

This commit is contained in:
MoNTE48 2019-05-24 22:20:10 +02:00
parent 2974e4fde2
commit a20f410088
24 changed files with 241 additions and 282 deletions

View File

@ -1,48 +1,25 @@
local reverse = true
local function destruct_bed(pos, n)
local node = minetest.get_node(pos)
local other
if n == 2 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.subtract(pos, dir)
elseif n == 1 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.add(pos, dir)
end
if reverse then
reverse = not reverse
minetest.remove_node(other)
minetest.check_for_falling(other)
else
reverse = not reverse
end
end
function beds.register_bed(name, def) function beds.register_bed(name, def)
minetest.register_node(name .. "_bottom", { minetest.register_node(name, {
description = def.description, description = def.description,
inventory_image = def.inventory_image, inventory_image = def.inventory_image,
wield_image = def.wield_image, wield_image = def.wield_image,
drawtype = "nodebox", drawtype = "mesh",
tiles = def.tiles.bottom, mesh = def.mesh,
tiles = def.tiles,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
stack_max = 1, stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = def.sounds or default.node_sound_wood_defaults(), sounds = def.sounds or default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
},
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = def.selectionbox, fixed = def.selectionbox,
}, },
collision_box = {
type = "fixed",
fixed = def.collisionbox,
},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under local under = pointed_thing.under
@ -77,21 +54,8 @@ function beds.register_bed(name, def)
local dir = placer and placer:get_look_dir() and local dir = placer and placer:get_look_dir() and
minetest.dir_to_facedir(placer:get_look_dir()) or 0 minetest.dir_to_facedir(placer:get_look_dir()) or 0
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
if minetest.is_protected(botpos, player_name) and minetest.set_node(pos, {name = name, param2 = dir})
not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(botpos, player_name)
return itemstack
end
local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return itemstack
end
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not (creative and creative.is_enabled_for if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then and creative.is_enabled_for(player_name)) then
@ -100,78 +64,18 @@ function beds.register_bed(name, def)
return itemstack return itemstack
end, end,
on_destruct = function(pos)
destruct_bed(pos, 1)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
beds.on_rightclick(pos, clicker) beds.on_rightclick(pos, clicker)
return itemstack return itemstack
end, end,
on_rotate = function(pos, node, user, _, new_param2)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
local node2 = minetest.get_node_or_nil(p)
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
not node.param2 == node2.param2 then
return false
end
if minetest.is_protected(p, user:get_player_name()) then
minetest.record_protection_violation(p, user:get_player_name())
return false
end
if new_param2 % 32 > 3 then
return false
end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp)
local node_def = node3 and minetest.registered_nodes[node3.name]
if not node_def or not node_def.buildable_to then
return false
end
if minetest.is_protected(newp, user:get_player_name()) then
minetest.record_protection_violation(newp, user:get_player_name())
return false
end
node.param2 = new_param2
-- do not remove_node here - it will trigger destroy_bed()
minetest.set_node(p, {name = "air"})
minetest.set_node(pos, node)
minetest.set_node(newp, {name = name .. "_top", param2 = new_param2})
return true
end,
can_dig = function(pos, player) can_dig = function(pos, player)
return beds.can_dig(pos) return beds.can_dig(pos)
end, end,
}) })
minetest.register_node(name .. "_top", { minetest.register_alias(name .. "_bottom", name)
drawtype = "nodebox", minetest.register_alias(name .. "_top", "air")
tiles = def.tiles.top,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = def.sounds or default.node_sound_wood_defaults(),
drop = name .. "_bottom",
node_box = {
type = "fixed",
fixed = def.nodebox.top,
},
on_destruct = function(pos)
destruct_bed(pos, 2)
end,
can_dig = function(pos, player)
local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
return beds.can_dig(p)
end,
})
minetest.register_alias(name, name .. "_bottom")
minetest.register_craft({ minetest.register_craft({
output = name, output = name,

View File

@ -1,41 +1,17 @@
beds.register_bed("beds:bed", { beds.register_bed("beds:bed", {
description = "Bed", description = "Bed",
inventory_image = "beds_bed.png", inventory_image = "beds_bed_inv.png",
wield_image = "beds_bed.png", wield_image = "beds_bed_inv.png",
tiles = { tiles = {"beds_bed.png"},
bottom = { mesh = "beds_bed.obj",
"beds_bed_top_bottom.png^[transformR90",
"default_wood.png",
"beds_bed_side_bottom_r.png",
"beds_bed_side_bottom_r.png^[transformfx",
"beds_transparent.png",
"beds_bed_side_bottom.png"
},
top = {
"beds_bed_top_top.png^[transformR90",
"default_wood.png",
"beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top.png",
"beds_transparent.png",
}
},
nodebox = {
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5}, selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = { recipe = {
{"group:wool", "group:wool", "group:wool"}, {"group:wool", "group:wool", "group:wool"},
{"group:wood", "group:wood", "group:wood"} {"group:wood", "group:wood", "group:wood"}
}, },
}) })
-- Aliases for PilzAdam's beds mod
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
-- Fuel -- Fuel
minetest.register_craft({ minetest.register_craft({

View File

@ -0,0 +1,32 @@
# Blender v2.69 (sub 0) OBJ File: ''
# www.blender.org
mtllib simple_bed.mtl
o Simple_Bed
v 0.500000 -0.500000 -0.500000
v 0.500000 0.060000 -0.500000
v 0.500000 0.060000 1.500000
v 0.500000 -0.500000 1.500000
v -0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 1.500000
v -0.500000 0.060000 1.500000
v -0.500000 0.060000 -0.500000
vt 0.000112 0.780442
vt 0.000110 0.999969
vt 0.780324 0.999889
vt 0.780377 0.780471
vt 0.780636 0.390284
vt 0.999906 0.780382
vt 0.999906 0.390284
vt 0.780636 0.000047
vt 0.999906 0.000094
vt 0.390235 0.780320
vt 0.390235 0.000071
vt 0.000142 0.000142
usemtl none.002
s off
f 1/1 2/2 3/3 4/4
f 5/1 6/4 7/3 8/2
f 1/5 5/4 8/6 2/7
f 4/8 3/9 7/7 6/5
f 1/8 4/4 6/10 5/11
f 2/11 8/12 7/1 3/10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

View File

@ -97,6 +97,14 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
end end
end end
if minetest.is_singleplayer() ~= true then
local player_name = user:get_player_name()
if pointed_thing.under.y > 8 then
minetest.chat_send_player(player_name, "Too much liquid is bad, right?", true)
return itemstack
end
end
if check_protection(lpos, user if check_protection(lpos, user
and user:get_player_name() and user:get_player_name()
or "", "place "..source) then or "", "place "..source) then

View File

@ -32,7 +32,7 @@ return {
"default:stone_with_gold", "default:stone_with_gold",
"default:goldblock", "default:goldblock",
"default:quartz_ore", "default:quartz_ore",
"default:sponge", "sponge:sponge",
"default:glass_white", "default:glass_white",
"default:glass_purple", "default:glass_purple",
"default:glass_gray", "default:glass_gray",

View File

@ -589,12 +589,6 @@ minetest.register_craft({
recipe = "group:tree", recipe = "group:tree",
}) })
minetest.register_craft({
type = "cooking",
output = "default:sponge",
recipe = "default:sponge_wet",
})
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "default:steak", output = "default:steak",

View File

@ -953,7 +953,7 @@ minetest.register_node("default:dry_grass", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1, groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
not_in_creative_inventory=1, dry_grass = 1, dig_immediate = 3}, dry_grass = 1, dig_immediate = 3},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -1401,40 +1401,6 @@ minetest.register_node("default:vine", {
end, end,
}) })
--
-- Quartz
--
minetest.register_node("default:quartz_ore", {
description = "Quartz Ore",
tiles = {"default_quartz_ore.png"},
groups = {cracky = 3, stone = 1},
drop = 'default:quartz_crystal',
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:quartz_block", {
description = "Quartz Block",
tiles = {"default_quartz_block_top.png", "default_quartz_block_bottom.png", "default_quartz_block_side.png"},
groups = {snappy = 1, bendy = 2,cracky = 1,level = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:quartz_chiseled", {
description = "Chiseled Quartz",
tiles = {"default_quartz_chiseled_top.png", "default_quartz_chiseled_top.png", "default_quartz_chiseled_side.png"},
groups = {snappy = 1,bendy=2,cracky = 1,level = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:quartz_pillar", {
description = "Quartz Pillar",
paramtype2 = "facedir",
on_place = minetest.rotate_node,
tiles = {"default_quartz_pillar_top.png", "default_quartz_pillar_top.png", "default_quartz_pillar_side.png"},
groups = {snappy = 1,bendy=2,cracky = 1,level = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:glass", { minetest.register_node("default:glass", {
description = "Glass", description = "Glass",
@ -1476,99 +1442,10 @@ minetest.register_node("default:glowstone", {
light_source = 12, light_source = 12,
}) })
minetest.register_node("default:sponge", {
description = "Sponge",
drawtype = "normal",
tiles = {"default_sponge.png"},
paramtype = 'light',
walkable = true,
pointable = true,
diggable = true,
buildable_to = false,
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3},
on_place = function(itemstack, placer, pointed_thing)
local pn = placer:get_player_name()
if pointed_thing.type ~= "node" then
return itemstack
end
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
local change = false
local on_water = false
local pos = pointed_thing.above
-- verifier si il est dans l'eau ou a cotée
if string.find(minetest.get_node(pointed_thing.above).name, "water_source")
or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then
on_water = true
end
for i=-1,1 do
local p = {x=pos.x+i, y=pos.y, z=pos.z}
local n = minetest.get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
end
end
for i=-1,1 do
local p = {x=pos.x, y=pos.y+i, z=pos.z}
local n = minetest.get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
end
end
for i=-1,1 do
local p = {x=pos.x, y=pos.y, z=pos.z+i}
local n = minetest.get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
end
end
if on_water == true then
for i=-3,3 do
for j=-3,3 do
for k=-3,3 do
local p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
local n = minetest.get_node(p)
if (n.name=="default:water_flowing") or (n.name == "default:water_source")then
minetest.set_node(p, {name="air"})
change = true
end
end
end
end
end
local p = {x=pos.x, y=pos.y, z=pos.z}
local n = minetest.get_node(p)
if change == true then
minetest.set_node(pointed_thing.above, {name = "default:sponge_wet"})
else
minetest.set_node(pointed_thing.above, {name = "default:sponge"})
end
return itemstack
end
})
minetest.register_node("default:sponge_wet", {
description = "Wet Sponge",
drawtype = "normal",
tiles = {"default_sponge_wet.png"},
paramtype = 'light',
walkable = true,
pointable = true,
diggable = true,
buildable_to = false,
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
})
minetest.register_node("default:slimeblock", { minetest.register_node("default:slimeblock", {
description = "Slime Block", description = "Slime Block",
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"default_slimeblock.png"},
paramtype = "light", paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -1577,11 +1454,45 @@ minetest.register_node("default:slimeblock", {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
} }
}, },
tiles = {"default_slimeblock.png"},
paramtype = "light",
use_texture_alpha = true, use_texture_alpha = true,
sunlight_propagates = true, sunlight_propagates = true,
groups = {oddly_breakable_by_hand = 3,dig_immediate = 2,bouncy=70,disable_jump=1, fall_damage_add_percent=-100}, groups = {oddly_breakable_by_hand = 3, disable_jump = 1, fall_damage_add_percent=-100},
})
--
-- Quartz
--
minetest.register_node("default:quartz_ore", {
description = "Quartz Ore",
tiles = {"default_quartz_ore.png"},
groups = {cracky = 3, stone = 1},
drop = 'default:quartz_crystal',
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:quartz_block", {
description = "Quartz Block",
tiles = {"default_quartz_block_top.png", "default_quartz_block_bottom.png", "default_quartz_block_side.png"},
groups = {snappy = 1, bendy = 2,cracky = 1,level = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:quartz_chiseled", {
description = "Chiseled Quartz",
tiles = {"default_quartz_chiseled_top.png", "default_quartz_chiseled_top.png", "default_quartz_chiseled_side.png"},
groups = {snappy = 1, bendy = 2, cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:quartz_pillar", {
description = "Quartz Pillar",
paramtype2 = "facedir",
on_place = minetest.rotate_node,
tiles = {"default_quartz_pillar_top.png", "default_quartz_pillar_top.png", "default_quartz_pillar_side.png"},
groups = {snappy = 1, bendy = 2, cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
}) })
-- --

View File

@ -46,8 +46,8 @@ local theme_main = sfinv.gui_bg ..
sfinv.gui_bg_img sfinv.gui_bg_img
local theme_inv = sfinv.gui_slots .. [[ local theme_inv = sfinv.gui_slots .. [[
list[current_player;main;0.01,4.49;9,3;9] list[current_player;main;0.01,4.51;9,3;9]
list[current_player;main;0.01,7.72;9,1;] list[current_player;main;0.01,7.74;9,1;]
]] ]]
function sfinv.make_formspec(player, context, content, show_inv, size) function sfinv.make_formspec(player, context, content, show_inv, size)

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,20 @@
MultiCraft Game mod: Spomge
=========================
Introduction:
Wet sponges are quite rare, found deep in the sea where it is dark (below -11).
These can be cooked into dry sponges, and then placed near a liquid to remove an area of it. They will hold the water away until they are removed.
They turn in to wet sponges when used, so to use them again, they have to be cooked.
### How it works:
* sponges create a 5x5 area of air-like nodes that water can't flow through (checks for protection)
* if sponges have cleared more than 3 nodes of liquid, they become wet sponges
* removing a sponge or wet sponge will turn a 5x5 area of air-like nodes back into air.
*(Air-like nodes can be removed in protection by removing a sponge outside the protection, they are not meant to be permanent)*
[Forum topic](https://forum.minetest.net/viewtopic.php?f=9&t=20729)
License of source code:
-----------------------
Copyright (c) Benjie/Fiftysix - 27/8/18
MIT, see the LICENSE file.

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,99 @@
local area = 2
local destruct = function(pos) -- removing the air-like nodes
for x = pos.x-area, pos.x+area do
for y = pos.y-area, pos.y+area do
for z = pos.z-area, pos.z+area do
local n = minetest.get_node({x=x, y=y, z=z}).name
if n == "sponge:liquid_stop" then
minetest.remove_node({x=x, y=y, z=z})
end
end
end
end
end
minetest.register_node("sponge:liquid_stop", { -- air-like node
description = "liquid blocker for sponges",
drawtype = "airlike",
drop = "",
groups = {not_in_creative_inventory = 1},
pointable = false,
walkable = false,
sunlight_propagates = true,
paramtype = "light",
buildable_to = true,
})
minetest.register_node("sponge:sponge", { -- dry sponge
description = "Sponge",
tiles = {"sponge_sponge.png"},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3},
sounds = default.node_sound_dirt_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
local name = placer:get_player_name()
if not minetest.is_protected(pos, name) then
local count = 0
for x = pos.x-area, pos.x+area do
for y = pos.y-area, pos.y+area do
for z = pos.z-area, pos.z+area do
local n = minetest.get_node({x=x, y=y, z=z}).name
local d = minetest.registered_nodes[n]
if d ~= nil and (n == "air" or d["drawtype"] == "liquid" or d["drawtype"] == "flowingliquid") then
local p = {x=x, y=y, z=z}
if not minetest.is_protected(p, name) then
if n ~= "air" then
count = count + 1 -- counting liquids
end
minetest.set_node(p, {name="sponge:liquid_stop"})
end
end
end
end
end
if count > 2 then -- turns wet if it removed more than 2 nodes
minetest.set_node(pos, {name="sponge:wet_sponge"})
end
end
end,
after_dig_node = destruct
})
minetest.register_node("sponge:wet_sponge", { -- wet sponge
description = "Wet Sponge",
tiles = {"sponge_sponge_wet.png"},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3, not_in_creative_inventory = 1},
sounds = default.node_sound_dirt_defaults(),
on_destruct = destruct
})
minetest.register_craft({ -- cooking wet sponge back into dry sponge
type = "cooking",
recipe = "sponge:wet_sponge",
output = "sponge:sponge",
cooktime = 4,
})
minetest.register_decoration({ -- sponges are found deep in the sea
name = "sponge:sponges",
deco_type = "simple",
place_on = {"default:sand"},
spawn_by = "default:water_source",
num_spawn_by = 3,
fill_ratio = 0.0003,
y_max = -12,
flags = "force_placement",
decoration = "sponge:wet_sponge",
})
-- Aliases
minetest.register_alias("default:sponge", "sponge:sponges")
minetest.register_alias("default:sponge_wet", "sponge:wet_sponge")

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,8 +1 @@
movement_acceleration_default = 1.8 default_privs = interact, shout, home, fly, settime
movement_acceleration_air = 1
movement_liquid_sink = 23
movement_gravity = 10.3
default_privs = fly, interact, shout, settime
movement_speed_jump = 6.7