/datum/beam
Beam Datum and Effect
-
IF YOU ARE LAZY AND DO NOT WANT TO READ, GO TO THE BOTTOM OF THE FILE AND USE THAT PROC!
-
This is the beam datum! It's a really neat effect for the game in drawing a line from one atom to another.
-
It has two parts:
-
The datum itself which manages redrawing the beam to constantly keep it pointing from the origin to the target.
-
The effect which is what the beams are made out of. They're placed in a line from the origin to target, rotated towards the target and snipped off at the end.
-
These effects are kept in a list and constantly created and destroyed (hence the proc names draw and reset, reset destroying all effects and draw creating more.)
-
You can add more special effects to the beam itself by changing what the drawn beam effects do. For example you can make a vine that pricks people by making the beam_type
-
include a crossed proc that damages the crosser. Examples in venus_human_trap.dm
Vars | |
always_turn | will the origin object always turn to face the target? |
---|---|
beam_type | the objects placed in the elements list |
elements | list of beam objects. These have their visuals set by the visuals var which is created on starting |
icon | icon used by the beam. |
icon_state | icon state of the main segments of the beam |
max_distance | The beam will qdel if it's longer than this many tiles. |
origin | where the beam goes from |
target | where the beam goes to |
visuals | This is used as the visual_contents of beams, so you can apply one effect to this and the whole beam will look like that. never gets deleted on redrawing. |
Procs | |
Draw | Creates the beam effects and places them in a line from the origin to the target. Sets their rotation to make the beams face the target, too. |
Start | Proc called by the atom Beam() proc. Sets up signals, and draws the beam for the first time. |
redrawing | Triggered by signals set up when the beam is set up. If it's still sane to create a beam, it removes the old beam, creates a new one. Otherwise it kills the beam. |
Var Details
always_turn
will the origin object always turn to face the target?
beam_type
the objects placed in the elements list
elements
list of beam objects. These have their visuals set by the visuals var which is created on starting
icon
icon used by the beam.
icon_state
icon state of the main segments of the beam
max_distance
The beam will qdel if it's longer than this many tiles.
origin
where the beam goes from
target
where the beam goes to
visuals
This is used as the visual_contents of beams, so you can apply one effect to this and the whole beam will look like that. never gets deleted on redrawing.
Proc Details
Draw
Creates the beam effects and places them in a line from the origin to the target. Sets their rotation to make the beams face the target, too.
Start
Proc called by the atom Beam() proc. Sets up signals, and draws the beam for the first time.
redrawing
Triggered by signals set up when the beam is set up. If it's still sane to create a beam, it removes the old beam, creates a new one. Otherwise it kills the beam.
Arguments: mover: either the origin of the beam or the target of the beam that moved. oldloc: from where mover moved. direction: in what direction mover moved from.