canary/data/scripts/actions/tools/toolgear.lua
Elson Costa 520a539a4f
fix: scripts and achievements (#2301)
Co-authored-by: Jonyrewind <jonyrewind@gmail.com>
2024-02-22 17:43:45 +00:00

23 lines
1 KiB
Lua

local toolGear = Action()
function toolGear.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if math.random(100) > 5 then
return onUseRope(player, item, fromPosition, target, toPosition, isHotkey)
or onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
or onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
or onUseMachete(player, item, fromPosition, target, toPosition, isHotkey)
or onUseCrowbar(player, item, fromPosition, target, toPosition, isHotkey)
or onUseSpoon(player, item, fromPosition, target, toPosition, isHotkey)
or onUseScythe(player, item, fromPosition, target, toPosition, isHotkey)
or onUseKitchenKnife(player, item, fromPosition, target, toPosition, isHotkey)
else
player:say("Oh no! Your tool is jammed and can't be used for a minute.", TALKTYPE_MONSTER_SAY)
player:addAchievementProgress("Bad Timing", 10)
item:transform(item.itemid + 1)
item:decay()
end
return true
end
toolGear:id(9594, 9596, 9598)
toolGear:register()