mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-20 17:46:57 +01:00
28 lines
804 B
Plaintext
28 lines
804 B
Plaintext
//This helper applies components to things on the map directly.
|
|
/obj/map_helper/component_injector
|
|
name = "Component Injector"
|
|
late = TRUE
|
|
var/target_type
|
|
var/target_name
|
|
var/component_type
|
|
|
|
//Late init so everything is likely ready and loaded (no warranty)
|
|
/obj/map_helper/component_injector/LateInitialize()
|
|
if(!ispath(component_type,/datum/component))
|
|
CRASH("Wrong component type in [type] - [component_type] is not a component")
|
|
var/turf/T = get_turf(src)
|
|
for(var/atom/A in T.get_all_contents())
|
|
if(A == src)
|
|
continue
|
|
if(target_name && A.name != target_name)
|
|
continue
|
|
if(target_type && !istype(A,target_type))
|
|
continue
|
|
var/cargs = build_args()
|
|
A._AddComponent(cargs)
|
|
qdel(src)
|
|
return
|
|
|
|
/obj/map_helper/component_injector/proc/build_args()
|
|
return list(component_type)
|