mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Change to a game.Rojo module instead of _G
This commit is contained in:
parent
b401b6db2f
commit
955b143ced
1 changed files with 15 additions and 8 deletions
|
|
@ -138,14 +138,14 @@ function App:init()
|
||||||
|
|
||||||
self.headlessAPI, self.readOnlyHeadlessAPI = HeadlessAPI.new(self)
|
self.headlessAPI, self.readOnlyHeadlessAPI = HeadlessAPI.new(self)
|
||||||
|
|
||||||
-- selene: allow(global_usage)
|
local existingAPIModule = game:FindFirstChild("Rojo")
|
||||||
local existingAPI = _G.Rojo
|
if existingAPIModule and existingAPIModule:IsA("ModuleScript") then
|
||||||
if existingAPI then
|
local existingAPI = require(existingAPIModule :: ModuleScript)
|
||||||
|
|
||||||
local responseEvent = Instance.new("BindableEvent")
|
local responseEvent = Instance.new("BindableEvent")
|
||||||
responseEvent.Event:Once(function(accepted)
|
responseEvent.Event:Once(function(accepted)
|
||||||
if accepted then
|
if accepted then
|
||||||
-- selene: allow(global_usage)
|
existingAPI.API = self.readOnlyHeadlessAPI
|
||||||
_G.Rojo = self.readOnlyHeadlessAPI -- Expose headless to other plugins and command bar
|
|
||||||
end
|
end
|
||||||
|
|
||||||
responseEvent:Destroy()
|
responseEvent:Destroy()
|
||||||
|
|
@ -163,7 +163,7 @@ function App:init()
|
||||||
responseEvent:Fire(false)
|
responseEvent:Fire(false)
|
||||||
end,
|
end,
|
||||||
content = e(ConflictAPIPopup, {
|
content = e(ConflictAPIPopup, {
|
||||||
existingAPI = existingAPI,
|
existingAPI = existingAPI.API,
|
||||||
onAccept = function()
|
onAccept = function()
|
||||||
responseEvent:Fire(true)
|
responseEvent:Fire(true)
|
||||||
end,
|
end,
|
||||||
|
|
@ -176,8 +176,15 @@ function App:init()
|
||||||
return state
|
return state
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
-- selene: allow(global_usage)
|
local ExposedAPIModule = Instance.new("ModuleScript")
|
||||||
_G.Rojo = self.readOnlyHeadlessAPI -- Expose headless to other plugins and command bar
|
ExposedAPIModule.Name = "Rojo"
|
||||||
|
ExposedAPIModule.Archivable = false
|
||||||
|
ExposedAPIModule.Source = "return { API = nil }"
|
||||||
|
|
||||||
|
local ExposedAPI = require(ExposedAPIModule)
|
||||||
|
ExposedAPI.API = self.readOnlyHeadlessAPI
|
||||||
|
|
||||||
|
ExposedAPIModule.Parent = game
|
||||||
end
|
end
|
||||||
|
|
||||||
if
|
if
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue