stick-the-quick/autoload/FX/FX.gd

245 lines
6.8 KiB
GDScript3
Raw Normal View History

extends Node
const DEFAULT_CAMERA_DISTANCE: float = 8.0
@onready var _bgm := $AudioStreamPlayer as AudioStreamPlayer
@onready var _audio_fader := $AudioFader as AudioFader
@onready var _screen_effects := $ScreenEffects as ScreenEffects
func light_source(
point_at_infinity: Vector3,
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.light_source(point_at_infinity, transition)
func stop_bgm(t_fade_out: float = AudioFader.DEFAULT_FADE) -> void:
if _bgm.playing:
if t_fade_out > 0.0:
await _audio_fader.fade_out(_bgm, t_fade_out)
else:
_bgm.stop()
func play_bgm(
stream: AudioStream,
t_fade_in: float = 0.0,
t_fade_out: float = AudioFader.DEFAULT_FADE
) -> void:
await stop_bgm(t_fade_out)
_bgm.stream = stream
if t_fade_in > 0.0:
await _audio_fader.fade_in(_bgm, t_fade_in)
else:
_bgm.play()
func get_bgm() -> AudioStream:
return _bgm.stream
func get_camera() -> RunnerObserver:
return PlayerControl.get_camera()
func hard_reorient_camera(direction: Vector3 = Vector3.ZERO) -> void:
if not direction.is_zero_approx():
PlayerControl.get_camera().maintain_direction = direction
PlayerControl.get_camera().reorient(false, true)
func main_camera_active() -> bool:
return PlayerControl.get_camera().current
func restore_main_camera() -> void:
PlayerControl.get_camera().make_current()
func get_camera_target_override() -> Node3D:
return PlayerControl.get_camera().target_override
func set_camera_target_override(what: Node3D) -> void:
PlayerControl.get_camera().target_override = what
func camera_is_following(what: Node3D) -> bool:
return (
bool(what == PlayerControl.get_camera().target_override) if PlayerControl.get_camera().target_override
else bool(what == PlayerControl.get_camera().runner)
)
func set_camera_distance(distance: float) -> void:
PlayerControl.get_camera().maintain_distance = distance
func get_camera_distance() -> float:
return PlayerControl.get_camera().maintain_distance
func clear_camera_target_override() -> void:
PlayerControl.get_camera().target_override = null
func audio_fade_in(
audio: AudioStreamPlayer,
duration: float = AudioFader.DEFAULT_FADE,
target: float = 0.0
) -> void:
await _audio_fader.fade_in(audio, duration, target)
func audio_fade_out(
audio: AudioStreamPlayer,
duration: float = AudioFader.DEFAULT_FADE
) -> void:
await _audio_fader.fade_out(audio, duration)
func audio_cross_fade(
stop: AudioStreamPlayer,
start: AudioStreamPlayer,
duration: float = AudioFader.DEFAULT_FADE,
target: float = 0.0
) -> void:
await _audio_fader.cross_fade(stop, start, duration, target)
func tint(
color: Color = Color.WHITE,
duration: float = ScreenEffects.DEFAULT_TRANSITION
) -> void:
await _screen_effects.tint(color, duration)
func clear_tint(transition: float = ScreenEffects.DEFAULT_TRANSITION) -> void:
await _screen_effects.clear_tint(transition)
func fade(
color: Color = Color.TRANSPARENT,
duration: float = ScreenEffects.DEFAULT_TRANSITION
) -> void:
await _screen_effects.fade(color, duration)
func clear_fade(transition: float = ScreenEffects.DEFAULT_TRANSITION) -> void:
await _screen_effects.clear_fade(transition)
func flash(
color: Color = Color.TRANSPARENT,
duration: float = ScreenEffects.DEFAULT_TRANSITION
) -> void:
await _screen_effects.flash(color, duration)
func rain(
magnitude: int = 3,
transition: float = ScreenEffects.DEFAULT_TRANSITION,
do_not_adjust_overcast: bool = false,
do_not_adjust_brightness: bool = false,
do_not_adjust_wind: bool = false
) -> void:
await _screen_effects.rain(
magnitude, transition,
bool(do_not_adjust_overcast),
bool(do_not_adjust_brightness),
bool(do_not_adjust_wind)
)
func snow(
magnitude: int = 1,
transition: float = ScreenEffects.DEFAULT_TRANSITION,
do_not_adjust_overcast: bool = false,
do_not_adjust_brightness: bool = false,
do_not_adjust_wind: bool = false
) -> void:
await _screen_effects.snow(
magnitude, transition,
bool(do_not_adjust_overcast),
bool(do_not_adjust_brightness),
bool(do_not_adjust_wind)
)
func stop_weather(
transition: float = ScreenEffects.DEFAULT_WEATHER_TRANSITION,
do_not_adjust_overcast: bool = false,
do_not_adjust_brightness: bool = false,
do_not_adjust_wind: bool = false
) -> void:
await _screen_effects.stop_weather(
transition,
bool(do_not_adjust_overcast),
bool(do_not_adjust_brightness),
bool(do_not_adjust_wind)
)
func wind(
magnitude: float = ScreenEffects.SIGNIFICANT_WIND,
transition: float = ScreenEffects.DEFAULT_WEATHER_TRANSITION
) -> void:
await _screen_effects.wind(magnitude, transition)
func overcast(
magnitude: float = ScreenEffects.SIGNIFICANT_OVERCAST,
transition: float = ScreenEffects.DEFAULT_WEATHER_TRANSITION,
do_not_adjust_brightness: bool = false
) -> void:
await _screen_effects.overcast(
magnitude, transition,
bool(do_not_adjust_brightness)
)
func stop_wind(
transition: float = ScreenEffects.DEFAULT_WEATHER_TRANSITION
) -> void:
await _screen_effects.stop_wind(transition)
func clear_overcast(
transition: float = ScreenEffects.DEFAULT_WEATHER_TRANSITION,
do_not_adjust_brightness: bool = false
) -> void:
await _screen_effects.clear_overcast(
transition,
bool(do_not_adjust_brightness)
)
func morning(
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.morning(transition)
func day(
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.day(transition)
func afternoon(
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.afternoon(transition)
func evening(
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.evening(transition)
func night(
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.night(transition)
func brightness(
magnitude: float = ScreenEffects.NORMAL_BRIGHTNESS,
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.brightness(magnitude, transition)
func twist(
magnitude: float = ScreenEffects.NORMAL_TWIST,
transition: float = ScreenEffects.DEFAULT_WEATHER_TRANSITION
) -> void:
await _screen_effects.twist(magnitude, transition)
func psychedelic(
magnitude: float = ScreenEffects.NORMAL_PSYCHEDELIC,
transition: float = ScreenEffects.DEFAULT_TIME_OF_DAY_TRANSITION
) -> void:
await _screen_effects.psychedelic(magnitude, transition)
func lightning(intensity: float = 1.0) -> void:
await _screen_effects.lightning(intensity)
func hide_weather_particles() -> void:
_screen_effects.hide_weather_particles()
func unhide_weather_particles() -> void:
_screen_effects.unhide_weather_particles()
func current_tint() -> Color:
return _screen_effects.current_tint()
func current_fade() -> Color:
return _screen_effects.current_fade()