Advertisement
LeonMMS

LM² - Ignore near_screen - Ignorar near_screen

Mar 6th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.40 KB | None | 0 0
  1. #       LM² - Ignore near_screen - Ignorar near_screen
  2. #            26/02/18 - by LeonM²
  3. # Log:
  4. # 03/05/18 - Update - Better code | Atualização - Melhor código
  5. # En:
  6. #   To ignore near_screen
  7. #   Put a comment with
  8. #   <ignore_near>
  9. #   To stop ignore when changing to a new event page
  10. #   Put a coment in the new page with
  11. #   <stop_ignore_near>
  12. # Pt-Br:
  13. #   Para ignorar near_screen
  14. #   Adicione um comentário com
  15. #   <ignore_near>
  16. #   Para parar de ignorar o evento numa nova página
  17. #   Adicione um comentário com
  18. #   <stop_ignore_near>
  19. class Game_Event < Game_Character
  20.   alias lmm_initialize_ge initialize
  21.   def initialize(map_id, event)
  22.     lmm_initialize_ge(map_id, event)
  23.     @lmm_ignore_near = false
  24.     get_setup
  25.   end
  26.   def get_setup
  27.     return if !@page or !@page.list or @page.list.size <= 0
  28.     @page.list.each do |item|
  29.       next unless item && (item.code == 108 || item.code == 408)
  30.       if item.parameters[0].match(/<ignore_near>/)
  31.         @lmm_ignore_near = true
  32.       elsif item.parameters[0].match(/<stop_ignore_near>/)
  33.         @lmm_ignore_near = false
  34.       end
  35.     end  
  36.   end  
  37.   alias lmm_near_screen_ge near_the_screen?
  38.   def near_the_screen?(dx = 12, dy = 8)
  39.     return true if @lmm_ignore_near
  40.     lmm_near_screen_ge(dx, dy)
  41.   end
  42.   alias lmm_setup_page_ge setup_page
  43.   def setup_page(new_page)
  44.     lmm_setup_page_ge(new_page)
  45.     get_setup
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement