diff --git a/data-otservbr-global/scripts/actions/other/bath_tub.lua b/data/scripts/actions/objects/bath_tub_drain.lua similarity index 99% rename from data-otservbr-global/scripts/actions/other/bath_tub.lua rename to data/scripts/actions/objects/bath_tub_drain.lua index cd1b3238ca6..a09886a2ad1 100644 --- a/data-otservbr-global/scripts/actions/other/bath_tub.lua +++ b/data/scripts/actions/objects/bath_tub_drain.lua @@ -1,4 +1,5 @@ local bathtubDrain = Action() + function bathtubDrain.onUse(player, item, fromPosition, itemEx, toPosition) local tile = Tile(fromPosition) if tile:getTopCreature() then diff --git a/data-otservbr-global/scripts/movements/others/bath_tub.lua b/data/scripts/movements/bath_tub.lua similarity index 72% rename from data-otservbr-global/scripts/movements/others/bath_tub.lua rename to data/scripts/movements/bath_tub.lua index 7ff7d1fe841..7e81d19782f 100644 --- a/data-otservbr-global/scripts/movements/others/bath_tub.lua +++ b/data/scripts/movements/bath_tub.lua @@ -1,14 +1,13 @@ -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) @@ -17,13 +16,16 @@ function bathtubEnter.onStepIn(creature, item, position, fromPosition) 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) @@ -31,5 +33,6 @@ function bathtubExit.onStepOut(creature, item, position, fromPosition) return true end +bathtubExit:type("stepout") bathtubExit:id(BATHTUB_FILLED_NOTMOVABLE) bathtubExit:register()