Beds: Fix code style issues
This commit is contained in:
parent
aa676ab878
commit
45bc0b245f
@ -19,6 +19,7 @@ function beds.register_bed(name, def)
|
||||
type = "fixed",
|
||||
fixed = def.selectionbox,
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
if not n or not n.param2 then
|
||||
@ -36,6 +37,7 @@ function beds.register_bed(name, def)
|
||||
minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2})
|
||||
return false
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
if not n then return end
|
||||
@ -46,9 +48,11 @@ function beds.register_bed(name, def)
|
||||
minetest.remove_node(p)
|
||||
end
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
end,
|
||||
|
||||
on_rotate = function(pos, node, user, mode, new_param2)
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
local p = vector.add(pos, dir)
|
||||
@ -99,7 +103,6 @@ function beds.register_bed(name, def)
|
||||
|
||||
minetest.register_alias(name, name .. "_bottom")
|
||||
|
||||
-- register recipe
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = def.recipe
|
||||
|
@ -1,4 +1,5 @@
|
||||
-- fancy shaped bed
|
||||
-- Fancy shaped bed
|
||||
|
||||
beds.register_bed("beds:fancy_bed", {
|
||||
description = "Fancy Bed",
|
||||
inventory_image = "beds_bed_fancy.png",
|
||||
@ -48,7 +49,8 @@ beds.register_bed("beds:fancy_bed", {
|
||||
},
|
||||
})
|
||||
|
||||
-- simple shaped bed
|
||||
-- Simple shaped bed
|
||||
|
||||
beds.register_bed("beds:bed", {
|
||||
description = "Simple Bed",
|
||||
inventory_image = "beds_bed.png",
|
||||
@ -80,9 +82,9 @@ beds.register_bed("beds:bed", {
|
||||
{"wool:red", "wool:red", "wool:white"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
-- aliases for PA's beds mod
|
||||
-- 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")
|
||||
|
@ -6,8 +6,7 @@ if enable_respawn == nil then
|
||||
enable_respawn = true
|
||||
end
|
||||
|
||||
|
||||
-- helper functions
|
||||
-- Helper functions
|
||||
|
||||
local function get_look_yaw(pos)
|
||||
local n = minetest.get_node(pos)
|
||||
@ -105,14 +104,12 @@ local function update_formspecs(finished)
|
||||
local is_majority = (ges / 2) < player_in_bed
|
||||
|
||||
if finished then
|
||||
form_n = beds.formspec ..
|
||||
"label[2.7,11; Good morning.]"
|
||||
form_n = beds.formspec .. "label[2.7,11; Good morning.]"
|
||||
else
|
||||
form_n = beds.formspec ..
|
||||
"label[2.2,11;"..tostring(player_in_bed).." of "..tostring(ges).." players are in bed]"
|
||||
form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) ..
|
||||
" of " .. tostring(ges) .. " players are in bed]"
|
||||
if is_majority and is_night_skip_enabled() then
|
||||
form_n = form_n ..
|
||||
"button_exit[2,8;4,0.75;force;Force night skip]"
|
||||
form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]"
|
||||
end
|
||||
end
|
||||
|
||||
@ -122,7 +119,7 @@ local function update_formspecs(finished)
|
||||
end
|
||||
|
||||
|
||||
-- public functions
|
||||
-- Public functions
|
||||
|
||||
function beds.kick_players()
|
||||
for name, _ in pairs(beds.player) do
|
||||
@ -175,7 +172,7 @@ function beds.on_rightclick(pos, player)
|
||||
end
|
||||
|
||||
|
||||
-- callbacks
|
||||
-- Callbacks
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
beds.read_spawns()
|
||||
|
@ -9,7 +9,8 @@ beds.formspec = "size[8,15;true]"..
|
||||
|
||||
local modpath = minetest.get_modpath("beds")
|
||||
|
||||
-- load files
|
||||
-- Load files
|
||||
|
||||
dofile(modpath .. "/functions.lua")
|
||||
dofile(modpath .. "/api.lua")
|
||||
dofile(modpath .. "/beds.lua")
|
||||
|
Loading…
Reference in New Issue
Block a user