Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Using: CC: Tweaked, Plethora
- pastebin run F1bcLbLQ
- pastebin get F1bcLbLQ startup
- ]]--
- if pcall(os.loadAPI, "jLib/jFuncs") then
- else
- shell.run("pastebin get kqBFGcfV jLib/jFuncs")
- os.loadAPI("jLib/jFuncs")
- end
- local sensor = peripheral.find("manipulator")
- local logName = "log.txt"
- local function logChange(entity, verb)
- local printStr = ("%s: %s %s!"):format(os.date("!%c"), entity, verb)
- print(printStr)
- local file = fs.open(logName, fs.exists(logName) and "a" or "w")
- file.writeLine(printStr)
- file.close()
- end
- local lastList = {}
- while(true) do
- for i, entity in pairs(lastList) do
- lastList[i] = false
- end
- for _, entity in pairs(sensor.sense()) do
- if(entity.displayName ~= nil) then
- if(lastList[entity.displayName] == nil and not string.find(entity.displayName, "item.tile")) then
- logChange(entity.displayName, "entered")
- lastList[entity.displayName] = true
- elseif(lastList[entity.displayName] == false) then
- lastList[entity.displayName] = true
- end
- end
- end
- for i, entity in pairs(lastList) do
- if(not lastList[i]) then
- logChange(i, "left")
- lastList[i] = nil
- end
- end
- if(not redstone.getOutput("left") and lastList["EvilKurt2"]) then
- redstone.setOutput("left", true)
- elseif(redstone.getOutput("left") and not lastList["EvilKurt2"]) then
- redstone.setOutput("left", false)
- end
- os.sleep(1)
- end
Add Comment
Please, Sign In to add comment