Skip to content

Commit

Permalink
Updates Pipeworks compatibility checks
Browse files Browse the repository at this point in the history
  • Loading branch information
6r1d committed Jun 9, 2020
1 parent 4b075b1 commit 6a99586
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nodes.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
local function isempty(s)
return s == nil or s == ''
end

local handle_after_place = function(pos, placer, itemstack, pointed_thing)
-- Store node owner
local meta = minetest.get_meta(pos)
Expand All @@ -13,7 +17,7 @@ local tube_config = {
-- Check ATM has owner
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if owner then
if not isempty(owner) then
local input = ItemStack(stack)
local input_name = input:get_name()
accept = input_name:match('^currency:minegeld_%d+$') or
Expand All @@ -38,12 +42,12 @@ local tube_config = {
minegeld_type = 1
end
-- Count minegeld
if minegeld_type ~= nil then
if not isempty(minegeld_type) then
mg_count = minegeld_type * input:get_count()
end
-- Update player balance if possible,
-- return input stack otherwise
if mg_count ~= nil then
if not isempty(mg_count) then
atm.balance[owner] = math.floor(atm.balance[owner] + mg_count)
atm.saveaccounts()
minetest.chat_send_player(
Expand Down

0 comments on commit 6a99586

Please sign in to comment.