mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 23:01:53 +00:00
Physical working relays!
This commit is contained in:
@@ -2,26 +2,28 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type TweenAnimation = {
|
||||
[string]: any
|
||||
--Weird type hack for allowing more than 1 property to be defined inside a tween
|
||||
--Couldnt get type packs working
|
||||
type TweenAnimation<T,U> = {
|
||||
[string]: T | U --I hate "any"
|
||||
}
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type ClassConstructor<T,U> = typeof(setmetatable({} :: Constructor_Return_Props<T,U>, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Start: (self: ClassConstructor, PostInstance: Instance?, PostProperties: TweenAnimation?, PostTweenSettings: TweenInfo?) -> Tween,
|
||||
Start: <T,U>(self: ClassConstructor<T,U>, PostInstance: Instance?, PostProperties: TweenAnimation<T,U>?, PostTweenSettings: TweenInfo?) -> Tween,
|
||||
}
|
||||
|
||||
type Constructor_Fun = (TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
type Constructor_Fun = <T,U>(TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation<T,U>?) -> ClassConstructor<T,U>
|
||||
type Constructor_Return_Props<T,U> = {
|
||||
TweenInfo: TweenInfo?,
|
||||
Instance: Instance?,
|
||||
PreProperties: TweenAnimation?,
|
||||
PreProperties: TweenAnimation<T,U>?,
|
||||
}
|
||||
|
||||
export type TweenClass = ClassConstructor
|
||||
export type TweenClass<T,U> = ClassConstructor<T,U>
|
||||
export type TweenConstructor = Impl_Constructor
|
||||
|
||||
local Tween = {} :: Impl_Constructor
|
||||
@@ -37,7 +39,7 @@ function Tween.constructor(TweenSettings, Object, PreProperties)
|
||||
}, Tween)
|
||||
end
|
||||
|
||||
function Tween:Start(PostInstance, PostProperties, PostTweenSettings)
|
||||
function Tween:Start<T,U>(PostInstance, PostProperties, PostTweenSettings)
|
||||
local Props = self.PreProperties
|
||||
local Object = self.Instance
|
||||
local TweenSettings = self.TweenInfo
|
||||
@@ -45,7 +47,7 @@ function Tween:Start(PostInstance, PostProperties, PostTweenSettings)
|
||||
if PostProperties then
|
||||
if self.PreProperties then
|
||||
if Props then
|
||||
print("Tween library: Combining PostProperties and PreProperties together", debug.traceback())
|
||||
warn("Tween library: Combining PostProperties and PreProperties together", debug.traceback())
|
||||
for tween_prop, tween_value in PostProperties do
|
||||
Props[tween_prop] = tween_value
|
||||
end
|
||||
@@ -56,13 +58,13 @@ function Tween:Start(PostInstance, PostProperties, PostTweenSettings)
|
||||
end
|
||||
if PostInstance then
|
||||
if Object then
|
||||
print("Tween library: Overwriting an already defined animating object old=", Object, "new=", PostInstance, debug.traceback())
|
||||
warn("Tween library: Overwriting an already defined animating object old=", Object, "new=", PostInstance, debug.traceback())
|
||||
end
|
||||
Object = PostInstance
|
||||
end
|
||||
if PostTweenSettings then
|
||||
if TweenSettings then
|
||||
print("Tween library: Overwriting already defined Tween settings", debug.traceback())
|
||||
warn("Tween library: Overwriting already defined Tween settings", debug.traceback())
|
||||
end
|
||||
TweenSettings = PostTweenSettings
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user