Changed some stuff, added the whole controller script

This commit is contained in:
aiden@zuchtbude.de
2020-05-03 19:41:25 +02:00
parent 66d96b567d
commit f31502b030
6 changed files with 148 additions and 48 deletions
@@ -0,0 +1,37 @@
-- FileName --
The filename of an instruction sheet must be made up of the magnetic card reader and the suffix ".lua"
example : 3bbdd537-f117-4d4a-bc48-6adc766fb243.lua
|___________________________________|___|
Filename Suffix
-- Content --
The content of an instruction sheet is basically an array.
This array contains the address of the door controller, and the magstripe card codes that are allowed to go in.
example :
accessArray = {
["doorController"] = "91b601d3-19eb-4762-9073-8f2a208accc2", -- This is the address of the controller that the MagCard reader is supposed to work with --
["allowed"] = {
"18873940", -- Here are the codes of the cards that can use the card reader --
"11225543" -- This can be anything, numbers, characters, special characters, it doesnt matter --
}
}
-- How to create a magstripe access card --
You need the cardwriter.
Then you go to lua input mode, and type in :
component.os_cardwriter.write("18873940", "The name of the card you want")
done, now you have a keycard that has the code "18873940" on it.
-- Sample --
This is a sample that you can use in notepad++ for example, and put your values in, and then copy paste it into your game when you are done.
accessArray = {
["doorController"] = "",
["allowed"] = {
""
}
}
+36
View File
@@ -0,0 +1,36 @@
-- Mag Keycard Door Controller Program
event = require("event")
function inTable(tbl, item)
for key, value in pairs(tbl) do
if value == item then return true end
end
return false
end
function doorCtrl(doorController)
door = component.proxy(component.get(doorController))
door.toggle()
end
while true do
_,address,user,code = event.pull("magData")
if code == "99447582" then
print("Exiting")
door1 = require("component").os_doorcontroller
door1.close()
os.exit()
end
require("instructions/" .. address)
if inTable(accessArray["allowed"], code) then
print("The code is correct")
doorCtrl(accessArray["doorController"])
else
print("The code is incorrect")
end
end
+12
View File
@@ -0,0 +1,12 @@
-- Instruction on how to use --
Step 0:
Make sure that you have the OpenComputers and OpenSecurity mods installed
Step 1:
You copy paste the main.lua script into your OC device
Step 2:
If you havent done this yet, build your MagCard Reader and DoorControllers, and you need an "Analyzer" (5948/0)
Step 3:
Follow the instructions in the "instructions" directory