Improve formatting and fix bugs in corescripts

This commit is contained in:
Lewin Kelly 2023-05-21 08:16:09 +01:00
parent 37d28a3999
commit a76055d3eb
6 changed files with 81 additions and 94 deletions

View File

@ -92,7 +92,7 @@ initializeDeveloperConsole = ->
Size: UDim2.new 0.8, 0, 0.8, 0 Size: UDim2.new 0.8, 0, 0.8, 0
Rotation: 135 Rotation: 135
Image: "http://www.roblox.com/Asset?id=151205813" Image: "http://www.roblox.com/Asset?id=151205813"
* New "TextButton", "LocalConsole" * New "TextButton", "LocalConsole"
BackgroundColor3: Color3.new 0, 0, 0 BackgroundColor3: Color3.new 0, 0, 0
BackgroundTransparency: 0.6 BackgroundTransparency: 0.6
@ -349,12 +349,8 @@ initializeDeveloperConsole = ->
TextYAlignment: Enum.TextYAlignment.Top TextYAlignment: Enum.TextYAlignment.Top
---Saved Mouse Information ---Saved Mouse Information
local previousMousePos local previousMousePos, pPos
local pPos local previousMousePosResize, pSize
local previousMousePosResize
local pSize
local previousMousePosScroll local previousMousePosScroll
-- local pScrollHandle -- local pScrollHandle

View File

@ -1126,7 +1126,6 @@ t.CreateTrueScrollingFrame = ->
doScrollDown! doScrollDown!
break if mouseYPos and mouseYPos < (scrollbar.AbsolutePosition.y + scrollbar.AbsoluteSize.x) break if mouseYPos and mouseYPos < (scrollbar.AbsolutePosition.y + scrollbar.AbsoluteSize.x)
break if not scrollDownButton.Active break if not scrollDownButton.Active
w = if tick! - t > 5 w = if tick! - t > 5
0 0
@ -3258,16 +3257,16 @@ t.CreateLoadingFrame = (name, size, position) ->
updateLoadingGuiPercent = (percent, tweenAction, tweenLength) -> updateLoadingGuiPercent = (percent, tweenAction, tweenLength) ->
if percent and type percent ~= "number" if percent and type(percent) ~= "number"
error "updateLoadingGuiPercent expects number as argument, got #{type percent} instead" error "updateLoadingGuiPercent expects number as argument, got #{type percent} instead"
newSize = if percent < 0 newSize = UDim2.new if percent < 0
UDim2.new 0, 0, 1, 0 0, 0, 1, 0
elseif percent > 1 elseif percent > 1
UDim2.new 1, 0, 1, 0 1, 0, 1, 0
else else
UDim2.new percent, 0, 1, 0 percent, 0, 1, 0
if tweenAction if tweenAction
@ -3477,10 +3476,10 @@ t.CreatePluginFrame = (name, size, position, scrollable, parent) ->
else else
UDim2.new 0, dragBar.AbsoluteSize.X, size.Y.Scale, size.Y.Offset UDim2.new 0, dragBar.AbsoluteSize.X, size.Y.Scale, size.Y.Offset
else else
if scrollable UDim2.new 0, if scrollable
UDim2.new 0, 163, 0, 400 163, 0, 400
else else
UDim2.new 0, dragBar.AbsoluteSize.X, 0, 400 dragBar.AbsoluteSize.X, 0, 400
if position if position
widgetContainer.Position += UDim2.new 0, 0, 0, 20 widgetContainer.Position += UDim2.new 0, 0, 0, 20
@ -3608,23 +3607,15 @@ t.CreatePluginFrame = (name, size, position, scrollable, parent) ->
widgetContainer.Visible = not widgetContainer.Visible widgetContainer.Visible = not widgetContainer.Visible
if minimizeFrame.Visible minimizeButton.Text = if minimizeFrame.Visible
minimizeButton.Text = "+" "+"
else else
minimizeButton.Text = "-" "-"
minimizeBigButton.MouseButton1Click\connect -> switchMinimize!
minimizeButton.MouseButton1Click\connect -> switchMinimize!
minimizeBigButton.MouseButton1Click\connect -> dragBar, (if scrollable then frame else widgetContainer), helpFrame, closeEvent
switchMinimize!
minimizeButton.MouseButton1Click\connect ->
switchMinimize!
if scrollable
dragBar, frame, helpFrame, closeEvent
else
dragBar, widgetContainer, helpFrame, closeEvent
t.Help = (funcNameOrFunc) -> t.Help = (funcNameOrFunc) ->

View File

@ -821,10 +821,8 @@ centerGear = ->
else else
table.insert gearButtons, i table.insert gearButtons, i
i.BackgroundTransparency = 1 i.BackgroundTransparency = 1
if lastSlotAdd if lastSlotAdd
table.insert gearButtons, lastSlotAdd table.insert gearButtons, lastSlotAdd

View File

@ -799,22 +799,22 @@ t.GetStampModel = (assetId, terrainShape, useAssetVersionId) ->
Parent: root Parent: root
if terrainShape if terrainShape and
if root.Name == "MegaClusterCube" root.Name == "MegaClusterCube"
if terrainShape == 6 -- insert an autowedging tag
New "BoolValue", "AutoWedge"
Parent: root
else
clusterTag = root\FindFirstChild "ClusterMaterial"
root = if clusterTag
if clusterTag\IsA "Vector3Value"
setupFakeTerrainPart clusterTag.Value.X, terrainShape, clusterTag.Value.Z
else
setupFakeTerrainPart clusterTag.Value, terrainShape, 0
if terrainShape == 6 -- insert an autowedging tag
New "BoolValue", "AutoWedge"
Parent: root
else
clusterTag = root\FindFirstChild "ClusterMaterial"
root = if clusterTag
if clusterTag\IsA "Vector3Value"
setupFakeTerrainPart clusterTag.Value.X, terrainShape, clusterTag.Value.Z
else else
setupFakeTerrainPart 1, terrainShape, 0 setupFakeTerrainPart clusterTag.Value, terrainShape, 0
else
setupFakeTerrainPart 1, terrainShape, 0
root root
@ -1104,14 +1104,14 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
-- don't drag into terrain -- don't drag into terrain
if clusterPartsInRegion minBB + insertBoundingBoxOverlapVector, maxBB - insertBoundingBoxOverlapVector if clusterPartsInRegion minBB + insertBoundingBoxOverlapVector, maxBB - insertBoundingBoxOverlapVector
if lastTarget.CFrame if lastTarget.CFrame and
if stampData.CurrentParts\FindFirstChild "ClusterMaterial", true stampData.CurrentParts\FindFirstChild "ClusterMaterial", true
theClusterMaterial = stampData.CurrentParts\FindFirstChild "ClusterMaterial", true
if theClusterMaterial\IsA "Vector3Value"
stampClusterMaterial = stampData.CurrentParts\FindFirstChild "ClusterMaterial", true
if stampClusterMaterial
stampClusterMaterial = clusterMat
theClusterMaterial = stampData.CurrentParts\FindFirstChild "ClusterMaterial", true
if theClusterMaterial\IsA "Vector3Value"
stampClusterMaterial = stampData.CurrentParts\FindFirstChild "ClusterMaterial", true
if stampClusterMaterial
stampClusterMaterial = clusterMat
return return
@ -1288,7 +1288,7 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
if game\FindFirstChild"Players" and if game\FindFirstChild"Players" and
game.Players["LocalPlayer"] and game.Players["LocalPlayer"] and
game.Players.LocalPlayer\FindFirstChild "PlayerGui" game.Players.LocalPlayer\FindFirstChild "PlayerGui"
gui = game.Players.LocalPlayer.PlayerGui gui = game.Players.LocalPlayer.PlayerGui
return if not stampData["ErrorBox"] return if not stampData["ErrorBox"]
@ -1870,13 +1870,14 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
-- something will be stamped! so set the "StampedSomething" toggle to true -- something will be stamped! so set the "StampedSomething" toggle to true
if game\FindFirstChild "Players" if game\FindFirstChild"Players" and
if game.Players["LocalPlayer"] game.Players["LocalPlayer"] and
if game.Players.LocalPlayer["Character"] game.Players.LocalPlayer["Character"]
localChar = game.Players.LocalPlayer.Character
stampTracker = localChar\FindFirstChild "StampTracker" localChar = game.Players.LocalPlayer.Character
if stampTracker and not stampTracker.Value stampTracker = localChar\FindFirstChild "StampTracker"
stampTracker.Value = true if stampTracker and not stampTracker.Value
stampTracker.Value = true
-- if we drew a line of mega parts, stamp them out -- if we drew a line of mega parts, stamp them out
@ -1983,7 +1984,7 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
getPlayer = -> getPlayer = ->
if game\FindFirstChild"Players" and if game\FindFirstChild"Players" and
game.Players["LocalPlayer"] game.Players["LocalPlayer"]
return game.Players.LocalPlayer return game.Players.LocalPlayer

