~gpcf/misc-patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Merging in the changes from the latest updates

Details
Message ID
<20210216192706.19413-1-erstazi@gmail.com>
DKIM signature
missing
Download raw message
Patch: +28 -20
---
 README.md          |  3 ++-
 init.lua           | 27 ++++++++++++++-------------
 lua/api.lua        |  3 ++-
 lua/controller.lua | 11 ++++++++---
 lua/helpers.lua    |  3 +--
 lua/visual.lua     |  1 +
 6 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/README.md b/README.md
index 06aef18..da4f6f7 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
# Minetest Mod Storage Drawers

[![ContentDB](https://content.minetest.net/packages/LNJ/drawers/shields/downloads/)](https://content.minetest.net/packages/LNJ/drawers/)
![](https://github.com/minetest-mods/drawers/workflows/luacheck/badge.svg)

Version 0.6.0, License: MIT
Version 0.6.1, License: MIT

## Description
This mod adds simple item storages showing the item's inventory image in the
diff --git a/init.lua b/init.lua
index 1b7d416..ae9d813 100755
--- a/init.lua
+++ b/init.lua
@@ -1,7 +1,7 @@
--[[
Minetest Mod Storage Drawers - A Mod adding storage drawers

Copyright (C) 2017-2019 Linus Jahn <lnj@kaidan.im>
Copyright (C) 2017-2020 Linus Jahn <lnj@kaidan.im>

MIT License

@@ -88,7 +88,7 @@ if core.get_modpath("default") and default then
			"drawers_wood.png"),
		groups = {choppy = 3, oddly_breakable_by_hand = 2},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 8, -- normal chest size
		drawer_stack_max_factor = 32, -- 4 * 8 normal chest size
		material = drawers.WOOD_ITEMSTRING
	})
	drawers.register_drawer("drawers:acacia_wood", {
@@ -101,7 +101,7 @@ if core.get_modpath("default") and default then
			"drawers_acacia_wood.png"),
		groups = {choppy = 3, oddly_breakable_by_hand = 2},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 8, -- normal mcl chest size
		drawer_stack_max_factor = 32, -- 4 * 8 normal mcl chest size
		material = "default:acacia_wood"
	})
	drawers.register_drawer("drawers:aspen_wood", {
@@ -114,7 +114,7 @@ if core.get_modpath("default") and default then
			"drawers_aspen_wood.png"),
		groups = {choppy = 3, oddly_breakable_by_hand = 2},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 8, -- normal chest size
		drawer_stack_max_factor = 32, -- 4 * 8 normal chest size
		material = "default:aspen_wood"
	})
	drawers.register_drawer("drawers:junglewood", {
@@ -127,7 +127,7 @@ if core.get_modpath("default") and default then
			"drawers_junglewood.png"),
		groups = {choppy = 3, oddly_breakable_by_hand = 2},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 8, -- normal mcl chest size
		drawer_stack_max_factor = 32, -- 4 * 8 normal mcl chest size
		material = "default:junglewood"
	})
	drawers.register_drawer("drawers:pine_wood", {
@@ -140,7 +140,7 @@ if core.get_modpath("default") and default then
			"drawers_pine_wood.png"),
		groups = {choppy = 3, oddly_breakable_by_hand = 2},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 8, -- normal chest size
		drawer_stack_max_factor = 32, -- 4 * 8 normal chest size
		material = "default:pine_wood"
	})
elseif core.get_modpath("mcl_core") and mcl_core then
@@ -154,7 +154,7 @@ elseif core.get_modpath("mcl_core") and mcl_core then
			"drawers_oak_wood.png"),
		groups = {handy = 1, axey = 1, flammable = 3, wood = 1, building_block = 1, material_wood = 1},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 9, -- normal mcl chest size
		drawer_stack_max_factor = 36, -- 4 * 9 normal mcl chest size
		material = drawers.WOOD_ITEMSTRING,
		_mcl_blast_resistance = 15,
		_mcl_hardness = 2,
@@ -169,7 +169,7 @@ elseif core.get_modpath("mcl_core") and mcl_core then
			"drawers_acacia_wood_mcl.png"),
		groups = {handy = 1, axey = 1, flammable = 3, wood = 1, building_block = 1, material_wood = 1},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 9, -- normal mcl chest size
		drawer_stack_max_factor = 36, -- 4 * 9 normal mcl chest size
		material = "mcl_core:acaciawood",
		_mcl_blast_resistance = 15,
		_mcl_hardness = 2,
@@ -184,7 +184,7 @@ elseif core.get_modpath("mcl_core") and mcl_core then
			"drawers_birch_wood.png"),
		groups = {handy = 1, axey = 1, flammable = 3, wood = 1, building_block = 1, material_wood = 1},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 9, -- normal mcl chest size
		drawer_stack_max_factor = 36, -- 4 * 9 normal mcl chest size
		material = "mcl_core:birchwood",
		_mcl_blast_resistance = 15,
		_mcl_hardness = 2,
@@ -199,7 +199,7 @@ elseif core.get_modpath("mcl_core") and mcl_core then
			"drawers_dark_oak_wood.png"),
		groups = {handy = 1, axey = 1, flammable = 3, wood = 1, building_block = 1, material_wood = 1},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 9, -- normal mcl chest size
		drawer_stack_max_factor = 36, -- 4 * 9 normal mcl chest size
		material = "mcl_core:darkwood",
		_mcl_blast_resistance = 15,
		_mcl_hardness = 2,
