buckshotroulette-decomp/TimeScaleManager.gd
Lyssa 6f47bf7fb4
Beta branch v2.0.0.2
Fixed a possible softlock where item grabbing started when all alive players have full inventories, while dead players had room in their inventory for more items
When entering multiplayer without a connection to Steam, the player will get a message prompt which will return them to the menu once closed
Fixed final score showing up incorrectly in singleplayer
Fixed the magnifying glass sometimes showing the wrong shell in multiplayer
2024-10-31 20:49:01 +04:00

37 lines
774 B
GDScript

class_name TimeScaleManager extends Node
@export var pitchShiftDuration : float
@export var timeScaleLerpDuration : float
var moving = false
var elapsed = 0
var from
var to
func _process(delta):
LerpTimeScale()
func BeginTimeScaleLerp(start : float, end : float):
moving = false
elapsed = 0
from = start
to = end
moving = true
func LerpTimeScale():
if (moving):
elapsed += get_process_delta_time()
var c = clampf(elapsed / timeScaleLerpDuration, 0.0 , 1.0)
c = ease(c, 0.4)
var val = lerpf(from, to, c)
Engine.time_scale = val
func _unhandled_input(event):
if GlobalVariables.mp_debugging:
if event.is_action_pressed("-"):
moving = false
if event.is_action_pressed(","):
moving = false
if event.is_action_pressed("."):
moving = false