mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Only fire door events when the door is reached
This commit is contained in:
@@ -16,8 +16,11 @@ class OpenDoorAction < DistancedAction
|
|||||||
end
|
end
|
||||||
|
|
||||||
def executeAction
|
def executeAction
|
||||||
mob.turn_to(@door.position)
|
if $world.submit(OpenDoorEvent.new(mob, @door))
|
||||||
DoorUtil.toggle(@door)
|
mob.turn_to(@door.position)
|
||||||
|
DoorUtil.toggle(@door)
|
||||||
|
end
|
||||||
|
|
||||||
stop
|
stop
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -44,12 +47,8 @@ on :message, :first_object_action do |player, message|
|
|||||||
id = message.id
|
id = message.id
|
||||||
|
|
||||||
if DoorUtil.door?(id)
|
if DoorUtil.door?(id)
|
||||||
position = message.position
|
door = DoorUtil.get_door_object(message.position, id)
|
||||||
door = DoorUtil.get_door_object(position, id)
|
player.start_action(OpenDoorAction.new(player, door)) unless door.nil?
|
||||||
|
|
||||||
if !door.nil? && $world.submit(OpenDoorEvent.new(player, door))
|
|
||||||
player.start_action(OpenDoorAction.new(player, door))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user