Implements the Tesla engine and supporting features (#4539)

* 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.
This commit is contained in:
Leshana
2018-01-19 15:56:08 -05:00
committed by Anewbe
parent 1348077678
commit db0ba60f64
24 changed files with 857 additions and 27 deletions

View File

@@ -56,6 +56,68 @@ proc/isemptylist(list/list)
return 1
return 0
//////////////////////////////////////////////////////
// "typecache" utilities - Making and searching them
//////////////////////////////////////////////////////
//Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches')
/proc/is_type_in_typecache(atom/A, list/L)
if(!LAZYLEN(L) || !A)
return FALSE
return L[A.type]
//returns a new list with only atoms that are in typecache L
/proc/typecache_filter_list(list/atoms, list/typecache)
. = list()
for(var/thing in atoms)
var/atom/A = thing
if(typecache[A.type])
. += A
/proc/typecache_filter_list_reverse(list/atoms, list/typecache)
. = list()
for(var/thing in atoms)
var/atom/A = thing
if(!typecache[A.type])
. += A
/proc/typecache_filter_multi_list_exclusion(list/atoms, list/typecache_include, list/typecache_exclude)
. = list()
for(var/thing in atoms)
var/atom/A = thing
if(typecache_include[A.type] && !typecache_exclude[A.type])
. += A
//Like typesof() or subtypesof(), but returns a typecache instead of a list
/proc/typecacheof(path, ignore_root_path, only_root_path = FALSE)
if(ispath(path))
var/list/types = list()
if(only_root_path)
types = list(path)
else
types = ignore_root_path ? subtypesof(path) : typesof(path)
var/list/L = list()
for(var/T in types)
L[T] = TRUE
return L
else if(islist(path))
var/list/pathlist = path
var/list/L = list()
if(ignore_root_path)
for(var/P in pathlist)
for(var/T in subtypesof(P))
L[T] = TRUE
else
for(var/P in pathlist)
if(only_root_path)
L[P] = TRUE
else
for(var/T in typesof(P))
L[T] = TRUE
return L
//////////////////////////////////////////////////////
//Empties the list by setting the length to 0. Hopefully the elements get garbage collected
proc/clearlist(list/list)
if(istype(list))

View File

@@ -1094,6 +1094,15 @@ var/global/list/common_tools = list(
return 1
return 0
/proc/is_wire_tool(obj/item/I)
if(istype(I, /obj/item/device/multitool))
return TRUE
if(istype(I, /obj/item/weapon/wirecutters))
return TRUE
if(istype(I, /obj/item/device/assembly/signaler))
return TRUE
return
proc/is_hot(obj/item/W as obj)
switch(W.type)
if(/obj/item/weapon/weldingtool)