mirror of
https://github.com/osmarks/random-stuff
synced 2024-12-26 18:10:34 +00:00
Lua tweaks
This commit is contained in:
parent
acccb2f715
commit
72c242d0a9
@ -77,7 +77,12 @@ local function display_stats()
|
|||||||
if reactor_state.status == "warming_up" then
|
if reactor_state.status == "warming_up" then
|
||||||
status = "Reactor Precharge"
|
status = "Reactor Precharge"
|
||||||
status_col = colors.blue
|
status_col = colors.blue
|
||||||
elseif reactor_state.status ~= "cold" and (reactor_state.status == "stopping" or reactor_state.temperature > 8000 or reactor_state.fieldStrength / reactor_state.maxFieldStrength < 0.2 or reactor_state.fuelConversion / reactor_state.maxFuelConversion > 0.83) then
|
elseif reactor_state.status == "stopping" or reactor_state.status == "cooling" then
|
||||||
|
status = "Shutdown Running"
|
||||||
|
status_col = colors.lime
|
||||||
|
re_out_gate.setFlowOverride(1e4)
|
||||||
|
re_in_gate.setFlowOverride(0)
|
||||||
|
elseif reactor_state.status ~= "cold" and (reactor_state.temperature > 8000 or reactor_state.fieldStrength / reactor_state.maxFieldStrength < 0.2 or reactor_state.fuelConversion / reactor_state.maxFuelConversion > 0.83) then
|
||||||
status = "Emergency Shutdown"
|
status = "Emergency Shutdown"
|
||||||
status_col = colors.orange
|
status_col = colors.orange
|
||||||
reactor.stopReactor()
|
reactor.stopReactor()
|
||||||
@ -121,4 +126,4 @@ local function display_stats()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
display_stats()
|
display_stats()
|
||||||
|
66
computercraft/gcts_v2.lua
Normal file
66
computercraft/gcts_v2.lua
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
local integrators = {peripheral.find "redstone_integrator"}
|
||||||
|
local mon = peripheral.find "monitor"
|
||||||
|
|
||||||
|
local spinner = {
|
||||||
|
"|", "/", "-", "\\"
|
||||||
|
}
|
||||||
|
|
||||||
|
local function draw_status(god, operation, color)
|
||||||
|
local r = term.redirect(mon)
|
||||||
|
term.setBackgroundColor(color)
|
||||||
|
term.clear()
|
||||||
|
term.setCursorPos(3, 2)
|
||||||
|
term.write "God Murder/"
|
||||||
|
term.setCursorPos(3, 3)
|
||||||
|
term.write "Resurrection"
|
||||||
|
term.setCursorPos(3, 4)
|
||||||
|
term.write "System"
|
||||||
|
term.setCursorPos(3, 8)
|
||||||
|
term.write "God Status:"
|
||||||
|
term.setCursorPos(3, 9)
|
||||||
|
term.write(god)
|
||||||
|
term.setCursorPos(3, 11)
|
||||||
|
if operation then
|
||||||
|
term.write(operation .. " " .. spinner[(math.floor(os.clock() * 20) % #spinner) + 1])
|
||||||
|
end
|
||||||
|
term.redirect(r)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_trapdoors(state)
|
||||||
|
for _, i in pairs(integrators) do
|
||||||
|
local s = state
|
||||||
|
if s == "random" then s = math.random(0, 1) == 0 end
|
||||||
|
i.setOutput("west", s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local god = "DEAD"
|
||||||
|
local operation
|
||||||
|
|
||||||
|
while true do
|
||||||
|
if operation and math.random(0, 16) == 0 then
|
||||||
|
if god == "DEAD" then
|
||||||
|
god = "ALIVE"
|
||||||
|
elseif god == "ALIVE" then
|
||||||
|
god = "DEAD"
|
||||||
|
end
|
||||||
|
operation = nil
|
||||||
|
set_trapdoors(false)
|
||||||
|
end
|
||||||
|
if not operation and math.random(0, 30) == 0 then
|
||||||
|
if god == "DEAD" then
|
||||||
|
operation = "Resurrecting"
|
||||||
|
elseif god == "ALIVE" then
|
||||||
|
operation = "Murdering"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if operation then set_trapdoors "random" end
|
||||||
|
local color = colors.black
|
||||||
|
if operation == "Resurrecting" then
|
||||||
|
color = colors.green
|
||||||
|
elseif operation == "Murdering" then
|
||||||
|
color = colors.red
|
||||||
|
end
|
||||||
|
draw_status(god, operation, color)
|
||||||
|
sleep(operation and 0 or 1)
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user