Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Kit/Managers/CharacterManager/PhysicsFixer.local.luau
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ Thank you
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
local humanoid: Humanoid? = character:WaitForChild("Humanoid")
if not humanoid then
return
end
local localPlayer = Players.LocalPlayer :: Player

local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid") :: Humanoid

-- Head collision glitch fix
local head = character:FindFirstChild("Head")
Expand All @@ -34,7 +33,7 @@ if head and head:IsA("BasePart") then
end

-- Truss Fix
-- Original script by AkaWhats (& some help by MasSpartan)
-- Original script by AkaWhats (& some help by Nullspace)
-- Code touchups & some micro-optimizations done by synnwave

local DEFAULT_FPS = 1 / 60
Expand All @@ -55,8 +54,8 @@ local STATES = {
[Enum.HumanoidStateType.Running] = false,
}

local fps
local function onStateChanged(oldState, newState)
local fps: number
local function onStateChanged(oldState: Enum.HumanoidStateType, newState: Enum.HumanoidStateType)
if newState ~= oldState and STATES[newState] then
for state, allowed in STATES do
if allowed and state ~= newState then
Expand Down
6 changes: 2 additions & 4 deletions Kit/Managers/CharacterManager/TypeDefs.luau
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Thank you

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local GuiManager = ReplicatedStorage.Framework.Kit.Managers.GuiManager

export type __VALID_DAMAGEBRICKS = {
kills: number,
double: number,
Expand Down Expand Up @@ -72,7 +70,7 @@ export type BoostData = {
power: number,

priority: number?,
frame: typeof(GuiManager.BoostFrame)?, -- created later
frame: typeof(ReplicatedStorage.Framework.Kit.Managers.GuiManager.BoostFrame)?, -- created later
module: Boost,
extraVariables: {[string]: any},

Expand Down Expand Up @@ -101,7 +99,7 @@ export type CharacterManager = {

-- damage functions
Damage: (self: CharacterManager, damage: BasePart | number | string) -> (),
ValidateDamageBrick: (self: CharacterManager, brick: BasePart) -> (number | string)?,
ValidateDamageBrick: (self: CharacterManager, brick: BasePart) -> ((number | string)?, number?),

-- helper functions
GetHumanoid: (self: CharacterManager, player: Player) -> Humanoid?,
Expand Down
12 changes: 6 additions & 6 deletions Kit/Managers/CharacterManager/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Functions
function CharacterManager:ValidateDamageBrick(brick: BasePart)
local damageAmount: (number | string)?
if brick:GetAttribute("Activated") == false then
return
return nil, nil
end

local configuration = brick:FindFirstChild("DamageBrickConfiguration")
Expand Down Expand Up @@ -151,7 +151,7 @@ function CharacterManager:Damage(damage: BasePart | string | number)
return
end

local cooldown = 0
local cooldown: number
local damageAmount: (number | string)?
if typeof(damage) == "Instance" and damage:IsA("BasePart") then
damageAmount, cooldown = CharacterManager:ValidateDamageBrick(damage)
Expand All @@ -162,7 +162,7 @@ function CharacterManager:Damage(damage: BasePart | string | number)
if not damageAmount then
return
end
if cooldown > 0 and typeof(damage) == "Instance" then
if (cooldown or 0) > 0 and typeof(damage) == "Instance" then
damageCooldown[damage] = true
task.delay(cooldown, function()
damageCooldown[damage] = false
Expand All @@ -180,7 +180,7 @@ end
function CharacterManager:GetHumanoid(player: Player): Humanoid?
local character = player.Character
if not character then
return
return nil
end

return character:FindFirstChildOfClass("Humanoid")
Expand All @@ -193,7 +193,7 @@ end
A `TweenInfo` can be provided to tween the value.
]=]
function CharacterManager:ChangeHumanoidProperty(property: string, value: any, tweenInfo: TweenInfo?)
local humanoid = CharacterManager:GetHumanoid(Players.LocalPlayer)
local humanoid = CharacterManager:GetHumanoid(Players.LocalPlayer :: Player)
if not humanoid then
return
end
Expand Down Expand Up @@ -326,7 +326,7 @@ function CharacterManager:StartBoost(boostData: _TDefs.BoostData)
if boostData.mode == "Default" then --handle regular boosters
boostData.infinite = CharacterManager:IsBoostInfinite(boostData)

local boostLoop
local boostLoop: RBXScriptConnection
boostLoop = RunService.Heartbeat:Connect(function()
local activeBoostData = CharacterManager:GetActiveBoost(boostData.type, boostData.mode)

Expand Down
6 changes: 3 additions & 3 deletions Kit/Managers/ClientObjectManager/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ local function traverseFolders(folder: Instance, repository: Repo, startingPath:
continue
end

local cached = requireCache[instance]
local cached: (ScopeTypes.LegacyRepositoryModule | ScopeTypes.RepositoryModule)? = requireCache[instance]
if not requireCache[instance] then
-- requires already cache but i think it'l be a bit more
-- performant doing this
local loadSuccess, loadReturns = pcall(require, instance)
local loadSuccess, loadReturns: (ScopeTypes.LegacyRepositoryModule | ScopeTypes.RepositoryModule)? = pcall(require, instance)
if not loadSuccess then
Log({
`Failed to load repository script "{path}"`,
Expand Down Expand Up @@ -278,7 +278,7 @@ function ClientObjectManager:Init()
local property = if i == 2 then "LocalTransparencyModifier" else "Transparency"
for _, instance in CollectionService:GetTagged(tag) do
if instance:IsA("BasePart") then
instance[property] = 1
(instance :: any)[property] = 1
end
end

Expand Down
12 changes: 6 additions & 6 deletions Kit/Managers/FlipManager/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Functions
---------------------------------------------------------------------------
]]

local localPlayer = Players.LocalPlayer
local localPlayer = Players.LocalPlayer :: Player

local flipCooldowns = {}

Expand Down Expand Up @@ -100,7 +100,7 @@ function FlipManager:TryFlip()
return
end

for _, touchingPart: BasePart in Workspace:GetPartsInPart(torso, PARAMS) do
for _, touchingPart in Workspace:GetPartsInPart(torso, PARAMS) do
if
(
not touchingPart:HasTag("CanFlip")
Expand All @@ -118,16 +118,16 @@ function FlipManager:TryFlip()
flipCooldowns[touchingPart] = nil
end)

local teleportPart = touchingPart
local teleportPart: BasePart = touchingPart
if not touchingPart:HasTag("DoNotFlipPlayer") then
local teleportToObject = touchingPart:FindFirstChild("TeleToObject")
if
teleportToObject
and teleportToObject:IsA("ObjectValue")
and teleportToObject.Value
and teleportToObject.Value:IsA("BasePart")
and (teleportToObject.Value :: Instance):IsA("BasePart")
then
teleportPart = teleportToObject.Value
teleportPart = teleportToObject.Value :: BasePart
elseif teleportToObject then
warn("blank", teleportToObject, "value")
return
Expand Down Expand Up @@ -174,7 +174,7 @@ function FlipManager:BindToFlip(part: BasePart, callback: (rootPart: BasePart) -
end

local callbacks = FlipManager.__callbacks
local callbackID = HttpService:GenerateGUID()
local callbackID: string? = HttpService:GenerateGUID()
if not callbacks[part] then
callbacks[part] = {}
end
Expand Down
27 changes: 13 additions & 14 deletions Kit/Managers/GuiManager/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ local Log = require(Framework.Log)
local CharacterManager_Types = require(Kit.Managers.CharacterManager.TypeDefs)
local KitSettings = require(ReplicatedStorage.KitSettings)

local localPlayer = Players.LocalPlayer :: Player

--[[
---------------------------------------------------------------------------
Main table
Expand Down Expand Up @@ -88,9 +90,9 @@ end

Creates and returns a boost timer frame for the given `boostType`.
]=]
function GuiManager:CreateBoostFrame(boostData: CharacterManager_Types.BoostData): _TDefs.BoostTimerFrame
function GuiManager:CreateBoostFrame(boostData: CharacterManager_Types.BoostData): _TDefs.BoostTimerFrame?
if boostData.hideGUI then
return -- don't make one if they disabled it
return nil-- don't make one if they disabled it
end

boostID += 1
Expand All @@ -116,7 +118,7 @@ function GuiManager:CreateBoostFrame(boostData: CharacterManager_Types.BoostData
frame.LayoutOrder = -boostID
frame.Parent = GuiManager.Gui.Boosts

boostData.frame = frame
boostData.frame = frame :: _TDefs.BoostTimerFrame?
TweenService:Create(frame, BOOST_FRAME_TWEEN_INFO, { Size = script.BoostFrame.Size }):Play()

GuiManager:UpdateBoostFrame(boostData)
Expand Down Expand Up @@ -216,7 +218,7 @@ function GuiManager:__updateKeyDisplay()
end

local characterCFrame
local character = Players.LocalPlayer.Character
local character = (Players.LocalPlayer :: Player).Character
if character then
characterCFrame = character:GetPivot()
end
Expand Down Expand Up @@ -295,24 +297,22 @@ end
]=]
function GuiManager:DisplayGUI(guiName: string, ...: any)
local gui = script:FindFirstChild(guiName)
if not gui then -- already being displayed?
if not gui or not gui:IsA("ScreenGui") then -- already being displayed?
Log({
`{guiName} GUI not found or already visible!!`,
type = "warn",
})

return true
return
end

if guiName == "debug" then
local displayMemory = ...
gui.memory.Visible = displayMemory
gui.memory.LocalScript.Enabled = displayMemory
(gui :: typeof(script.debug)).memory.Visible = displayMemory
do (gui :: typeof(script.debug)).memory.LocalScript.Enabled = displayMemory end
end

gui.Enabled = true
gui.Parent = GuiManager.PlayerGui
return true
end

function GuiManager:Init()
Expand All @@ -321,17 +321,16 @@ function GuiManager:Init()
end
self.__initialized = true

local localPlayer = Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local playerGui = localPlayer:WaitForChild("PlayerGui") :: PlayerGui
task.spawn(function()
GuiManager.Gui = playerGui:WaitForChild("EffectGUI", 5)
GuiManager.Gui = playerGui:WaitForChild("EffectGUI", 5) :: index<_TDefs.GuiManager, "Gui">
end)
GuiManager.PlayerGui = playerGui

--> Detect any new EffectGUIs
playerGui.ChildAdded:Connect(function(child)
if child.Name == "EffectGUI" then
GuiManager.Gui = child
GuiManager.Gui = child :: index<_TDefs.GuiManager, "Gui">
end
end)

Expand Down
2 changes: 1 addition & 1 deletion Kit/Managers/ScopeConstructor/TypeDefs.luau
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export type ScopeCommunicator = typeof(setmetatable({} :: __Communicator_params,
-----------------------------------------
--> Scope Types

export type RepositoryModule = { Run: (scope: Scope, repository: any) -> (), [string]: any }
export type RepositoryModule = { Run: (scope: Scope, repository: any) -> (), Init: ((utility: any) -> ())?, [string]: any }
export type LegacyRepositoryModule = (scope: Scope, repository: any) -> ()

export type __Scope_params = {
Expand Down
12 changes: 4 additions & 8 deletions Kit/Repository/Interactables/BoostRemover/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ local BoostRemover = {
RunOnStart = false,
}

local REMOVER_CONFIG_TEMPLATE
function BoostRemover.Init(utility: _T.Utility)
local Config = utility.Config
REMOVER_CONFIG_TEMPLATE = {
Type = "Unknown",
Mode = "",
}
end
local REMOVER_CONFIG_TEMPLATE = {
Type = "Unknown",
Mode = "",
}

local SequencerSupport = require(script.SequencerSupport)
local function setupCache(rootScope: _T.Scope, utility: _T.Utility)
Expand Down
20 changes: 10 additions & 10 deletions Kit/Repository/Interactables/Booster/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ local _T = require(ReplicatedStorage.Framework.ClientTypes)
local CharacterManager_Types = require(ReplicatedStorage.Framework.Kit.Managers.CharacterManager.TypeDefs)
local SequencerSupport = require(script.SequencerSupport)

type Booster = {
type Booster<T> = {
hitbox: BasePart,
configuration: { [string]: any },
extraVariables: { [string]: any},
startTweenConfig: { [string]: any },
endTweenConfig: { [string]: any },
startTweenConfig: T,
endTweenConfig: T,
id: string,
}

type BoosterCache = {
type BoosterCache<T> = {
activators: { [BasePart]: () -> () },
boosters: { Booster },
activeBoosters: { [string]: Booster? },
boosters: { Booster<T> },
activeBoosters: { [string]: Booster<T> },
}

local Booster = {
Expand Down Expand Up @@ -93,7 +93,7 @@ function Booster.Run(scope: _T.Scope, utility: _T.Utility)
else {}

--> Functions
local function getBoostData(booster: Booster): CharacterManager_Types.BoostData?
local function getBoostData(booster: Booster<typeof(Config.TWEEN_CONFIG)>): CharacterManager_Types.BoostData?
local boostModule = CharacterUtil.getBoostModule(booster.configuration.Type)
if not boostModule then
return nil
Expand Down Expand Up @@ -137,7 +137,7 @@ function Booster.Run(scope: _T.Scope, utility: _T.Utility)
CharacterUtil.getHitbox("StaticWholeBody", overlapParams)

local cache = utility.Scope.getCached(scope, scope.scriptPath, function()
local cache: BoosterCache = {
local cache: BoosterCache<typeof(Config.TWEEN_CONFIG)> = {
activators = {},
boosters = {},
activeBoosters = {},
Expand All @@ -161,7 +161,7 @@ function Booster.Run(scope: _T.Scope, utility: _T.Utility)
lastTick = currentTick

--> Get touching parts and determine if any zone boosters are being touched
local touchingBoosters: { Booster } = {}
local touchingBoosters: { Booster<typeof(Config.TWEEN_CONFIG)> } = {}
for _, booster in cache.boosters do
if
#Workspace:GetPartsInPart(booster.hitbox, overlapParams) > 0
Expand Down Expand Up @@ -230,7 +230,7 @@ function Booster.Run(scope: _T.Scope, utility: _T.Utility)
end

--> Main functionality
local boosterData: Booster = {
local boosterData: Booster<typeof(Config.TWEEN_CONFIG)> = {
hitbox = booster,
configuration = configuration,
extraVariables = extraVariables,
Expand Down
Loading