mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-05-03 11:09:19 +02:00
fix dice to not use while in depot tile
This commit is contained in:
parent
9c5db41fd9
commit
aba06f9298
@ -1,4 +1,20 @@
|
|||||||
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
|
||||||
|
local playerPosition = player:getPosition()
|
||||||
|
local afrompos = {x=playerPosition.x - 1, y=playerPosition.y - 1, z=playerPosition.z}
|
||||||
|
local atopos = {x=playerPosition.x + 1, y=playerPosition.y + 1, z=playerPosition.z}
|
||||||
|
for xa = afrompos.x,atopos.x do
|
||||||
|
for ya = afrompos.y,atopos.y do
|
||||||
|
for za = afrompos.z,atopos.z do
|
||||||
|
local npos = {x = xa,y = ya,z = za}
|
||||||
|
local depotItem = Tile(npos):getItemByType(ITEM_TYPE_DEPOT)
|
||||||
|
if depotItem ~= nil then
|
||||||
|
player:sendCancelMessage("You cannot use this object.")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local dicePosition = item:getPosition()
|
local dicePosition = item:getPosition()
|
||||||
local value = math.random(6)
|
local value = math.random(6)
|
||||||
local isInGhostMode = player:isInGhostMode()
|
local isInGhostMode = player:isInGhostMode()
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user