mirror of
https://gitlab.com/rubenwardy/awards.git
synced 2024-11-29 18:53:44 +01:00
Fix craft trigger not taking stack count into account
This commit is contained in:
parent
c79f13a4a3
commit
48bb2e9656
4
api.lua
4
api.lua
@ -77,7 +77,7 @@ function awards.run_trigger_callbacks(player, data, trigger, table_func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function awards.increment_item_counter(data, field, itemname)
|
function awards.increment_item_counter(data, field, itemname, count)
|
||||||
local name_split = string.split(itemname, ":")
|
local name_split = string.split(itemname, ":")
|
||||||
if #name_split ~= 2 then
|
if #name_split ~= 2 then
|
||||||
return false
|
return false
|
||||||
@ -91,7 +91,7 @@ function awards.increment_item_counter(data, field, itemname)
|
|||||||
awards.tbv(data[field], mod)
|
awards.tbv(data[field], mod)
|
||||||
awards.tbv(data[field][mod], item, 0)
|
awards.tbv(data[field][mod], item, 0)
|
||||||
|
|
||||||
data[field][mod][item] = data[field][mod][item] + 1
|
data[field][mod][item] = data[field][mod][item] + (count or 1)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
|
@ -126,7 +126,7 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
|
|||||||
end
|
end
|
||||||
|
|
||||||
local data = awards.players[player:get_player_name()]
|
local data = awards.players[player:get_player_name()]
|
||||||
if not awards.increment_item_counter(data, "craft", itemstack:get_name()) then
|
if not awards.increment_item_counter(data, "craft", itemstack:get_name(), itemstack:get_count()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user