v 20220614 - update beds mod, minigame support and engine detection

* minigame support
* proper engine detection for respawn
* add red and white bed
This commit is contained in:
Герхард PICCORO Lenz McKAY 2022-06-14 23:16:05 -04:00
parent dde9a5338e
commit 07a1de54a0
12 changed files with 84 additions and 20 deletions

View File

@ -8,7 +8,7 @@ For information check [../README.md](../README.md)
| mod name | origin or work | version | info | | mod name | origin or work | version | info |
| ------------------ | --------------------------------------------------- | -------- | --- | | ------------------ | --------------------------------------------------- | -------- | --- |
| api | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | [api](../game_api.md) | | api | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | [api](../game_api.md) |
| beds | https://codeberg.org/minenux/minetest-mod-beds | https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef | [beds/README.md](beds/README.md) | | beds | https://codeberg.org/minenux/minetest-mod-beds | https://codeberg.org/minenux/minetest-mod-beds/commit/a1aac5940c88106b901c00409d7dac942720dd5b | [beds/README.md](beds/README.md) |
| boats | https://codeberg.org/minenux/minetest-mod-boats | https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f | [boats/README.md](boats/README.md) | | boats | https://codeberg.org/minenux/minetest-mod-boats | https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f | [boats/README.md](boats/README.md) |
| bucket | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) | | bucket | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) |
| butterflies | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) | | butterflies | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) |

View File

@ -1,3 +1,10 @@
NEXT
----
- add more beds as fuel, add mini-game respawn flag.
- add new white simple bed, change red bed recipes to use red wool, add my own screenshot
- older engine detection and intlib
1.0.1 beta 1.0.1 beta
---------- ----------
- Add backwards compatibility with PilzAdam's beds mod - Add backwards compatibility with PilzAdam's beds mod

View File

@ -6,37 +6,37 @@ This mod improves beds which allows sleep, featured to (auto) skip the night.
Information Information
----------- -----------
This mod is named `beds` to sleep, by rightclick the bed. It featured This mod is named `beds` to sleep, by rightclick the bed. It featured
in singleplayer mode that the night gets skipped immediately. If playing in singleplayer mode that the night gets skipped immediately. If playing
in multiplayer you get shown how many other players are in bed too, in multiplayer you get shown how many other players are in bed too,
if all players are sleeping the night gets skipped. if all players are sleeping the night gets skipped.
![screenshot.jpg](screenshot.jpg) ![screenshot.jpg](screenshot.jpg)
Tech information Tech information
---------------- ----------------
This mod sustitute default one, you must disable the default of minetest This mod sustitute default one, you must disable the default of minetest
game if present or override it. game if present or override it.
#### Features #### Features
* Night Skypping: * Night Skypping:
This mod auto featured night skip in singleplayer, in multiplayer it skipped This mod auto featured night skip in singleplayer, in multiplayer it skipped
if more than a set percentage (default 50%) of the players are lying if more than a set percentage (default 50%) of the players are lying
in bed and use this option. Check configuration section for more info. in bed and use this option. Check configuration section for more info.
* Controlled respawning: * Controlled respawning:
If you have slept in bed (not just lying in it) your respawn point If you have slept in bed (not just lying in it) your respawn point
is set to the beds location and you will respawn there after is set to the beds location and you will respawn there after
death. Check configuration section for more info. death. Check configuration section for more info.
* More beds: * More beds:
It features two more beds, the "Blue Simple Bed" like the "Simple Bed" It features more beds, so along with the Red simple bed we now have White and
but in blue, and the "Pink Fancy Bed" like the "Fancy Bed" but in pink. Blue, and the fance beds has the original Red and now Pink.
#### Dependencies #### Dependencies
@ -48,13 +48,13 @@ Optional dependences:
* intllib (only for older engines) * intllib (only for older engines)
* pova (optional) * pova (optional)
The pova mod are not xplicit set as optional depends, due the circular depends bug, The pova mod are not xplicit set as optional depends, due the circular depends bug,
its detected and used. its detected and used.
#### Configuration #### Configuration
| Configuration | type | default | place file | Notes about | | Configuration | type | default | place file | Notes about |
| --------------------- | ----- | ------- | ------------ | ----------------------------------------- | | --------------------- | ----- | ------- | ------------ | ----------------------------------------- |
| enable_bed_respawn | bool | true | minetest.conf | Enable respawn point set to last sleep bed | | enable_bed_respawn | bool | true | minetest.conf | Enable respawn point set to last sleep bed |
| enable_bed_night_skip | bool | false | minetest.conf | You can disable the night skip feature | | enable_bed_night_skip | bool | false | minetest.conf | You can disable the night skip feature |
| bed_sleep_divide | int | 2 | minetest.conf | Division of players needed to skip night | | bed_sleep_divide | int | 2 | minetest.conf | Division of players needed to skip night |
@ -77,6 +77,14 @@ Crafting are same as original default mod, but colored uses a white plus the oth
| beds:bed_top_red | beds:bed_top | | beds:bed_top_red | beds:bed_top |
| beds:bed_bottom_red | beds:bed_bottom | | beds:bed_bottom_red | beds:bed_bottom |
#### Mini-Game Support
If enable_bed_respawn is set to true and a player dies when playing a mini-game then this
can interrupt the game, so a special beds.respawn[player_name] flag has been added which
is set to 'true' by default to always respawn player at their bed, but can be set to
'false' during a mini-game to stop this behaviour.
License License
------ ------

