Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # ***TPS-Addon: Tints for Periods***
- #
- # Author: eugene222 (Evgenij)
- # Version: 1.3a
- # Date: 01.09.2014
- # Requires: Time and Period System V. 1.2 by eugene222
- #===============================================================================
- # Changelog:
- #
- # 04.04.2014 - V. 1.0-alpha1 - script created
- # 05.04.2014 - V. 1.0 - released the script
- # 09.04.2014 - V. 1.1 - made this compatible with Core V. 1.1
- # 21.05.2014 - V. 1.2 - tints for phases added
- # 31.08.2014 - V. 1.3 - experimental khas support (cant test this currently)
- # 01.09.2014 - V. 1.3a - Tested Khas support and fixed few things
- #
- #===============================================================================
- # Terms of Use:
- # You can use this script for free and commercial projects as long as you give
- # credits.
- #===============================================================================
- # Beschreibung:
- # Tints for periods.
- #
- # Scriptcalls:
- # $game_time.stop_tint # stop automatic tints
- # $game_time.resume_tint # resume automatic tints
- #
- #===============================================================================
- module TPS_TINT
- #-----------------------------------------------------------------------------
- # Use Battle Tints?
- #-----------------------------------------------------------------------------
- TONE_BATTLE = true
- #-----------------------------------------------------------------------------
- # FADE TIME FOR TINTS (in Frames)
- #-----------------------------------------------------------------------------
- FADE_TIME = 60
- #-----------------------------------------------------------------------------
- # ENABLE THIS WHEN USING KHAS AWESOME LIGHT EFFECTS
- #-----------------------------------------------------------------------------
- USE_KHAS_TINTING = false
- #-----------------------------------------------------------------------------
- DEFAULT = { # Diese Zeile nicht verändern!
- #-----------------------------------------------------------------------------
- # THE DEFAULT TINTS
- #-----------------------------------------------------------------------------
- :morning => [-51, -34, -17, 62],
- :forenoon => [-51, -34, -17, 68],
- :noon => [0,0,0,0],
- :afternoon => [0, -17, -34, 0],
- :evening => [0, -34, -68, 34],
- :night => [-102, -85, -34, 85],
- #-----------------------------------------------------------------------------
- } # Diese Zeile nicht verändern!
- #-----------------------------------------------------------------------------
- #-----------------------------------------------------------------------------
- # If you use the Addon: Phases and Weather you can overwrite the default tints
- # for your custom phases
- # - When more than one phase is active and get its own tint, the tint for the
- # phase with the highest priority will be taken (the priority is definable
- # in the other Addon)
- #-----------------------------------------------------------------------------
- PHASES = {
- #-----------------------------------------------------------------------
- # Overwrite some tints for winter.
- #-----------------------------------------------------------------------
- :winter => {
- :noon => [-5, 0, 15, 15],
- :afternoon => [-15, -5, 20, 25],
- :evening => [-80, -85, -34, 51],
- },
- }
- end
- #===============================================================================
- # END OF CONFIG
- #===============================================================================
- $imported ||= {}
- $imported[:e222_tps_tints] = 1.2
- unless $imported[:e222_tps_core]
- msgbox("\"TBS-Addon: Tints for Periods\" requires the \"TBS-Core\" script.\n"+
- "The \"TBS-Core\" script must be placed above the addon script.")
- exit
- end
- #===============================================================================
- # Game_Time
- # aliased methods: initialize, post_set_period
- # new methods: stop_tint, resume_tint
- #===============================================================================
- class Game_Time
- #-----------------------------------------------------------------------------
- attr_reader :tint_screen
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- alias :tps_tint_reinitialize_e222 :reinitialize
- #-----------------------------------------------------------------------------
- def reinitialize
- tps_tint_reinitialize_e222
- @tint_screen = true if @tint_screen.nil?
- @tone_phases ||= []
- end
- #-----------------------------------------------------------------------------
- # Initialize Period
- #-----------------------------------------------------------------------------
- alias :tps_tint_initialize_period_e222 :initialize_period
- #-----------------------------------------------------------------------------
- def initialize_period
- tps_tint_initialize_period_e222
- initialize_tone_phases
- refresh_map_tone(0)
- end
- #-----------------------------------------------------------------------------
- # Refresh Period
- #-----------------------------------------------------------------------------
- alias :tps_tint_refresh_period_e222 :refresh_period
- #-----------------------------------------------------------------------------
- def refresh_period
- tps_tint_refresh_period_e222
- case SceneManager.scene
- when Scene_Map
- refresh_map_tone(TPS_TINT::FADE_TIME)
- when Scene_Battle
- refresh_battle_tone(TPS_TINT::FADE_TIME)
- end
- end
- #-----------------------------------------------------------------------------
- # Refresh Map Tone
- #-----------------------------------------------------------------------------
- def refresh_map_tone(fade_time)
- return unless SceneManager.scene_is?(Scene_Map)
- $game_map.indoor? ? refresh_indoor_tone : refresh_outdoor_tone(fade_time)
- end
- #-----------------------------------------------------------------------------
- # Refresh Indoor Tone
- #-----------------------------------------------------------------------------
- def refresh_indoor_tone
- $game_map.set_screen_tone([0,0,0,0], 0)
- end
- #-----------------------------------------------------------------------------
- # Refresh Outdoor Tone
- #-----------------------------------------------------------------------------
- def refresh_outdoor_tone(fade_time)
- return unless @tint_screen
- $game_map.set_screen_tone(get_tone, fade_time)
- end
- #-----------------------------------------------------------------------------
- # Refresh Battle Tone
- #-----------------------------------------------------------------------------
- def refresh_battle_tone(fade_time)
- return if $game_map.indoor? || !TPS_TINT::TONE_BATTLE || !@tint_screen
- $game_troop.set_screen_tone(get_tone, fade_time)
- end
- #-----------------------------------------------------------------------------
- # Sort Active Phases
- #-----------------------------------------------------------------------------
- if Game_Time.instance_methods.include?(:sort_active_phases)
- alias :tps_tint_sap_e222 :sort_active_phases
- #---------------------------------------------------------------------------
- def sort_active_phases
- tps_tint_sap_e222
- initialize_tone_phases
- end
- #---------------------------------------------------------------------------
- end
- #=============================================================================
- # For Phases and Weather Addon:
- #=============================================================================
- #-----------------------------------------------------------------------------
- # Initialize Tone Phases
- #-----------------------------------------------------------------------------
- def initialize_tone_phases
- return unless $imported[:e222_tps_phases]
- tint_phases = TPS_TINT::PHASES
- @tone_phases = tint_phases.select {|k, v| tone_phase?(k)}.keys
- @tone_phases.sort_by! {|k| TPS_PHASES::CONDITIONS[k][:priority]}
- end
- #-----------------------------------------------------------------------------
- # Tone Phase
- #-----------------------------------------------------------------------------
- def tone_phase
- return @tone_phases.last
- end
- #-----------------------------------------------------------------------------
- # Tone Phase ?
- #-----------------------------------------------------------------------------
- def tone_phase?(key)
- return TPS_PHASES::CONDITIONS[key] && phase_active?(key)
- end
- #-----------------------------------------------------------------------------
- # Get Tone
- #-----------------------------------------------------------------------------
- def get_tone
- if $imported[:e222_tps_phases] && tone_phase
- return phase_tone if phase_tone
- return TPS_TINT::DEFAULT[@current_period]
- else
- return TPS_TINT::DEFAULT[@current_period]
- end
- end
- #-----------------------------------------------------------------------------
- # Phase Tone
- #-----------------------------------------------------------------------------
- def phase_tone
- return TPS_TINT::PHASES[tone_phase][@current_period]
- end
- #-----------------------------------------------------------------------------
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Tint Script Calls:
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #-----------------------------------------------------------------------------
- # Stop Tint
- #-----------------------------------------------------------------------------
- def stop_tint
- @tint_screen = false
- end
- #-----------------------------------------------------------------------------
- # Resume Tine
- #-----------------------------------------------------------------------------
- def resume_tint
- @tint_screen = true
- refresh_period
- end
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # Game_Troop
- # new method: set_screen_tone
- #===============================================================================
- class Game_Troop
- #-----------------------------------------------------------------------------
- # Set Screen Tone
- #-----------------------------------------------------------------------------
- def set_screen_tone(tone, fade_time)
- screen.start_tone_change(Tone.new(*tone), fade_time)
- end
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # Window_TimePopUp
- # new method: set_screen_tone
- #===============================================================================
- class Game_Map
- #-----------------------------------------------------------------------------
- # Set Screen Tone
- #-----------------------------------------------------------------------------
- def set_screen_tone(tone, fade_time)
- if TPS_TINT::USE_KHAS_TINTING
- if fade_time <= 0
- @effect_surface.set_alpha(tone[3])
- @effect_surface.set_color(tone[0], tone[1], tone[2])
- else
- @effect_surface.change_color(fade_time, *tone)
- end
- else
- screen.start_tone_change(Tone.new(*tone), fade_time)
- end
- end
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # SCRIPT END
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement