Add Stan patches

This commit is contained in:
cirroskais 2023-09-02 18:15:48 -04:00
parent a915bd775c
commit cd8d56e767
No known key found for this signature in database
GPG Key ID: E55435DEA0825091
2 changed files with 9 additions and 14 deletions

View File

@ -9,12 +9,8 @@ class GameJob extends Job {
super({ expirationInSeconds: 360 }) super({ expirationInSeconds: 360 })
} }
StartGame(id, port) { StartGame(id, port, creatorId) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const response = await axios(`${process.env.BASE_URL}/API/Game/${id}?t=${process.env.ARBITER_TOKEN}`).catch((_) => reject(_))
const { server_token, server_port } = response.data
this.serverToken = server_token
this.placeId = id this.placeId = id
this.port = port this.port = port
this.id = id this.id = id
@ -38,6 +34,7 @@ class GameJob extends Job {
{ type: "LUA_TNUMBER", value: id }, { type: "LUA_TNUMBER", value: id },
{ type: "LUA_TNUMBER", value: port }, { type: "LUA_TNUMBER", value: port },
{ type: "LUA_TSTRING", value: process.env.ARBITER_TOKEN }, { type: "LUA_TSTRING", value: process.env.ARBITER_TOKEN },
{ type: "LUA_TNUMBER", value: creatorId },
], ],
}, },
}).catch((e) => reject(e)) }).catch((e) => reject(e))

View File

@ -1,4 +1,4 @@
local jobId, type, baseUrl, placeId, port, key = ... local jobId, type, baseUrl, placeId, port, key, creatorId = ...
------------------- UTILITY FUNCTIONS -------------------------- ------------------- UTILITY FUNCTIONS --------------------------
@ -54,9 +54,10 @@ if baseUrl ~= nil then
game:GetService("InsertService"):SetCollectionUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?sid=%d") game:GetService("InsertService"):SetCollectionUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?sid=%d")
game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/Asset/?id=%d") game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/Asset/?id=%d")
game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d") game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
pcall(function() game:SetCreatorID(creatorId, Enum.CreatorType.User) end)
pcall(function() loadfile(baseUrl .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end) pcall(function() loadfile(baseUrl .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) -- pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
game:GetService('Players'):SetSysStatsUrl('https://kapish.fun/Game/report-stats')
end end
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
@ -64,11 +65,11 @@ pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequi
settings().Diagnostics.LuaRamLimit = 0 settings().Diagnostics.LuaRamLimit = 0
game:GetService("Players").PlayerAdded:connect(function(player) game:GetService("Players").PlayerAdded:connect(function(player)
print("Player " .. player.userId .. " added") --print("Player " .. player.userId .. " added")
end) end)
game:GetService("Players").PlayerRemoving:connect(function(player) game:GetService("Players").PlayerRemoving:connect(function(player)
print("Player " .. player.userId .. " leaving") --print("Player " .. player.userId .. " leaving")
end) end)
if placeId~=nil and baseUrl~=nil then if placeId~=nil and baseUrl~=nil then
@ -78,8 +79,7 @@ end
-- Now start the connection -- Now start the connection
ns:Start(port) game:GetService("RunService"):Run()
spawn(function() spawn(function()
while wait(5) do while wait(5) do
local playerIds = "" local playerIds = ""
@ -107,5 +107,3 @@ spawn(function()
end end
end end
end) end)
game:GetService("RunService"):Run()