Tweaked code for interacting with a follower

This commit is contained in:
Maruno17
2021-12-12 00:06:33 +00:00
parent 85bf1a334c
commit 2ddedfb935

View File

@@ -21,8 +21,19 @@ class FollowerData
@direction = direction @direction = direction
@character_name = character_name @character_name = character_name
@character_hue = character_hue @character_hue = character_hue
@name = nil
@common_event_id = nil
@visible = true @visible = true
end end
def interact(event)
return if !event || event.list.size <= 1
return if !@common_event_id
# Start event
$game_map.refresh if $game_map.need_refresh
event.lock
pbMapInterpreter.setup(event.list, event.id, event.map.map_id)
end
end end
#=============================================================================== #===============================================================================
@@ -181,26 +192,16 @@ class Game_FollowerFactory
facing_tile = $map_factory.getFacingTile facing_tile = $map_factory.getFacingTile
# Assumes player is 1x1 tile in size # Assumes player is 1x1 tile in size
each_follower do |event, follower| each_follower do |event, follower|
next if !follower.common_event_id if event.at_coordinate?($game_player.x, $game_player.y) # Underneath player
next if event.jumping? next if !event.over_trigger?
if event.at_coordinate?($game_player.x, $game_player.y)
# On same position
if event.over_trigger? && event.list.size > 1
# Start event
$game_map.refresh if $game_map.need_refresh
event.lock
pbMapInterpreter.setup(event.list, event.id, event.map.map_id)
end
elsif facing_tile && event.map.map_id == facing_tile[0] && elsif facing_tile && event.map.map_id == facing_tile[0] &&
event.at_coordinate?(facing_tile[1], facing_tile[2]) event.at_coordinate?(facing_tile[1], facing_tile[2]) # On facing tile
# On facing tile next if event.over_trigger?
if !event.over_trigger? && event.list.size > 1 else # Somewhere else
# Start event next
$game_map.refresh if $game_map.need_refresh
event.lock
pbMapInterpreter.setup(event.list, event.id, event.map.map_id)
end
end end
next if event.jumping?
follower.interact(event)
end end
end end
end end