Log usage of /pulverize (#7503)
authorAnand S <ClobberXD@gmail.com>
Sat, 30 Jun 2018 10:53:43 +0000 (16:23 +0530)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Sat, 30 Jun 2018 10:53:43 +0000 (12:53 +0200)
builtin/game/chatcommands.lua

index a8aaba9c609b09ace652902c42d0cf8689227569..d56f2112bd9632d94b7b5193bab0a0bedbc45795 100644 (file)
@@ -683,10 +683,13 @@ core.register_chatcommand("pulverize", {
                        core.log("error", "Unable to pulverize, no player.")
                        return false, "Unable to pulverize, no player."
                end
-               if player:get_wielded_item():is_empty() then
+               local wielded_item = player:get_wielded_item()
+               if wielded_item:is_empty() then
                        return false, "Unable to pulverize, no item in hand."
                end
-               player:set_wielded_item(nil)
+               core.log("action", name .. " pulverized \"" ..
+                       wielded_item:get_name() .. " " .. wielded_item:get_count() .. "\"")
+               player:set_wielded_item(nil)                    
                return true, "An item was pulverized."
        end,
 })