new callback; noautoplay

This commit is contained in:
Jill 2022-09-19 23:49:20 +03:00
parent dbe85cb5d1
commit ed260e9d69
3 changed files with 30 additions and 0 deletions

View File

@ -140,6 +140,13 @@
self:hidden(1)
end
local hasExited = false
local function exit()
if hasExited then return end
hasExited = true
uranium:call('exit')
end
local actorsInitialized = false -- if true, no new actors can be created
local luaobj
@ -212,6 +219,10 @@
local errored = false
local firstrun = true
self:addcommand('Update', function()
if not P1 and not P2 then -- sora exit hack
exit()
end
if errored then
return 0
end
@ -226,6 +237,7 @@
firstrun = false
dt = 0
self:GetChildren()[2]:hidden(1)
uranium:call('ready')
end
for _, q in ipairs(globalQueue) do
@ -462,6 +474,7 @@
self:addcommand('On', onCommand)
self:addcommand('Ready', screen_ready_command)
self:addcommand('Off', exit)
self:queuecommand('Ready')
else
Trace('got an error loading main.lua!')

View File

@ -1,3 +1,5 @@
require('stdlib.util')
---@class easable
---@field public a number @the eased value
---@field public toa number @the target, uneased value

15
stdlib/noautoplay.lua Normal file
View File

@ -0,0 +1,15 @@
local oldAutoplay
return function()
function uranium.ready()
oldAutoplay = PREFSMAN:GetPreference('AutoPlay')
PREFSMAN:SetPreference('AutoPlay', 0)
print('hi?? da hell??')
end
function uranium.exit()
if oldAutoplay and oldAutoplay ~= 0 then
PREFSMAN:SetPreference('AutoPlay', oldAutoplay)
end
end
end