Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- pastebin get 4XF7EwMD attac
- --- This script fires a laser in the direction the player is looking when they sneak.
- --- Firstly we want to ensure that we have a neural interface and wrap it.
- local modules = peripheral.find("neuralInterface")
- local kinetic = peripheral.wrap(--[[ whatever ]])
- if not modules then
- error("Must have a neural interface", 0)
- end
- --- We require an introspection module and entity sensor to get the direction the player is facing in. Obviously a laser
- --- is required too.
- if not modules.hasModule("plethora:sensor") then
- error("Must have an entity sensor", 0)
- end
- if not modules.hasModule("plethora:introspection") then
- error("Must have an introspection module", 0)
- end
- --- Now that we're all set up, we loop forever. First we get the player's metadata and check they're sneaking. If so we
- --- fire a laser and sleep to allow the energy buffer to refil. Otherwise we sleep for a short period of time before
- --- checking again.
- while true do
- local meta = modules.getMetaOwner()
- if meta.isSneaking then
- kinetic.swing()
- sleep(0.2)
- else
- sleep(0.1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement