robot move refactor

This commit is contained in:
SteelSlayer
2021-09-03 08:47:30 -05:00
parent b1b66e78e6
commit dec01b62e3
2 changed files with 48 additions and 48 deletions
+11 -48
View File
@@ -1147,55 +1147,18 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
cell = null
qdel(src)
#define BORG_CAMERA_BUFFER 30
/mob/living/silicon/robot/Move(a, b, flag)
var/oldLoc = src.loc
#define BORG_CAMERA_BUFFER 3 SECONDS
/mob/living/silicon/robot/Move(atom/newloc, direct, movetime)
var/oldLoc = loc
. = ..()
if(.)
if(src.camera)
if(!updating)
updating = 1
spawn(BORG_CAMERA_BUFFER)
if(camera && oldLoc != src.loc)
GLOB.cameranet.updatePortableCamera(src.camera)
updating = 0
if(module)
if(module.type == /obj/item/robot_module/janitor)
var/turf/tile = loc
if(stat != DEAD && isturf(tile))
var/floor_only = TRUE
for(var/A in tile)
if(istype(A, /obj/effect))
var/obj/effect/E = A
if(E.is_cleanable())
var/obj/effect/decal/cleanable/blood/B = E
if(istype(B) && B.off_floor)
floor_only = FALSE
else
qdel(E)
else if(istype(A, /obj/item))
var/obj/item/cleaned_item = A
cleaned_item.clean_blood()
else if(istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/cleaned_human = A
if(cleaned_human.lying)
if(cleaned_human.head)
cleaned_human.head.clean_blood()
cleaned_human.update_inv_head()
if(cleaned_human.wear_suit)
cleaned_human.wear_suit.clean_blood()
cleaned_human.update_inv_wear_suit()
else if(cleaned_human.w_uniform)
cleaned_human.w_uniform.clean_blood()
cleaned_human.update_inv_w_uniform()
if(cleaned_human.shoes)
cleaned_human.shoes.clean_blood()
cleaned_human.update_inv_shoes()
cleaned_human.clean_blood()
to_chat(cleaned_human, "<span class='danger'>[src] cleans your face!</span>")
if(floor_only)
tile.clean_blood()
return
if(. && !updating && camera)
updating = TRUE
spawn(BORG_CAMERA_BUFFER)
if(camera && oldLoc != loc)
GLOB.cameranet.updatePortableCamera(camera)
updating = FALSE
#undef BORG_CAMERA_BUFFER
/mob/living/silicon/robot/proc/self_destruct()
@@ -447,6 +447,43 @@
/obj/item/extinguisher/mini
)
/obj/item/robot_module/janitor/Initialize(mapload)
. = ..()
var/mob/living/silicon/robot/R = loc
RegisterSignal(R, COMSIG_MOVABLE_MOVED, .proc/on_cyborg_move)
/**
* Proc called after the janitor cyborg has moved, in order to clean atoms at it's new location.
*
* Arguments:
* * mob/living/silicon/robot/R - The cyborg who moved.
*/
/obj/item/robot_module/janitor/proc/on_cyborg_move(mob/living/silicon/robot/R)
SIGNAL_HANDLER
if(R.stat == DEAD || !isturf(R.loc))
return
var/turf/tile = R.loc
for(var/A in tile)
if(iseffect(A))
var/obj/effect/E = A
if(!E.is_cleanable())
continue
var/obj/effect/decal/cleanable/blood/B = E
if(istype(B) && B.off_floor)
tile.clean_blood()
else
qdel(E)
else if(isitem(A))
var/obj/item/I = A
I.clean_blood()
else if(ishuman(A))
var/mob/living/carbon/human/cleaned_human = A
if(!cleaned_human.lying)
continue
cleaned_human.clean_blood()
to_chat(cleaned_human, "<span class='danger'>[src] cleans your face!</span>")
/obj/item/reagent_containers/spray/cyborg_lube
name = "Lube spray"
list_reagents = list("lube" = 250)