View File

@ -3,7 +3,7 @@ local S = beds.get_translator
-- Fancy shaped bed -- Fancy shaped bed
beds.register_bed("beds:fancy_bed", { beds.register_bed("beds:fancy_bed", {
description = S("Fancy Bed"), description = S("Red Fancy Bed"),
inventory_image = "beds_bed_fancy.png", inventory_image = "beds_bed_fancy.png",
wield_image = "beds_bed_fancy.png", wield_image = "beds_bed_fancy.png",
tiles = {"beds_fancy_bed.png", "default_wood.png"}, tiles = {"beds_fancy_bed.png", "default_wood.png"},
@ -12,7 +12,7 @@ beds.register_bed("beds:fancy_bed", {
collisionbox = {-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 = { recipe = {
{"", "", "group:stick"}, {"", "", "group:stick"},
{"wool:white", "wool:white", "wool:white"}, {"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"} {"group:wood", "group:wood", "group:wood"}
} }
}) })
@ -34,8 +34,22 @@ beds.register_bed("beds:fancy_bed_pink", {
-- Simple shaped bed -- Simple shaped bed
beds.register_bed("beds:bed_white", {
description = S("White Simple Bed"),
inventory_image = "beds_bed_white.png",
wield_image = "beds_bed_white.png",
tiles = {"beds_simple_bed_white.png"},
mesh = "beds_simple_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 = {
{"wool:white", "wool:white", "wool:white"},
{"group:wood", "group:wood", "group:wood"}
}
})
beds.register_bed("beds:bed", { beds.register_bed("beds:bed", {
description = S("Simple Bed"), description = S("Red Simple Bed"),
inventory_image = "beds_bed.png", inventory_image = "beds_bed.png",
wield_image = "beds_bed.png", wield_image = "beds_bed.png",
tiles = {"beds_simple_bed.png"}, tiles = {"beds_simple_bed.png"},
@ -43,7 +57,7 @@ beds.register_bed("beds:bed", {
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5}, 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}, collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = { recipe = {
{"wool:white", "wool:white", "wool:white"}, {"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"} {"group:wood", "group:wood", "group:wood"}
} }
}) })
@ -75,8 +89,26 @@ minetest.register_craft({
burntime = 13 burntime = 13
}) })
minetest.register_craft({
type = "fuel",
recipe = "beds:fancy_bed_pink",
burntime = 13
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "beds:bed", recipe = "beds:bed",
burntime = 12 burntime = 12
}) })
minetest.register_craft({
type = "fuel",
recipe = "beds:bed_blue",
burntime = 12
})
minetest.register_craft({
type = "fuel",
recipe = "beds:bed_white",
burntime = 12
})

View File

@ -319,6 +319,15 @@ end
-- Only register respawn callback if respawn enabled -- Only register respawn callback if respawn enabled
if enable_respawn then if enable_respawn then
-- set respawn flag to true by default
minetest.register_on_joinplayer(function(player)
if not player then return end
local name = player:get_player_name()
beds.respawn[name] = true
end)
-- respawn player at bed if enabled and valid position is found -- respawn player at bed if enabled and valid position is found
minetest.register_on_respawnplayer(function(player) minetest.register_on_respawnplayer(function(player)
@ -327,7 +336,8 @@ if enable_respawn then
local name = player:get_player_name() local name = player:get_player_name()
local pos = beds.spawn[name] local pos = beds.spawn[name]
if pos then -- check if respawn flag is true (for mini-game support, can be set to false)
if pos and beds.respawn[name] then
player:set_pos(pos) player:set_pos(pos)
return true return true
end end

View File

@ -27,10 +27,12 @@ else
end end
beds = { beds = {
mod = "redo",
player = {}, player = {},
bed_position = {}, bed_position = {},
pos = {}, pos = {},
spawn = {}, spawn = {},
respawn = {},
get_translator = S, get_translator = S,
formspec = "size[8,11;true]" formspec = "size[8,11;true]"
.. "no_prepend[]" .. "no_prepend[]"

View File

@ -59,3 +59,7 @@ rights may limit how you use the material.
For more details: For more details:
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/
WTFPL license applies to bed .obj files by jp from mesh beds mod:
https://forum.minetest.net/viewtopic.php?t=11817

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -50,6 +50,7 @@ function beds.read_spawns()
end end
-- load player spawn positions
beds.read_spawns() beds.read_spawns()

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -25,7 +25,7 @@ else
end end
end end
-- check for minetest 5.x compatibility -- check for minetest 5.x compatibility
is_53 = minetest.has_feature("direct_velocity_on_players") or minetest.has_feature("is_creative_enabled") of false is_53 = minetest.has_feature("direct_velocity_on_players") or minetest.has_feature("is_creative_enabled") or false
-- --
-- Helper functions -- Helper functions