mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
* Adds "typecache" utility functions. A fast way to filter lists by type. Ported from TG * Ports the "orbit" feature and subsystem from TG * Adds a feature that allows mobs and objs to "orbit" around some atom. They literally are moved around in circles. See the `orbit` proc in orbit.dm. * Adds a subsystem that processes the actual movement of orbiting items. * Adds utility methods for common machinery behavior. * Adds default_unfasten_wrench which handles the standard anchor/unanchor behavior of wrenches being used on machines. Together with the other default_x_tool machinery procs we can eliminate having that code duplicated in dozens of places! * Adds is_wire_tool proc to easily detect when a machine is hit with a tool that should open its wires UI (if it has one). Based on ideas from Paradise, with improvements for us. * Implements the Tesla Engine Ported from a mixture of TG and Paradise code and assets: Edison's Bane Includes the tesla energy ball itself, the generator that makes it, tesla coils, grounding rods, the circuits and frames to build them. * Switch dusting to zapping on impact and spin better Ported /tg SpinAnimation which supports more than triangles.
45 lines
956 B
Plaintext
45 lines
956 B
Plaintext
SUBSYSTEM_DEF(orbit)
|
|
name = "Orbits"
|
|
priority = 8 // FIRE_PRIORITY_ORBIT
|
|
wait = 2
|
|
flags = SS_NO_INIT|SS_TICKER
|
|
|
|
var/list/currentrun = list()
|
|
var/list/processing = list()
|
|
|
|
/datum/controller/subsystem/orbit/stat_entry()
|
|
..("P:[processing.len]")
|
|
|
|
|
|
/datum/controller/subsystem/orbit/fire(resumed = 0)
|
|
if (!resumed)
|
|
src.currentrun = processing.Copy()
|
|
|
|
//cache for sanic speed (lists are references anyways)
|
|
var/list/currentrun = src.currentrun
|
|
|
|
while (currentrun.len)
|
|
var/datum/orbit/O = currentrun[currentrun.len]
|
|
currentrun.len--
|
|
if (!O)
|
|
processing -= O
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
continue
|
|
if (!O.orbiter)
|
|
qdel(O)
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
continue
|
|
if (O.lastprocess >= world.time) //we already checked recently
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
continue
|
|
var/targetloc = get_turf(O.orbiting)
|
|
if (targetloc != O.lastloc || O.orbiter.loc != targetloc)
|
|
O.Check(targetloc)
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
|