code from inital PR
|
@ -10,3 +10,4 @@ local modpath = minetest.get_modpath("mcl_beds")
|
|||
dofile(modpath .. "/functions.lua")
|
||||
dofile(modpath .. "/api.lua")
|
||||
dofile(modpath .. "/beds.lua")
|
||||
dofile(modpath .. "/respawn_anchor.lua")
|
|
@ -40,3 +40,4 @@ You will fall asleep when all players are in bed.=Sie werden einschlafen, wenn a
|
|||
You will fall asleep when @1% of all players are in bed.=Sie werden einschlafen, wenn @1% der Spieler im Bett sind.
|
||||
You're in bed.=Sie sind im Bett.
|
||||
Allows you to sleep=Zum Einschafen
|
||||
Respawn Anchor=Seelenanker
|
|
@ -40,3 +40,4 @@ You will fall asleep when all players are in bed.=
|
|||
You will fall asleep when @1% of all players are in bed.=
|
||||
You're in bed.=
|
||||
Allows you to sleep=
|
||||
Respawn Anchor=
|
||||
|
|
87
mods/ITEMS/mcl_beds/respawn_anchor.lua
Normal file
|
@ -0,0 +1,87 @@
|
|||
--TODO: Add sounds for the respawn anchor (charge sounds etc.)
|
||||
|
||||
--Nether ends at y -29077
|
||||
--Nether roof at y -28933
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
--local mod_doc = minetest.get_modpath("doc") -> maybe add documentation ?
|
||||
|
||||
for i=0,4 do
|
||||
local nodebox_uncharged = { --Reused the composter nodebox, since it is basicly the same
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
|
||||
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
|
||||
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
|
||||
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.47, 0.5}, -- Bottom level, -0.47 because -0.5 is so low that you can see the texture of the block below through
|
||||
}
|
||||
}
|
||||
|
||||
local nodebox_charged = { --Reused the composter nodebox, since it is basicly the same
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
|
||||
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
|
||||
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
|
||||
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Bottom level
|
||||
}
|
||||
}
|
||||
|
||||
local function rightclick(pos, node, player, itemstack)
|
||||
if itemstack.get_name(itemstack) == "mcl_nether:glowstone" and i ~= 4 then
|
||||
minetest.set_node(pos, {name="mcl_beds:respawn_anchor_charged_" .. i+1})
|
||||
itemstack:take_item()
|
||||
elseif mcl_worlds.pos_to_dimension(pos) ~= "nether" then
|
||||
if node.name ~= "mcl_beds:respawn_anchor" then --only charged respawn anchors are exploding in the overworld & end in minecraft
|
||||
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
|
||||
end
|
||||
elseif string.match(node.name, "mcl_beds:respawn_anchor_charged_") then
|
||||
minetest.chat_send_player(player.get_player_name(player), S"New respawn position set!")
|
||||
mcl_spawn.set_spawn_pos(player, pos, nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if i == 0 then
|
||||
minetest.register_node("mcl_beds:respawn_anchor",{
|
||||
description=S("Respawn Anchor"),
|
||||
tiles = {
|
||||
"respawn_anchor_top_off.png",
|
||||
"respawn_anchor_bottom.png",
|
||||
"respawn_anchor_side0.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = nodebox_uncharged,
|
||||
on_rightclick = rightclick,
|
||||
groups = {pickaxey=1, material_stone=1},
|
||||
_mcl_hardness = 22.5,
|
||||
sounds= mcl_sounds.node_sound_stone_defaults()
|
||||
})
|
||||
else
|
||||
minetest.register_node("mcl_beds:respawn_anchor_charged_"..i,{
|
||||
description=S("Respawn Anchor"),
|
||||
tiles = {
|
||||
"portal.png",
|
||||
"respawn_anchor_bottom.png",
|
||||
"respawn_anchor_side"..i ..".png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = nodebox_charged,
|
||||
on_rightclick = rightclick,
|
||||
groups = {pickaxey=1, material_stone=1, not_in_creative_inventory=1},
|
||||
_mcl_hardness = 22.5,
|
||||
sounds= mcl_sounds.node_sound_stone_defaults()
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craft({ --TODO: Please change this crafting recipe once crying obsidian is implemented!
|
||||
output = "mcl_beds:respawn_anchor",
|
||||
recipe = {
|
||||
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"},
|
||||
{"mcl_nether:glowstone", "mcl_nether:glowstone", "mcl_nether:glowstone"},
|
||||
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"}
|
||||
}
|
||||
})
|
BIN
mods/ITEMS/mcl_beds/textures/portal.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_bottom.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_side0.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_side1.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_side2.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_side3.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_side4.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
mods/ITEMS/mcl_beds/textures/respawn_anchor_top_off.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
|
@ -452,11 +452,32 @@ function mcl_spawn.get_player_spawn_pos(player)
|
|||
if bgroup ~= 1 and bgroup ~= 2 then
|
||||
-- Bed is destroyed:
|
||||
if player and player:is_player() then
|
||||
local checkpos = minetest.string_to_pos(player:get_meta():get_string("mcl_beds:spawn"))
|
||||
local checknode = minetest.get_node(checkpos)
|
||||
|
||||
if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then
|
||||
local charge_level = tonumber(string.sub(checknode.name, -1))
|
||||
if not charge_level then
|
||||
minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!")
|
||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||
minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!"))
|
||||
return mcl_spawn.get_world_spawn_pos(), false
|
||||
elseif charge_level ~= 1 then
|
||||
minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor_charged_".. charge_level-1})
|
||||
return checkpos, false
|
||||
else
|
||||
minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"})
|
||||
return checkpos, false
|
||||
end
|
||||
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked."))
|
||||
else
|
||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
|
||||
return mcl_spawn.get_world_spawn_pos(), false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Find spawning position on/near the bed free of solid or damaging blocks iterating a square spiral 15x15:
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# textdomain: mcl_spawn
|
||||
New respawn position set!=Neue Wiedereinstiegsposition gesetzt!
|
||||
Respawn position cleared!=Wiedereinstiegsposition gelöscht!
|
||||
Your spawn bed was missing or blocked.=Ihr Startbett fehlte oder war blockiert.
|
||||
Your spawn bed was missing or blocked, and you had no charged respawn anchor!=Ihr Startbett fehlte oder war blockiert, und Sie hatten keinen geladenen Seelenanker!
|
||||
Couldn't get level of your respawn anchor!=Das Füllstand ihres Seelenankers konnte nicht erkannt werden!
|
|
@ -1,4 +1,5 @@
|
|||
# textdomain: mcl_spawn
|
||||
New respawn position set!=
|
||||
Respawn position cleared!=
|
||||
Your spawn bed was missing or blocked.=
|
||||
Couldn't get level of your respawn anchor!=
|
||||
Your spawn bed was missing or blocked, and you had no charged respawn anchor!=
|