Add fancy bed model and push to 1.1
|
@ -3,4 +3,12 @@
|
|||
- Add backwards compatibility with PilzAdam's beds mod
|
||||
- Fix placement
|
||||
- Fix small bugs
|
||||
- Prevent possible crash
|
||||
- Prevent possible crash
|
||||
|
||||
1.1
|
||||
---
|
||||
- Add fancy bed model (based on jp's model)
|
||||
- Add API to register beds
|
||||
- Allow players always to detach from bed (by donat-b)
|
||||
- If more than 50% of players want sleep they can skip the night
|
||||
- Don't show sleep dialog in singleplayer
|
||||
|
|
18
README.txt
|
@ -2,23 +2,33 @@ Minetest mod "Beds"
|
|||
===================
|
||||
by BlockMen (c) 2014
|
||||
|
||||
Version: 1.0.1 Beta
|
||||
Version: 1.1
|
||||
|
||||
About
|
||||
~~~~~
|
||||
This mod a bed to Minetest which helps to skip the night. To sleep rightclick the bed, if playing
|
||||
This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing
|
||||
in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other
|
||||
players are in bed too. If all players are sleeping the night gets skipped aswell.
|
||||
players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced
|
||||
if more than 50% of the players are lying in bed and use this option.
|
||||
|
||||
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
|
||||
is set to the beds location. If dying you will respawn there.
|
||||
|
||||
|
||||
To craft a bed you need 3 wood and 3 wool and place it in following shape:
|
||||
|
||||
You can craft two types of beds:
|
||||
|
||||
|
||||
Simple shaped bed:
|
||||
|
||||
wool wool wool
|
||||
wood wood wood
|
||||
|
||||
Fancy shaped bed:
|
||||
|
||||
wool wool stick
|
||||
wood wood wood
|
||||
|
||||
Notice: You can use any color of wood or wool, mixing different is also possible.
|
||||
|
||||
|
||||
|
|
186
nodes.lua
|
@ -25,72 +25,152 @@ local function add_top(pos)
|
|||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
minetest.set_node(p, {name="beds:bed_top", param2 = n.param2})
|
||||
minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2})
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- register nodes
|
||||
function beds.register_bed(name, def)
|
||||
minetest.register_node(name .. "_bottom", {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
wield_image = def.wield_image,
|
||||
drawtype = "nodebox",
|
||||
tiles = def.tiles.bottom,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
stack_max = 1,
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.nodebox.bottom,
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = def.selectionbox,
|
||||
|
||||
},
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
return add_top(pos)
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
remove_top(pos)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("beds:bed_bottom", {
|
||||
description = "Bed",
|
||||
minetest.register_node(name .. "_top", {
|
||||
drawtype = "nodebox",
|
||||
tiles = def.tiles.top,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.nodebox.top,
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0, 0, 0, 0, 0, 0},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_alias(name, name .. "_bottom")
|
||||
|
||||
-- register recipe
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = def.recipe
|
||||
})
|
||||
end
|
||||
|
||||
-- fancy shaped
|
||||
beds.register_bed("beds:fancy_bed", {
|
||||
description = "Fancy Bed",
|
||||
inventory_image = "beds_bed_fancy.png",
|
||||
wield_image = "beds_bed_fancy.png",
|
||||
tiles = {
|
||||
bottom = {
|
||||
"beds_bed_top1.png",
|
||||
"default_wood.png",
|
||||
"beds_bed_side1.png",
|
||||
"beds_bed_side1.png^[transformFX",
|
||||
"default_wood.png",
|
||||
"beds_bed_foot.png",
|
||||
},
|
||||
top = {
|
||||
"beds_bed_top2.png",
|
||||
"default_wood.png",
|
||||
"beds_bed_side2.png",
|
||||
"beds_bed_side2.png^[transformFX",
|
||||
"beds_bed_head.png",
|
||||
"default_wood.png",
|
||||
}
|
||||
},
|
||||
nodebox = {
|
||||
bottom = {
|
||||
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
|
||||
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
|
||||
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
|
||||
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
|
||||
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
|
||||
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
|
||||
},
|
||||
top = {
|
||||
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
|
||||
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
|
||||
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
|
||||
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
|
||||
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
|
||||
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
|
||||
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
|
||||
}
|
||||
},
|
||||
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||
recipe = {
|
||||
{"group:wool", "group:wool", "group:stick"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
-- simple (default)
|
||||
beds.register_bed("beds:bed", {
|
||||
description = "Simple Bed",
|
||||
inventory_image = "beds_bed.png",
|
||||
wield_image = "beds_bed.png",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"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"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
stack_max = 1,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,bed=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||
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",
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||
|
||||
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},
|
||||
},
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
return add_top(pos)
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
remove_top(pos)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("beds:bed_top", {
|
||||
drawtype = "nodebox",
|
||||
tiles = {"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"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,bed=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0, 0, 0, 0, 0, 0},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_alias("beds:bed", "beds:bed_bottom")
|
||||
|
||||
|
||||
-- register recipe
|
||||
|
||||
minetest.register_craft({
|
||||
output = "beds:bed",
|
||||
selectionbox = {-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 PA's beds mod
|
||||
|
|
After Width: | Height: | Size: 537 B |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 387 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 316 B |
After Width: | Height: | Size: 583 B |
After Width: | Height: | Size: 616 B |