-
Notifications
You must be signed in to change notification settings - Fork 42
Laser setup (advanced)
This is the full tutorial on how to setup basic and amplified lasers.
You need at least a [Laser Camera](Laser Camera) with a few [Laser mediums](Laser medium) and a monitor. Ideally, you would use 1 Laser Camera with boosters and a bunch of laser with [Laser mediums](Laser medium). Laser Camera is used to designate a target: Any Laser or Laser Camera should have clear view to its target and a bunch of Laser mediums. Laser frequency 1420 is reserved for scanning. Any other frequency is for attacking or boosting.
For the non-geeky, non-amplified version, check the basic setup in the related [page](Laser setup (basic)). Here's the geeky setup used by Cr0s:
Place a compute with modem next to your Laser Camera. Type this program:
modem = peripheral.wrap("right")
laser = peripheral.wrap("left")
laser.freq(1420)
laser.camFreq(100)
-- Previous target coordinates
px, py, pz = -1
while true do
-- poll a laser head for new target
x_, y_, z_, id, meta, res = laser.getFirstHit()
if res ~= -1 and px ~= x_ and py ~= y_ and pz ~= z_ then
-- send serialized target info
target = { x = x_, y = y_, z = z_ }
print("Target: " .. textutils.serialize(target))
-- init boost (remove comment on next line if you use boosters)
-- modem.transmit(4, 1, "go")
sleep(0.1)
-- init main laser with target
modem.transmit(3, 1, textutils.serialize(target))
-- remember previous target
px = x_
py = y_
pz = z_
end
sleep(0)
end
Place a monitor and set its frequency to match the Laser Camera cameraFrequency (100 in our case). To set it's frequency, place a computer on its left and type:
lua
peripheral.wrap("right").freq(100)
(you can then break the computer afterward)
Place a laser 'head' with a few laser medium blocks and a computer (below) with a modem on its left. Type this program:
laser = peripheral.wrap("top")
laser.freq(1010)
modem = peripheral.wrap("left")
-- listening for targets
mode.open(3)
while true do
-- receive target info
local event, _, ch, _, msg, _ = os.pullEvent("modem_message")
-- is targeting channel ?
if ch == 3 then
print("Got target: " .. msg)
-- get coordinates
target = textutils.unserialize(msg)
-- calculate targeting vector
myX, myY, myZ = laser.pos()
dx = target.x - myX
dy = target.y - myY
dz = target.z - myZ
-- shoot
laser.emitBeam(dx, dy, -dz)
end
sleep(0)
end
Repeat step 3 with laser boosters and a modem on channel 4 (optional) Each laser booster should be targeting the laser head to boost its charge (increasing it's destructive power). Each laser booster should have the same frequency as the laser head (otherwise it'll break it). As said earlier, each laser booster should have a clear view to the laser head. Here's an example program, remember to adjust the coordinates in emitBeam calls:
modem = peripheral.wrap("bottom")
laser1 = peripheral.wrap("top")
laser2 = peripheral.wrap("left")
laser3 = peripheral.wrap("right")
laser1.freq(1010)
laser2.freq(1010)
laser3.freq(1010)
modem.open(4)
while true do
local event, _, ch, _, _, _ = os.pullEvent("modem_message")
-- is boosting channel ?
if ch == 4 then
laser1.emitBeam( 0, 1, 4)
laser2.emitBeam( 1, 0, 4)
laser3.emitBeam(-1, 0, 4)
end
sleep(0)
end
Power all the particle boosters with your favorite energy (all blocks accept both RF & EU)
Here's an example with IndustrialCraft2 Fiber cables:
Right click the monitor:
- move your mouse around to select a target
- use left click to cycle zoom level
- press space to shoot!
- use right click to exit the monitor
A first blue laser from the targeting laser will acquire the target, then the boosting lasers will charge the head laser then the main laser will shoot.
This is a very lag-inducing example, it'll kill your server resources pretty fast (loop on sleep(0) and 3 computers per weapon).
It's strongly advised to use wired modems instead of wireless ones to have a single loop on a single computer. A wired version is notably more stable and you can't be 'hacked' by your enemy.
Home
Dependencies
Frequently Asked Questions
Changelog
Tutorials
* First ship, first jump
* Tuning Tools
* Programmable blocks
* Lasers - Basic Tutorial
* Lasers - Advanced Boosting
Exploration
* World generation
* Air in space
* Planets and Transition Planes
* Warp Jump Checklist
Atomic
* Large Hadron Collider
* Accelerator Controller
* Accelerator Control Point
* Chiller
* Electromagnet
* Particles Collider
* Particles Injector
* Void Shell
* Electromagnetic Cell
Breathing
* Breathing
* Air Canister
* Air Generator
* Air Tank
* Energy Air Shield
* Warp armor
Collection
* Laser Tree Farm
* Mining Laser
Detection
* Camera and Monitor
* Cloaking
* Radar
* Siren
* Warp Field Isolation Block
Energy
* IC2 Reactor Laser
* Subspace Capacitor
* Enantiomorphic Reactor
Movement
* Lift
* Transporter Room
* Transporter Core
* Transporter Scanner
* Transporter Containment
* Transporter Beacon
Protection
* Hull
* Force field projector
* Force field relay
* Force field upgrades
Weapons
* Lasers - Basic Tutorial
* Lasers - Advanced Boosting
LUA API
* LUA methods
- for Detection
- for Energy
- for Movement
* LUA properties
- for Energy
- for Movement
* LUA events
* LUA change logs