Advertisement
Te-ki

CCDECServeur

Mar 8th, 2016
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. --ComputerCraft Draconic Energy Core Serveur by Teki
  2.  
  3. local energyCore = peripheral.wrap("back")
  4.  
  5. rednet.open("left")
  6.  
  7. local reponse = ""
  8.  
  9. while true do
  10.     id, msg = rednet.receive("CCDECClient")
  11.    
  12.     if (msg == "getAll") then -- Is the computer connected ?
  13.         reponse = {energyCore.getEnergyStored(), energyCore.getMaxEnergyStored()}
  14.     elseif (msg == "getEnergyStored") then -- Is the computer connected ?
  15.         reponse = energyCore.getEnergyStored()
  16.     elseif (msg == "getMaxEnergyStored") then -- Is the generator active ?
  17.         reponse = energyCore.getMaxEnergyStored()
  18.     end
  19.    
  20.     rednet.send(id, reponse, "CCDECServeur")
  21.     print("recv: '" .. msg .. "' from " .. id)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement