Update init.client.lua
This commit is contained in:
parent
10f91c8f36
commit
b6a19b47a6
1 changed files with 50 additions and 20 deletions
|
@ -54,7 +54,10 @@ local function processAction(id: string, state: Enum.UserInputState)
|
||||||
local isDebug = not script.Util:GetAttribute("Debug")
|
local isDebug = not script.Util:GetAttribute("Debug")
|
||||||
local character = player.Character
|
local character = player.Character
|
||||||
|
|
||||||
local rootPart = if character then character.PrimaryPart else nil
|
-- stylua: ignore
|
||||||
|
local rootPart = if character
|
||||||
|
then character.PrimaryPart
|
||||||
|
else nil
|
||||||
|
|
||||||
if rootPart then
|
if rootPart then
|
||||||
local action = rootPart:FindFirstChild("Action")
|
local action = rootPart:FindFirstChild("Action")
|
||||||
|
@ -85,7 +88,10 @@ local function updateCollisions()
|
||||||
for i, player in Players:GetPlayers() do
|
for i, player in Players:GetPlayers() do
|
||||||
assert(player:IsA("Player"))
|
assert(player:IsA("Player"))
|
||||||
|
|
||||||
local rootPart = if player.Character then player.Character.PrimaryPart else nil
|
-- stylua: ignore
|
||||||
|
local rootPart = if player.Character
|
||||||
|
then player.Character.PrimaryPart
|
||||||
|
else nil
|
||||||
|
|
||||||
if rootPart then
|
if rootPart then
|
||||||
local parts = rootPart:GetConnectedParts(true)
|
local parts = rootPart:GetConnectedParts(true)
|
||||||
|
@ -147,7 +153,10 @@ function Commands.PlaySound(player: Player, name: string)
|
||||||
local sound: Sound? = Sounds[name]
|
local sound: Sound? = Sounds[name]
|
||||||
local character = player.Character
|
local character = player.Character
|
||||||
|
|
||||||
local rootPart = if character then character.PrimaryPart else nil
|
-- stylua: ignore
|
||||||
|
local rootPart = if character
|
||||||
|
then character.PrimaryPart
|
||||||
|
else nil
|
||||||
|
|
||||||
if rootPart and sound then
|
if rootPart and sound then
|
||||||
local oldSound: Instance? = rootPart:FindFirstChild(name)
|
local oldSound: Instance? = rootPart:FindFirstChild(name)
|
||||||
|
@ -169,12 +178,18 @@ end
|
||||||
function Commands.SetParticle(player: Player, name: string, set: boolean)
|
function Commands.SetParticle(player: Player, name: string, set: boolean)
|
||||||
local character = player.Character
|
local character = player.Character
|
||||||
|
|
||||||
local rootPart = if character then character.PrimaryPart else nil
|
-- stylua: ignore
|
||||||
|
local rootPart = if character
|
||||||
|
then character.PrimaryPart
|
||||||
|
else nil
|
||||||
|
|
||||||
if rootPart then
|
if rootPart then
|
||||||
local particles = rootPart:FindFirstChild("Particles")
|
local particles = rootPart:FindFirstChild("Particles")
|
||||||
|
|
||||||
local inst = if particles then particles:FindFirstChild(name) else nil
|
-- stylua: ignore
|
||||||
|
local inst = if particles
|
||||||
|
then particles:FindFirstChild(name)
|
||||||
|
else nil
|
||||||
|
|
||||||
if inst and PARTICLE_CLASSES[inst.ClassName] then
|
if inst and PARTICLE_CLASSES[inst.ClassName] then
|
||||||
local particle = inst :: ParticleEmitter
|
local particle = inst :: ParticleEmitter
|
||||||
|
@ -192,7 +207,10 @@ end
|
||||||
function Commands.SetAngle(player: Player, angle: Vector3int16)
|
function Commands.SetAngle(player: Player, angle: Vector3int16)
|
||||||
local character = player.Character
|
local character = player.Character
|
||||||
|
|
||||||
local waist = if character then character:FindFirstChild("Waist", true) else nil
|
-- stylua: ignore
|
||||||
|
local waist = if character
|
||||||
|
then character:FindFirstChild("Waist", true)
|
||||||
|
else nil
|
||||||
|
|
||||||
if waist and waist:IsA("Motor6D") then
|
if waist and waist:IsA("Motor6D") then
|
||||||
local props = { C1 = Util.ToRotation(-angle) + waist.C1.Position }
|
local props = { C1 = Util.ToRotation(-angle) + waist.C1.Position }
|
||||||
|
@ -297,7 +315,10 @@ local function update()
|
||||||
local now = os.clock()
|
local now = os.clock()
|
||||||
local gfxRot = CFrame.identity
|
local gfxRot = CFrame.identity
|
||||||
|
|
||||||
local humanoid = if character then character:FindFirstChildOfClass("Humanoid") else nil
|
-- stylua: ignore
|
||||||
|
local humanoid = if character
|
||||||
|
then character:FindFirstChildOfClass("Humanoid")
|
||||||
|
else nil
|
||||||
|
|
||||||
local simSpeed = tonumber(script:GetAttribute("TimeScale") or nil) or 1
|
local simSpeed = tonumber(script:GetAttribute("TimeScale") or nil) or 1
|
||||||
local frames = math.floor((now - lastUpdate) * (STEP_RATE * simSpeed))
|
local frames = math.floor((now - lastUpdate) * (STEP_RATE * simSpeed))
|
||||||
|
@ -384,14 +405,23 @@ local function update()
|
||||||
alignCF.CFrame = cf.Rotation
|
alignCF.CFrame = cf.Rotation
|
||||||
end
|
end
|
||||||
|
|
||||||
local debugLabel = if action then action:FindFirstChildOfClass("TextLabel") else nil
|
-- stylua: ignore
|
||||||
|
local debugLabel = if action
|
||||||
|
then action:FindFirstChildOfClass("TextLabel")
|
||||||
|
else nil
|
||||||
|
|
||||||
if debugLabel then
|
if debugLabel then
|
||||||
local actionId = mario.Action()
|
local actionId = mario.Action()
|
||||||
|
|
||||||
local anim = if activeTrack then activeTrack.Animation else nil
|
-- stylua: ignore
|
||||||
|
local anim = if activeTrack
|
||||||
|
then activeTrack.Animation
|
||||||
|
else nil
|
||||||
|
|
||||||
local animName = if anim then anim.Name else nil
|
-- stylua: ignore
|
||||||
|
local animName = if anim
|
||||||
|
then anim.Name
|
||||||
|
else nil
|
||||||
|
|
||||||
local debugText = "Action: "
|
local debugText = "Action: "
|
||||||
.. Enums.GetName(Action, actionId)
|
.. Enums.GetName(Action, actionId)
|
||||||
|
|
Loading…
Reference in a new issue