From eba15ca982f349b405ba42aa373b37fde28e5166 Mon Sep 17 00:00:00 2001 From: BlockMen Date: Fri, 22 Aug 2014 04:02:54 +0200 Subject: [PATCH] Add fancy bed model and push to 1.1 --- Changelog.txt | 10 +- README.txt | 18 +++- nodes.lua | 186 ++++++++++++++++++++++++++---------- textures/beds_bed_fancy.png | Bin 0 -> 537 bytes textures/beds_bed_foot.png | Bin 0 -> 390 bytes textures/beds_bed_head.png | Bin 0 -> 387 bytes textures/beds_bed_side1.png | Bin 0 -> 296 bytes textures/beds_bed_side2.png | Bin 0 -> 316 bytes textures/beds_bed_top1.png | Bin 0 -> 583 bytes textures/beds_bed_top2.png | Bin 0 -> 616 bytes 10 files changed, 156 insertions(+), 58 deletions(-) create mode 100644 textures/beds_bed_fancy.png create mode 100644 textures/beds_bed_foot.png create mode 100644 textures/beds_bed_head.png create mode 100644 textures/beds_bed_side1.png create mode 100644 textures/beds_bed_side2.png create mode 100644 textures/beds_bed_top1.png create mode 100644 textures/beds_bed_top2.png diff --git a/Changelog.txt b/Changelog.txt index db18b2b..be97d52 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3,4 +3,12 @@ - Add backwards compatibility with PilzAdam's beds mod - Fix placement - Fix small bugs -- Prevent possible crash \ No newline at end of file +- 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 diff --git a/README.txt b/README.txt index bc0d99a..eac46f0 100644 --- a/README.txt +++ b/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. diff --git a/nodes.lua b/nodes.lua index c445ea0..98a7d94 100644 --- a/nodes.lua +++ b/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 diff --git a/textures/beds_bed_fancy.png b/textures/beds_bed_fancy.png new file mode 100644 index 0000000000000000000000000000000000000000..4f9e8a746908c4dc923ad1cb5de9a3c97627e88b GIT binary patch literal 537 zcmV+!0_OdRP)g*HHLyD4EErh^$d!evj~?!;w+tqZzwqymgMeDx1#n?dXW(+7I^j z_St_k^B1t(Ej;stoGM$Yq*ckNl2xT_#?IM0W5(**8tdz?@h4-*Vz=IaP{gq|ZRp&Jk-9GAj#=g#%0sb|R@8%9aQvGv2AP?HoI*&VnKxfzHnFf+Xn~N3;zD6Tfu*Y?3Zb$v zg2=$aA_3zUP;9`2-#iw&AXrdfX>qGJ@60_f1*8tiLCgPuzXI66BWmOr8pFgGtWtzZ zF%w}XLZmgXTJvrUQ)384coAXT%rkE0N!h^TqhF>YLQjP8H)y0ak=DF@FAlXP6k%ix z))=Bj4jXu+s)Zw}g(DtCXp8XRI6NuEK!m;s9i?b1MOSN{wWj4bG#!VlqRUm${c4bC zB(-Sf6QY16?2P83#QW&QJRk|weB8Qo{O_K%6XC6?A_ zaN~V7NL==%cIuMct9I)CzJU!q!rL@)?_ynb-ag~*@`QQ&oVZsatY`T7eyy-^^O>}^ kHKIlq8>9*AnJsvdPtZDUt>P4NqW}N^07*qoM6N<$g2%O|ZU6uP literal 0 HcmV?d00001 diff --git a/textures/beds_bed_head.png b/textures/beds_bed_head.png new file mode 100644 index 0000000000000000000000000000000000000000..763f5e14048e931e237397df959ac20041b5c26d GIT binary patch literal 387 zcmV-}0et?6P)iQ^b)nj#1SL{Wq+%dpvO5QZT<&qI+L6 hP*s3AYVMI2_yGC^`^BWEuA=||002ovPDHLkV1jg)Z%*=ZTOTcn^vn)iA$(CEh(y=mOD|9)MV?|wgnb2TpX^xpv!I3ISX!Ls{+#>4Re*{iYWZLAR{{x+qvt2}TjB*pmasI2 zg)wZb4W-4n@5*!j753>=?Jf)eZ?8=n(&ePTT zw3B$yB@|i0bllhDztGirl;8ylaaf?1Asi2BR0px`@C z7srr_Id>=R_c|OP(yo8@?Bte)$9Ho%wkT|uG~SZ@IK`R$;KD2Q=4@v#EazA|A^d}> zOLCHc$owb80=zF4NH`Y!m{$Cw_PMzXV~1V|*MISYMO9yuo$fE3e86SZY=!Q<@figw zs@|HOIkTBhKML>?n|8D_ck}(%h2iFR%=vBXY=gs0L+=*U1{Xz#`LyXBa^Vuz)Jv<~ zbVIq@Hmtb+Pe|~RgVQ;HVv{c}KYA-8>~q)-v$X}2drqX)`YaJ}mD&^k??m+EI~nJ` zZ=3l__tRrpGq>VxtK+1BX5CM;Dd4Pazfdm0f9vP{e~uH`_AqQXW1hm`TF?yiIfJLG KpUXO@geCwE>46;p literal 0 HcmV?d00001 diff --git a/textures/beds_bed_top1.png b/textures/beds_bed_top1.png new file mode 100644 index 0000000000000000000000000000000000000000..b6fcc2c548f20d36165f3cb85980bbf76310131c GIT binary patch literal 583 zcmV-N0=WH&P)pG(@8`@RCt_4l0mK;RS-qbz4h#Fw?7yWh)@Pdh&el8h{RU12P8(U zf(5aUC_zGr^dX7u@9y`i7?_9})!^3PoLlgqgvBI>-q)%n!qRz+f`gs#*t;d!K(pD~qpD|4c7v^|GM5P7_o~J2aL&B-(Ox_| zzJ|pX+%gkR5eaK%!O<3+GX5=4&Q&?80e|;C zOHF#;`&M;~sH%U)5G*!u&D^TGG|x-pE~jeEZ1x_us$118P0}?}Fh@u_k8zM2VClgI z)=c2@h&2I_RD}%Ydg4(5pcNk zR2hyD9iFN-I7T$PNjgMat2US;47W_dWG9?6OR{9R-hb)4Z$9IfpMakE=G{3H18}Qc zpDq#l_Qlsz3qH-i+3@`uy literal 0 HcmV?d00001 diff --git a/textures/beds_bed_top2.png b/textures/beds_bed_top2.png new file mode 100644 index 0000000000000000000000000000000000000000..2fe5bf2b0c133858993413cfa495379f4c4b9aa1 GIT binary patch literal 616 zcmV-u0+;=XP)pG^hrcPRCt_Ckj;@DMG%BDtE#)_?da`Zv=?MCzyJE90XUz}LZ)P=Wg$7n1hB3vfLg05 zA0E!vBfng>h>+o4>u#!MskPQxQxy>&$5Cq))s#|ieU4E|o^7{3{@RvY#vC%lOhu&k z4j`o*;k|bcl#;2kU0$BvJeoUZ_*zyoZLN_~N+x;xa5|mloUM0wobJ|QY5+{FUazK_ zQdZ^B8Ui_|2-I2ukOXn9^^2vyKYlDZi)d@l$x_Z4q+cciqC#@pHV-#V04&1ae)IK+ z(1;|GfEjT_6f%)lcL0m(1U}FC?a$v?yY8917g1oi6F92|aJVbEnmN!T2)wo%zj7hn zUC37=1X@HytRe(H&q;C-abS<=)8*-_$LE_z;Of55X@CIxoS()pG664RT;?S3{=;U) z^iE{BcQTRum%E7Mh!!z`Ma0P$_mjf_2=HK*fNf3zR*?X%5el4DCvZdraIgAB>%FQ+ zbl{aLfWtk2yW7m2WFZyUBbM7>cR!H;K8>Md7IEM*CjccS;(1O7iYkDA08wZmbtryJ zD*ylh8gxZibU}4=Xm4@=RcvKpWFS*{b97~Gb1Wc9ZeuRV9X@sd0000