Fixed Event Touch events on connected maps triggering themselves by moving around

This commit is contained in:
Maruno17
2024-02-20 19:33:13 +00:00
parent 24dda5128a
commit 1c9ce0b01a
2 changed files with 10 additions and 4 deletions

View File

@@ -370,6 +370,7 @@ end
# Returns whether event is able to walk up to the player.
def pbEventCanReachPlayer?(event, player, distance)
return false if event.map_id != player.map_id
return false if !pbEventFacesPlayer?(event, player, distance)
delta_x = (event.direction == 6) ? 1 : (event.direction == 4) ? -1 : 0
delta_y = (event.direction == 2) ? 1 : (event.direction == 8) ? -1 : 0
@@ -394,6 +395,7 @@ end
# Returns whether the two events are standing next to each other and facing each
# other.
def pbFacingEachOther(event1, event2)
return false if event1.map_id != event2.map_id
return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1)
end