Skip to content
Heaven31415 edited this page Jan 28, 2019 · 7 revisions

Energy Turret

A energy turret, which uses OC Energy to fire energy beams at targets!
Be careful, it can also hit you or any other player.

Methods

turret = component.os_energyturret

-- Turns the turret on, it needs to be powered before you can call any other command.
turret.powerOn()

-- Turns the turret off.
turret.powerOff()

-- Returns true if the turret has cooled down from it's previous fire,
-- is armed, and the barrel is valid, otherwise false.
turret.isReady()

-- Returns true if the turret is powered on, otherwise false.
turret.isPowered()

-- Arms and disarms the turret, must be armed to fire.
turret.setArmed(boolean)

-- Valid range (0-2) extends/retracts the rotator shaft, must be at least 1 to fire.
turret.extendShaft(int)

-- Returns the shaft length.
turret.getShaftLength()

-- Moves the turret in radians instead of degrees.
turret.moveToRadians(int, int)

-- Valid ranges: (0-360), (-45,90) 
-- Moves the turret's aim to the provided coords and 
-- tries to use shortest rotation to move to them as quick as possible.
turret.moveTo(int, int)

-- Returns true if the turret has finished moving to it's target, false if not
turret.isOnTarget()

-- Returns true if fired, or false, error if it was unable to fire, not enough energy, or gun hasn't cooled down.
turret.fire()

The Energy Turret also has upgrade slots in it's GUI you can upgrade it's Damage, Movement Speed, Cooldown time, and Energy Usage.