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

This commit is contained in:
MoNTE48 2019-05-24 22:20:10 +02:00
parent 5c160c3461
commit 6e94770d31
19 changed files with 99 additions and 281 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)
minetest.register_node(name .. "_bottom", {
minetest.register_node(name, {
description = def.description,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
drawtype = "nodebox",
tiles = def.tiles.bottom,
drawtype = "mesh",
mesh = def.mesh,
tiles = def.tiles,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = def.sounds or default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
},
selection_box = {
type = "fixed",
fixed = def.selectionbox,
},
collision_box = {
type = "fixed",
fixed = def.collisionbox,
},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
@ -77,21 +54,8 @@ function beds.register_bed(name, def)
local dir = placer and placer:get_look_dir() and
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
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})
minetest.set_node(pos, {name = name, param2 = dir})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
@ -100,78 +64,18 @@ function beds.register_bed(name, def)
return itemstack
end,
on_destruct = function(pos)
destruct_bed(pos, 1)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
beds.on_rightclick(pos, clicker)
return itemstack
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)
return beds.can_dig(pos)
end,
})
minetest.register_node(name .. "_top", {
drawtype = "nodebox",
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_alias(name .. "_bottom", name)
minetest.register_alias(name .. "_top", "air")
minetest.register_craft({
output = name,

View File

@ -1,41 +1,17 @@
beds.register_bed("beds:bed", {
description = "Bed",
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {
"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},
},
inventory_image = "beds_bed_inv.png",
wield_image = "beds_bed_inv.png",
tiles = {"beds_bed.png"},
mesh = "beds_bed.obj",
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 = {
{"group:wool", "group:wool", "group:wool"},
{"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
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
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
and user:get_player_name()
or "", "place "..source) then

View File

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

View File

@ -884,7 +884,7 @@ minetest.register_node("default:dry_shrub", {
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node=1},
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
@ -953,7 +953,7 @@ minetest.register_node("default:dry_grass", {
walkable = false,
buildable_to = true,
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(),
})
@ -1401,40 +1401,6 @@ minetest.register_node("default:vine", {
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", {
description = "Glass",
@ -1476,99 +1442,10 @@ minetest.register_node("default:glowstone", {
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", {
description = "Slime Block",
drawtype = "nodebox",
tiles = {"default_slimeblock.png"},
paramtype = "light",
node_box = {
type = "fixed",
@ -1577,11 +1454,45 @@ minetest.register_node("default:slimeblock", {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
},
tiles = {"default_slimeblock.png"},
paramtype = "light",
use_texture_alpha = 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(),
})
--

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

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

View File

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