Fix bug with costs being deducted incorrectly

This commit is contained in:
Hugues Ross 2020-04-20 06:28:52 -04:00
parent 59c359a3a3
commit b4acab145e

View File

@ -423,7 +423,7 @@ minetest.register_on_player_receive_fields(function(player, name, fields)
if is_positive and can_afford(cost, meta) then
meta:set_int("paper", meta:get_int("paper") - cost.paper);
meta:set_int("pigment", meta:get_int("paper") - cost.pigment);
meta:set_int("pigment", meta:get_int("pigment") - cost.pigment);
local inv = meta:get_inventory();
local stack = inv:get_stack("output", 1);
@ -448,7 +448,7 @@ minetest.register_on_player_receive_fields(function(player, name, fields)
local cost = get_copy_material_cost(meta);
if can_afford(cost, meta) then
meta:set_int("paper", meta:get_int("paper") - cost.paper);
meta:set_int("pigment", meta:get_int("paper") - cost.pigment);
meta:set_int("pigment", meta:get_int("pigment") - cost.pigment);
cartographer.map_sound("cartographer_write", player);