Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --##################--
- -- Programm von endminecraffter
- -- https://pastebin.com/u/endminecraffter
- -- Server: MyFTB.de Deutsches Minecraft modded Netzwerk
- -- Benoetigte Mods/Apis: API Button(uhw8NuF3)
- --##################--
- function wrapPs(peripheralName)
- periTab={}
- sideTab={}
- if peripheralName==nil then
- print("Fehler")
- end
- local peripherals = peripheral.getNames()
- local i2 = 1
- for i =1, #peripherals do
- if peripheral.getType(peripherals[i])==peripheralName then
- periTab[i2]=peripheral.wrap(peripherals[i])
- sideTab[i2]=peripherals[i]
- i2=i2+1
- end
- end
- if periTab~={} then
- return periTab,sideTab
- else
- return nil
- end
- end
- r = wrapPs("BigReactors-Reactor")[1]
- os.loadAPI("Button")
- local t = Button.new("back")
- mon = peripheral.wrap("back")
- function buttons()
- local active = r.getActive()
- if active == true then
- t:add("off/on",nil,5,5,12,7,colors.lime,colors.red)
- else if active == false then
- t:add("off/on",nil,5,5,12,7,colors.red,colors.lime)
- end
- end
- t:add("-5",nil,36,5,40,7,colors.red,colors.red)
- t:add("+5",nil,42,5,46,7,colors.lime,colors.lime)
- t:draw()
- end
- function monitor()
- mon.setBackgroundColor(colors.black)
- mon.setTextScale(1.2)
- mon.setCursorPos(16,1)
- mon.write("endreactorControll")
- mon.setTextScale(1)
- mon.setCursorPos(40,4)
- mon.write("Rods")
- end
- function eventActive()
- local active = r.getActive()
- if active == false then
- activateR(true)
- else if active == true then
- activateR(false)
- end
- end
- end
- function eventRodh(zahl)
- local rods = r.getControlRodLevel(1)
- local plusrod = r.getControlRodLevel(1)+zahl
- if rods == 100 then
- write("Rods auf 100!")
- else
- r.setAllControlRodLevels(plusrod)
- end
- end
- function getFuel()
- local fuel = r.getFuelAmount()
- local maxfuel = r.getFuelAmountMax()
- return math.floor((fuel/maxfuel)*100)
- end
- function getEnergy()
- local amount = r.getEnergyStored()
- return math.floor((amount/10000000)*100)
- end
- function getRodLevel()
- local rod = r.getControlRodLevel(1)
- return rod
- end
- function getRActive()
- local active = r.getActive()
- if active == false then
- return "Nein"
- else
- return "ja"
- end
- end
- function eventRodr(zahl)
- local rods = r.getControlRodLevel(1)
- local minusrod = r.getControlRodLevel(1)-zahl
- if rods == 0 then
- write("Rods auf 0!")
- else
- r.setAllControlRodLevels(minusrod)
- end
- end
- function activateR(bool)
- if bool == false then
- r.setActive(false)
- else if bool == true then
- r.setActive(true)
- else
- write("activeR(bool) bool muss ein Boolean sein(true,false)")
- end
- end
- end
- buttons()
- monitor()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- if p1 == "off/on" then
- t:toggleButton(p1)
- eventActive()
- monitor()
- else if p1 == "-5" then
- monitor()
- t:flash(p1)
- eventRodr(5)
- monitor()
- else if p1 == "+5" then
- monitor()
- t:flash(p1)
- eventRodh(5)
- monitor()
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment