Advertisement
roninator2

Yanfly Move Restrict Regions - mod

Dec 8th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 23.86 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Move Restrict Region v1.03e
  4. # -- Last Updated: 2021.03.07
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. # -- additions by Roninator2
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-MoveRestrictRegion"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2021.12.17 - Added Feature: player confined to region # roninator2
  17. # 2021.03.07 - Added Feature: npc unrestricted # roninator2
  18. # 2019.07.25 - Added Feature: <player fly: x> # roninator2 for Galv Superman
  19. # 2019.05.27 - Added Feature: <player block: x> # roninator2
  20. # 2018.10.14 - Added Feature: <vehicle restrict: x> # roninator2
  21. # 2012.08.26 - Added Feature: <all restrict: x>
  22. # 2011.12.26 - Bug Fixed: Player Restricted Regions.
  23. # 2011.12.15 - Started Script and Finished.
  24. #
  25. #==============================================================================
  26. # ▼ Introduction
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # Not everybody wants NPC's to travel all over the place. With this script, you
  29. # can set NPC's to be unable to move pass tiles marked by a specified Region.
  30. # Simply draw out the area you want to enclose NPC's in on and they'll be
  31. # unable to move past it unless they have Through on. Likewise, there are
  32. # regions that you can prevent the player from moving onto, too!
  33. #
  34. #==============================================================================
  35. # ▼ Instructions
  36. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37. # To install this script, open up your script editor and copy/paste this script
  38. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Map Notetags - These notetags go in the map notebox in a map's properties.
  42. # -----------------------------------------------------------------------------
  43. # <all restrict: x>
  44. # <all restrict: x, x>
  45. # Players and NPC's on the map will be unable to move past region x even if
  46. # they have the "through" flag set. The only thing that can go past is if the
  47. # player is using the debug through flag. Draw out the area you want to close
  48. # the player and NPC's in with the regions and both will be unable to move onto
  49. # any of those tiles marked by region x. If you want to have more regions
  50. # restrict NPC's, insert multiples of this tag.
  51. #
  52. # <npc restrict: x>
  53. # <npc restrict: x, x>
  54. # NPC's on that map will be unable to move past regions x unless they have a
  55. # "Through" flag on. Draw out the area you want to close NPC's in with the
  56. # regions and the NPC's will be unable to move onto any of those tiles marked
  57. # by region x. If you want to have more regions restrict NPC's, insert
  58. # multiples of this tag.
  59. #
  60. # <player restrict: x>
  61. # <player restrict: x, x>
  62. # Players will not be able to move on tiles marked by region x unless the
  63. # player has a "Through" flag on. Draw out the area you want to close the
  64. # player in with the regions and the player will be unable to move past any of
  65. # those tiles marked by region x. If you want to have more regions restrict the
  66. # player, insert multiples of this tag.
  67. #
  68. # <player block: x>
  69. # <player block: x, x>
  70. # Players will not be able to move on tiles marked by region x even if
  71. # they have the "through" flag set. The only thing that can go past is if the
  72. # player is using the debug through flag. Draw out the area you want to close the
  73. # player in with the regions and the player will be unable to move past any of
  74. # those tiles marked by region x. If you want to have more regions restrict the
  75. # player, insert multiples of this tag.
  76. #
  77. # <player fly: x>
  78. # <player fly: x, x>
  79. # Players will not be able to move on tiles marked by region x even if
  80. # they have the "through" flag set. The only thing that can go past is if the
  81. # player is using the debug through flag. Draw out the area you want to close the
  82. # player in with the regions and the player will be unable to move past any of
  83. # those tiles marked by region x. If you want to have more regions restrict the
  84. # player, insert multiples of this tag.
  85. #
  86. # <vehicle restrict: x>
  87. # <vehicle restrict: x, x>
  88. # Players will not be able to move on tiles marked by region x unless the
  89. # player has a "Through" flag on. Draw out the area you want to close the
  90. # player in with the regions and the player will be unable to move past any of
  91. # those tiles marked by region x. If you want to have more regions restrict the
  92. # player, insert multiples of this tag.
  93. #
  94. # player confined -
  95. # Players will not be able to move off of tiles marked by region x unless the
  96. # player has a "Through" flag on. Draw out the area you want to close the
  97. # player in with the regions and the player will be unable to move past any of
  98. # those tiles marked by region x.
  99. # change the variable value to change the region.
  100. # turn the switch on to enable the confinement
  101. # modifications need to be made if using more than 1 region at a time.
  102. #
  103. #==============================================================================
  104. # ▼ Compatibility
  105. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  106. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  107. # it will run with RPG Maker VX without adjusting.
  108. #
  109. #==============================================================================
  110.  
  111. module YEA
  112.   module MOVE_RESTRICT
  113.  
  114.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  115.     # - Default Completely Restricted Regions -
  116.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  117.     # If you want there to always be a region ID that will forbid both the
  118.     # player and NPC's from passing through, insert that region ID into the
  119.     # array below. This effect will completely block out both players and NPC's
  120.     # even if they have the "through" flag. However, it does not block the
  121.     # debug_through flag for players.
  122.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  123.     DEFAULT_ALL = [60]
  124.  
  125.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  126.     # - Default Player Restricted Regions -
  127.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  128.     # If you want there to always be a region ID that will forbid the player
  129.     # from passing through, insert that region ID into the array below.
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     DEFAULT_PLAYER = [61]
  132.  
  133.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  134.     # - Default Player Blocked Regions -
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # If you want there to always be a region ID that will forbid the player
  137.     # from passing through, insert that region ID into the array below.
  138.     # Including if @through is set.
  139.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  140.     PLAYER_BLOCK = [59]
  141.  
  142.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  143.     # - Default Player fly Regions -
  144.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  145.     # If you want there to always be a region ID that will forbid the player
  146.     # from passing through, insert that region ID into the array below.
  147.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148.     PLAYER_FLY = [58]
  149.    
  150.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  151.     # - Default NPC Restricted Regions -
  152.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153.     # If you want there to always be a region ID that will forbid NPC's from
  154.     # passing through, insert that region ID into the array below.
  155.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  156.     DEFAULT_NPC = [62]
  157.  
  158.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  159.     # - Override NPC Restricted Regions -
  160.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  161.     # If you want an NPC to be unrestricted, add the name below to the
  162.     # event name
  163.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  164.     EXCLUDE_NPC = "flying"
  165.  
  166.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  167.     # - Default Player Restricted Regions -
  168.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  169.     # If you want there to always be a region ID that will forbid the player
  170.     # from passing through, insert that region ID into the array below.
  171.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  172.     DEFAULT_VEHICLE = [63]
  173.  
  174.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  175.     # - Default Player Confined Regions -
  176.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  177.     # Set the conditions below to restrict a play to a specific region
  178.     # while the player is on that specific region.
  179.     # Turn the switch on to confine and off to release.
  180.     # change the variable value to change the region.
  181.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  182.     PLAYER_CONFINE = 10 # variable to hold the region currently confined to
  183.     PLAYER_CONFINE_SWITCH = 10 # switch to enable this function
  184.  
  185.   end # MOVE_RESTRICT
  186. end # YEA
  187.  
  188. #==============================================================================
  189. # ▼ Editting anything past this point may potentially result in causing
  190. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  191. # halitosis so edit at your own risk.
  192. #==============================================================================
  193.  
  194. module YEA
  195.   module REGEXP
  196.   module MAP
  197.  
  198.     ALL_RESTRICT =
  199.       /<(?:ALL_RESTRICT|all restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  200.     NPC_RESTRICT =
  201.       /<(?:NPC_RESTRICT|npc restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  202.     PLAYER_RESTRICT =
  203.       /<(?:PLAYER_RESTRICT|player restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  204.     PLAYER_BLOCK =
  205.       /<(?:PLAYER_BLOCK|player block):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  206.     PLAYER_FLY =
  207.       /<(?:PLAYER_FLY|player fly):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  208.     VEHICLE_RESTRICT =
  209.       /<(?:VEHICLE_RESTRICT|vehicle restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  210.  
  211.   end # MAP
  212.   end # REGEXP
  213. end # YEA
  214.  
  215. #==============================================================================
  216. # ■ RPG::Map
  217. #==============================================================================
  218.  
  219. class RPG::Map
  220.  
  221.   #--------------------------------------------------------------------------
  222.   # public instance variables
  223.   #--------------------------------------------------------------------------
  224.   attr_accessor :all_restrict_regions
  225.   attr_accessor :npc_restrict_regions
  226.   attr_accessor :player_restrict_regions
  227.   attr_accessor :player_block_regions
  228.   attr_accessor :player_fly_regions
  229.   attr_accessor :player_confine_region
  230.   attr_accessor :player_confine_region_switch
  231.   attr_accessor :vehicle_restrict_regions
  232.  
  233.   #--------------------------------------------------------------------------
  234.   # common cache: load_notetags_mrr
  235.   #--------------------------------------------------------------------------
  236.   def load_notetags_mrr
  237.     @all_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_ALL.clone
  238.     @npc_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_NPC.clone
  239.     @player_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_PLAYER.clone
  240.     @player_block_regions = YEA::MOVE_RESTRICT::PLAYER_BLOCK.clone
  241.     @player_fly_regions = YEA::MOVE_RESTRICT::PLAYER_FLY.clone
  242.     @player_confine_region = YEA::MOVE_RESTRICT::PLAYER_CONFINE
  243.     @player_confine_region_switch = YEA::MOVE_RESTRICT::PLAYER_CONFINE_SWITCH
  244.     @vehicle_restrict_regions = YEA::MOVE_RESTRICT::DEFAULT_VEHICLE.clone
  245.     #---
  246.     self.note.split(/[\r\n]+/).each { |line|
  247.       case line
  248.       #---
  249.       when YEA::REGEXP::MAP::ALL_RESTRICT
  250.         $1.scan(/\d+/).each { |num|
  251.         @all_restrict_regions.push(num.to_i) if num.to_i > 0 }
  252.       when YEA::REGEXP::MAP::NPC_RESTRICT
  253.         $1.scan(/\d+/).each { |num|
  254.         @npc_restrict_regions.push(num.to_i) if num.to_i > 0 }
  255.       when YEA::REGEXP::MAP::PLAYER_RESTRICT
  256.         $1.scan(/\d+/).each { |num|
  257.         @player_restrict_regions.push(num.to_i) if num.to_i > 0 }
  258.       when YEA::REGEXP::MAP::PLAYER_BLOCK
  259.         $1.scan(/\d+/).each { |num|
  260.         @player_block_regions.push(num.to_i) if num.to_i > 0 }
  261.       when YEA::REGEXP::MAP::PLAYER_FLY
  262.         $1.scan(/\d+/).each { |num|
  263.         @player_fly_regions.push(num.to_i) if num.to_i > 0 }
  264.       when YEA::REGEXP::MAP::VEHICLE_RESTRICT
  265.         $1.scan(/\d+/).each { |num|
  266.         @vehicle_restrict_regions.push(num.to_i) if num.to_i > 0 }
  267.       #---
  268.       end
  269.     } # self.note.split
  270.     #---
  271.   end
  272.  
  273. end # RPG::Map
  274.  
  275. #==============================================================================
  276. # ■ Game_Map
  277. #==============================================================================
  278.  
  279. class Game_Map
  280.  
  281.   #--------------------------------------------------------------------------
  282.   # alias method: setup
  283.   #--------------------------------------------------------------------------
  284.   alias game_map_setup_mrr setup
  285.   def setup(map_id)
  286.     game_map_setup_mrr(map_id)
  287.     @map.load_notetags_mrr
  288.   end
  289.  
  290.   #--------------------------------------------------------------------------
  291.   # new method: all_restrict_regions
  292.   #--------------------------------------------------------------------------
  293.   def all_restrict_regions
  294.     return @map.all_restrict_regions
  295.   end
  296.  
  297.   #--------------------------------------------------------------------------
  298.   # new method: npc_restrict_regions
  299.   #--------------------------------------------------------------------------
  300.   def npc_restrict_regions
  301.     return @map.npc_restrict_regions
  302.   end
  303.  
  304.   #--------------------------------------------------------------------------
  305.   # new method: player_restrict_regions
  306.   #--------------------------------------------------------------------------
  307.   def player_restrict_regions
  308.     return @map.player_restrict_regions
  309.   end
  310.  
  311.   #--------------------------------------------------------------------------
  312.   # new method: player_restrict_regions
  313.   #--------------------------------------------------------------------------
  314.   def player_block_regions
  315.     return @map.player_block_regions
  316.   end
  317.  
  318.   #--------------------------------------------------------------------------
  319.   # new method: player_confine_region
  320.   #--------------------------------------------------------------------------
  321.   def player_confine_region
  322.     return $game_variables[@map.player_confine_region]
  323.   end
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # new method: player_confine_region_switch
  327.   #--------------------------------------------------------------------------
  328.   def player_confine_region_switch
  329.     return $game_switches[@map.player_confine_region_switch]
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # new method: player_fly_regions    Galv Superman addon
  334.   #--------------------------------------------------------------------------
  335.   def player_fly_regions
  336.     return @map.player_fly_regions
  337.   end
  338.  
  339.   #--------------------------------------------------------------------------
  340.   # new method: player_restrict_regions
  341.   #--------------------------------------------------------------------------
  342.   def vehicle_restrict_regions
  343.     return @map.vehicle_restrict_regions
  344.   end
  345.  
  346. end # Game_Map
  347.  
  348. #==============================================================================
  349. # ■ Game_CharacterBase
  350. #==============================================================================
  351.  
  352. class Game_CharacterBase
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # alias method: passable?
  356.   #--------------------------------------------------------------------------
  357.   alias game_characterbase_passable_mrr passable?
  358.   def passable?(x, y, d)
  359.         return true if npc_exclude_allow?(x, y, d)
  360.     return false if npc_region_forbid?(x, y, d)
  361.     return false if player_confine_region?(x, y, d)
  362.     return false if player_region_forbid?(x, y, d)
  363.     return false if player_block_forbid?(x, y, d)
  364.     return false if player_fly_forbid?(x, y, d) unless !@in_air
  365.     return false if vehicle_region_forbid?(x, y, d)
  366.     return game_characterbase_passable_mrr(x, y, d)
  367.   end
  368.  
  369.   #--------------------------------------------------------------------------
  370.   # new method: npc_forbid?
  371.   #--------------------------------------------------------------------------
  372.   def npc_region_forbid?(x, y, d)
  373.     return false unless self.is_a?(Game_Event)
  374.     region = 0
  375.     case d
  376.     when 1; region = $game_map.region_id(x-1, y+1)
  377.     when 2; region = $game_map.region_id(x+0, y+1)
  378.     when 3; region = $game_map.region_id(x+1, y+1)
  379.     when 4; region = $game_map.region_id(x-1, y+0)
  380.     when 5; region = $game_map.region_id(x+0, y+0)
  381.     when 6; region = $game_map.region_id(x+1, y+0)
  382.     when 7; region = $game_map.region_id(x-1, y-1)
  383.     when 8; region = $game_map.region_id(x+0, y-1)
  384.     when 9; region = $game_map.region_id(x+1, y-1)
  385.     end
  386.     return true if $game_map.all_restrict_regions.include?(region)
  387.     return false if @through
  388.     return $game_map.npc_restrict_regions.include?(region)
  389.   end
  390.  
  391.   #--------------------------------------------------------------------------
  392.   # new method: npc_exclude_allow?
  393.   #--------------------------------------------------------------------------
  394.   def npc_exclude_allow?(x, y, d)
  395.     return false unless self.is_a?(Game_Event)
  396.     region = 0
  397.     case d
  398.     when 1; region = $game_map.region_id(x-1, y+1)
  399.     when 2; region = $game_map.region_id(x+0, y+1)
  400.     when 3; region = $game_map.region_id(x+1, y+1)
  401.     when 4; region = $game_map.region_id(x-1, y+0)
  402.     when 5; region = $game_map.region_id(x+0, y+0)
  403.     when 6; region = $game_map.region_id(x+1, y+0)
  404.     when 7; region = $game_map.region_id(x-1, y-1)
  405.     when 8; region = $game_map.region_id(x+0, y-1)
  406.     when 9; region = $game_map.region_id(x+1, y-1)
  407.     end
  408.     text = "#{YEA::MOVE_RESTRICT::EXCLUDE_NPC}"
  409.     if @event.name.downcase.include?(text.downcase)
  410.       return true
  411.     end
  412.     return false
  413.   end
  414.  
  415.   #--------------------------------------------------------------------------
  416.   # new method: player_region_forbid?
  417.   #--------------------------------------------------------------------------
  418.   def player_region_forbid?(x, y, d)
  419.     return false unless self.is_a?(Game_Player)
  420.     return false if debug_through?
  421.     region = 0
  422.     case d
  423.     when 1; region = $game_map.region_id(x-1, y+1)
  424.     when 2; region = $game_map.region_id(x+0, y+1)
  425.     when 3; region = $game_map.region_id(x+1, y+1)
  426.     when 4; region = $game_map.region_id(x-1, y+0)
  427.     when 5; region = $game_map.region_id(x+0, y+0)
  428.     when 6; region = $game_map.region_id(x+1, y+0)
  429.     when 7; region = $game_map.region_id(x-1, y-1)
  430.     when 8; region = $game_map.region_id(x+0, y-1)
  431.     when 9; region = $game_map.region_id(x+1, y-1)
  432.     end
  433.     return true if $game_map.all_restrict_regions.include?(region)
  434.     return false if @through
  435.     return $game_map.player_restrict_regions.include?(region)
  436.   end
  437.  
  438.   #--------------------------------------------------------------------------
  439.   # new method: player_region_forbid?
  440.   #--------------------------------------------------------------------------
  441.   def player_block_forbid?(x, y, d)
  442.     return false unless self.is_a?(Game_Player)
  443.     return false if debug_through?
  444.     region = 0
  445.     case d
  446.     when 1; region = $game_map.region_id(x-1, y+1)
  447.     when 2; region = $game_map.region_id(x+0, y+1)
  448.     when 3; region = $game_map.region_id(x+1, y+1)
  449.     when 4; region = $game_map.region_id(x-1, y+0)
  450.     when 5; region = $game_map.region_id(x+0, y+0)
  451.     when 6; region = $game_map.region_id(x+1, y+0)
  452.     when 7; region = $game_map.region_id(x-1, y-1)
  453.     when 8; region = $game_map.region_id(x+0, y-1)
  454.     when 9; region = $game_map.region_id(x+1, y-1)
  455.     end
  456.     return true if $game_map.all_restrict_regions.include?(region)
  457.     return true if $game_map.all_restrict_regions.include?(region) && @through || @in_air
  458.     return $game_map.player_block_regions.include?(region)
  459.   end
  460.  
  461.   #--------------------------------------------------------------------------
  462.   # new method: player_region_forbid?
  463.   #--------------------------------------------------------------------------
  464.   def vehicle_region_forbid?(x, y, d)
  465.     return false unless self.is_a?(Game_Vehicle)
  466.     return false if debug_through?
  467.     region = 0
  468.     case d
  469.     when 1; region = $game_map.region_id(x-1, y+1)
  470.     when 2; region = $game_map.region_id(x+0, y+1)
  471.     when 3; region = $game_map.region_id(x+1, y+1)
  472.     when 4; region = $game_map.region_id(x-1, y+0)
  473.     when 5; region = $game_map.region_id(x+0, y+0)
  474.     when 6; region = $game_map.region_id(x+1, y+0)
  475.     when 7; region = $game_map.region_id(x-1, y-1)
  476.     when 8; region = $game_map.region_id(x+0, y-1)
  477.     when 9; region = $game_map.region_id(x+1, y-1)
  478.     end
  479.     return true if $game_map.all_restrict_regions.include?(region)
  480.     return false if @through
  481.     return $game_map.vehicle_restrict_regions.include?(region)
  482.   end
  483.  
  484.   #--------------------------------------------------------------------------
  485.   # new method: player_fly_forbid? - Galv superman addon
  486.   #--------------------------------------------------------------------------
  487.   def player_fly_forbid?(x, y, d)
  488.     return false unless self.is_a?(Game_Player)
  489.     return false if debug_through?
  490.     region = 0
  491.     case d
  492.     when 1; region = $game_map.region_id(x-1, y+1)
  493.     when 2; region = $game_map.region_id(x+0, y+1)
  494.     when 3; region = $game_map.region_id(x+1, y+1)
  495.     when 4; region = $game_map.region_id(x-1, y+0)
  496.     when 5; region = $game_map.region_id(x+0, y+0)
  497.     when 6; region = $game_map.region_id(x+1, y+0)
  498.     when 7; region = $game_map.region_id(x-1, y-1)
  499.     when 8; region = $game_map.region_id(x+0, y-1)
  500.     when 9; region = $game_map.region_id(x+1, y-1)
  501.     end
  502.     return true if $game_map.all_restrict_regions.include?(region) unless @in_air
  503.     return true if $game_map.player_fly_regions.include?(region) && @in_air
  504.     return $game_map.player_fly_regions.include?(region)
  505.   end
  506.  
  507.   #--------------------------------------------------------------------------
  508.   # new method: player_region_forbid?
  509.   #--------------------------------------------------------------------------
  510.   def player_confine_region?(x, y, d)
  511.     return false unless self.is_a?(Game_Player)
  512.     return false if debug_through?
  513.     region = 0
  514.     case d
  515.     when 1; region = $game_map.region_id(x-1, y+1)
  516.     when 2; region = $game_map.region_id(x+0, y+1)
  517.     when 3; region = $game_map.region_id(x+1, y+1)
  518.     when 4; region = $game_map.region_id(x-1, y+0)
  519.     when 5; region = $game_map.region_id(x+0, y+0)
  520.     when 6; region = $game_map.region_id(x+1, y+0)
  521.     when 7; region = $game_map.region_id(x-1, y-1)
  522.     when 8; region = $game_map.region_id(x+0, y-1)
  523.     when 9; region = $game_map.region_id(x+1, y-1)
  524.     end
  525.     if $game_map.player_confine_region_switch == true
  526.     return false if $game_map.player_confine_region == region
  527.     return true
  528.     else
  529.     return $game_map.player_block_regions.include?(region)
  530.     end
  531.   end
  532.  
  533.  
  534. end # Game_CharacterBase
  535.  
  536. #==============================================================================
  537. #
  538. # ▼ End of File
  539. #
  540. #==============================================================================
  541.  
  542.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement