Improve typing and formatting of files

This commit is contained in:
Lewin Kelly 2024-01-29 23:49:16 +00:00
parent 7c4ee737f1
commit c7b816f4d0
5 changed files with 125 additions and 130 deletions

View File

@ -3149,8 +3149,11 @@ declare class Vector3
Unit: Vector3 Unit: Vector3
unit: Vector3 unit: Vector3
X: number X: number
x: number
Y: number Y: number
y: number
Z: number Z: number
z: number
function Angle(self, other: Vector3, axis: Vector3?): number function Angle(self, other: Vector3, axis: Vector3?): number
function Cross(self, other: Vector3): Vector3 function Cross(self, other: Vector3): Vector3
function Dot(self, other: Vector3): number function Dot(self, other: Vector3): number
@ -3194,31 +3197,18 @@ end
declare class CFrame declare class CFrame
lookVector: Vector3 lookVector: Vector3
LookVector: Vector3 -- ? p: Vector3
Position: Vector3
RightVector: Vector3
Rotation: CFrame
UpVector: Vector3
X: number X: number
XVector: Vector3
Y: number Y: number
YVector: Vector3
Z: number Z: number
ZVector: Vector3 function inverse(self): CFrame
function GetComponents(self): (number, number, number, number, number, number, number, number, number, number, number, number) function pointToObjectSpace(self, v3: Vector3): Vector3
function Inverse(self): CFrame function pointToWorldSpace(self, v3: Vector3): Vector3
function Lerp(self, goal: CFrame, alpha: number): CFrame function toEulerAnglesXYZ(self): (number, number, number)
function Orthonormalize(self): CFrame function toObjectSpace(self, cf: CFrame): CFrame
function PointToObjectSpace(self, v3: Vector3): Vector3 function toWorldSpace(self, cf: CFrame): CFrame
function PointToWorldSpace(self, v3: Vector3): Vector3 function vectorToObjectSpace(self, v3: Vector3): Vector3
function ToAxisAngle(self): (Vector3, number) function vectorToWorldSpace(self, v3: Vector3): Vector3
function ToEulerAnglesXYZ(self): (number, number, number)
function ToEulerAnglesYXZ(self): (number, number, number)
function ToObjectSpace(self, cf: CFrame): CFrame
function ToOrientation(self): (number, number, number)
function ToWorldSpace(self, cf: CFrame): CFrame
function VectorToObjectSpace(self, v3: Vector3): Vector3
function VectorToWorldSpace(self, v3: Vector3): Vector3
function __add(self, other: Vector3): CFrame function __add(self, other: Vector3): CFrame
function __mul(self, other: CFrame): CFrame function __mul(self, other: CFrame): CFrame
function __mul(self, other: Vector3): Vector3 function __mul(self, other: Vector3): Vector3
@ -6214,6 +6204,8 @@ declare class Terrain extends BasePart
function WriteVoxels(self, region: Region3, resolution: number, materials: { any }, occupancy: { any }): nil function WriteVoxels(self, region: Region3, resolution: number, materials: { any }, occupancy: { any }): nil
function AutoWedgeCell(self, x: number, y: number, z: number): boolean function AutoWedgeCell(self, x: number, y: number, z: number): boolean
function SetWaterCell(self, x: number, y: number, z: number, waterForce: EnumWaterForce, waterDirection: EnumWaterDirection): nil
function SetCell(self, x: number, y: number, z: number, material: EnumCellMaterial, orientation: EnumCellOrientation): nil
end end
declare class TriangleMeshPart extends BasePart declare class TriangleMeshPart extends BasePart
@ -7051,6 +7043,8 @@ declare class ScriptContext extends Instance
function StopScriptProfiling(self): string function StopScriptProfiling(self): string
function AddCoreScript(self, id: number, player: Player, name: string): nil function AddCoreScript(self, id: number, player: Player, name: string): nil
function RegisterLibrary(self, name: string, id: string): nil
function LibraryRegistrationComplete(self): nil
end end
declare class ScriptDebugger extends Instance declare class ScriptDebugger extends Instance
@ -8903,7 +8897,7 @@ export type Red = {
Load: (self: Red, Script: LuaSourceContainer) -> RedCore, Load: (self: Red, Script: LuaSourceContainer) -> RedCore,
} }
declare LoadLibrary: ((libraryName: "RbxFusion") -> Fusion) & ((libraryName: "RbxRed") -> Red) declare LoadLibrary: ((libraryName: "RbxFusion") -> Fusion) & ((libraryName: "RbxRed") -> Red) & ((libraryName: string) -> any)
declare function settings(): GlobalSettings declare function settings(): GlobalSettings
declare function UserSettings(): UserSettings declare function UserSettings(): UserSettings

View File

@ -2404,8 +2404,8 @@ RbxGui.CreateTutorial = function(name, tutorialKey, createButtons)
end end
local function CreateBasicTutorialPage( local function CreateBasicTutorialPage(
name, name: string,
handleResize, handleResize: (number, number) -> (),
skipTutorial, skipTutorial,
giveDoneButton giveDoneButton
) )

View File

@ -111,25 +111,17 @@ end
function JsonWriter:ParseString(s) function JsonWriter:ParseString(s)
self:Append '"' self:Append '"'
self:Append(string.gsub(s, '[%z%c\\"/]', function(n) local copy = string.gsub(s, '[%z%c\\"/]', function(n)
local c = self.backslashes[n] return self.backslashes[n] or string.format("\\u%.4X", string.byte(n))
if c then end)
return c self:Append(copy)
end
return string.format("\\u%.4X", string.byte(n))
end))
self:Append '"' self:Append '"'
end end
function JsonWriter:IsArray(t) function JsonWriter:IsArray(t)
local count = 0 local count = 0
local isindex = function(k) local function isindex(k)
if type(k) == "number" and k > 0 then return type(k) == "number" and k > 0 and math.floor(k) == k
if math.floor(k) == k then
return true
end
end
return false
end end
for k, _ in pairs(t) do for k, _ in pairs(t) do
if not isindex(k) then if not isindex(k) then
@ -451,9 +443,9 @@ function Null()
end end
-------------------- End JSON Parser ------------------------ -------------------- End JSON Parser ------------------------
local t = {} local RbxUtility = {}
t.DecodeJSON = function(jsonString) RbxUtility.DecodeJSON = function(jsonString: string)
pcall(function() pcall(function()
warn "RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead." warn "RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead."
end) end)
@ -465,7 +457,7 @@ t.DecodeJSON = function(jsonString)
return nil return nil
end end
t.EncodeJSON = function(jsonTable) RbxUtility.EncodeJSON = function(jsonTable: { [any]: any })
pcall(function() pcall(function()
warn "RbxUtility.EncodeJSON is deprecated, please use Game:GetService('HttpService'):JSONEncode() instead." warn "RbxUtility.EncodeJSON is deprecated, please use Game:GetService('HttpService'):JSONEncode() instead."
end) end)
@ -482,17 +474,17 @@ end
--makes a wedge at location x, y, z --makes a wedge at location x, y, z
--sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously w --sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously w
--returns true if made a wedge, false if the cell remains a block --returns true if made a wedge, false if the cell remains a block
t.MakeWedge = function(x, y, z, _) RbxUtility.MakeWedge = function(x, y, z, _)
return game:GetService("Terrain"):AutoWedgeCell(x, y, z) return game:GetService("Terrain"):AutoWedgeCell(x, y, z)
end end
t.SelectTerrainRegion = function( RbxUtility.SelectTerrainRegion = function(
regionToSelect, regionToSelect: Region3,
colour, colour: BrickColor,
selectEmptyCells, selectEmptyCells: boolean,
selectionParent selectionParent: Instance
) )
local terrain = game.Workspace:FindFirstChild "Terrain" local terrain = game.Workspace:FindFirstChild "Terrain" :: Terrain
if not terrain then if not terrain then
return return
end end
@ -500,14 +492,15 @@ t.SelectTerrainRegion = function(
assert(regionToSelect) assert(regionToSelect)
assert(colour) assert(colour)
if type(regionToSelect) ~= "Region3" then -- can't use typeof
if not (regionToSelect.CFrame and regionToSelect.Size) then
error( error(
`regionToSelect (first arg), should be of type Region3, but is type {type( `regionToSelect (first arg), should be of type Region3, but is type {type(
regionToSelect regionToSelect
)}` )}`
) )
end end
if type(colour) ~= "BrickColor" then if not (colour.Number and colour.r and colour.Color) then
error( error(
`color (second arg), should be of type BrickColor, but is type {type( `color (second arg), should be of type BrickColor, but is type {type(
colour colour
@ -669,7 +662,7 @@ t.SelectTerrainRegion = function(
adornments.SelectionPart = selectionPart adornments.SelectionPart = selectionPart
adornments.SelectionBox = selectionBox adornments.SelectionBox = selectionBox
updateSelection = function(newRegion, newColour) updateSelection = function(newRegion: Region3, newColour)
if newRegion and newRegion ~= lastRegion then if newRegion and newRegion ~= lastRegion then
lastRegion = newRegion lastRegion = newRegion
selectionPart.Size = newRegion.Size selectionPart.Size = newRegion.Size
@ -737,7 +730,7 @@ Method :wait()
Description: This call blocks until Description: This call blocks until
]] ]]
function t.CreateSignal() function RbxUtility.CreateSignal()
local this = {} local this = {}
local mBindableEvent = Instance.new "BindableEvent" local mBindableEvent = Instance.new "BindableEvent"
@ -800,7 +793,7 @@ function t.CreateSignal()
end end
------------------------------------------------- Sigal class End ------------------------------------------------------ ------------------------------------------------- Sigal class End ------------------------------------------------------
-- this ones my favourite - Heliodex
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
@ -894,7 +887,7 @@ Note: It is also perfectly legal to save a reference to the function returned by
--the Create function need to be created as a functor, not a function, in order to support the Create.E syntax, so it --the Create function need to be created as a functor, not a function, in order to support the Create.E syntax, so it
--will be created in several steps rather than as a single function declaration. --will be created in several steps rather than as a single function declaration.
local function Create_PrivImpl(objectType) local function Create_PrivImpl(objectType: string)
if type(objectType) ~= "string" then if type(objectType) ~= "string" then
error("Argument of Create must be a string", 2) error("Argument of Create must be a string", 2)
end end
@ -902,7 +895,7 @@ local function Create_PrivImpl(objectType)
--The first function call is a function call using Lua's single-string-argument syntax --The first function call is a function call using Lua's single-string-argument syntax
--The second function call is using Lua's single-table-argument syntax --The second function call is using Lua's single-table-argument syntax
--Both can be chained together for the nice effect. --Both can be chained together for the nice effect.
return function(dat) return function(dat: { [string | number | { any } | any]: any })
--default to nothing, to handle the no argument given case --default to nothing, to handle the no argument given case
dat = dat or {} dat = dat or {}
@ -944,7 +937,7 @@ local function Create_PrivImpl(objectType)
obj[k.__eventname]:connect(v) obj[k.__eventname]:connect(v)
--define constructor function --define constructor function
elseif k == t.Create then elseif k == RbxUtility.Create then
if type(v) ~= "function" then if type(v) ~= "function" then
error( error(
`Bad entry in Create body: Key \`[Create]\` should be paired with a constructor function, got: {v}`, `Bad entry in Create body: Key \`[Create]\` should be paired with a constructor function, got: {v}`,
@ -978,7 +971,7 @@ local function Create_PrivImpl(objectType)
end end
--now, create the functor: --now, create the functor:
t.Create = setmetatable({}, { RbxUtility.Create = setmetatable({}, {
__call = function(_, ...) __call = function(_, ...)
return Create_PrivImpl(...) return Create_PrivImpl(...)
end, end,
@ -986,7 +979,7 @@ t.Create = setmetatable({}, {
--and create the "Event.E" syntax stub. Really it's just a stub to construct a table which our Create --and create the "Event.E" syntax stub. Really it's just a stub to construct a table which our Create
--function can recognize as special. --function can recognize as special.
t.Create.E = function(eventName) RbxUtility.Create.E = function(eventName)
return { __eventname = eventName } return { __eventname = eventName }
end end
@ -1000,19 +993,28 @@ end
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
t.Help = function(funcNameOrFunc) RbxUtility.Help = function(funcNameOrFunc)
--input argument can be a string or a function. Should return a description (of arguments and expected side effects) --input argument can be a string or a function. Should return a description (of arguments and expected side effects)
if funcNameOrFunc == "DecodeJSON" or funcNameOrFunc == t.DecodeJSON then if
funcNameOrFunc == "DecodeJSON"
or funcNameOrFunc == RbxUtility.DecodeJSON
then
return "Function DecodeJSON. " return "Function DecodeJSON. "
.. "Arguments: (string). " .. "Arguments: (string). "
.. "Side effect: returns a table with all parsed JSON values" .. "Side effect: returns a table with all parsed JSON values"
end end
if funcNameOrFunc == "EncodeJSON" or funcNameOrFunc == t.EncodeJSON then if
funcNameOrFunc == "EncodeJSON"
or funcNameOrFunc == RbxUtility.EncodeJSON
then
return "Function EncodeJSON. " return "Function EncodeJSON. "
.. "Arguments: (table). " .. "Arguments: (table). "
.. "Side effect: returns a string composed of argument table in JSON data format" .. "Side effect: returns a string composed of argument table in JSON data format"
end end
if funcNameOrFunc == "MakeWedge" or funcNameOrFunc == t.MakeWedge then if
funcNameOrFunc == "MakeWedge"
or funcNameOrFunc == RbxUtility.MakeWedge
then
return "Function MakeWedge. " return "Function MakeWedge. "
.. "Arguments: (x, y, z, [default material]). " .. "Arguments: (x, y, z, [default material]). "
.. "Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if " .. "Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if "
@ -1021,7 +1023,7 @@ t.Help = function(funcNameOrFunc)
end end
if if
funcNameOrFunc == "SelectTerrainRegion" funcNameOrFunc == "SelectTerrainRegion"
or funcNameOrFunc == t.SelectTerrainRegion or funcNameOrFunc == RbxUtility.SelectTerrainRegion
then then
return "Function SelectTerrainRegion. " return "Function SelectTerrainRegion. "
.. "Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). " .. "Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). "
@ -1033,7 +1035,10 @@ t.Help = function(funcNameOrFunc)
.. "arguments to said function are a new region3 to select, and the adornment color (color arg is optional). " .. "arguments to said function are a new region3 to select, and the adornment color (color arg is optional). "
.. "Also returns a second function that takes no arguments and destroys the selection" .. "Also returns a second function that takes no arguments and destroys the selection"
end end
if funcNameOrFunc == "CreateSignal" or funcNameOrFunc == t.CreateSignal then if
funcNameOrFunc == "CreateSignal"
or funcNameOrFunc == RbxUtility.CreateSignal
then
return "Function CreateSignal. " return "Function CreateSignal. "
.. "Arguments: None. " .. "Arguments: None. "
.. "Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class " .. "Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class "
@ -1082,8 +1087,9 @@ t.Help = function(funcNameOrFunc)
.. "Descrition: Create is a very powerfull function, whose description is too long to fit here, and " .. "Descrition: Create is a very powerfull function, whose description is too long to fit here, and "
.. "is best described via example, please see the wiki page for a description of how to use it." .. "is best described via example, please see the wiki page for a description of how to use it."
end end
return "No help available for this function"
end end
--------------------------------------------Documentation Ends---------------------------------------------------------- --------------------------------------------Documentation Ends----------------------------------------------------------
return t return RbxUtility

View File

@ -426,26 +426,17 @@ local function getMouseTargetCFrame(targetPart)
return targetPart.CFrame return targetPart.CFrame
end end
local function isBlocker(part) -- returns whether or not we want to cancel the stamp because we're blocked by this part local function isBlocker(part: Instance) -- returns whether or not we want to cancel the stamp because we're blocked by this part
if not part then if not part or not part.Parent or part:FindFirstChild "Humanoid" then
return false return false
end elseif
if not part.Parent then
return false
end
if part:FindFirstChild "Humanoid" then
return false
end
if
part:FindFirstChild "RobloxStamper" part:FindFirstChild "RobloxStamper"
or part:FindFirstChild "RobloxModel" or part:FindFirstChild "RobloxModel"
then then
return true return true
end elseif
if part:IsA "Part" and not part.CanCollide then (part:IsA "Part" and not part.CanCollide) or (part == game.Lighting)
return false then
end
if part == game.Lighting then
return false return false
end end
return isBlocker(part.Parent) return isBlocker(part.Parent)
@ -453,7 +444,11 @@ end
-- helper function to determine if a character can be pushed upwards by a certain amount -- helper function to determine if a character can be pushed upwards by a certain amount
-- character is 5 studs tall, we'll check a 1.5 x 1.5 x 4.5 box around char, with center .5 studs below torsocenter -- character is 5 studs tall, we'll check a 1.5 x 1.5 x 4.5 box around char, with center .5 studs below torsocenter
local function spaceAboveCharacter(charTorso, newTorsoY, stampData) local function spaceAboveCharacter(
charTorso: BasePart,
newTorsoY,
stampData: Instance
)
local partsAboveChar = game.Workspace:FindPartsInRegion3( local partsAboveChar = game.Workspace:FindPartsInRegion3(
Region3.new( Region3.new(
Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z)
@ -461,7 +456,7 @@ local function spaceAboveCharacter(charTorso, newTorsoY, stampData)
Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z)
+ Vector3.new(0.75, 1.75, 0.75) + Vector3.new(0.75, 1.75, 0.75)
), ),
charTorso.Parent, charTorso.Parent :: Instance,
100 100
) )
@ -474,30 +469,25 @@ local function spaceAboveCharacter(charTorso, newTorsoY, stampData)
end end
end end
if return not clusterPartsInRegion(
clusterPartsInRegion( Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z)
Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) - Vector3.new(0.75, 2.75, 0.75),
- Vector3.new(0.75, 2.75, 0.75), Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z)
Vector3.new(charTorso.Position.X, newTorsoY, charTorso.Position.Z) + Vector3.new(0.75, 1.75, 0.75)
+ Vector3.new(0.75, 1.75, 0.75) )
)
then
return false
end
return true
end end
local function findConfigAtMouseTarget(Mouse, stampData) local function findConfigAtMouseTarget(Mouse: Mouse, stampData: Instance)
-- *Critical Assumption* : -- *Critical Assumption* :
-- This function assumes the target CF axes are orthogonal with the target bounding box faces -- This function assumes the target CF axes are orthogonal with the target bounding box faces
-- And, it assumes the insert CF axes are orthongonal with the insert bounding box faces -- And, it assumes the insert CF axes are orthongonal with the insert bounding box faces
-- Therefore, insertion will not work with angled faces on wedges or other "non-block" parts, nor -- Therefore, insertion will not work with angled faces on wedges or other "non-block" parts, nor
-- will it work for parts in a model that are not orthogonally aligned with the model's CF. -- will it work for parts in a model that are not orthogonally aligned with the model's CF.
-- This can happen sometimes, return if so
if not Mouse then if not Mouse then
return nil return nil
end -- This can happen sometimes, return if so end
if not stampData then if not stampData then
error "findConfigAtMouseTarget: stampData is nil" error "findConfigAtMouseTarget: stampData is nil"
return nil return nil
@ -572,7 +562,7 @@ local function findConfigAtMouseTarget(Mouse, stampData)
if targetPart:IsA "Terrain" then if targetPart:IsA "Terrain" then
if not cluster then if not cluster then
cluster = game.Workspace:FindFirstChild "Terrain" cluster = game.Workspace:FindFirstChild "Terrain" :: Terrain
end end
local cellID = cluster:WorldToCellPreferSolid(mouseHitInWorld) local cellID = cluster:WorldToCellPreferSolid(mouseHitInWorld)
if hitPlane then if hitPlane then
@ -1025,7 +1015,9 @@ RbxStamper.SetupStamperDragger = function(
-- Init all state variables -- Init all state variables
local gInitial90DegreeRotations = 0 local gInitial90DegreeRotations = 0
local stampData local stampData: {
DisabledScripts: { LuaSourceContainer }?,
}
local mouseTarget local mouseTarget
local errorBox = Instance.new "SelectionBox" local errorBox = Instance.new "SelectionBox"
@ -1327,6 +1319,8 @@ RbxStamper.SetupStamperDragger = function(
minBB += targetCFrame.p - currModelCFrame.p minBB += targetCFrame.p - currModelCFrame.p
maxBB += targetCFrame.p - currModelCFrame.p maxBB += targetCFrame.p - currModelCFrame.p
local clusterMat: Instance
-- don't drag into terrain -- don't drag into terrain
if if
clusterPartsInRegion( clusterPartsInRegion(
@ -1391,7 +1385,7 @@ RbxStamper.SetupStamperDragger = function(
positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts) positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts)
lastTarget.CFrame = targetCFrame -- successful positioning, so update 'dat cframe lastTarget.CFrame = targetCFrame -- successful positioning, so update 'dat cframe
if stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) then if stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) then
local clusterMat = clusterMat =
stampData.CurrentParts:FindFirstChild("ClusterMaterial", true) stampData.CurrentParts:FindFirstChild("ClusterMaterial", true)
if clusterMat:IsA "Vector3Value" then if clusterMat:IsA "Vector3Value" then
lastTarget.TerrainOrientation = clusterMat.Value.Z lastTarget.TerrainOrientation = clusterMat.Value.Z
@ -1707,15 +1701,16 @@ RbxStamper.SetupStamperDragger = function(
local parts = {} local parts = {}
local decals = {} local decals = {}
stampData = {} stampData = {
stampData.DisabledScripts = {} DisabledScripts = {},
stampData.TransparencyTable = {} TransparencyTable = {},
stampData.MaterialTable = {} MaterialTable = {},
stampData.CanCollideTable = {} CanCollideTable = {},
stampData.AnchoredTable = {} AnchoredTable = {},
stampData.ArchivableTable = {} ArchivableTable = {},
stampData.DecalTransparencyTable = {} DecalTransparencyTable = {},
stampData.SurfaceTypeTable = {} SurfaceTypeTable = {},
}
collectParts(clone, parts, scripts, decals) collectParts(clone, parts, scripts, decals)

View File

@ -18,9 +18,10 @@ local function WaitForChild(parent, childName)
return parent[childName] return parent[childName]
end end
local function typedef(obj) -- wtf
return obj -- local function typedef(obj)
end -- return obj
-- end
local function IsPhone() local function IsPhone()
local cGui = Game:GetService "CoreGui" local cGui = Game:GetService "CoreGui"
@ -51,7 +52,7 @@ while Player.Character == nil do
wait(0.03) wait(0.03)
end end
local RbxUtility = LoadLibrary "RbxUtility" local RbxUtility = LoadLibrary "RbxUtility"
local Gui = typedef(RbxUtility) local Create = RbxUtility.Create
local Camera = Game.Workspace.CurrentCamera local Camera = Game.Workspace.CurrentCamera
-- Services -- Services
@ -127,7 +128,6 @@ local Input = {
--------------------------------------------------- ---------------------------------------------------
------------------ Chat class -------------------- ------------------ Chat class --------------------
local Chat = { local Chat = {
ChatColors = { ChatColors = {
BrickColor.new "Bright red", BrickColor.new "Bright red",
BrickColor.new "Bright blue", BrickColor.new "Bright blue",
@ -1098,7 +1098,7 @@ end
function Chat:ComputeSpaceString(pLabel) function Chat:ComputeSpaceString(pLabel)
local nString = " " local nString = " "
if not self.TempSpaceLabel then if not self.TempSpaceLabel then
self.TempSpaceLabel = Gui.Create "TextButton" { self.TempSpaceLabel = Create "TextButton" {
Size = UDim2.new( Size = UDim2.new(
0, 0,
pLabel.AbsoluteSize.X, pLabel.AbsoluteSize.X,
@ -1227,7 +1227,7 @@ function Chat:CreateMessage(cPlayer, message)
end end
--else --else
-- Haven't hit the mark yet, so keep creating -- Haven't hit the mark yet, so keep creating
pLabel = Gui.Create "TextLabel" { pLabel = Create "TextLabel" {
Name = pName, Name = pName,
Text = `{pName}:`, Text = `{pName}:`,
-- TextColor3 = pColor, -- TextColor3 = pColor,
@ -1259,7 +1259,7 @@ function Chat:CreateMessage(cPlayer, message)
nString = self.CachedSpaceStrings_List[pName] nString = self.CachedSpaceStrings_List[pName]
end end
mLabel = Gui.Create "TextLabel" { mLabel = Create "TextLabel" {
Name = `{pName} - message`, Name = `{pName} - message`,
-- Max is 3 lines -- Max is 3 lines
Size = UDim2.new(1, 0, 0.5, 0), Size = UDim2.new(1, 0, 0.5, 0),
@ -1353,7 +1353,7 @@ function Chat:CreateSafeChatOptions(list, rootButton)
rootButton = rootButton or self.SafeChatButton rootButton = rootButton or self.SafeChatButton
for msg, _ in pairs(list) do for msg, _ in pairs(list) do
if type(msg) == "string" then if type(msg) == "string" then
local chatText = Gui.Create "TextButton" { local chatText = Create "TextButton" {
Name = msg, Name = msg,
Text = msg, Text = msg,
Size = UDim2.new(0, 100, 0, 20), Size = UDim2.new(0, 100, 0, 20),
@ -1404,13 +1404,13 @@ function Chat:CreateSafeChatOptions(list, rootButton)
end end
function Chat:CreateSafeChatGui() function Chat:CreateSafeChatGui()
self.SafeChatFrame = Gui.Create "Frame" { self.SafeChatFrame = Create "Frame" {
Name = "SafeChatFrame", Name = "SafeChatFrame",
Size = UDim2.new(1, 0, 1, 0), Size = UDim2.new(1, 0, 1, 0),
Parent = self.Gui, Parent = self.Gui,
BackgroundTransparency = 1, BackgroundTransparency = 1,
Gui.Create "ImageButton" { Create "ImageButton" {
Name = "SafeChatButton", Name = "SafeChatButton",
Size = UDim2.new(0, 44, 0, 31), Size = UDim2.new(0, 44, 0, 31),
Position = UDim2.new(0, 1, 0.35, 0), Position = UDim2.new(0, 1, 0.35, 0),
@ -1443,21 +1443,21 @@ end
-- For touch devices we create a button instead -- For touch devices we create a button instead
function Chat:CreateTouchButton() function Chat:CreateTouchButton()
self.ChatTouchFrame = Gui.Create "Frame" { self.ChatTouchFrame = Create "Frame" {
Name = "ChatTouchFrame", Name = "ChatTouchFrame",
Size = UDim2.new(0, 128, 0, 32), Size = UDim2.new(0, 128, 0, 32),
Position = UDim2.new(0, 88, 0, 0), Position = UDim2.new(0, 88, 0, 0),
BackgroundTransparency = 1, BackgroundTransparency = 1,
Parent = self.Gui, Parent = self.Gui,
Gui.Create "ImageButton" { Create "ImageButton" {
Name = "ChatLabel", Name = "ChatLabel",
Size = UDim2.new(0, 74, 0, 28), Size = UDim2.new(0, 74, 0, 28),
Position = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0, 0, 0, 0),
BackgroundTransparency = 1, BackgroundTransparency = 1,
ZIndex = 2.0, ZIndex = 2.0,
}, },
Gui.Create "ImageLabel" { Create "ImageLabel" {
Name = "Background", Name = "Background",
Size = UDim2.new(1, 0, 1, 0), Size = UDim2.new(1, 0, 1, 0),
Position = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0, 0, 0, 0),
@ -1468,7 +1468,7 @@ function Chat:CreateTouchButton()
self.TapToChatLabel = self.ChatTouchFrame.ChatLabel self.TapToChatLabel = self.ChatTouchFrame.ChatLabel
self.TouchLabelBackground = self.ChatTouchFrame.Background self.TouchLabelBackground = self.ChatTouchFrame.Background
self.ChatBar = Gui.Create "TextBox" { self.ChatBar = Create "TextBox" {
Name = "ChatBar", Name = "ChatBar",
Size = UDim2.new(1, 0, 0.2, 0), Size = UDim2.new(1, 0, 0.2, 0),
Position = UDim2.new(0, 0, 0.8, 800), Position = UDim2.new(0, 0, 0.8, 800),
@ -1500,7 +1500,7 @@ function Chat:CreateChatBar()
return GuiService.UseLuaChat return GuiService.UseLuaChat
end) end)
if forceChatGUI or (status and result) then if forceChatGUI or (status and result) then
self.ClickToChatButton = Gui.Create "TextButton" { self.ClickToChatButton = Create "TextButton" {
Name = "ClickToChat", Name = "ClickToChat",
Size = UDim2.new(1, 0, 0, 20), Size = UDim2.new(1, 0, 0, 20),
BackgroundTransparency = 1, BackgroundTransparency = 1,
@ -1513,7 +1513,7 @@ function Chat:CreateChatBar()
FontSize = Enum.FontSize.Size12, FontSize = Enum.FontSize.Size12,
} }
self.ChatBar = Gui.Create "TextBox" { self.ChatBar = Create "TextBox" {
Name = "ChatBar", Name = "ChatBar",
Size = UDim2.new(1, 0, 0, 20), Size = UDim2.new(1, 0, 0, 20),
Position = UDim2.new(0, 0, 1, 0), Position = UDim2.new(0, 0, 1, 0),
@ -1554,7 +1554,7 @@ end
-- Done only once -- Done only once
function Chat:CreateGui() function Chat:CreateGui()
self.Gui = WaitForChild(CoreGuiService, "RobloxGui") self.Gui = WaitForChild(CoreGuiService, "RobloxGui")
self.Frame = Gui.Create "Frame" { self.Frame = Create "Frame" {
Name = "ChatFrame", Name = "ChatFrame",
--Size = self.Configuration.Size; --Size = self.Configuration.Size;
Size = UDim2.new(0, 500, 0, 120), Size = UDim2.new(0, 500, 0, 120),
@ -1565,7 +1565,7 @@ function Chat:CreateGui()
Parent = self.Gui, Parent = self.Gui,
Active = false, Active = false,
Gui.Create "ImageLabel" { Create "ImageLabel" {
Name = "Background", Name = "Background",
Image = "http://banland.xyz/asset/?id=97120937", --96551212'; Image = "http://banland.xyz/asset/?id=97120937", --96551212';
Size = UDim2.new(1.3, 0, 1.64, 0), Size = UDim2.new(1.3, 0, 1.64, 0),
@ -1575,7 +1575,7 @@ function Chat:CreateGui()
Visible = false, Visible = false,
}, },
Gui.Create "Frame" { Create "Frame" {
Name = "Border", Name = "Border",
Size = UDim2.new(1, 0, 0, 1), Size = UDim2.new(1, 0, 0, 1),
Position = UDim2.new(0, 0, 0.8, 0), Position = UDim2.new(0, 0, 0.8, 0),
@ -1585,7 +1585,7 @@ function Chat:CreateGui()
Visible = false, Visible = false,
}, },
Gui.Create "Frame" { Create "Frame" {
Name = "ChatRenderFrame", Name = "ChatRenderFrame",
Size = UDim2.new(1.02, 0, 1.01, 0), Size = UDim2.new(1.02, 0, 1.01, 0),
Position = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0, 0, 0, 0),