Rename beds to rebeds
|
@ -1,18 +0,0 @@
|
|||
1.0.1 beta
|
||||
----------
|
||||
- Add backwards compatibility with PilzAdam's beds mod
|
||||
- Fix placement
|
||||
- Fix small bugs
|
||||
- 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
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
- Prevent possbile crash by trying to reposition leaving players
|
|
@ -1,6 +1,6 @@
|
|||
Minetest mod "Beds"
|
||||
Minetest mod: "rebeds" (Beds for respawning)
|
||||
===================
|
||||
by BlockMen (c) 2014-2015
|
||||
Forked from the beds mod by BlockMen (c) 2014-2015.
|
||||
|
||||
About
|
||||
~~~~~
|
||||
|
@ -10,8 +10,6 @@ License of source code, textures: WTFPL
|
|||
---------------------------------------
|
||||
(c) Copyright BlockMen (2014-2015)
|
||||
|
||||
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
|
@ -1,4 +1,4 @@
|
|||
function beds.register_bed(name, def)
|
||||
function rebeds.register_bed(name, def)
|
||||
minetest.register_node(name .. "_bottom", {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
|
@ -47,7 +47,7 @@ function beds.register_bed(name, def)
|
|||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
rebeds.on_rightclick(pos, clicker)
|
||||
end,
|
||||
})
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
-- fancy shaped bed
|
||||
beds.register_bed("beds:fancy_bed", {
|
||||
rebeds.register_bed("rebeds:fancy_bed", {
|
||||
description = "Fancy Bed",
|
||||
inventory_image = "beds_bed_fancy.png",
|
||||
wield_image = "beds_bed_fancy.png",
|
||||
|
@ -49,7 +49,7 @@ beds.register_bed("beds:fancy_bed", {
|
|||
})
|
||||
|
||||
-- simple shaped bed
|
||||
beds.register_bed("beds:bed", {
|
||||
rebeds.register_bed("rebeds:bed", {
|
||||
description = "Simple Bed",
|
||||
inventory_image = "beds_bed.png",
|
||||
wield_image = "beds_bed.png",
|
||||
|
@ -87,3 +87,9 @@ beds.register_bed("beds:bed", {
|
|||
-- aliases for PA's beds mod
|
||||
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
|
||||
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
|
||||
|
||||
minetest.register_alias("beds:bed_bottom", "rebeds:bed_bottom")
|
||||
minetest.register_alias("beds:bed_top", "rebeds:bed_top")
|
||||
minetest.register_alias("beds:fancy_bed_bottom", "rebeds:fancy_bed_bottom")
|
||||
minetest.register_alias("beds:fancy_bed_top", "rebeds:fancy_bed_top")
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
-- helper functions
|
||||
|
||||
function beds.on_rightclick(pos, player)
|
||||
beds.set_spawn(player, pos)
|
||||
function rebeds.on_rightclick(pos, player)
|
||||
rebeds.set_spawn(player, pos)
|
||||
end
|
||||
|
||||
-- callbacks
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
beds.read_spawns()
|
||||
rebeds.read_spawns()
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local pos = beds.spawn[name] or nil
|
||||
local pos = rebeds.spawn[name] or nil
|
||||
if pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
|
@ -20,6 +20,6 @@ minetest.register_on_respawnplayer(function(player)
|
|||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
beds.player[name] = nil
|
||||
rebeds.player[name] = nil
|
||||
end)
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
beds = {}
|
||||
beds.player = {}
|
||||
beds.pos = {}
|
||||
beds.spawn = {}
|
||||
rebeds = {}
|
||||
rebeds.player = {}
|
||||
rebeds.pos = {}
|
||||
rebeds.spawn = {}
|
||||
|
||||
beds.formspec = "size[8,15;true]"..
|
||||
rebeds.formspec = "size[8,15;true]"..
|
||||
"bgcolor[#080808BB; true]"..
|
||||
"button_exit[2,12;4,0.75;leave;Leave Bed]"
|
||||
|
||||
local modpath = minetest.get_modpath("beds")
|
||||
local modpath = minetest.get_modpath("rebeds")
|
||||
|
||||
-- load files
|
||||
dofile(modpath.."/functions.lua")
|
|
@ -11,8 +11,8 @@ if cf ~= nil then
|
|||
bkwd = true
|
||||
end
|
||||
|
||||
function beds.read_spawns()
|
||||
local spawns = beds.spawn
|
||||
function rebeds.read_spawns()
|
||||
local spawns = rebeds.spawn
|
||||
local input = io.open(file, "r")
|
||||
if input and not bkwd then
|
||||
repeat
|
||||
|
@ -27,9 +27,9 @@ function beds.read_spawns()
|
|||
until input:read(0) == nil
|
||||
io.close(input)
|
||||
elseif input and bkwd then
|
||||
beds.spawn = minetest.deserialize(input:read("*all"))
|
||||
rebeds.spawn = minetest.deserialize(input:read("*all"))
|
||||
input:close()
|
||||
beds.save_spawns()
|
||||
rebeds.save_spawns()
|
||||
os.rename(file, file .. ".backup")
|
||||
file = org_file
|
||||
else
|
||||
|
@ -37,22 +37,22 @@ function beds.read_spawns()
|
|||
end
|
||||
end
|
||||
|
||||
function beds.save_spawns()
|
||||
if not beds.spawn then
|
||||
function rebeds.save_spawns()
|
||||
if not rebeds.spawn then
|
||||
return
|
||||
end
|
||||
writing = true
|
||||
local output = io.open(org_file, "w")
|
||||
for i, v in pairs(beds.spawn) do
|
||||
for i, v in pairs(rebeds.spawn) do
|
||||
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
|
||||
end
|
||||
io.close(output)
|
||||
writing = false
|
||||
end
|
||||
|
||||
function beds.set_spawn(player, pos)
|
||||
function rebeds.set_spawn(player, pos)
|
||||
local name = player:get_player_name()
|
||||
beds.spawn[name] = pos
|
||||
rebeds.spawn[name] = pos
|
||||
minetest.chat_send_player(name, "Spawn position set!")
|
||||
end
|
||||
|
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 517 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 539 B |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 490 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |