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

View File

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

View File

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

View File

@ -799,22 +799,22 @@ t.GetStampModel = (assetId, terrainShape, useAssetVersionId) ->
Parent: root
if terrainShape
if 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 and
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 1, terrainShape, 0
setupFakeTerrainPart clusterTag.Value, terrainShape, 0
else
setupFakeTerrainPart 1, terrainShape, 0
root
@ -1104,14 +1104,14 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
-- don't drag into terrain
if clusterPartsInRegion minBB + insertBoundingBoxOverlapVector, maxBB - insertBoundingBoxOverlapVector
if lastTarget.CFrame
if 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
if lastTarget.CFrame and
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
return
@ -1288,7 +1288,7 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
if game\FindFirstChild"Players" and
game.Players["LocalPlayer"] and
game.Players.LocalPlayer\FindFirstChild "PlayerGui"
gui = game.Players.LocalPlayer.PlayerGui
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
if game\FindFirstChild "Players"
if game.Players["LocalPlayer"]
if game.Players.LocalPlayer["Character"]
localChar = game.Players.LocalPlayer.Character
stampTracker = localChar\FindFirstChild "StampTracker"
if stampTracker and not stampTracker.Value
stampTracker.Value = true
if game\FindFirstChild"Players" and
game.Players["LocalPlayer"] and
game.Players.LocalPlayer["Character"]
localChar = game.Players.LocalPlayer.Character
stampTracker = localChar\FindFirstChild "StampTracker"
if stampTracker and not stampTracker.Value
stampTracker.Value = true
-- if we drew a line of mega parts, stamp them out
@ -1983,7 +1984,7 @@ t.SetupStamperDragger = (modelToStamp, Mouse, StampInModel, AllowedStampRegion,
getPlayer = ->
if game\FindFirstChild"Players" and
game.Players["LocalPlayer"]
return game.Players.LocalPlayer

View File

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

View File

@ -1034,39 +1034,40 @@ Chat.UpdateQueue = (field, diff) =>
for i = #@MessageQueue, 1, -1
if @MessageQueue[i]
for _, label in pairs @MessageQueue[i]
if label and type(label) ~= "table" and type(label) ~= "number"
if label\IsA"TextLabel" or label\IsA "TextButton"
if diff
label.Position = label.Position - UDim2.new 0, 0, diff, 0
if (label and type(label) ~= "table" and type(label) ~= "number") and
(label\IsA"TextLabel" or label\IsA "TextButton")
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
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
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!
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 ==>
-- Code for scrolling is in here, partially, but scroll bar drawing isn't drawn