Corrected MapFactory#isPassable?

This commit is contained in:
Maruno17
2020-09-09 20:30:43 +01:00
parent 3e1c482c21
commit 925c12c831

View File

@@ -168,19 +168,22 @@ class PokemonMapFactory
return false if !map return false if !map
return false if !map.valid?(x, y) return false if !map.valid?(x, y)
return true if thisEvent.through return true if thisEvent.through
if thisEvent==$game_player # Check passability of tile
if thisEvent.is_a?(Game_Player)
return false unless ($DEBUG && Input.press?(Input::CTRL)) || return false unless ($DEBUG && Input.press?(Input::CTRL)) ||
map.passable?(x, y, 0, thisEvent) map.passable?(x, y, 0, thisEvent)
else else
return false unless map.passable?(x, y, 0, thisEvent) return false unless map.passable?(x, y, 0, thisEvent)
end end
# Check passability of event(s) in that spot
for event in map.events.values for event in map.events.values
next if event.x != x || event.y != y next if event.x != x || event.y != y || event == thisEvent
return false if !event.through && event.character_name != "" return false if !event.through && event.character_name != ""
end end
if thisEvent.is_a?(Game_Player) # Check passability of player
if thisEvent.x == x and thisEvent.y == y if !thisEvent.is_a?(Game_Player)
return false if !thisEvent.through && thisEvent.character_name!="" if $game_map.map_id == mapID && $game_player.x == x && $game_player.y == y
return false if !$game_player.through && $game_player.character_name != ""
end end
end end
return true return true