forked from Nex4rius/Nex4rius-Programme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chunkloader.lua
53 lines (49 loc) · 1.34 KB
/
chunkloader.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- Robot programm to load the chunk on active redstone signal (white signal from stargate computer)
-- WIP
local component = require("component")
os.execute("wget -f 'https://raw.githubusercontent.com/DarknessShadow/Stargate-Programm/master/chunkloader.lua' autorun.lua")
function main()
print("\nPruefe Komponenten\n")
if component.isAvailable("chunkloader") then
local c = component.chunkloader
local chunkloaderstatus = true
print("- ChunkLoader ok")
else
local chunkloaderstatus = false
print("- ChunkLoader fehlt")
end
if component.isAvailable("redstone") then
local r = component.getPrimary("redstone")
local redstonestatus = true
print("- Redstone Card ok")
else
print("- Redstone Card fehlt")
end
print("")
if chunkloaderstatus == true and redstonestatus == true then
loop()
end
end
function loop()
local aktiv = true
while aktiv == true do
if r.getInput(1) == 0 then
os.sleep(10)
if r.getInput(1) == 0 then
c.setActive(false)
else
c.setActive(true)
end
else
c.setActive(true)
end
print("\nredstone input: " .. r.getInput(1)) --test
if c.isActive() == true then
print("Chunkloader An")
elseif c.isActive() == false then
print("Chunkloader Aus")
end
os.sleep(10)
end
end
main()