Lightning can create a line, beam, lightning bolt or branched lightning bolt between two vectors.
This was made following this
article. The article can be used for further explanation of how it works.
Usage is as simple as:
var/vector/start = new (x1 * 32, y1 * 32) // position in pixels
var/vector/dest = new (x2 * 32, y2 * 32) // position in pixels
var/line/l = new(start, dest)
var/bolt/b = new(start, dest)
- Renamed atan2 and rand to avoid conflicts.
- Drastically reduces appearance churn.
- Tiny optimization.
- Added force lightning demo. Click stickman faces to zap them.
- Added ability to draw lines as overlays.
- Bolts can now be drawn as overlays, this greatly improves CPU usage as well as adds the ability to rotate bolts by changing transform angle on a single object.
- Added a proc to rotate last made bolt.
- Added bar datum to bars, you can adjust the size of the bar via Adjust()
- Library now supports drawing on client.screen
- Line vectors can now be rotated
- Added beam datum to handle creation of beams.
- Added parameter to control the thickness of segments
- Segment type parameter is now defaulted to /obj/segment
- Added targets parameter to branched bolt allowing to set amount of branches amount or targets fire branched bolts at.
- The demo will now clear lines when mode is changed
- Fixes the library to allow different icon_size
For a full list of changes click here.