Skip to content

Commit

Permalink
fix: disable ladder effect and add support for all ladders (#3114)
Browse files Browse the repository at this point in the history
This PR updates the teleport action for ladders by disabling the effect
when using the ladder and modifying the logic to support all ladder IDs
dynamically.

1. The effect of moving up or down is now disabled when using the
ladder.
2. The script now automatically recognizes all ladder IDs, removing the
need for hardcoded values.
  • Loading branch information
omarcopires authored Nov 13, 2024
1 parent 73f5c5a commit 6b48370
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
12 changes: 0 additions & 12 deletions data-canary/scripts/actions/other/sewer.lua

This file was deleted.

19 changes: 0 additions & 19 deletions data-otservbr-global/scripts/actions/other/teleport.lua

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local setting = { 1948, 1968, 5542, 20474, 20475, 28656, 31262 }
local ladderTable = Game.getLadderIds()

local ladder = Action()

function ladder.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if table.contains(setting, item.itemid) then
if table.contains(ladderTable, item.itemid) then
fromPosition:moveUpstairs()
else
fromPosition.z = fromPosition.z + 1
Expand All @@ -18,8 +18,5 @@ function ladder.onUse(player, item, fromPosition, target, toPosition, isHotkey)
return true
end

for index, value in ipairs(setting) do
ladder:id(value)
end

ladder:id(435, unpack(ladderTable))
ladder:register()

0 comments on commit 6b48370

Please sign in to comment.