mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-03 09:56:01 -04:00
Improving onClick/update mocks
Making on to off to on and on to off to idle wait for progress to finish
This commit is contained in:
parent
510846d1ec
commit
f84c082d47
@ -26,7 +26,7 @@ local colors = {
|
||||
lightGray = 0xD3D3D3,
|
||||
darkGray = 0xA9A9A9,
|
||||
darkSlateGrey = 0x2F4F4F,
|
||||
notBlack = 0x101020,
|
||||
notBlack = 0x181828,
|
||||
black = 0x000000
|
||||
}
|
||||
|
||||
|
@ -96,24 +96,35 @@ local function updateMachineWidget(self)
|
||||
self.progress = self.progress + 1
|
||||
if self.progress >= self.maxProgress then
|
||||
self.progress = 0
|
||||
self.state = states[2]
|
||||
self.maxProgress = 0
|
||||
self.state = states[2]
|
||||
end
|
||||
elseif self.state == states[2] then
|
||||
if math.random(1000) > 999 then
|
||||
self.state = states[1]
|
||||
self.maxProgress = math.random(500)
|
||||
end
|
||||
elseif self.state == states[3] then
|
||||
self.progress = self.progress + 1
|
||||
if self.progress >= self.maxProgress then
|
||||
self.progress = 0
|
||||
self.maxProgress = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function machineOnClick(self)
|
||||
self.progress = 0
|
||||
self.maxProgress = 0
|
||||
if self.state == states[1] or self.state == states[2] then
|
||||
self.state = states[3]
|
||||
elseif self.state == states[3] or self.state == states[4] then
|
||||
self.state = states[2]
|
||||
elseif self.state == states[3] then
|
||||
if self.progress < self.maxProgress then
|
||||
self.state = states[1]
|
||||
else
|
||||
self.state = states[2]
|
||||
end
|
||||
elseif self.state == states[4] then
|
||||
self.progress = 0
|
||||
self.maxProgress = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user