Remove some formatting from join and visit corescripts

This commit is contained in:
Lewin Kelly 2023-04-26 13:32:00 +01:00
parent 8be2be6594
commit 73c8c3fc7f
2 changed files with 16 additions and 20 deletions

View File

@ -1,6 +1,5 @@
print "[Mercury]: Loaded Join corescript"
-- functions -------------------------- -- functions --------------------------
function onPlayerAdded(_) function onPlayerAdded(player)
-- override -- override
end end
@ -12,7 +11,7 @@ end)
-- if we are on a touch device, no blocking http calls allowed! This can cause a crash on iOS -- if we are on a touch device, no blocking http calls allowed! This can cause a crash on iOS
-- In general we need a long term strategy to remove blocking http calls from all platforms -- In general we need a long term strategy to remove blocking http calls from all platforms
-- local isTouchDevice = Game:GetService("UserInputService").TouchEnabled local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
settings()["Game Options"].CollisionSoundEnabled = true settings()["Game Options"].CollisionSoundEnabled = true
pcall(function() pcall(function()
@ -88,7 +87,7 @@ pcall(function()
game:GetService("Players"):SetChatStyle(Enum.ChatStyle.ClassicAndBubble) game:GetService("Players"):SetChatStyle(Enum.ChatStyle.ClassicAndBubble)
end) end)
-- local waitingForCharacter = false local waitingForCharacter = false
pcall(function() pcall(function()
if settings().Network.MtuOverride == 0 then if settings().Network.MtuOverride == 0 then
settings().Network.MtuOverride = 1400 settings().Network.MtuOverride = 1400
@ -97,8 +96,8 @@ end)
-- globals ----------------------------------------- -- globals -----------------------------------------
local client = game:GetService "NetworkClient" client = game:GetService "NetworkClient"
local visit = game:GetService "Visit" visit = game:GetService "Visit"
-- functions --------------------------------------- -- functions ---------------------------------------
function setMessage(message) function setMessage(message)
@ -111,7 +110,7 @@ function setMessage(message)
end end
end end
function showErrorWindow(message, _, _) function showErrorWindow(message, errorType, errorCategory)
game:SetMessage(message) game:SetMessage(message)
end end
@ -126,7 +125,7 @@ function reportError(err, message)
end end
-- called when the client connection closes -- called when the client connection closes
function onDisconnection(_, lostConnection) function onDisconnection(peer, lostConnection)
if lostConnection then if lostConnection then
showErrorWindow("You have lost the connection to the game", "LostConnection", "LostConnection") showErrorWindow("You have lost the connection to the game", "LostConnection", "LostConnection")
else else
@ -140,7 +139,7 @@ function requestCharacter(replicator)
connection = player.Changed:connect(function(property) connection = player.Changed:connect(function(property)
if property == "Character" then if property == "Character" then
game:ClearMessage() game:ClearMessage()
-- waitingForCharacter = false waitingForCharacter = false
connection:disconnect() connection:disconnect()
end end
end) end)
@ -150,7 +149,7 @@ function requestCharacter(replicator)
local success, err = pcall(function() local success, err = pcall(function()
replicator:RequestCharacter() replicator:RequestCharacter()
setMessage "Waiting for character" setMessage "Waiting for character"
-- waitingForCharacter = true waitingForCharacter = true
end) end)
if not success then if not success then
@ -160,8 +159,8 @@ function requestCharacter(replicator)
end end
-- called when the client connection is established -- called when the client connection is established
function onConnectionAccepted(_, replicator) function onConnectionAccepted(url, replicator)
-- connectResolved = true connectResolved = true
local waitingForMarker = true local waitingForMarker = true
@ -205,14 +204,13 @@ function onConnectionFailed(_, error)
showErrorWindow("Failed to connect to the Game. (ID=" .. error .. ")", "ID" .. error, "Other") showErrorWindow("Failed to connect to the Game. (ID=" .. error .. ")", "ID" .. error, "Other")
end end
local connectionFailed
-- called when the client connection is rejected -- called when the client connection is rejected
function onConnectionRejected() function onConnectionRejected()
connectionFailed:disconnect() connectionFailed:disconnect()
showErrorWindow("This game is not available. Please try another", "WrongVersion", "WrongVersion") showErrorWindow("This game is not available. Please try another", "WrongVersion", "WrongVersion")
end end
local idled = false idled = false
function onPlayerIdled(time) function onPlayerIdled(time)
if time > 20 * 60 then if time > 20 * 60 then
showErrorWindow(string.format("You were disconnected for being idle %d minutes", time / 60), "Idle", "Idle") showErrorWindow(string.format("You were disconnected for being idle %d minutes", time / 60), "Idle", "Idle")
@ -237,7 +235,7 @@ local success, err = pcall(function()
connectionFailed = client.ConnectionFailed:connect(onConnectionFailed) connectionFailed = client.ConnectionFailed:connect(onConnectionFailed)
client.Ticket = "" client.Ticket = ""
local playerConnectSucces, player = pcall(function() playerConnectSucces, player = pcall(function()
return client:PlayerConnect(_USER_ID, "_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime) return client:PlayerConnect(_USER_ID, "_SERVER_ADDRESS", _SERVER_PORT, 0, threadSleepTime)
end) end)
if not playerConnectSucces then if not playerConnectSucces then

View File

@ -1,4 +1,3 @@
print "[Mercury]: Loaded Visit corescript"
-- Prepended to Edit.lua and Visit.lua and Studio.lua and PlaySolo.lua-- -- Prepended to Edit.lua and Visit.lua and Studio.lua and PlaySolo.lua--
if true then if true then
@ -13,7 +12,7 @@ else
end end
end end
local visit = game:GetService "Visit" visit = game:GetService "Visit"
local message = Instance.new "Message" local message = Instance.new "Message"
message.Parent = workspace message.Parent = workspace
@ -92,7 +91,6 @@ workspace:SetPhysicsThrottleEnabled(true)
local addedBuildTools = false local addedBuildTools = false
local screenGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui" local screenGui = game:GetService("CoreGui"):FindFirstChild "RobloxGui"
local player
function doVisit() function doVisit()
message.Text = "Loading Game" message.Text = "Loading Game"
if false then if false then
@ -117,7 +115,7 @@ function doVisit()
player = game:GetService("Players"):CreateLocalPlayer(0) player = game:GetService("Players"):CreateLocalPlayer(0)
end end
player.CharacterAppearance = "" player.CharacterAppearance = ""
local propExists, canAutoLoadChar = false, false local propExists, canAutoLoadChar = false
propExists = pcall(function() propExists = pcall(function()
canAutoLoadChar = game.Players.CharacterAutoLoads canAutoLoadChar = game.Players.CharacterAutoLoads
end) end)
@ -144,7 +142,7 @@ function doVisit()
end end
end end
local success, err = pcall(doVisit) success, err = pcall(doVisit)
if not addedBuildTools then if not addedBuildTools then
local playerName = Instance.new "StringValue" local playerName = Instance.new "StringValue"