Improve corescript and terrain plugin formatting

This commit is contained in:
Lewin Kelly 2024-04-06 11:15:28 +01:00
parent 9d12d4b362
commit 7c9660e0cb
19 changed files with 393 additions and 348 deletions

View File

@ -3242,7 +3242,7 @@ export type SharedTable = any
export type OpenCloudModel = any export type OpenCloudModel = any
export type RBXScriptSignal<T... = ...any> = { export type RBXScriptSignal<T... = ...any> = {
wait: (self: RBXScriptSignal<T...>) -> T..., wait: (self: RBXScriptSignal<T...>, time: number?) -> T...,
connect: (self: RBXScriptSignal<T...>, callback: (T...) -> ()) -> RBXScriptConnection, connect: (self: RBXScriptSignal<T...>, callback: (T...) -> ()) -> RBXScriptConnection,
connectParallel: (self: RBXScriptSignal<T...>, callback: (T...) -> ()) -> RBXScriptConnection, connectParallel: (self: RBXScriptSignal<T...>, callback: (T...) -> ()) -> RBXScriptConnection,
once: (self: RBXScriptSignal<T...>, callback: (T...) -> ()) -> RBXScriptConnection, once: (self: RBXScriptSignal<T...>, callback: (T...) -> ()) -> RBXScriptConnection,
@ -5384,6 +5384,7 @@ declare class GuiService extends Instance
function ToggleGuiIsVisibleIfAllowed(self, guiType: EnumGuiType): nil function ToggleGuiIsVisibleIfAllowed(self, guiType: EnumGuiType): nil
function OpenBrowserWindow(self, url: string): nil function OpenBrowserWindow(self, url: string): nil
function SetGlobalSizeOffsetPixel(self, x: number, y: number): nil
end end
declare class GuidRegistryService extends Instance declare class GuidRegistryService extends Instance
@ -5542,6 +5543,7 @@ declare class InsertService extends Instance
function SetAssetVersionUrl(self, assetVersionUrl: string): nil function SetAssetVersionUrl(self, assetVersionUrl: string): nil
function SetBaseSetsUrl(self, baseSetsUrl: string): nil function SetBaseSetsUrl(self, baseSetsUrl: string): nil
function SetCollectionUrl(self, collectionUrl: string): nil function SetCollectionUrl(self, collectionUrl: string): nil
function SetUserSetsUrl(self, userSetsUrl: string): nil
end end
declare class JointInstance extends Instance declare class JointInstance extends Instance
@ -5969,7 +5971,11 @@ end
declare class NetworkClient extends NetworkPeer declare class NetworkClient extends NetworkPeer
ConnectionAccepted: RBXScriptSignal<string, Instance> ConnectionAccepted: RBXScriptSignal<string, Instance>
ConnectionRejected: RBXScriptSignal<string>
ConnectionFailed: RBXScriptSignal<string, number, string> ConnectionFailed: RBXScriptSignal<string, number, string>
function Connect(self, serverAddress: string, serverPort: number, id: number, threadSleepTime: number): nil
function Disconnect(self, blockDuration: number?): nil
function PlayerConnect(self, userId: number, server: string, serverPort: number, clientPort: number?, threadSleepTime: number?, userName: string?): Player
end end
declare class NetworkServer extends NetworkPeer declare class NetworkServer extends NetworkPeer
@ -6619,6 +6625,8 @@ declare class Player extends Instance
function SetModerationAccessKey(self, moderationAccessKey: string): nil function SetModerationAccessKey(self, moderationAccessKey: string): nil
function SetSuperSafeChat(self, value: boolean): nil function SetSuperSafeChat(self, value: boolean): nil
function UpdatePlayerBlocked(self, userId: number, blocked: boolean): nil function UpdatePlayerBlocked(self, userId: number, blocked: boolean): nil
function SetUnder13(self, value: boolean): nil
end end
declare class PlayerEmulatorService extends Instance declare class PlayerEmulatorService extends Instance
@ -8358,7 +8366,8 @@ declare class VisibilityService extends Instance
end end
declare class Visit extends Instance declare class Visit extends Instance
function SetPing(self, url: string, interval: number): nil function SetPing(self, pingUrl: string, interval: number): nil
function SetUploadUrl(self, url: string): nil
end end
declare class Wire extends Instance declare class Wire extends Instance
@ -8569,7 +8578,7 @@ declare _IS_STUDIO_JOIN: string
declare _SERVER_ADDRESS: any declare _SERVER_ADDRESS: any
declare _SERVER_PORT: string declare _SERVER_PORT: string
declare _CREATOR_ID: number declare _CREATOR_ID: number
declare _USER_ID: string declare _USER_ID: number
declare _USER_NAME: any declare _USER_NAME: any
declare _MEMBERSHIP_TYPE: any declare _MEMBERSHIP_TYPE: any
declare _CHAR_APPEARANCE: string declare _CHAR_APPEARANCE: string

View File

@ -4,10 +4,11 @@ print "[Mercury]: Loaded corescript 107893730"
-- this script creates the gui and sends the web requests for in game purchase prompts -- this script creates the gui and sends the web requests for in game purchase prompts
local MarketplaceService = game:GetService "MarketplaceService"
local GuiService = game:GetService "GuiService"
local ContentProvider = game:GetService "ContentProvider" local ContentProvider = game:GetService "ContentProvider"
local GuiService = game:GetService "GuiService"
local HttpService = game:GetService "HttpService" local HttpService = game:GetService "HttpService"
local InsertService = game:GetService "InsertService"
local MarketplaceService = game:GetService "MarketplaceService"
local RunService = game:GetService "RunService" local RunService = game:GetService "RunService"
-- wait for important items to appear -- wait for important items to appear
@ -27,7 +28,7 @@ end
-------------------------------- Global Variables ---------------------------------------- -------------------------------- Global Variables ----------------------------------------
-- utility variables -- utility variables
local baseUrl = string.lower(ContentProvider.BaseUrl) local baseUrl = ContentProvider.BaseUrl
-- data variables -- data variables
local currentProductInfo, currentAssetId, currentCurrencyType, currentCurrencyAmount, currentEquipOnPurchase, currentProductId, currentServerResponseTable local currentProductInfo, currentAssetId, currentCurrencyType, currentCurrencyAmount, currentEquipOnPurchase, currentProductId, currentServerResponseTable
@ -390,12 +391,12 @@ local function updateAfterBalanceText(playerBalance, notRightBc)
end end
if not keyWord then if not keyWord then
return false return false, false
end end
local playerBalanceNumber = tonumber(playerBalance[keyWord]) local playerBalanceNumber = tonumber(playerBalance[keyWord])
if not playerBalanceNumber then if not playerBalanceNumber then
return false return false, false
end end
local afterBalanceNumber = playerBalanceNumber - currentCurrencyAmount local afterBalanceNumber = playerBalanceNumber - currentCurrencyAmount
@ -434,11 +435,11 @@ end
-- will get the player's balance of robux and tix, return in a table -- will get the player's balance of robux and tix, return in a table
local function getPlayerBalance() local function getPlayerBalance()
local playerBalance local playerBalance
local success, errorCode = ypcall(function() local ok, errorCode = ypcall(function()
playerBalance = playerBalance =
game:HttpGetAsync(`{getSecureApiBaseUrl()}currency/balance`) game:HttpGetAsync(`{getSecureApiBaseUrl()}currency/balance`)
end) end)
if not success then if not ok then
print("Get player balance failed because", errorCode) print("Get player balance failed because", errorCode)
return return
elseif playerBalance == "" then elseif playerBalance == "" then
@ -486,26 +487,26 @@ local function canPurchaseItem()
local playerOwnsAsset = false local playerOwnsAsset = false
local notRightBc = false local notRightBc = false
local descText local descText
local success = false local ok = false
if purchasingConsumable then if purchasingConsumable then
local currentProductInfoRaw local currentProductInfoRaw
success = ypcall(function() ok = ypcall(function()
currentProductInfoRaw = Game:HttpGetAsync( currentProductInfoRaw = Game:HttpGetAsync(
`{getSecureApiBaseUrl()}marketplace/productDetails?productid={currentProductId}` `{getSecureApiBaseUrl()}marketplace/productDetails?productid={currentProductId}`
) )
end) end)
if success then if ok then
currentProductInfo = HttpService:JSONDecode(currentProductInfoRaw) currentProductInfo = HttpService:JSONDecode(currentProductInfoRaw)
end end
else else
success = ypcall(function() ok = ypcall(function()
currentProductInfo = currentProductInfo =
MarketplaceService:GetProductInfo(currentAssetId) MarketplaceService:GetProductInfo(currentAssetId)
end) end)
end end
if currentProductInfo == nil or not success then if currentProductInfo == nil or not ok then
return true, return true,
nil, nil,
nil, nil,
@ -755,7 +756,7 @@ end
-- given an asset id, this function will grab that asset from the website, and return the first "Tool" object found inside it -- given an asset id, this function will grab that asset from the website, and return the first "Tool" object found inside it
local function getToolAssetID(assetID) local function getToolAssetID(assetID)
local newTool = game:GetService("InsertService"):LoadAsset(assetID) local newTool = InsertService:LoadAsset(assetID)
if not newTool then if not newTool then
return nil return nil
end end
@ -853,14 +854,14 @@ local function acceptPurchase()
url ..= `purchase?productId={currentProductId}{currencyData}&purchasePrice={currentCurrencyAmount}&locationType=Game&locationId={Game.PlaceId}` url ..= `purchase?productId={currentProductId}{currencyData}&purchasePrice={currentCurrencyAmount}&locationType=Game&locationId={Game.PlaceId}`
end end
local success, reason = ypcall(function() local ok, reason = ypcall(function()
response = game:HttpPostAsync(url, "RobloxPurchaseRequest") response = game:HttpPostAsync(url, "RobloxPurchaseRequest")
end) end)
-- debug output for us (found in the logs from local) -- debug output for us (found in the logs from local)
print( print(
"acceptPurchase success from ypcall is ", "acceptPurchase success from ypcall is ",
success, ok,
"reason is", "reason is",
reason reason
) )
@ -905,7 +906,7 @@ local function acceptPurchase()
-- check to see if this item was bought, and if we want to equip it (also need to make sure the asset type was gear) -- check to see if this item was bought, and if we want to equip it (also need to make sure the asset type was gear)
if if
currentEquipOnPurchase currentEquipOnPurchase
and success and ok
and currentAssetId and currentAssetId
and tonumber(currentProductInfo.AssetTypeId) == 19 and tonumber(currentProductInfo.AssetTypeId) == 19
then then
@ -930,7 +931,7 @@ local function acceptPurchase()
currentProductId currentProductId
) )
else else
userPurchaseActionsEnded(success) userPurchaseActionsEnded(ok)
end end
end end

