Fixes integrated circuit reagent components not working while in mobs, adds new helper procs
This commit is contained in:
committed by
CitadelStationBot
parent
65cc4a2f16
commit
a4129f92df
@@ -122,9 +122,8 @@
|
||||
if(!battery)
|
||||
to_chat(usr, "<span class='warning'>There's no power cell to remove from \the [src].</span>")
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
battery.forceMove(T)
|
||||
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
battery.forceMove(drop_location())
|
||||
playsound(src, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
to_chat(usr, "<span class='notice'>You pull \the [battery] out of \the [src]'s power supplier.</span>")
|
||||
battery = null
|
||||
|
||||
@@ -393,6 +392,17 @@
|
||||
return src
|
||||
|
||||
|
||||
// Returns the location to be used for dropping items.
|
||||
// Same as the regular drop_location(), but with checks being run on acting_object if necessary.
|
||||
/obj/item/integrated_circuit/drop_location()
|
||||
var/atom/movable/acting_object = get_object()
|
||||
|
||||
// plz no infinite loops
|
||||
if(acting_object == src)
|
||||
return ..()
|
||||
|
||||
return acting_object.drop_location()
|
||||
|
||||
|
||||
|
||||
/obj/item/device/electronic_assembly/medium
|
||||
|
||||
@@ -330,3 +330,43 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
return assembly.get_object()
|
||||
else
|
||||
return src // If not, the component is acting on its own.
|
||||
|
||||
|
||||
// Returns the location to be used for dropping items.
|
||||
// Same as the regular drop_location(), but with proc being run on assembly if there is any.
|
||||
/obj/item/integrated_circuit/drop_location()
|
||||
// If the component is located in an assembly, let the assembly figure that one out.
|
||||
if(assembly)
|
||||
return assembly.drop_location()
|
||||
else
|
||||
return ..() // If not, the component is acting on its own.
|
||||
|
||||
|
||||
// Checks if the target object is reachable. Useful for various manipulators and manipulator-like objects.
|
||||
/obj/item/integrated_circuit/proc/check_target(atom/target, exclude_contents = FALSE, exclude_components = FALSE, exclude_self = FALSE)
|
||||
if(!target)
|
||||
return FALSE
|
||||
|
||||
var/atom/movable/acting_object = get_object()
|
||||
|
||||
if(exclude_self && target == acting_object)
|
||||
return FALSE
|
||||
|
||||
if(exclude_components && assembly)
|
||||
if(target in assembly.assembly_components)
|
||||
return FALSE
|
||||
|
||||
if(target == assembly.battery)
|
||||
return FALSE
|
||||
|
||||
if(target.Adjacent(acting_object) && isturf(target.loc))
|
||||
return TRUE
|
||||
|
||||
if(!exclude_contents && (target in acting_object.GetAllContents()))
|
||||
return TRUE
|
||||
|
||||
if(target in acting_object.loc)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user