#==============================================================================
#  @> Disable Move to Direction ~ Karin's Soulkeeper, 2015
#------------------------------------------------------------------------------
#   v1.0 - May 23 : Started & finished.
#------------------------------------------------------------------------------
#  * Description:
#    This script disables movement in a specified direction.
#------------------------------------------------------------------------------
#  * To Use:
#    Put this script below Materials and above Main.
#
#    To enable/disable a direction, perform the script call:
#        enable_move(:SYMBOL)
#        disable_move(:SYMBOL)
#    ~ Where :SYMBOL is any of the symbols specified in the module below.
#------------------------------------------------------------------------------
#  * Compatibility:
#    This script aliases Game_Player.move_by_input
#------------------------------------------------------------------------------
#  * Terms:
#    Free to use in any kind of project, with or without credit. I wouldn't
#    really mind. Though I'd appreciate it! (^w^)/
#    Just don't, you know, claim that you made this here script yourself,
#    Because that's just mean (._.)
#==============================================================================

#CUSTOMIZATION OPTIONS
module KS
  module Disabled_Dirs
  #--------------------------------------------------------------------------
  # Set the symbol names and their corresponding direction.
  #--------------------------------------------------------------------------
  # - No need to change, unless if you have Diagonal Movement, or something.
  #--------------------------------------------------------------------------
  INPUT = {
     :DOWN  => 2,
     :LEFT  => 4,
     :RIGHT => 6,
     :UP    => 8
  }# FFS, DO NOT REMOVE
  
# END OF CUSTOMIZATION OPTIONS
  Disabled = []
  end
end

#==============================================================================
# ** Modified Class: Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * New: Disable Direction
  #--------------------------------------------------------------------------
  def disable_move(dir)
    dir = KS::Disabled_Dirs::INPUT[dir]
    KS::Disabled_Dirs::Disabled.push(dir) unless KS::Disabled_Dirs::Disabled.include?(dir)
  end
  
  #--------------------------------------------------------------------------
  # * New: Enable Direction
  #--------------------------------------------------------------------------
  def enable_move(dir)
    dir = KS::Disabled_Dirs::INPUT[dir]
    KS::Disabled_Dirs::Disabled.delete(dir) if KS::Disabled_Dirs::Disabled.include?(dir)
  end
end

#==============================================================================
# ** Aliased Class: Game_Player
#==============================================================================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias: Processing of Movement via Input from Directional Buttons
  #--------------------------------------------------------------------------
  alias move_by_input_orig move_by_input
  def move_by_input
    return if KS::Disabled_Dirs::Disabled.include?(Input.dir4)
    move_by_input_orig
  end
end