From ba3251821551b9870d541bf7641ad1eb16357ec9 Mon Sep 17 00:00:00 2001 From: SX Date: Sun, 16 Feb 2020 22:13:38 +0200 Subject: [PATCH] [gs]et_attribute -> meta methods --- stats.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/stats.lua b/stats.lua index 454859f..0dac1b8 100644 --- a/stats.lua +++ b/stats.lua @@ -1,19 +1,19 @@ - local increase_stat = function(player, name, value) - if player == nil or player.get_attribute == nil then + if player == nil or player.get_meta == nil then -- fake player return end - local count = player:get_attribute(name) + local meta = player:get_meta() + local count = meta:get_int(name) if not count then count = 0 end local newValue = count + value - player:set_attribute(name, newValue) + meta:set_int(name, newValue) xp_redo.run_hook("stat_change", { player:get_player_name(), name, newValue }) end @@ -28,7 +28,6 @@ minetest.register_globalstep(function(dtime) end end) - minetest.register_on_dignode(function(_, _, player) if player and player:is_player() then increase_stat(player, "digged_nodes", 1)