Skip to content

Commit

Permalink
Merge pull request #55 from jprzimba/fix-position-command
Browse files Browse the repository at this point in the history
[fix] /pos command
  • Loading branch information
jprzimba authored Feb 25, 2025
2 parents 18aa76e + f699ad9 commit e749e47
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 163 deletions.
65 changes: 0 additions & 65 deletions .github/ISSUE_TEMPLATE/bug.yaml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/ISSUE_TEMPLATE/request.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

9 changes: 6 additions & 3 deletions data/scripts/talkactions/gm/position.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,28 @@ function position.onSay(player, words, param)
if param == "" then
local pos = player:getPosition()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your current position is: " .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. ".")
return
return true
end

local teleportPosition = param:toPosition()
if not teleportPosition then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Invalid position format. Use one of the following formats: \n/pos {x = ..., y = ..., z = ...}\n/pos Position(..., ..., ...)\n/pos x, y, z.")
return
return true
end

local tile = Tile(teleportPosition)
if not tile then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Invalid tile or position. Send a valid position.")
return
return true
end

player:teleportTo(teleportPosition)
if not player:isInGhostMode() then
teleportPosition:sendMagicEffect(CONST_ME_TELEPORT)
return true
end

return true
end

position:separator(" ")
Expand Down

0 comments on commit e749e47

Please sign in to comment.