Compare commits
9 Commits
4cdf672879
...
ecc14e7fcc
Author | SHA1 | Date |
---|---|---|
Pascal Abresch | ecc14e7fcc | |
Pascal Abresch | 4dbf73a7a8 | |
Pascal Abresch | 0c390d53a3 | |
Pascal Abresch | 5e5e30d7f0 | |
Pascal Abresch | d33030e0e2 | |
Pascal Abresch | e73fa06354 | |
Pascal Abresch | 0848bc9fea | |
Pascal Abresch | 6a304f4dd8 | |
Pascal Abresch | e748b9d3fe |
|
@ -12,3 +12,56 @@ minetest.register_on_joinplayer(
|
|||
player:set_inventory_formspec(sparktech.add_inventory(0, 0, ""))
|
||||
end)
|
||||
end)
|
||||
|
||||
local spark_quick_put_machines = minetest.setting_getbool("spark_quick_put_machines")
|
||||
local spark_quick_put_storage = minetest.setting_getbool("spark_quick_put_storage")
|
||||
local spark_quick_put_default = minetest.setting_getbool("spark_quick_put_default")
|
||||
local spark_quick_put_overide = minetest.settings:get("spark_quick_put_overide")
|
||||
|
||||
local whitelist
|
||||
if spark_quick_put_overide then
|
||||
--overide here
|
||||
whitelist = { "product" }
|
||||
else
|
||||
if spark_quick_put_machines then
|
||||
whitelist = { "fuel", "product", "source" }
|
||||
end
|
||||
|
||||
if spark_quick_put_storage then
|
||||
if whitelist then
|
||||
table.insert(whitelist, "main")
|
||||
else
|
||||
whitelist = { "main" }
|
||||
end
|
||||
end
|
||||
|
||||
if spark_quick_put_default then
|
||||
if whitelist then
|
||||
table.insert(whitelist, "src")
|
||||
table.insert(whitelist, "dst")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function quick_refuel(position, node, puncher, pointed)
|
||||
local nodemeta = minetest.get_meta(position)
|
||||
local noderef = minetest.registered_nodes[node.name]
|
||||
if not noderef then return false end
|
||||
local putfunc = noderef.allow_metadata_inventory_put
|
||||
local itemstack = puncher:get_wielded_item()
|
||||
local inventory = nodemeta:get_inventory()
|
||||
if not inventory or not putfunc then return false end -- putfunc so grass doesnt crash the game
|
||||
for list in pairs(whitelist) do
|
||||
local transstack = putfunc(position, whitelist[list], nil, itemstack, puncher)
|
||||
if transstack ~= 0 then
|
||||
local leftover = inventory:add_item(whitelist[list], itemstack)
|
||||
puncher:set_wielded_item(leftover)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if whitelist then
|
||||
minetest.register_on_punchnode(quick_refuel)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
spark_dig_stlye_alt (Alternate tool dig style) bool false
|
||||
spark_log (Enable console log) bool true
|
||||
spark_log (Enable console log) bool true
|
||||
spark_quick_put_machines (Left click items into machines) bool false
|
||||
spark_quick_put_storage (Left click items into storage) bool false
|
||||
spark_quick_put_default (Left click items into default mod blocks) bool false
|
||||
spark_quick_put_overide ([ADVANCED] Space seperated list of inventories to overide the whitelist) string
|
||||
|
|
|
@ -15,8 +15,8 @@ local function is_fuel(items)
|
|||
end
|
||||
|
||||
local function is_item_allowed(pos, target, _, stack)
|
||||
if stack == nil or not is_fuel({stack}) then
|
||||
return 0
|
||||
if stack == nil or not is_fuel({stack}) or target ~= "fuel" then
|
||||
return 0 -- returning nil here crashes minetest 1942660955bc3684a60d527e2fafa0ec3e02dd54
|
||||
else
|
||||
return stack:get_count()
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ local function is_smeltable(items)
|
|||
end
|
||||
|
||||
local function is_item_allowed(pos, target, _, stack)
|
||||
if target == "product" then return 0 end --so no items get moved into the souce inventory by the user
|
||||
if target ~= "source" then return 0 end --so no items get moved into the produce inventory by the user
|
||||
|
||||
if stack == nil or not is_smeltable({stack}) then --invalid or unsmeltable items dont get in
|
||||
return 0
|
||||
|
|
Reference in New Issue