-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from Quenty/users/quenty/datastore
users/quenty/datastore
- Loading branch information
Showing
165 changed files
with
6,493 additions
and
969 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[tools] | ||
rojo = "quenty/[email protected]" | ||
run-in-roblox = "rojo-rbx/[email protected]" | ||
selene = "Kampfkarren/selene@0.23.1" | ||
selene = "Kampfkarren/selene@0.25.0" | ||
moonwave-extractor = "UpliftGames/[email protected]" | ||
mantle = "blake-mealey/[email protected]" | ||
remodel = "rojo-rbx/[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
# For more information, see https://github.com/LPGhatguy/aftman | ||
[tools] | ||
rojo = "quenty/[email protected]" | ||
selene = "Kampfkarren/selene@0.23.1" | ||
selene = "Kampfkarren/selene@0.25.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
--[=[ | ||
@class AnimationTrackPlayer | ||
]=] | ||
|
||
local require = require(script.Parent.loader).load(script) | ||
|
||
local BaseObject = require("BaseObject") | ||
local ValueObject = require("ValueObject") | ||
local Rx = require("Rx") | ||
local AnimationUtils = require("AnimationUtils") | ||
local Signal = require("Signal") | ||
|
||
local AnimationTrackPlayer = setmetatable({}, BaseObject) | ||
AnimationTrackPlayer.ClassName = "AnimationTrackPlayer" | ||
AnimationTrackPlayer.__index = AnimationTrackPlayer | ||
|
||
function AnimationTrackPlayer.new(animationTarget, animationId) | ||
local self = setmetatable(BaseObject.new(), AnimationTrackPlayer) | ||
|
||
self._animationTarget = ValueObject.new(nil) | ||
self._maid:GiveTask(self._animationTarget) | ||
|
||
self._trackId = ValueObject.new(nil) | ||
self._maid:GiveTask(self._trackId) | ||
|
||
self._currentTrack = ValueObject.new(nil) | ||
self._maid:GiveTask(self._currentTrack) | ||
|
||
self.KeyframeReached = Signal.new() | ||
self._maid:GiveTask(self.KeyframeReached) | ||
|
||
self._animationPriority = ValueObject.new(nil) | ||
self._maid:GiveTask(self._animationPriority) | ||
|
||
if animationTarget then | ||
self:SetAnimationTarget(animationTarget) | ||
end | ||
|
||
if animationId then | ||
self:SetAnimationId(animationId) | ||
end | ||
|
||
self:_setupState() | ||
|
||
return self | ||
end | ||
|
||
function AnimationTrackPlayer:_setupState() | ||
self._maid:GiveTask(Rx.combineLatest({ | ||
animationTarget = self._animationTarget:Observe(); | ||
trackId = self._trackId:Observe(); | ||
animationPriority = self._animationPriority:Observe(); | ||
}):Pipe({ | ||
Rx.throttleDefer(); | ||
}):Subscribe(function(state) | ||
if state.animationTarget and state.trackId then | ||
self._currentTrack.Value = AnimationUtils.getOrCreateAnimationTrack(state.animationTarget, state.trackId, state.animationPriority) | ||
else | ||
self._currentTrack.Value = nil | ||
end | ||
end)) | ||
|
||
self._maid:GiveTask(self._currentTrack:ObserveBrio(function(track) | ||
return track ~= nil | ||
end):Subscribe(function(brio) | ||
if brio:IsDead() then | ||
return | ||
end | ||
|
||
local maid = brio:ToMaid() | ||
local track = brio:GetValue() | ||
|
||
maid:GiveTask(track.KeyframeReached:Connect(function(...) | ||
self.KeyframeReached:Fire(...) | ||
end)) | ||
end)) | ||
end | ||
|
||
function AnimationTrackPlayer:SetAnimationId(animationId) | ||
return self._trackId:Mount(animationId) | ||
end | ||
|
||
function AnimationTrackPlayer:GetAnimationId() | ||
return self._trackId.Value | ||
end | ||
|
||
function AnimationTrackPlayer:SetAnimationTarget(animationTarget) | ||
return self._animationTarget:Mount(animationTarget) | ||
end | ||
|
||
function AnimationTrackPlayer:SetWeightTargetIfNotSet(weight, fadeTime) | ||
self._maid._adjustWeight = self:_onEachTrack(function(_maid, track) | ||
if track.WeightTarget ~= weight then | ||
track:AdjustWeight(weight, fadeTime) | ||
end | ||
end) | ||
end | ||
|
||
function AnimationTrackPlayer:Play(fadeTime, weight, speed) | ||
if weight then | ||
self._maid._adjustWeight = nil | ||
end | ||
|
||
if speed then | ||
self._maid._adjustSpeed = nil | ||
end | ||
|
||
self._maid._stop = nil | ||
self._maid._play = self:_onEachTrack(function(_maid, track) | ||
track:Play(fadeTime, weight, speed) | ||
end) | ||
end | ||
|
||
function AnimationTrackPlayer:Stop(fadeTime) | ||
self._maid._play = nil | ||
self._maid._stop = self:_onEachTrack(function(_maid, track) | ||
track:Stop(fadeTime) | ||
end) | ||
end | ||
|
||
function AnimationTrackPlayer:AdjustWeight(weight, fadeTime) | ||
self._maid._adjustWeight = self:_onEachTrack(function(_maid, track) | ||
track:AdjustWeight(weight, fadeTime) | ||
end) | ||
end | ||
|
||
function AnimationTrackPlayer:AdjustSpeed(speed, fadeTime) | ||
self._maid._adjustSpeed = self:_onEachTrack(function(_maid, track) | ||
track:AdjustSpeed(speed, fadeTime) | ||
end) | ||
end | ||
|
||
function AnimationTrackPlayer:IsPlaying() | ||
local track = self._currentTrack.Value | ||
if track then | ||
return track.IsPlaying | ||
else | ||
return false | ||
end | ||
end | ||
|
||
function AnimationTrackPlayer:_onEachTrack(callback) | ||
return self._currentTrack:ObserveBrio(function(track) | ||
return track ~= nil | ||
end):Subscribe(function(brio) | ||
if brio:IsDead() then | ||
return | ||
end | ||
|
||
local track = brio:GetValue() | ||
callback(brio:ToMaid(), track) | ||
end) | ||
end | ||
|
||
return AnimationTrackPlayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--[=[ | ||
Ship to run animations in hoarcekat | ||
@class StudioRigAnimator | ||
]=] | ||
|
||
local require = require(script.Parent.loader).load(script) | ||
|
||
local RunService = game:GetService("RunService") | ||
|
||
local BaseObject = require("BaseObject") | ||
local AnimationUtils = require("AnimationUtils") | ||
|
||
local StudioRigAnimator = setmetatable({}, BaseObject) | ||
StudioRigAnimator.ClassName = "StudioRigAnimator" | ||
StudioRigAnimator.__index = StudioRigAnimator | ||
|
||
function StudioRigAnimator.new(animatorOrHumanoid) | ||
local self = setmetatable(BaseObject.new(animatorOrHumanoid), StudioRigAnimator) | ||
|
||
if RunService:IsStudio() and not RunService:IsRunning() then | ||
self:_setupStudio() | ||
end | ||
|
||
return self | ||
end | ||
|
||
function StudioRigAnimator:_setupStudio() | ||
self._animator = AnimationUtils.getOrCreateAnimator(self._obj) | ||
self._lastTime = os.clock() | ||
|
||
self._maid:GiveTask(RunService.RenderStepped:Connect(function() | ||
local now = os.clock() | ||
local delta = now - self._lastTime | ||
self._lastTime = now | ||
|
||
self._animator:StepAnimations(delta) | ||
end)) | ||
end | ||
|
||
return StudioRigAnimator |
Oops, something went wrong.