@@ -214,7 +214,7 @@ elseif core.get_modpath("mcl_core") and mcl_core then
			"drawers_junglewood_mcl.png"),
		groups = {handy = 1, axey = 1, flammable = 3, wood = 1, building_block = 1, material_wood = 1},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 9, -- normal mcl chest size
		drawer_stack_max_factor = 36, -- 4 * 9 normal mcl chest size
		material = "mcl_core:junglewood",
		_mcl_blast_resistance = 15,
		_mcl_hardness = 2,
@@ -229,7 +229,7 @@ elseif core.get_modpath("mcl_core") and mcl_core then
			"drawers_spruce_wood.png"),
		groups = {handy = 1, axey = 1, flammable = 3, wood = 1, building_block = 1, material_wood = 1},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 9, -- normal mcl chest size
		drawer_stack_max_factor = 36, -- 4 * 9 normal mcl chest size
		material = "mcl_core:sprucewood",
		_mcl_blast_resistance = 15,
		_mcl_hardness = 2,
@@ -250,7 +250,7 @@ else
			"drawers_wood.png"),
		groups = {choppy = 3, oddly_breakable_by_hand = 2},
		sounds = drawers.WOOD_SOUNDS,
		drawer_stack_max_factor = 4 * 8, -- normal chest size
		drawer_stack_max_factor = 32, -- 4 * 8 normal chest size
		material = drawers.WOOD_ITEMSTRING
	})
end
@@ -380,3 +380,4 @@ core.register_craft({
		{"group:stick", "group:stick", "group:stick"}
	}
})

diff --git a/lua/api.lua b/lua/api.lua
index c93f7ca..b4db2bd 100755
--- a/lua/api.lua
+++ b/lua/api.lua
@@ -257,7 +257,7 @@ function drawers.drawer_take_item(pos, itemstack)
	end

	for _, visual in pairs(drawer_visuals) do
		if visual.itemName == itemstack:get_name() and visual.count ~= visual.maxCount then
		if visual.itemName == itemstack:get_name() then
			return visual:take_items(itemstack:get_count())
		end
	end
@@ -424,3 +424,4 @@ function drawers.register_drawer_upgrade(name, def)
		})
	end
end

diff --git a/lua/controller.lua b/lua/controller.lua
index 6ae3f44..47c531b 100644
--- a/lua/controller.lua
+++ b/lua/controller.lua
@@ -242,7 +242,9 @@ local function controller_get_drawer_index(pos, itemstring)

	-- There is a valid entry in the index: check that the entry is still up-to-date
	else
		local content = drawers.drawer_get_content(drawer_net_index[itemstring].drawer_pos, drawer_net_index[itemstring].visualid)
		local content = drawers.drawer_get_content(
			drawer_net_index[itemstring].drawer_pos,
			drawer_net_index[itemstring].visualid)

		if content.name ~= itemstring or content.count >= content.maxCount then
			drawer_net_index = index_drawers(pos)
@@ -280,7 +282,8 @@ local function controller_insert_to_drawers(pos, stack)
		local visualid = drawer_net_index["empty"]["visualid"]
		local content = drawers.drawer_get_content(drawer_pos, visualid)

		-- If the drawer is still empty and the drawer entity is loaded, we will put the items in the drawer
		-- If the drawer is still empty and the drawer entity is loaded, we will
		-- put the items in the drawer
		if content.name == "" and drawers.drawer_visuals[core.serialize(drawer_pos)] then
			local leftover = drawers.drawer_insert_object(drawer_pos, stack, visualid)

@@ -387,7 +390,8 @@ local function controller_on_digiline_receive(pos, _, channel, msg)
		return
	end

	local taken_stack = drawers.drawer_take_item(drawers_index[item:get_name()]["drawer_pos"], item)
	local taken_stack = drawers.drawer_take_item(
		drawers_index[item:get_name()]["drawer_pos"], item)
	local dir = core.facedir_to_dir(core.get_node(pos).param2)

	-- prevent crash if taken_stack ended up with a nil value
@@ -528,3 +532,4 @@ else
		}
	})
end

diff --git a/lua/helpers.lua b/lua/helpers.lua
index 9c8766c..de039ce 100755
--- a/lua/helpers.lua
+++ b/lua/helpers.lua
@@ -100,9 +100,8 @@ function drawers.spawn_visuals(pos)
		local pos2 = vector.add(pos, vector.multiply(fdir, 0.45))

		local obj = core.add_entity(pos2, "drawers:visual")
		
		if not obj then return end
		

		if bdir.x < 0 then obj:set_yaw(0.5 * math.pi) end
		if bdir.z < 0 then obj:set_yaw(math.pi) end
		if bdir.x > 0 then obj:set_yaw(1.5 * math.pi) end
diff --git a/lua/visual.lua b/lua/visual.lua
index 130c1fa..a75fd63 100755
--- a/lua/visual.lua
+++ b/lua/visual.lua
@@ -317,6 +317,7 @@ core.register_entity("drawers:visual", {
			self.count = 0
			self.itemName = itemstack:get_name()
			self.maxCount = itemstack:get_stack_max() * self.stackMaxFactor
			self.itemStackMax = itemstack:get_stack_max()
		end

		-- update everything
-- 
2.17.1
Reply to thread Export thread (mbox)