View File

@ -392,8 +392,8 @@ input.FocusLost:connect(function(enterPressed)
end end
setfenv(fn, env) setfenv(fn, env)
local success, output = ypcall(fn) local ok, output = ypcall(fn)
if success then if ok then
logEvent:Fire("= " .. tostring(output), Color3.new(0.5, 1, 0.5)) logEvent:Fire("= " .. tostring(output), Color3.new(0.5, 1, 0.5))
else else
logEvent:Fire("! " .. tostring(output), Color3.new(1, 0.5, 0.5)) logEvent:Fire("! " .. tostring(output), Color3.new(1, 0.5, 0.5))

View File

@ -17,8 +17,8 @@ local function ScopedConnect(
instance, instance,
event, event,
signalFunc, signalFunc,
syncFunc, syncFunc: (() -> ())?,
removeFunc removeFunc: (() -> ())?
) )
local eventConnection local eventConnection
@ -252,7 +252,11 @@ function RbxGui.CreateStyledMessageDialog(title, message, style, buttons)
end end
local scrollMouseCount local scrollMouseCount
function RbxGui.CreateDropDownMenu(items, onSelect, forRoblox: boolean?) function RbxGui.CreateDropDownMenu(
items,
onSelect,
forRoblox: boolean?
): (Frame, (string) -> ())
local width = UDim.new(0, 100) local width = UDim.new(0, 100)
local height = UDim.new(0, 32) local height = UDim.new(0, 32)
@ -1560,7 +1564,7 @@ function RbxGui.CreateTrueScrollingFrame()
return scrollingFrame, controlFrame return scrollingFrame, controlFrame
end end
function RbxGui.CreateScrollingFrame(orderList, scrollStyle) function RbxGui.CreateScrollingFrame(orderList: { GuiObject }?, scrollStyle)
local frame = New "Frame" { local frame = New "Frame" {
Name = "ScrollingFrame", Name = "ScrollingFrame",
BackgroundTransparency = 1, BackgroundTransparency = 1,
@ -1954,17 +1958,17 @@ function RbxGui.CreateScrollingFrame(orderList, scrollStyle)
end end
reentrancyGuard = true reentrancyGuard = true
RunService.Heartbeat:wait() RunService.Heartbeat:wait()
local success, err local ok, err
if style == "grid" then if style == "grid" then
success, err = pcall(function() ok, err = pcall(function()
layoutGridScrollBar() layoutGridScrollBar()
end) end)
elseif style == "simple" then elseif style == "simple" then
success, err = pcall(function() ok, err = pcall(function()
layoutSimpleScrollBar() layoutSimpleScrollBar()
end) end)
end end
if not success then if not ok then
print(err) print(err)
end end
moveDragger() moveDragger()
@ -2055,13 +2059,13 @@ function RbxGui.CreateScrollingFrame(orderList, scrollStyle)
end end
-- local y = 0 -- local y = 0
scrollDrag.MouseButton1Down:connect(function(_, y) scrollDrag.MouseButton1Down:connect(function(_, y: number)
if scrollDrag.Active then if scrollDrag.Active then
scrollStamp = tick() scrollStamp = tick()
local mouseOffset = y - scrollDrag.AbsolutePosition.y local mouseOffset = y - scrollDrag.AbsolutePosition.y
local dragCon local dragCon
local upCon local upCon
dragCon = mouseDrag.MouseMoved:connect(function(_, y2) dragCon = mouseDrag.MouseMoved:connect(function(_, y2: number)
local barAbsPos = scrollbar.AbsolutePosition.y local barAbsPos = scrollbar.AbsolutePosition.y
local barAbsSize = scrollbar.AbsoluteSize.y local barAbsSize = scrollbar.AbsoluteSize.y
@ -2705,7 +2709,15 @@ type TutorialPage = GuiObject & {
PrevButton: TextButton, PrevButton: TextButton,
} }
RbxGui.AddTutorialPage = function(tutorial, tutorialPage: TutorialPage) function RbxGui.AddTutorialPage(
tutorial: {
TransitionFrame: Frame,
CurrentTutorialPage: ObjectValue,
Buttons: BoolValue,
Pages: Frame,
},
tutorialPage: TutorialPage
)
local transitionFrame = tutorial.TransitionFrame local transitionFrame = tutorial.TransitionFrame
local currentPageValue = tutorial.CurrentTutorialPage local currentPageValue = tutorial.CurrentTutorialPage
@ -2714,7 +2726,7 @@ RbxGui.AddTutorialPage = function(tutorial, tutorialPage: TutorialPage)
tutorialPage.PrevButton.Parent = nil tutorialPage.PrevButton.Parent = nil
end end
local children = tutorial.Pages:GetChildren() local children = tutorial.Pages:GetChildren() :: { TutorialPage }
if children and #children > 0 then if children and #children > 0 then
tutorialPage.Name = "TutorialPage" .. (#children + 1) tutorialPage.Name = "TutorialPage" .. (#children + 1)
local previousPage: TutorialPage = children[#children] local previousPage: TutorialPage = children[#children]
@ -2751,13 +2763,11 @@ RbxGui.AddTutorialPage = function(tutorial, tutorialPage: TutorialPage)
tutorialPage.PrevButton.Active = true tutorialPage.PrevButton.Active = true
tutorialPage.PrevButton.Visible = true tutorialPage.PrevButton.Visible = true
end end
tutorialPage.Parent = tutorial.Pages
else else
--First child -- First child
tutorialPage.Name = "TutorialPage1" tutorialPage.Name = "TutorialPage1"
tutorialPage.Parent = tutorial.Pages
end end
tutorialPage.Parent = tutorial.Pages
end end
RbxGui.CreateSetPanel = function( RbxGui.CreateSetPanel = function(
@ -2806,7 +2816,7 @@ RbxGui.CreateSetPanel = function(
local arrayPosition = 1 local arrayPosition = 1
local insertButtons = {} local insertButtons = {}
local insertButtonCons = {} local insertButtonCons: { RBXScriptConnection } = {}
local contents local contents
local setGui local setGui
@ -3289,9 +3299,10 @@ RbxGui.CreateSetPanel = function(
end end
local function buildInsertButton() local function buildInsertButton()
local insertButton = makeInsertAssetButton() local insertButton = Hydrate(makeInsertAssetButton()) {
insertButton.Name = "InsertAssetButton" Name = "InsertAssetButton",
insertButton.Visible = true Visible = true,
}
if if
Data.Category[Data.CurrentCategory].SetName == "High Scalability" Data.Category[Data.CurrentCategory].SetName == "High Scalability"
@ -3365,7 +3376,7 @@ RbxGui.CreateSetPanel = function(
end end
end end
local function loadSectionOfItems(setGui, rows, columns) local function loadSectionOfItems(setGui, rows: number, columns: number)
local pageSize = rows * columns local pageSize = rows * columns
if arrayPosition > #contents then if arrayPosition > #contents then
@ -3675,6 +3686,7 @@ RbxGui.CreateSetPanel = function(
waterTypeChangedEvent waterTypeChangedEvent
end end
-- We all know enums are just numbers in a trench coat
local cm = Enum.CellMaterial local cm = Enum.CellMaterial
local EnumMaterialNames = { local EnumMaterialNames = {
[cm.Grass] = "Grass", [cm.Grass] = "Grass",
@ -3723,14 +3735,6 @@ for k, v in pairs(EnumMaterialNames) do
StringChoices[v] = k StringChoices[v] = k
end end
local function getEnumFromName(choice)
return StringChoices[choice]
end
local function getNameFromEnum(choice)
return EnumMaterialNames[choice] or MaterialNames[choice]
end
RbxGui.CreateTerrainMaterialSelector = function(size, position) RbxGui.CreateTerrainMaterialSelector = function(size, position)
local terrainMaterialSelectionChanged = Instance.new "BindableEvent" local terrainMaterialSelectionChanged = Instance.new "BindableEvent"
terrainMaterialSelectionChanged.Name = "TerrainMaterialSelectionChanged" terrainMaterialSelectionChanged.Name = "TerrainMaterialSelectionChanged"
@ -3751,10 +3755,10 @@ RbxGui.CreateTerrainMaterialSelector = function(size, position)
local materialToImageMap = {} local materialToImageMap = {}
local currentMaterial = 1 local currentMaterial: number = 1
local function updateMaterialChoice(choice) local function updateMaterialChoice(choice)
currentMaterial = getEnumFromName(choice) currentMaterial = (StringChoices[choice] :: unknown) :: number
terrainMaterialSelectionChanged:Fire(currentMaterial) terrainMaterialSelectionChanged:Fire(currentMaterial)
end end
@ -3866,7 +3870,8 @@ RbxGui.CreateTerrainMaterialSelector = function(size, position)
return return
end end
local matName = getNameFromEnum(newMaterialType) local matName = EnumMaterialNames[newMaterialType]
or MaterialNames[newMaterialType]
local buttons = scrollFrame:GetChildren() local buttons = scrollFrame:GetChildren()
for i = 1, #buttons do for i = 1, #buttons do
if if
@ -4032,7 +4037,13 @@ RbxGui.CreateLoadingFrame = function(name, size, position)
return loadingFrame, updateLoadingGuiPercent, cancelButtonClicked return loadingFrame, updateLoadingGuiPercent, cancelButtonClicked
end end
function RbxGui.CreatePluginFrame(name: string, size, position, scrollable, parent) function RbxGui.CreatePluginFrame(
name: string,
size,
position,
scrollable,
parent
)
local function createMenuButton( local function createMenuButton(
size, size,
position, position,

View File

@ -1,3 +1,4 @@
--!strict
-- CoreGui.RobloxGui.CoreScripts/Settings -- CoreGui.RobloxGui.CoreScripts/Settings
print "[Mercury]: Loaded corescript 46295863" print "[Mercury]: Loaded corescript 46295863"
@ -50,10 +51,10 @@ local mainShield
local inStudioMode = UserSettings().GameSettings:InStudioMode() local inStudioMode = UserSettings().GameSettings:InStudioMode()
local macClient = false local macClient = false
local success, isMac = pcall(function() local ok, isMac = pcall(function()
return not game.GuiService.IsWindows return not game.GuiService.IsWindows
end) end)
macClient = success and isMac macClient = ok and isMac
local function Color3I(r, g, b) local function Color3I(r, g, b)
return Color3.new(r / 255, g / 255, b / 255) return Color3.new(r / 255, g / 255, b / 255)
@ -183,31 +184,30 @@ end
local function resetLocalCharacter() local function resetLocalCharacter()
local player = game.Players.LocalPlayer local player = game.Players.LocalPlayer
if if player and player.Character then
player local humanoid = (player.Character:FindFirstChild "Humanoid") :: Humanoid
and player.Character if humanoid then
and player.Character:FindFirstChild "Humanoid" humanoid.Health = 0
then end
player.Character.Humanoid.Health = 0
end end
end end
local function createTextButton( local function createTextButton(
text, text: string,
style, style: EnumItem,
fontSize, fontSize: EnumItem,
buttonSize, buttonSize: UDim2,
buttonPosition buttonPosition: UDim2
) )
local newTextButton = Instance.new "TextButton" return New "TextButton" {
newTextButton.Font = Enum.Font.Arial Font = Enum.Font.Arial,
newTextButton.FontSize = fontSize FontSize = fontSize,
newTextButton.Size = buttonSize Size = buttonSize,
newTextButton.Position = buttonPosition Position = buttonPosition,
newTextButton.Style = style Style = style,
newTextButton.TextColor3 = Color3.new(1, 1, 1) TextColor3 = Color3.new(1, 1, 1),
newTextButton.Text = text Text = text,
return newTextButton }
end end
local function CreateTextButtons(frame, buttons, yPos, ySize) local function CreateTextButtons(frame, buttons, yPos, ySize)

View File

@ -1,9 +1,12 @@
--!strict
-- CoreGui.RobloxGui.CoreScripts/PlayerListScript -- CoreGui.RobloxGui.CoreScripts/PlayerListScript
print "[Mercury]: Loaded corescript 48488235" print "[Mercury]: Loaded corescript 48488235"
local RunService = game:GetService "RunService" local RunService = game:GetService "RunService"
local New = (require "../Modules/New").New local News = require "../Modules/New"
local New = News.New
local Hydrate = News.Hydrate
local log = require "../Modules/Logger" local log = require "../Modules/Logger"
-------------------- --------------------
@ -19,24 +22,24 @@ local ADMINS = {
} }
local Images = { local Images = {
bottomDark = "94691904", bottomDark = 94691904,
bottomLight = "94691940", bottomLight = 94691940,
midDark = "94691980", midDark = 94691980,
midLight = "94692025", midLight = 94692025,
LargeDark = "96098866", LargeDark = 96098866,
LargeLight = "96098920", LargeLight = 96098920,
LargeHeader = "96097470", LargeHeader = 96097470,
NormalHeader = "94692054", NormalHeader = 94692054,
LargeBottom = "96397271", LargeBottom = 96397271,
NormalBottom = "94754966", NormalBottom = 94754966,
DarkBluePopupMid = "97114905", DarkBluePopupMid = 97114905,
LightBluePopupMid = "97114905", LightBluePopupMid = 97114905,
DarkPopupMid = "97112126", DarkPopupMid = 97112126,
LightPopupMid = "97109338", LightPopupMid = 97109338,
DarkBluePopupTop = "97114838", DarkBluePopupTop = 97114838,
DarkBluePopupBottom = "97114758", DarkBluePopupBottom = 97114758,
DarkPopupBottom = "100869219", DarkPopupBottom = 100869219,
LightPopupBottom = "97109175", LightPopupBottom = 97109175,
} }
local BASE_TWEEN = 0.25 local BASE_TWEEN = 0.25
@ -667,7 +670,16 @@ local AddId = 0
-- Score -- Score
-- ID -- ID
-- MyTeam (team ENRTY(not actual team) I am currently on) -- MyTeam (team ENRTY(not actual team) I am currently on)
local PlayerFrames = {} local PlayerFrames: {
{
Frame: Frame,
Player: Player,
Score: number,
ID: number,
MyTeam: nil,
}
} =
{}
-- intermediate ordered frame array, composed of Entrys of -- intermediate ordered frame array, composed of Entrys of
-- Frame -- Frame
-- MyTeam (my team object) -- MyTeam (my team object)
@ -686,9 +698,9 @@ local MiddleFrameBackgrounds = {}
local LastClick = 0 local LastClick = 0
local ButtonCooldown = 0.25 local ButtonCooldown = 0.25
local OnIos = false -- local OnIos = false
-- pcall(function() -- pcall(function()
-- OnIos = Game:GetService("UserInputService").TouchEnabled -- OnIos = UserInputService.TouchEnabled
-- end) -- end)
-- you get 200 of x screen space per stat added, start width 16% -- you get 200 of x screen space per stat added, start width 16%
@ -720,10 +732,10 @@ local NeutralTeamLock = false
local ScrollWheelConnections: { RBXScriptConnection }? = {} local ScrollWheelConnections: { RBXScriptConnection }? = {}
local DefaultListSize = 8 -- local DefaultListSize = 8
if not OnIos then -- if not OnIos then
DefaultListSize = 12 -- DefaultListSize = 12
end -- end
local DidMinimizeDrag = false local DidMinimizeDrag = false
--local PlaceCreatorId=game.CreatorId --local PlaceCreatorId=game.CreatorId
@ -881,7 +893,7 @@ end
player player to change rank of player player to change rank of
nrank new integer rank to give player nrank new integer rank to give player
--]] --]]
local function SetPrivilegeRank(player, nrank) local function SetPrivilegeRank(player, nrank: number)
while player.PersonalServerRank < nrank do while player.PersonalServerRank < nrank do
PersonalServerService:Promote(player) PersonalServerService:Promote(player)
end end
@ -1068,14 +1080,14 @@ end
player player object to check if friends with player player object to check if friends with
@Return: enum of friend status @Return: enum of friend status
--]] --]]
local function GetFriendStatus(player) local function GetFriendStatus(player: Player)
if player == game.Players.LocalPlayer then if player == game.Players.LocalPlayer then
return Enum.FriendStatus.NotFriend return Enum.FriendStatus.NotFriend
end end
local success, result = pcall(function() local ok, result = pcall(function()
return game.Players.LocalPlayer:GetFriendStatus(player) return game.Players.LocalPlayer:GetFriendStatus(player)
end) end)
if success then if ok then
return result return result
end end
return Enum.FriendStatus.NotFriend return Enum.FriendStatus.NotFriend
@ -1116,18 +1128,22 @@ end
------------------------------------ ------------------------------------
-- Player Entry Handling -- Player Entry Handling
------------------------------------ ------------------------------------
type Plr = {
Score: number,
Player: Player,
}
--[[ --[[
used by lua's table.sort to sort player entries used by lua's table.sort to sort player entries
--]] --]]
local function PlayerSortFunction(a, b) local function PlayerSortFunction(a: Plr, b: Plr)
-- prevents flipping out leaderboard -- prevents flipping out leaderboard
if a.Score == b.Score then if a.Score == b.Score then
return a.Player.Name:upper() < b.Player.Name:upper() return a.Player.Name:upper() < b.Player.Name:upper()
end elseif not a.Score then
if not a.Score then
return false return false
end elseif not b.Score then
if not b.Score then
return true return true
end end
return a.Score < b.Score return a.Score < b.Score
@ -1822,7 +1838,7 @@ end
local function ToggleMaximize() local function ToggleMaximize()
IsMaximized.Value = not IsMaximized.Value IsMaximized.Value = not IsMaximized.Value
RecreateScoreColumns(PlayerFrames) --done to re-position stat names NOTE: optimize-able RecreateScoreColumns(PlayerFrames) -- done to re-position stat names NOTE: optimize-able
end end
--[[ --[[
@ -2176,7 +2192,7 @@ end)
last is this the last element of the popup menu last is this the last element of the popup menu
@Return: a popup menu button @Return: a popup menu button
--]] --]]
local function MakePopupButton(nparent, ntext, index, last) local function MakePopupButton(nparent, ntext, index, last: boolean?)
local tobj = New "ImageButton" { local tobj = New "ImageButton" {
Name = "ReportButton", Name = "ReportButton",
BackgroundTransparency = 1, BackgroundTransparency = 1,
@ -2202,19 +2218,12 @@ local function MakePopupButton(nparent, ntext, index, last)
if index == 0 then if index == 0 then
tobj.Image = "http://banland.xyz/asset?id=97108784" tobj.Image = "http://banland.xyz/asset?id=97108784"
elseif last then elseif last then
if index % 2 == 1 then tobj.Image = index % 2 == 1
tobj.Image = "http://banland.xyz/asset?id=" and "http://banland.xyz/asset?id=" .. Images.LightPopupBottom
.. Images.LightPopupBottom or "http://banland.xyz/asset?id=" .. Images.DarkPopupBottom
else
tobj.Image = "http://banland.xyz/asset?id="
.. Images.DarkPopupBottom
end
else else
if index % 2 == 1 then tobj.Image = index % 2 == 1 and "http://banland.xyz/asset?id=97112126"
tobj.Image = "http://banland.xyz/asset?id=97112126" or "http://banland.xyz/asset?id=97109338"
else
tobj.Image = "http://banland.xyz/asset?id=97109338"
end
end end
return tobj return tobj
end end
@ -2229,8 +2238,9 @@ local function InitMovingPanel(entry, player)
if PopUpPanel then if PopUpPanel then
PopUpPanel:Destroy() PopUpPanel:Destroy()
end end
PopUpPanel = PopUpPanelTemplate:Clone() PopUpPanel = Hydrate(PopUpPanelTemplate:Clone()) {
PopUpPanel.Parent = PopUpClipFrame Parent = PopUpClipFrame,
}
local nextIndex = 2 local nextIndex = 2
local friendStatus = GetFriendStatus(player) local friendStatus = GetFriendStatus(player)
@ -2563,7 +2573,11 @@ local function AddMiddleBGFrame()
nBGFrame.Parent = ListFrame nBGFrame.Parent = ListFrame
table.insert(MiddleFrameBackgrounds, nBGFrame) table.insert(MiddleFrameBackgrounds, nBGFrame)
if #MiddleFrameBackgrounds < DefaultListSize and not DidMinimizeDrag then if
#MiddleFrameBackgrounds --[[DefaultListSize]]
< 12
and not DidMinimizeDrag
then
-- print "readjusting bottom clip" -- print "readjusting bottom clip"
DefaultBottomClipPos = -1 DefaultBottomClipPos = -1
+ (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale) + (#MiddleFrameBackgrounds * MiddleBGTemplate.Size.Y.Scale)
@ -2725,13 +2739,15 @@ local function AddNeutralTeam()
end end
NeutralTeamLock = true NeutralTeamLock = true
local defaultTeam = Instance.new "Team" local defaultTeam = New "Team" {
defaultTeam.TeamColor = BrickColor.new "White" TeamColor = BrickColor.new "White",
defaultTeam.Name = "Neutral" Name = "Neutral",
local nentry = {} }
nentry.MyTeam = defaultTeam local nentry = {
nentry.MyPlayers = {} MyTeam = defaultTeam,
nentry.Frame = MiddleTemplate:Clone() MyPlayers = {},
Frame = MiddleTemplate:Clone(),
}
WaitForChild(WaitForChild(nentry.Frame, "TitleFrame"), "Title").Text = WaitForChild(WaitForChild(nentry.Frame, "TitleFrame"), "Title").Text =
defaultTeam.Name defaultTeam.Name
nentry.Frame.TitleFrame.Position = UDim2.new( nentry.Frame.TitleFrame.Position = UDim2.new(
@ -2921,10 +2937,11 @@ local function InsertPlayerFrame(nplayer)
true true
) )
UpdateMinimize() UpdateMinimize()
local nentry = {} local nentry = {
nentry.Frame = nFrame Frame = nFrame,
nentry.Player = nplayer Player = nplayer,
nentry.ID = AddId ID = AddId,
}
AddId += 1 AddId += 1
table.insert(PlayerFrames, nentry) table.insert(PlayerFrames, nentry)
if #TeamFrames ~= 0 then if #TeamFrames ~= 0 then

View File

@ -1,6 +1,7 @@
-- CoreGui.RobloxGui.CoreScripts/NotificationScript -- CoreGui.RobloxGui.CoreScripts/NotificationScript
print "[Mercury]: Loaded corescript 48488398" print "[Mercury]: Loaded corescript 48488398"
local GuiService = game:GetService "GuiService"
local TeleportService = game:GetService "TeleportService" local TeleportService = game:GetService "TeleportService"
local function waitForProperty(instance, property) local function waitForProperty(instance, property)
@ -129,7 +130,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
if fromPlayer == localPlayer then if fromPlayer == localPlayer then
if event == Enum.FriendRequestEvent.Accept then if event == Enum.FriendRequestEvent.Accept then
game:GetService("GuiService"):SendNotification( GuiService:SendNotification(
"You are Friends", "You are Friends",
`With {toPlayer.Name}!`, `With {toPlayer.Name}!`,
`http://banland.xyz/thumbs/avatar.ashx?userId={toPlayer.userId}&x=48&y=48`, `http://banland.xyz/thumbs/avatar.ashx?userId={toPlayer.userId}&x=48&y=48`,
@ -142,7 +143,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
if friendRequestBlacklist[fromPlayer] then if friendRequestBlacklist[fromPlayer] then
return return
end -- previously cancelled friend request, we don't want it! end -- previously cancelled friend request, we don't want it!
game:GetService("GuiService"):SendNotification( GuiService:SendNotification(
"Friend Request", "Friend Request",
`From {fromPlayer.Name}`, `From {fromPlayer.Name}`,
`http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`, `http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`,
@ -152,7 +153,7 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
end end
) )
elseif event == Enum.FriendRequestEvent.Accept then elseif event == Enum.FriendRequestEvent.Accept then
game:GetService("GuiService"):SendNotification( GuiService:SendNotification(
"You are Friends", "You are Friends",
`With {fromPlayer.Name}!`, `With {fromPlayer.Name}!`,
`http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`, `http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`,
@ -276,10 +277,10 @@ if teleportEnabled then
yesCon = popup.AcceptButton.MouseButton1Click:connect(function() yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
killCons() killCons()
local success, err = pcall(function() local ok, err = pcall(function()
TeleportService:TeleportImpl(placeId, spawnName) TeleportService:TeleportImpl(placeId, spawnName)
end) end)
if not success then if not ok then
showOneButton() showOneButton()
popup.PopupText.Text = err popup.PopupText.Text = err
local clickCon local clickCon

View File

@ -2,6 +2,7 @@
print "[Mercury]: Loaded corescript 73157242" print "[Mercury]: Loaded corescript 73157242"
local ChangeHistoryService = game:GetService "ChangeHistoryService" local ChangeHistoryService = game:GetService "ChangeHistoryService"
local InsertService = game:GetService "InsertService"
local RbxStamper = {} local RbxStamper = {}
@ -522,11 +523,11 @@ local function findConfigAtMouseTarget(Mouse: Mouse, stampData: Instance)
local hitPlane = false local hitPlane = false
local targetPart local targetPart
local success = pcall(function() local ok = pcall(function()
targetPart = Mouse.Target targetPart = Mouse.Target
end) end)
if not success then -- or targetPart == nil then if not ok then -- or targetPart == nil then
return admissibleConfig, targetConfig return admissibleConfig, targetConfig
end end
@ -872,13 +873,13 @@ RbxStamper.GetStampModel = function(assetId, terrainShape, useAssetVersionId)
local loading = true local loading = true
if useAssetVersionId then if useAssetVersionId then
loader = coroutine.create(function() loader = coroutine.create(function()
root = game:GetService("InsertService"):LoadAssetVersion(assetId) root = InsertService:LoadAssetVersion(assetId)
loading = false loading = false
end) end)
coroutine.resume(loader) coroutine.resume(loader)
else else
loader = coroutine.create(function() loader = coroutine.create(function()
root = game:GetService("InsertService"):LoadAsset(assetId) root = InsertService:LoadAsset(assetId)
loading = false loading = false
end) end)
coroutine.resume(loader) coroutine.resume(loader)

View File

@ -1,6 +1,8 @@
-- CoreGui.RobloxGui.Backpack.CoreScripts/BackpackScripts/Back (1?) -- CoreGui.RobloxGui.Backpack.CoreScripts/BackpackScripts/Back (1?)
print "[Mercury]: Loaded corescript 89449008" print "[Mercury]: Loaded corescript 89449008"
local UserInputService = game:GetService "UserInputService"
local News = require "../Modules/New" local News = require "../Modules/New"
local New = News.New local New = News.New
local Hydrate = News.Hydrate local Hydrate = News.Hydrate
@ -22,7 +24,7 @@ end
local function IsTouchDevice() local function IsTouchDevice()
local touchEnabled = false local touchEnabled = false
pcall(function() pcall(function()
touchEnabled = Game:GetService("UserInputService").TouchEnabled touchEnabled = UserInputService.TouchEnabled
end) end)
return touchEnabled return touchEnabled
end end
@ -87,14 +89,15 @@ scrollFrame.Position = UDim2.new(0, 0, 0, 30)
scrollFrame.Size = UDim2.new(1, 0, 1, -30) scrollFrame.Size = UDim2.new(1, 0, 1, -30)
scrollFrame.Parent = backpack.Gear.GearGrid scrollFrame.Parent = backpack.Gear.GearGrid
local scrollBar = Instance.new "Frame" New "Frame" {
scrollBar.Name = "ScrollBar" Name = "ScrollBar",
scrollBar.BackgroundTransparency = 0.9 BackgroundTransparency = 0.9,
scrollBar.BackgroundColor3 = Color3.new(1, 1, 1) BackgroundColor3 = Color3.new(1, 1, 1),
scrollBar.BorderSizePixel = 0 BorderSizePixel = 0,
scrollBar.Size = UDim2.new(0, 17, 1, -36) Size = UDim2.new(0, 17, 1, -36),
scrollBar.Position = UDim2.new(0, 0, 0, 18) Position = UDim2.new(0, 0, 0, 18),
scrollBar.Parent = scroller Parent = scroller,
}
scrollDown.Position = UDim2.new(0, 0, 1, -17) scrollDown.Position = UDim2.new(0, 0, 1, -17)
@ -104,9 +107,11 @@ scrollDown.Parent = scroller
local scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout = local scrollFrameLoadout, scrollUpLoadout, scrollDownLoadout, recalculateScrollLoadout =
RbxGui.CreateScrollingFrame() RbxGui.CreateScrollingFrame()
scrollFrameLoadout.Position = UDim2.new(0, 0, 0, 0) Hydrate(scrollFrameLoadout) {
scrollFrameLoadout.Size = UDim2.new(1, 0, 1, 0) Position = UDim2.new(0, 0, 0, 0),
scrollFrameLoadout.Parent = backpack.Gear.GearLoadouts.LoadoutsList Size = UDim2.new(1, 0, 1, 0),
Parent = backpack.Gear.GearLoadouts.LoadoutsList,
}
for i = 1, 4 do for i = 1, 4 do
New "TextButton" { New "TextButton" {

View File

@ -10,7 +10,7 @@ local New = (require "../Modules/New").New
local forceChatGUI = false local forceChatGUI = false
-- Utility functions + Globals -- Utility functions + Globals
local function WaitForChild(parent, childName) local function WaitForChild(parent: Instance, childName)
while parent:FindFirstChild(childName) == nil do while parent:FindFirstChild(childName) == nil do
parent.ChildAdded:wait(0.03) parent.ChildAdded:wait(0.03)
end end
@ -629,11 +629,11 @@ function Chat:CreateChatBar()
} }
-- Engine has code to offset the entire world, so if we do it by -20 pixels nothing gets in our chat's way -- Engine has code to offset the entire world, so if we do it by -20 pixels nothing gets in our chat's way
--GuiService:SetGlobalSizeOffsetPixel(0, -20) -- GuiService:SetGlobalSizeOffsetPixel(0, -20)
local success = pcall(function() local ok = pcall(function()
GuiService:SetGlobalGuiInset(0, 0, 0, 20) GuiService:SetGlobalGuiInset(0, 0, 0, 20)
end) end)
if not success then if not ok then
GuiService:SetGlobalSizeOffsetPixel(0, -20) GuiService:SetGlobalSizeOffsetPixel(0, -20)
end end
-- ChatHotKey is '/' -- ChatHotKey is '/'

View File

@ -145,12 +145,12 @@ local function requestCharacter(replicator)
setLoadingMessage "Requesting character" setLoadingMessage "Requesting character"
local success, err = pcall(function() local ok, err = pcall(function()
replicator:RequestCharacter() replicator:RequestCharacter()
setLoadingMessage "Waiting for character" setLoadingMessage "Waiting for character"
end) end)
if not success then if not ok then
reportError(err) reportError(err)
return return
end end
@ -160,7 +160,7 @@ end
local function onConnectionAccepted(_, replicator) local function onConnectionAccepted(_, replicator)
local waitingForMarker = true local waitingForMarker = true
local success, err = pcall(function() local ok, err = pcall(function()
Visit:SetPing(_PING_URL, 30) Visit:SetPing(_PING_URL, 30)
loadingState += 1 loadingState += 1
@ -177,7 +177,7 @@ local function onConnectionAccepted(_, replicator)
end) end)
end) end)
if not success then if not ok then
reportError(err) reportError(err)
return return
end end
@ -209,7 +209,7 @@ local function onPlayerIdled(idleTime)
idleTime / 60 idleTime / 60
) )
) )
Client:disconnect() Client:Disconnect()
end end
end end
@ -218,7 +218,7 @@ end
pcall(function() pcall(function()
settings().Diagnostics:LegacyScriptMode() settings().Diagnostics:LegacyScriptMode()
end) end)
local success, err = pcall(function() local ok, err = pcall(function()
game:SetRemoteBuildMode(true) game:SetRemoteBuildMode(true)
setLoadingMessage "Connecting to server" setLoadingMessage "Connecting to server"
@ -238,7 +238,7 @@ local success, err = pcall(function()
) )
end) end)
if not playerConnectSuccess then if not playerConnectSuccess then
--Old player connection scheme -- Old player connection scheme
player = Players:CreateLocalPlayer(_USER_ID) player = Players:CreateLocalPlayer(_USER_ID)
Client:Connect("_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime) Client:Connect("_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime)
end end
@ -262,13 +262,10 @@ local success, err = pcall(function()
Visit:SetUploadUrl "" Visit:SetUploadUrl ""
end) end)
if not success then if not ok then
reportError(err) reportError(err)
end end
-- TODO: Async get?
-- loadfile ""("", -1, 0) -- wtf
pcall(function() pcall(function()
game:SetScreenshotInfo "" game:SetScreenshotInfo ""
end) end)

View File

@ -84,7 +84,7 @@ end)
workspace:SetPhysicsThrottleEnabled(true) workspace:SetPhysicsThrottleEnabled(true)
local function doVisit() local ok, err = pcall(function()
message.Text = "Loading Game" message.Text = "Loading Game"
pcall(function() pcall(function()
@ -96,7 +96,7 @@ local function doVisit()
message.Text = "Creating Player" message.Text = "Creating Player"
player = game:GetService("Players"):CreateLocalPlayer(0) player = Players:CreateLocalPlayer(0)
player.CharacterAppearance = "" player.CharacterAppearance = ""
local propExists, canAutoLoadChar = false, false local propExists, canAutoLoadChar = false, false
@ -116,11 +116,9 @@ local function doVisit()
pcall(function() pcall(function()
player:SetAccountAge(0) player:SetAccountAge(0)
end) end)
end end)
local success, err = pcall(doVisit) if ok then
if success then
message.Parent = nil message.Parent = nil
else else
print(err) print(err)

View File

@ -3,6 +3,9 @@ while game == nil do
wait() wait()
end end
local ChangeHistoryService = game:GetService "ChangeHistoryService"
local CoreGui = game:GetService "CoreGui"
--------------- ---------------
--PLUGIN SETUP- --PLUGIN SETUP-
--------------- ---------------
@ -123,7 +126,7 @@ local hideGenerateConformation = false
--screengui --screengui
local g = Instance.new "ScreenGui" local g = Instance.new "ScreenGui"
g.Name = "TerrainCreatorGui" g.Name = "TerrainCreatorGui"
g.Parent = game:GetService "CoreGui" g.Parent = CoreGui
-- UI gui load. Required for sliders. -- UI gui load. Required for sliders.
local RbxGui = LoadLibrary "RbxGui" local RbxGui = LoadLibrary "RbxGui"
@ -856,8 +859,7 @@ function GenerateTerrain()
for x = 1 + xpos2, generateOptions.width - 2 + xpos2 do for x = 1 + xpos2, generateOptions.width - 2 + xpos2 do
-- End on cancel. -- End on cancel.
if cancelValues.cancelActions then if cancelValues.cancelActions then
game:GetService("ChangeHistoryService") ChangeHistoryService:SetWaypoint "CancelGenerate"
:SetWaypoint "CancelGenerate"
UnloadProgressBar() UnloadProgressBar()
return return
end end
@ -914,8 +916,7 @@ function GenerateTerrain()
for x = 1 + xpos2, generateOptions.width - 2 + xpos2 do for x = 1 + xpos2, generateOptions.width - 2 + xpos2 do
-- End on cancel. -- End on cancel.
if cancelValues.cancelActions then if cancelValues.cancelActions then
game:GetService("ChangeHistoryService") ChangeHistoryService:SetWaypoint "GenerateGenerate"
:SetWaypoint "GenerateGenerate"
UnloadProgressBar() UnloadProgressBar()
return return
end end

View File

@ -16,9 +16,7 @@ local On, Off
local plugin = PluginManager():CreatePlugin() local plugin = PluginManager():CreatePlugin()
local mouse = plugin:GetMouse() local mouse = plugin:GetMouse()
mouse.Button1Down:connect(function()
onClicked(mouse)
end)
local toolbar = plugin:CreateToolbar "Terrain" local toolbar = plugin:CreateToolbar "Terrain"
local toolbarbutton = toolbar:CreateButton("Builder", "Builder", "builder.png") local toolbarbutton = toolbar:CreateButton("Builder", "Builder", "builder.png")
toolbarbutton.Click:connect(function() toolbarbutton.Click:connect(function()
@ -296,78 +294,81 @@ CreateStandardLabel(
-- Function to connect to the mouse button 1 down event. This is what will run when the user clicks. -- Function to connect to the mouse button 1 down event. This is what will run when the user clicks.
-- Adding and autowedging done here. -- Adding and autowedging done here.
-- mouse - Mouse data. -- mouse - Mouse data.
function onClicked(mouseC) local function onClicked()
if on then if not on then
local cellPos = WorldToCellPreferEmpty( return
c,
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z)
)
local x = cellPos.x
local y = cellPos.y
local z = cellPos.z
local solidCellPos = WorldToCellPreferSolid(
c,
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z)
)
local celMat =
GetCell(c, solidCellPos.x, solidCellPos.y, solidCellPos.z)
local success = false
if celMat.Value > 0 then
selectionProps.terrainMaterial = celMat.Value
selectionProps.isWater, selectionProps.waterForce, selectionProps.waterDirection =
GetWaterCell(c, solidCellPos.X, solidCellPos.Y, solidCellPos.Z)
else
if 0 == selectionProps.terrainMaterial then
-- It was nothing, give it a default type and the plane intersection.
selectionProps.isWater = false
selectionProps.terrainMaterial = 1
end
success, cellPos = PlaneIntersection(
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z)
)
if not success then
cellPos = solidCellPos
end
x = cellPos.x
y = cellPos.y
z = cellPos.z
end
if selectionProps.isWater and 17 == selectionProps.terrainMaterial then
SetWaterCell(
c,
x,
y,
z,
selectionProps.waterForce,
selectionProps.waterDirection
)
else
SetCell(c, x, y, z, selectionProps.terrainMaterial, 0, 0)
end
if properties.autoWedgeEnabled then
AutoWedge(
c,
Region3int16.new(
Vector3int16.new(x - 1, y - 1, z - 1),
Vector3int16.new(x + 1, y + 1, z + 1)
)
)
end
-- Mark undo point.
ChangeHistoryService:SetWaypoint "Builder"
UpdatePosition(mouseC.Hit)
end end
local cellPos = WorldToCellPreferEmpty(
c,
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
)
local x = cellPos.x
local y = cellPos.y
local z = cellPos.z
local solidCellPos = WorldToCellPreferSolid(
c,
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
)
local celMat = GetCell(c, solidCellPos.x, solidCellPos.y, solidCellPos.z)
local success = false
if celMat.Value > 0 then
selectionProps.terrainMaterial = celMat.Value
selectionProps.isWater, selectionProps.waterForce, selectionProps.waterDirection =
GetWaterCell(c, solidCellPos.X, solidCellPos.Y, solidCellPos.Z)
else
if 0 == selectionProps.terrainMaterial then
-- It was nothing, give it a default type and the plane intersection.
selectionProps.isWater = false
selectionProps.terrainMaterial = 1
end
success, cellPos = PlaneIntersection(
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
)
if not success then
cellPos = solidCellPos
end
x = cellPos.x
y = cellPos.y
z = cellPos.z
end
if selectionProps.isWater and 17 == selectionProps.terrainMaterial then
SetWaterCell(
c,
x,
y,
z,
selectionProps.waterForce,
selectionProps.waterDirection
)
else
SetCell(c, x, y, z, selectionProps.terrainMaterial, 0, 0)
end
if properties.autoWedgeEnabled then
AutoWedge(
c,
Region3int16.new(
Vector3int16.new(x - 1, y - 1, z - 1),
Vector3int16.new(x + 1, y + 1, z + 1)
)
)
end
-- Mark undo point.
ChangeHistoryService:SetWaypoint "Builder"
UpdatePosition(mouse.Hit)
end end
mouse.Button1Down:connect(onClicked)
mouseHighlighter.OnClicked = onClicked mouseHighlighter.OnClicked = onClicked
-- Run when the popup is activated. -- Run when the popup is activated.

View File

@ -19,9 +19,7 @@ local On, Off
--------------- ---------------
local plugin = PluginManager():CreatePlugin() local plugin = PluginManager():CreatePlugin()
local mouse = plugin:GetMouse() local mouse = plugin:GetMouse()
mouse.Button1Down:connect(function()
onClicked(mouse)
end)
local toolbar = plugin:CreateToolbar "Terrain" local toolbar = plugin:CreateToolbar "Terrain"
local toolbarbutton = local toolbarbutton =
toolbar:CreateButton("Remover", "Remover", "destroyer.png") toolbar:CreateButton("Remover", "Remover", "destroyer.png")
@ -251,11 +249,11 @@ CreateStandardLabel(
-- Function to connect to the mouse button 1 down event. This is what will run when the user clicks. -- Function to connect to the mouse button 1 down event. This is what will run when the user clicks.
-- mouse - Mouse data. -- mouse - Mouse data.
function onClicked(mouse2) function onClicked()
if on then if on then
local cellPos = WorldToCellPreferSolid( local cellPos = WorldToCellPreferSolid(
c, c,
Vector3.new(mouse2.Hit.x, mouse2.Hit.y, mouse2.Hit.z) Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
) )
local x = cellPos.x local x = cellPos.x
local y = cellPos.y local y = cellPos.y
@ -266,7 +264,7 @@ function onClicked(mouse2)
-- Mark undo point. -- Mark undo point.
ChangeHistoryService:SetWaypoint "Remover" ChangeHistoryService:SetWaypoint "Remover"
UpdatePosition(mouse2.Hit) UpdatePosition(mouse.Hit)
if properties.autoWedgeEnabled then if properties.autoWedgeEnabled then
AutoWedge( AutoWedge(
@ -280,6 +278,8 @@ function onClicked(mouse2)
end end
end end
mouse.Button1Down:connect(onClicked)
mouseHighlighter.OnClicked = onClicked mouseHighlighter.OnClicked = onClicked
-- Run when the popup is activated. -- Run when the popup is activated.

View File

@ -16,9 +16,7 @@ local On, Off
local plugin = PluginManager():CreatePlugin() local plugin = PluginManager():CreatePlugin()
local mouse = plugin:GetMouse() local mouse = plugin:GetMouse()
mouse.Button1Down:connect(function()
onClicked(mouse)
end)
local toolbar = plugin:CreateToolbar "Terrain" local toolbar = plugin:CreateToolbar "Terrain"
local toolbarbutton = toolbar:CreateButton( local toolbarbutton = toolbar:CreateButton(
"Elevation Adjuster", "Elevation Adjuster",
@ -557,18 +555,18 @@ end
local mousedown = false local mousedown = false
-- Run when the mouse gets clicked. If the click is on terrain, then it will be used as the starting point of the elevation area. -- Run when the mouse gets clicked. If the click is on terrain, then it will be used as the starting point of the elevation area.
function onClicked(mouse2) local function onClicked()
if on then if on then
oldheightmap = {} oldheightmap = {}
heightmap = {} heightmap = {}
local cellPos = WorldToCellPreferEmpty( local cellPos = WorldToCellPreferEmpty(
c, c,
Vector3.new(mouse2.Hit.x, mouse2.Hit.y, mouse2.Hit.z) Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
) )
local solidCell = WorldToCellPreferSolid( local solidCell = WorldToCellPreferSolid(
c, c,
Vector3.new(mouse2.Hit.x, mouse2.Hit.y, mouse2.Hit.z) Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
) )
local success = false local success = false
@ -576,7 +574,7 @@ function onClicked(mouse2)
if 0 == GetCell(c, solidCell.X, solidCell.Y, solidCell.Z).Value then if 0 == GetCell(c, solidCell.X, solidCell.Y, solidCell.Z).Value then
--print('Plane Intersection happens') --print('Plane Intersection happens')
success, cellPos = PlaneIntersection( success, cellPos = PlaneIntersection(
Vector3.new(mouse2.Hit.x, mouse2.Hit.y, mouse2.Hit.z) Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
) )
if not success then if not success then
cellPos = solidCell cellPos = solidCell
@ -604,25 +602,25 @@ function onClicked(mouse2)
mouseHighlighter:DisablePreview() mouseHighlighter:DisablePreview()
mousedown = true mousedown = true
local originalY = mouse2.Y local originalY = mouse.Y
local prevY = originalY local prevY = originalY
local d = 0 local d = 0
local range = 0 local range = 0
while mousedown == true do while mousedown == true do
if math.abs(mouse2.Y - prevY) >= 5 then if math.abs(mouse.Y - prevY) >= 5 then
prevY = mouse2.Y prevY = mouse.Y
local r2 = elevationOptions.r local r2 = elevationOptions.r
+ math.floor( + math.floor(
50 50
* 1 * 1
/ elevationOptions.s / elevationOptions.s
* math.abs(originalY - prevY) * math.abs(originalY - prevY)
/ mouse2.ViewSizeY / mouse.ViewSizeY
) )
if r2 > range then if r2 > range then
range = r2 range = r2
end end
d = math.floor(50 * (originalY - prevY) / mouse2.ViewSizeY) d = math.floor(50 * (originalY - prevY) / mouse.ViewSizeY)
elevate(x, y, z, elevationOptions.r, r2, d, range) elevate(x, y, z, elevationOptions.r, r2, d, range)
end end
wait() wait()
@ -631,6 +629,8 @@ function onClicked(mouse2)
end end
end end
mouse.Button1Down:connect(onClicked)
mouseHighlighter.OnClicked = onClicked mouseHighlighter.OnClicked = onClicked
mouse = plugin:GetMouse() mouse = plugin:GetMouse()
mouse.Button1Up:connect(function() mouse.Button1Up:connect(function()

View File

@ -15,9 +15,7 @@ local On, Off
local this = PluginManager():CreatePlugin() local this = PluginManager():CreatePlugin()
local mouse = this:GetMouse() local mouse = this:GetMouse()
mouse.Button1Down:connect(function()
onClicked(mouse)
end)
local toolbar = this:CreateToolbar "Terrain" local toolbar = this:CreateToolbar "Terrain"
local toolbarbutton = toolbar:CreateButton("Crater", "Crater", "craters.png") local toolbarbutton = toolbar:CreateButton("Crater", "Crater", "craters.png")
toolbarbutton.Click:connect(function() toolbarbutton.Click:connect(function()
@ -119,24 +117,27 @@ function dist(x1, y1, x2, y2)
end end
local debounce = false local debounce = false
function onClicked(mouseC)
if on and not debounce then
debounce = true
local cellPos = WorldToCellPreferSolid( mouse.Button1Down:connect(function()
c, if not on or debounce then
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z) return
)
local x = cellPos.x
local y = cellPos.y
local z = cellPos.z
makeCrater(x, y, z, r, d)
debounce = false
ChangeHistoryService:SetWaypoint "Crater"
end end
end
debounce = true
local cellPos = WorldToCellPreferSolid(
c,
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
)
local x = cellPos.x
local y = cellPos.y
local z = cellPos.z
makeCrater(x, y, z, r, d)
debounce = false
ChangeHistoryService:SetWaypoint "Crater"
end)
On = function() On = function()
if not c then if not c then

View File

@ -14,9 +14,6 @@ local On, Off
local this = PluginManager():CreatePlugin() local this = PluginManager():CreatePlugin()
local mouse = this:GetMouse() local mouse = this:GetMouse()
mouse.Button1Down:connect(function()
onClicked(mouse)
end)
local toolbar = this:CreateToolbar "Terrain" local toolbar = this:CreateToolbar "Terrain"
local toolbarbutton = toolbar:CreateButton("Roads", "Roads", "roads.png") local toolbarbutton = toolbar:CreateButton("Roads", "Roads", "roads.png")
toolbarbutton.Click:connect(function() toolbarbutton.Click:connect(function()
@ -222,56 +219,58 @@ function PlaneIntersection(vectorPos)
return success, cellPos return success, cellPos
end end
function onClicked(mouseC) mouse.Button1Down:connect(function()
if on then if not on then
local cellPos = WorldToCellPreferEmpty( return
c, end
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z)
local cellPos = WorldToCellPreferEmpty(
c,
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
)
local solidCell = WorldToCellPreferSolid(
c,
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
)
local success = false
-- If nothing was hit, do the plane intersection.
if 0 == GetCell(c, solidCell.X, solidCell.Y, solidCell.Z).Value then
--print('Plane Intersection happens')
success, cellPos = PlaneIntersection(
Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
) )
local solidCell = WorldToCellPreferSolid( if not success then
c, cellPos = solidCell
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z)
)
local success = false
-- If nothing was hit, do the plane intersection.
if 0 == GetCell(c, solidCell.X, solidCell.Y, solidCell.Z).Value then
--print('Plane Intersection happens')
success, cellPos = PlaneIntersection(
Vector3.new(mouseC.Hit.x, mouseC.Hit.y, mouseC.Hit.z)
)
if not success then
cellPos = solidCell
end
end
local x = cellPos.x
local y = cellPos.y
local z = cellPos.z
if mode == 0 then
x1 = x
y1 = z
h = y
mode = 1
-- first click determines default material
local celMat = GetCell(c, x, y, z)
if celMat.Value > 0 then
DefaultTerrainMaterial = celMat.Value
else
if 0 == DefaultTerrainMaterial then
DefaultTerrainMaterial = 1
end
end
elseif mode == 1 then
x2 = x
y2 = z
makePath(x1, y1, x2, y2, h, true)
mode = 0
end end
end end
end
local x = cellPos.x
local y = cellPos.y
local z = cellPos.z
if mode == 0 then
x1 = x
y1 = z
h = y
mode = 1
-- first click determines default material
local celMat = GetCell(c, x, y, z)
if celMat.Value > 0 then
DefaultTerrainMaterial = celMat.Value
else
if 0 == DefaultTerrainMaterial then
DefaultTerrainMaterial = 1
end
end
elseif mode == 1 then
x2 = x
y2 = z
makePath(x1, y1, x2, y2, h, true)
mode = 0
end
end)
On = function() On = function()
if not c then if not c then

View File

@ -2,6 +2,9 @@ while game == nil do
wait() wait()
end end
local ContentProvider = game:GetService "ContentProvider"
local CoreGui = game:GetService "CoreGui"
--------------- ---------------
--PLUGIN SETUP- --PLUGIN SETUP-
--------------- ---------------
@ -66,7 +69,7 @@ Spawn(function()
RbxStamper = LoadLibrary "RbxStamper" RbxStamper = LoadLibrary "RbxStamper"
end) end)
local BaseUrl = game:GetService("ContentProvider").BaseUrl:lower() local BaseUrl = ContentProvider.BaseUrl:lower()
----------------------- -----------------------
--FUNCTION DEFINITIONS- --FUNCTION DEFINITIONS-
@ -354,7 +357,7 @@ function createGui()
) )
setPanelVisibility(false) setPanelVisibility(false)
currStampGui.Parent = game:GetService "CoreGui" currStampGui.Parent = CoreGui
waterTypeChangedEvent.Event:connect(function(waterTable) waterTypeChangedEvent.Event:connect(function(waterTable)
waterForceAndDirection = waterTable waterForceAndDirection = waterTable