TheoAllen

Realistic Light menu Add-on

May 24th, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.00 KB | None | 0 0
  1. class Scene_Menu < Scene_MenuBase
  2.  
  3.   alias pre_create_light start
  4.   def start
  5.     pre_create_light
  6.     create_realistic_lights
  7.   end
  8.  
  9.   def create_realistic_lights
  10.     return unless use_realistic_lights?
  11.     @theo_lights = Spriteset_Light.new(@viewport) unless @theo_lights
  12.   end
  13.  
  14.   def use_realistic_lights?
  15.     !$game_switches[THEO::LIGHT::DISABLE_SWITCH_ID]
  16.   end
  17.  
  18.   alias pre_realistic_update_light update
  19.   def update
  20.     pre_realistic_update_light
  21.     update_realistic_light
  22.     check_light_existence
  23.   end
  24.  
  25.   def update_realistic_light
  26.     @theo_lights.update if @theo_lights
  27.   end
  28.  
  29.   def check_light_existence
  30.     $game_switches[THEO::LIGHT::DISABLE_SWITCH_ID] ?
  31.       dispose_real_lights : create_realistic_lights
  32.   end
  33.  
  34.   alias pre_dispose_real_lights terminate
  35.   def terminate
  36.     pre_dispose_real_lights
  37.     dispose_real_lights
  38.   end
  39.  
  40.   def dispose_real_lights
  41.     if @theo_lights
  42.       @theo_lights.dispose
  43.       @theo_lights = nil
  44.     end
  45.   end
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment