From 37ab30c2cc4e21466bfe2b97bb954ac1cbad1c2e Mon Sep 17 00:00:00 2001 From: MoNTE48 Date: Sun, 30 Jun 2019 20:29:05 +0200 Subject: [PATCH] Drop falling node in multiplayer, add falling for furniture --- builtin/game/falling.lua | 9 ++++++- games/default/files/beds/api.lua | 3 +++ games/default/files/default/nodes.lua | 15 ----------- .../files/{ts_furniture => furniture}/LICENSE | 0 .../{ts_furniture => furniture}/README.md | 4 +-- .../{ts_furniture => furniture}/depends.txt | 0 .../{ts_furniture => furniture}/init.lua | 3 ++- games/default/files/workbench/init.lua | 26 +++++++++---------- 8 files changed, 28 insertions(+), 32 deletions(-) rename games/default/files/{ts_furniture => furniture}/LICENSE (100%) rename games/default/files/{ts_furniture => furniture}/README.md (81%) rename games/default/files/{ts_furniture => furniture}/depends.txt (100%) rename games/default/files/{ts_furniture => furniture}/init.lua (99%) diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 64546b4c4..30ff9f1ef 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -197,7 +197,7 @@ end function core.check_single_for_falling(p) local n = core.get_node(p) - if core.get_item_group(n.name, "falling_node") ~= 0 then + if core.get_item_group(n.name, "falling_node") ~= 0 and core.is_singleplayer() then local p_bottom = {x = p.x, y = p.y - 1, z = p.z} -- Only spawn falling node if node below is loaded local n_bottom = core.get_node_or_nil(p_bottom) @@ -224,6 +224,13 @@ function core.check_single_for_falling(p) end end + if core.get_item_group(n.name, "falling_node") ~= 0 and not core.is_singleplayer() then + if not builtin_shared.check_attached_node(p, n) then + drop_attached_node(p) + return true + end + end + if core.get_item_group(n.name, "attached_node") ~= 0 then if not builtin_shared.check_attached_node(p, n) then drop_attached_node(p) diff --git a/games/default/files/beds/api.lua b/games/default/files/beds/api.lua index d78ff17cc..1a641d8b0 100644 --- a/games/default/files/beds/api.lua +++ b/games/default/files/beds/api.lua @@ -61,6 +61,9 @@ function beds.register_bed(name, def) end for _, p in pairs({pos_front, pos}) do local node_def = minetest.registered_nodes[minetest.get_node(p).name] + if node_def.buildable_to then + minetest.remove_node(pos_front) + end if not node_def or not node_def.buildable_to then return itemstack end diff --git a/games/default/files/default/nodes.lua b/games/default/files/default/nodes.lua index a8f313bfe..5200c0b15 100644 --- a/games/default/files/default/nodes.lua +++ b/games/default/files/default/nodes.lua @@ -190,20 +190,6 @@ minetest.register_node("default:redsand", { sounds = default.node_sound_sand_defaults(), }) -if not minetest.is_singleplayer() then - - minetest.override_item("default:sand", { - groups = {crumbly = 3, falling_node = 0, sand = 1}, - }) - minetest.override_item("default:gravel", { - groups = {crumbly = 2, falling_node = 0}, - }) - minetest.override_item("default:redsand", { - groups = {crumbly = 3, falling_node = 0, redsand = 1}, - }) - -end - minetest.register_node("default:clay", { description = "Clay", tiles = {"default_clay.png"}, @@ -262,7 +248,6 @@ minetest.register_node("default:snowblock", { end, }) --- 'is ground content = false' to avoid tunnels in sea ice or ice rivers minetest.register_node("default:ice", { description = "Ice", drawtype = "glasslike", diff --git a/games/default/files/ts_furniture/LICENSE b/games/default/files/furniture/LICENSE similarity index 100% rename from games/default/files/ts_furniture/LICENSE rename to games/default/files/furniture/LICENSE diff --git a/games/default/files/ts_furniture/README.md b/games/default/files/furniture/README.md similarity index 81% rename from games/default/files/ts_furniture/README.md rename to games/default/files/furniture/README.md index 55395bc03..1adc41189 100644 --- a/games/default/files/ts_furniture/README.md +++ b/games/default/files/furniture/README.md @@ -1,5 +1,5 @@ -MultiCraft Game mod: ts_furniture -================================= +MultiCraft Game mod: furniture +============================== https://github.com/minetest-mods/ts_furniture diff --git a/games/default/files/ts_furniture/depends.txt b/games/default/files/furniture/depends.txt similarity index 100% rename from games/default/files/ts_furniture/depends.txt rename to games/default/files/furniture/depends.txt diff --git a/games/default/files/ts_furniture/init.lua b/games/default/files/furniture/init.lua similarity index 99% rename from games/default/files/ts_furniture/init.lua rename to games/default/files/furniture/init.lua index 63710534e..89c718abd 100644 --- a/games/default/files/ts_furniture/init.lua +++ b/games/default/files/furniture/init.lua @@ -135,7 +135,8 @@ function ts_furniture.register_furniture(recipe, description, texture) return end - local groups = {} + local groups = {falling_node = 1} + for k, v in pairs(recipe_def.groups) do if not ignore_groups[k] then groups[k] = v diff --git a/games/default/files/workbench/init.lua b/games/default/files/workbench/init.lua index cc87de0b8..0b9eb6f39 100644 --- a/games/default/files/workbench/init.lua +++ b/games/default/files/workbench/init.lua @@ -346,32 +346,32 @@ local stairs_aliases = { for i=1, #nodes do local node = nodes[i] for _, d in pairs(workbench.defs) do - minetest.register_alias("stairs:"..d[1].."_"..node:match(":(.*)"), "stairs:"..d[1].."_"..node:gsub(":", "_")) + minetest.register_alias("stairs:"..d[1].."_"..node:match(":(.*)"), "stairs:"..d[1].."_"..node:gsub(":", "_")) end for _, e in pairs(stairs_aliases) do - minetest.register_alias("stairs:"..e[1].."_"..node:match(":(.*)"), "stairs:"..e[2].."_"..node:gsub(":", "_")) - minetest.register_alias("stairs:"..e[1].."_"..node:gsub(":", "_"), "stairs:"..e[2].."_"..node:gsub(":", "_")) + minetest.register_alias("stairs:"..e[1].."_"..node:match(":(.*)"), "stairs:"..e[2].."_"..node:gsub(":", "_")) + minetest.register_alias("stairs:"..e[1].."_"..node:gsub(":", "_"), "stairs:"..e[2].."_"..node:gsub(":", "_")) end end for _, d in pairs(workbench.defs) do - minetest.register_alias("stairs:"..d[1].."_coal", "stairs:"..d[1].."_default_coalblock") + minetest.register_alias("stairs:"..d[1].."_coal", "stairs:"..d[1].."_default_coalblock") end for _, e in pairs(stairs_aliases) do - minetest.register_alias("stairs:"..e[1].."_coal", "stairs:"..e[2].."_default_coalblock") + minetest.register_alias("stairs:"..e[1].."_coal", "stairs:"..e[2].."_default_coalblock") end -minetest.register_alias("stairs:stair_steel", "stairs:stair_default_steelblock") -minetest.register_alias("stairs:slab_steel", "stairs:slab_default_steelblock") -minetest.register_alias("stairs:corner_steel", "stairs:corner_default_steelblock") -minetest.register_alias("stairs:stair_gold", "stairs:stair_default_goldblock") -minetest.register_alias("stairs:slab_gold", "stairs:slab_default_goldblock") -minetest.register_alias("stairs:corner_gold", "stairs:corner_default_goldblock") -minetest.register_alias("stairs:stair_diamond", "stairs:stair_default_diamondblock") -minetest.register_alias("stairs:slab_diamond", "stairs:slab_default_diamondblock") +minetest.register_alias("stairs:stair_steel", "stairs:stair_default_steelblock") +minetest.register_alias("stairs:slab_steel", "stairs:slab_default_steelblock") +minetest.register_alias("stairs:corner_steel", "stairs:corner_default_steelblock") +minetest.register_alias("stairs:stair_gold", "stairs:stair_default_goldblock") +minetest.register_alias("stairs:slab_gold", "stairs:slab_default_goldblock") +minetest.register_alias("stairs:corner_gold", "stairs:corner_default_goldblock") +minetest.register_alias("stairs:stair_diamond", "stairs:stair_default_diamondblock") +minetest.register_alias("stairs:slab_diamond", "stairs:slab_default_diamondblock") minetest.register_alias("stairs:corner_diamond", "stairs:corner_default_diamondblock") -- Craft items