controllables.Turret
- class controllables.Turret(port: Optional[int] = None)
Reference to a turret part.
The following example assumes a turret is assigned to port
0
of the microcontrollerfrom time import sleep from controllables import Turret turret = Turret(0)
- emit()
Emits a single pellet.
from controllables import Turret turret = Turret(0) turret.emit()
- auto_emit(set: bool)
Set auto emit on/off
from controllables import Turret turret = Turret(0) turret.emit_rate = 10 turret.auto_emit(True) sleep(5) turret.auto_emit(False)
- property emit_rate: float
The rate of emission (ranging 1-10).
from controllables import Turret turret = Turret(0) turret.emit_rate = 10 turret.auto_emit(True)
from controllables import Turret turret = Turret(0) print(f'emit rate: {turret.emit_rate:0.1f}')
- property power: float
The force of emission (ranging 1-5).
from controllables import Turret turret = Turret(0) turret.power = 5 turret.auto_emit(True)
from controllables import Turret turret = Turret(0) print(f'power: {turret.power:0.1f}')
- name() str
Returns the user editable name of the controllable as found in the properties tab of the game.
The following example assumes that any controllable or sensor is assigned to port
0
and prints out its name.from ports import PortReference print(PortReference(0).name())