Browse Source

Register drawers with mvps_stopper when available (#50)

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
master
Buckaroo Banzai 1 year ago
committed by GitHub
parent
commit
d3850ca205
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions
  1. +2
    -1
      .luacheckrc
  2. +13
    -0
      lua/api.lua
  3. +1
    -1
      mod.conf

+ 2
- 1
.luacheckrc View File

@@ -24,5 +24,6 @@ read_globals = {
"pipeworks",
"screwdriver",
"intllib",
"digilines"
"digilines",
"mesecon"
}

+ 13
- 0
lua/api.lua View File

@@ -318,6 +318,8 @@ function drawers.register_drawer(name, def)
def.after_dig_node = pipeworks.after_dig
end

local has_mesecons_mvps = minetest.get_modpath("mesecons_mvps")

if drawers.enable_1x1 then
-- normal drawer 1x1 = 1
local def1 = table.copy(def)
@@ -329,6 +331,11 @@ function drawers.register_drawer(name, def)
def1.groups.drawer = 1
core.register_node(name .. "1", def1)
core.register_alias(name, name .. "1") -- 1x1 drawer is the default one
if has_mesecons_mvps then
-- don't let drawers be moved by pistons, visual glitches and
-- possible duplication bugs occur otherwise
mesecon.register_mvps_stopper(name .. "1")
end
end

if drawers.enable_1x2 then
@@ -341,6 +348,9 @@ function drawers.register_drawer(name, def)
def2.tiles4 = nil
def2.groups.drawer = 2
core.register_node(name .. "2", def2)
if has_mesecons_mvps then
mesecon.register_mvps_stopper(name .. "2")
end
end

if drawers.enable_2x2 then
@@ -353,6 +363,9 @@ function drawers.register_drawer(name, def)
def4.tiles4 = nil
def4.groups.drawer = 4
core.register_node(name .. "4", def4)
if has_mesecons_mvps then
mesecon.register_mvps_stopper(name .. "4")
end
end

if (not def.no_craft) and def.material then


+ 1
- 1
mod.conf View File

@@ -1,2 +1,2 @@
name = drawers
optional_depends = default, mcl_core, screwdriver, pipeworks, intllib, moreores, digilines
optional_depends = default, mcl_core, screwdriver, pipeworks, intllib, moreores, digilines, mesecons_mvps

Loading…
Cancel
Save