Update init.client.lua

This commit is contained in:
Max 2022-12-03 04:15:52 -06:00 committed by GitHub
parent 10f91c8f36
commit b6a19b47a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,10 @@ local function processAction(id: string, state: Enum.UserInputState)
local isDebug = not script.Util:GetAttribute("Debug")
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
local action = rootPart:FindFirstChild("Action")
@ -85,7 +88,10 @@ local function updateCollisions()
for i, player in Players:GetPlayers() do
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
local parts = rootPart:GetConnectedParts(true)
@ -147,7 +153,10 @@ function Commands.PlaySound(player: Player, name: string)
local sound: Sound? = Sounds[name]
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
local oldSound: Instance? = rootPart:FindFirstChild(name)
@ -169,12 +178,18 @@ end
function Commands.SetParticle(player: Player, name: string, set: boolean)
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
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
local particle = inst :: ParticleEmitter
@ -192,7 +207,10 @@ end
function Commands.SetAngle(player: Player, angle: Vector3int16)
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
local props = { C1 = Util.ToRotation(-angle) + waist.C1.Position }
@ -297,7 +315,10 @@ local function update()
local now = os.clock()
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 frames = math.floor((now - lastUpdate) * (STEP_RATE * simSpeed))
@ -384,14 +405,23 @@ local function update()
alignCF.CFrame = cf.Rotation
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
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: "
.. Enums.GetName(Action, actionId)