Skip to content

Commit

Permalink
fix: bath tube for custom data
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires committed Oct 24, 2024
1 parent b4af6d7 commit bb6862c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local bathtubDrain = Action()

function bathtubDrain.onUse(player, item, fromPosition, itemEx, toPosition)
local tile = Tile(fromPosition)
if tile:getTopCreature() then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
local playerBathTub = 26087

local bathtubEnter = MoveEvent()

function bathtubEnter.onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
local player = creature:getPlayer()
if not player then
return true
end

local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({ lookTypeEx = playerBathTub })
condition:setOutfit({ lookTypeEx = 26087 })
condition:setTicks(-1)

position:sendMagicEffect(CONST_ME_WATERSPLASH)
item:transform(BATHTUB_FILLED_NOTMOVABLE)
creature:addCondition(condition)
player:addCondition(condition)
return true
end

bathtubEnter:type("stepin")
bathtubEnter:id(BATHTUB_FILLED)
bathtubEnter:register()

local bathtubExit = MoveEvent()

function bathtubExit.onStepOut(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
local player = creature:getPlayer()
if not player then
return true
end

item:transform(BATHTUB_FILLED)
creature:removeCondition(CONDITION_OUTFIT)
player:removeCondition(CONDITION_OUTFIT)
return true
end

bathtubExit:type("stepout")
bathtubExit:id(BATHTUB_FILLED_NOTMOVABLE)
bathtubExit:register()

0 comments on commit bb6862c

Please sign in to comment.