Fix robot storage units dropping security borgs' taser/laser on storage, slight refactor.

This commit is contained in:
ginjaninja32
2015-01-10 04:15:55 +00:00
parent 6348253466
commit 1936410a91
2 changed files with 102 additions and 90 deletions

View File

@@ -277,14 +277,28 @@
if(!find_control_computer(urgent=1))
return
despawn_occupant()
// This function can not be undone; do not call this unless you are sure
// Also make sure there is a valid control computer
/obj/machinery/cryopod/robot/despawn_occupant()
var/mob/living/silicon/robot/R = occupant
if(!istype(R)) return ..()
del(R.mmi)
for(var/obj/item/I in R.module) // the tools the borg has; metal, glass, guns etc
for(var/obj/item/O in I) // the things inside the tools, if anything; mainly for janiborg trash bags
O.loc = R
del(I)
del(R.module)
return ..()
// This function can not be undone; do not call this unless you are sure
// Also make sure there is a valid control computer
/obj/machinery/cryopod/proc/despawn_occupant()
//Drop all items into the pod.
for(var/obj/item/W in occupant)
if(istype(W, /obj/item/device/mmi))
if(istype(occupant, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = occupant
if(R.mmi == W)
del(W)
continue
occupant.drop_from_inventory(W)
W.loc = src
@@ -383,8 +397,6 @@
occupant = null
name = initial(name)
return
/obj/machinery/cryopod/attackby(var/obj/item/weapon/G as obj, var/mob/user as mob)

View File

@@ -428,9 +428,9 @@
//checks whether this item is a module of the robot it is located in.
/obj/item/proc/is_robot_module()
if (!istype(src.loc, /mob/living/silicon/robot))
if (!istype(src.loc.loc, /mob/living/silicon/robot))
return 0
var/mob/living/silicon/robot/R = src.loc
var/mob/living/silicon/robot/R = src.loc.loc
return (src in R.module.modules)