diff --git a/data-canary/scripts/actions/tools/crowbar.lua b/data-canary/scripts/actions/tools/crowbar.lua new file mode 100644 index 00000000000..e21a43cc0cf --- /dev/null +++ b/data-canary/scripts/actions/tools/crowbar.lua @@ -0,0 +1,8 @@ +local crowbar = Action() + +function crowbar.onUse(player, item, fromPosition, target, toPosition, isHotkey) + return ActionsLib.useCrowbar(player, item, fromPosition, target, toPosition, isHotkey) +end + +crowbar:id(3304) +crowbar:register() diff --git a/data-canary/scripts/actions/tools/machete.lua b/data-canary/scripts/actions/tools/machete.lua new file mode 100644 index 00000000000..1cbab2495a6 --- /dev/null +++ b/data-canary/scripts/actions/tools/machete.lua @@ -0,0 +1,8 @@ +local machete = Action() + +function machete.onUse(player, item, fromPosition, target, toPosition, isHotkey) + return ActionsLib.useMachete(player, item, fromPosition, target, toPosition, isHotkey) +end + +machete:id(3308) +machete:register() diff --git a/data-canary/scripts/actions/tools/pick.lua b/data-canary/scripts/actions/tools/pick.lua new file mode 100644 index 00000000000..37cbc136948 --- /dev/null +++ b/data-canary/scripts/actions/tools/pick.lua @@ -0,0 +1,8 @@ +local pick = Action() + +function pick.onUse(player, item, fromPosition, target, toPosition, isHotkey) + return ActionsLib.usePick(player, item, fromPosition, target, toPosition, isHotkey) +end + +pick:id(3456) +pick:register() diff --git a/data-canary/scripts/actions/tools/rope.lua b/data-canary/scripts/actions/tools/rope.lua new file mode 100644 index 00000000000..f2dc348b505 --- /dev/null +++ b/data-canary/scripts/actions/tools/rope.lua @@ -0,0 +1,8 @@ +local rope = Action() + +function rope.onUse(player, item, fromPosition, target, toPosition, isHotkey) + return ActionsLib.useRope(player, item, fromPosition, target, toPosition, isHotkey) +end + +rope:id(3003, 646) +rope:register() diff --git a/data-canary/scripts/actions/tools/scythe.lua b/data-canary/scripts/actions/tools/scythe.lua new file mode 100644 index 00000000000..5a29085d188 --- /dev/null +++ b/data-canary/scripts/actions/tools/scythe.lua @@ -0,0 +1,8 @@ +local scythe = Action() + +function scythe.onUse(player, item, fromPosition, target, toPosition, isHotkey) + return ActionsLib.useScythe(player, item, fromPosition, target, toPosition, isHotkey) +end + +scythe:id(3453) +scythe:register() diff --git a/data-canary/scripts/actions/tools/shovel.lua b/data-canary/scripts/actions/tools/shovel.lua new file mode 100644 index 00000000000..cd2930223b8 --- /dev/null +++ b/data-canary/scripts/actions/tools/shovel.lua @@ -0,0 +1,8 @@ +local shovel = Action() + +function shovel.onUse(player, item, itemEx, fromPosition, target, toPosition, isHotkey) + return ActionsLib.useShovel(player, item, itemEx, fromPosition, target, toPosition, isHotkey) +end + +shovel:id(3457, 5710) +shovel:register() diff --git a/data-canary/scripts/actions/tools/spoon.lua b/data-canary/scripts/actions/tools/spoon.lua new file mode 100644 index 00000000000..b2a98422d2a --- /dev/null +++ b/data-canary/scripts/actions/tools/spoon.lua @@ -0,0 +1,8 @@ +local spoon = Action() + +function spoon.onUse(player, item, fromPosition, target, toPosition, isHotkey) + return ActionsLib.useSpoon(player, item, fromPosition, target, toPosition, isHotkey) +end + +spoon:id(3468) +spoon:register() diff --git a/data-canary/scripts/actions/tools/toolgear.lua b/data-canary/scripts/actions/tools/toolgear.lua new file mode 100644 index 00000000000..457832f3742 --- /dev/null +++ b/data-canary/scripts/actions/tools/toolgear.lua @@ -0,0 +1,23 @@ +local toolGear = Action() + +function toolGear.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if math.random(100) > 5 then + return ActionsLib.onUseRope(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.onUseShovel(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.onUsePick(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.onUseMachete(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.onUseCrowbar(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.onUseSpoon(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.onUseScythe(player, item, fromPosition, target, toPosition, isHotkey) + or ActionsLib.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() diff --git a/data/scripts/actions/tools/claw_of_the_noxious_spawn.lua b/data-otservbr-global/scripts/actions/tools/claw_of_the_noxious_spawn.lua similarity index 100% rename from data/scripts/actions/tools/claw_of_the_noxious_spawn.lua rename to data-otservbr-global/scripts/actions/tools/claw_of_the_noxious_spawn.lua diff --git a/data/scripts/actions/tools/crowbar.lua b/data-otservbr-global/scripts/actions/tools/crowbar.lua similarity index 100% rename from data/scripts/actions/tools/crowbar.lua rename to data-otservbr-global/scripts/actions/tools/crowbar.lua diff --git a/data/scripts/actions/tools/kitchen_knife.lua b/data-otservbr-global/scripts/actions/tools/kitchen_knife.lua similarity index 100% rename from data/scripts/actions/tools/kitchen_knife.lua rename to data-otservbr-global/scripts/actions/tools/kitchen_knife.lua diff --git a/data/scripts/actions/tools/machete.lua b/data-otservbr-global/scripts/actions/tools/machete.lua similarity index 100% rename from data/scripts/actions/tools/machete.lua rename to data-otservbr-global/scripts/actions/tools/machete.lua diff --git a/data/scripts/actions/tools/pick.lua b/data-otservbr-global/scripts/actions/tools/pick.lua similarity index 100% rename from data/scripts/actions/tools/pick.lua rename to data-otservbr-global/scripts/actions/tools/pick.lua diff --git a/data/scripts/actions/tools/rope.lua b/data-otservbr-global/scripts/actions/tools/rope.lua similarity index 100% rename from data/scripts/actions/tools/rope.lua rename to data-otservbr-global/scripts/actions/tools/rope.lua diff --git a/data/scripts/actions/tools/scythe.lua b/data-otservbr-global/scripts/actions/tools/scythe.lua similarity index 100% rename from data/scripts/actions/tools/scythe.lua rename to data-otservbr-global/scripts/actions/tools/scythe.lua diff --git a/data/scripts/actions/tools/shovel.lua b/data-otservbr-global/scripts/actions/tools/shovel.lua similarity index 100% rename from data/scripts/actions/tools/shovel.lua rename to data-otservbr-global/scripts/actions/tools/shovel.lua diff --git a/data/scripts/actions/tools/spoon.lua b/data-otservbr-global/scripts/actions/tools/spoon.lua similarity index 100% rename from data/scripts/actions/tools/spoon.lua rename to data-otservbr-global/scripts/actions/tools/spoon.lua diff --git a/data/scripts/actions/tools/toolgear.lua b/data-otservbr-global/scripts/actions/tools/toolgear.lua similarity index 100% rename from data/scripts/actions/tools/toolgear.lua rename to data-otservbr-global/scripts/actions/tools/toolgear.lua diff --git a/data/scripts/actions/tools/watch.lua b/data/scripts/actions/items/watch.lua similarity index 100% rename from data/scripts/actions/tools/watch.lua rename to data/scripts/actions/items/watch.lua diff --git a/src/canary_server.cpp b/src/canary_server.cpp index e49a86d7d9f..cca280b69fa 100644 --- a/src/canary_server.cpp +++ b/src/canary_server.cpp @@ -367,6 +367,7 @@ void CanaryServer::loadModules() { modulesLoadHelper(g_modules().loadFromXml(), "modules/modules.xml"); logger.debug("Loading datapack scripts on folder: {}/", datapackName); + modulesLoadHelper(g_scripts().loadScripts(datapackFolder + "/scripts/lib", true, false), datapackFolder + "/scripts/libs"); // Load scripts modulesLoadHelper(g_scripts().loadScripts(datapackFolder + "/scripts", false, false), datapackFolder + "/scripts"); // Load monsters