View File

@ -193,7 +193,7 @@ inLoadout = (gear) ->
if #button > 0 and if #button > 0 and
button[1].GearReference.Value and button[1].GearReference.Value and
button[1].GearReference.Value == gear button[1].GearReference.Value == gear
return true return true
false false

View File

@ -1034,39 +1034,40 @@ Chat.UpdateQueue = (field, diff) =>
for i = #@MessageQueue, 1, -1 for i = #@MessageQueue, 1, -1
if @MessageQueue[i] if @MessageQueue[i]
for _, label in pairs @MessageQueue[i] for _, label in pairs @MessageQueue[i]
if label and type(label) ~= "table" and type(label) ~= "number" if (label and type(label) ~= "table" and type(label) ~= "number") and
if label\IsA"TextLabel" or label\IsA "TextButton" (label\IsA"TextLabel" or label\IsA "TextButton")
if diff
label.Position = label.Position - UDim2.new 0, 0, diff, 0 if diff
label.Position = label.Position - UDim2.new 0, 0, diff, 0
else
if field == @MessageQueue[i]
label.Position = UDim2.new(
@Configuration.XScale,
0,
label.Position.Y.Scale - field["Message"].Size.Y.Scale,
0
)
-- Just to show up popping effect for the latest message in chat
Spawn ->
wait 0.05
while label.TextTransparency >= 0
label.TextTransparency = label.TextTransparency - 0.2
wait 0.03
label.TextStrokeTransparency = if label == field["Message"]
0.8
else
1
else else
if field == @MessageQueue[i] label.Position = UDim2.new(
label.Position = UDim2.new( @Configuration.XScale,
@Configuration.XScale, 0,
0, label.Position.Y.Scale - field["Message"].Size.Y.Scale,
label.Position.Y.Scale - field["Message"].Size.Y.Scale, 0
0 )
) if label.Position.Y.Scale < -0.01
-- Just to show up popping effect for the latest message in chat -- NOTE: Remove this fix when Textbounds is fixed
Spawn -> label.Visible = false
wait 0.05 label\Destroy!
while label.TextTransparency >= 0
label.TextTransparency = label.TextTransparency - 0.2
wait 0.03
label.TextStrokeTransparency = if label == field["Message"]
0.8
else
1
else
label.Position = UDim2.new(
@Configuration.XScale,
0,
label.Position.Y.Scale - field["Message"].Size.Y.Scale,
0
)
if label.Position.Y.Scale < -0.01
-- NOTE: Remove this fix when Textbounds is fixed
label.Visible = false
label\Destroy!
Chat.CreateScrollBar ==> Chat.CreateScrollBar ==>
-- Code for scrolling is in here, partially, but scroll bar drawing isn't drawn -- Code for scrolling is in here, partially, but scroll bar drawing isn't drawn