From 45285ef49158f1c7aa5c71820e395eca7f70b1be Mon Sep 17 00:00:00 2001 From: ktccd Date: Fri, 25 Aug 2017 03:36:13 +0200 Subject: [PATCH] Fixes a lot of problems in dogborg code (#2471) List of things I fixed: old << style messages didn't do crap, replaced with to_chat Medidog now respects your vore preferences also. K9 referenced the wrong type of sleeper unit by name, fixed now. All do_after checks now also have a check for distance once the timer is up. All do_after checks now properly sets target = . This is probably making the previous thing on the list redundant, but an extra sanity check isn't a bad idea... I think? --- code/citadel/dogborgstuff.dm | 76 ++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/code/citadel/dogborgstuff.dm b/code/citadel/dogborgstuff.dm index bcc5e573a7..8d3a3c0289 100644 --- a/code/citadel/dogborgstuff.dm +++ b/code/citadel/dogborgstuff.dm @@ -71,11 +71,11 @@ if(!C.handcuffed) C.handcuffed = new /obj/item/weapon/restraints/handcuffs/cable/zipties/used(C) C.update_inv_handcuffed(0) - user << "You handcuff [C]." + to_chat(user,"You handcuff [C].") playsound(loc, pick('sound/voice/bgod.ogg', 'sound/voice/biamthelaw.ogg', 'sound/voice/bsecureday.ogg', 'sound/voice/bradio.ogg', 'sound/voice/binsult.ogg', 'sound/voice/bcreep.ogg'), 50, 0) add_logs(user, C, "handcuffed") else - user << "You fail to handcuff [C]!" + to_chat(user,"You fail to handcuff [C]!") //Boop @@ -207,11 +207,13 @@ if(!proximity || !check_allowed_items(target)) return if(user.client && (target in user.client.screen)) - user << "You need to take that [target.name] off before cleaning it!" + to_chat(user, "You need to take that [target.name] off before cleaning it!") else if(istype(target,/obj/effect/decal/cleanable)) user.visible_message("[user] begins to lick off \the [target.name].", "You begin to lick off \the [target.name]...") if(do_after(user, src.cleanspeed, target = target)) - user << "You finish licking off \the [target.name]." + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. + to_chat(user, "You finish licking off \the [target.name].") qdel(target) var/mob/living/silicon/robot.R = user R.cell.give(50) @@ -219,7 +221,9 @@ if(istype(target,/obj/item/trash)) user.visible_message("[user] nibbles away at \the [target.name].", "You begin to nibble away at \the [target.name]...") if(do_after(user, src.cleanspeed, target = target)) - user << "You finish off \the [target.name]." + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. + to_chat(user, "You finish off \the [target.name].") qdel(target) var/mob/living/silicon/robot.R = user R.cell.give(250) @@ -227,7 +231,9 @@ if(istype(target,/obj/item/weapon/stock_parts/cell)) user.visible_message("[user] begins cramming \the [target.name] down its throat.", "You begin cramming \the [target.name] down your throat...") if(do_after(user, 50, target = target)) - user << "You finish off \the [target.name]." + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. + to_chat(user, "You finish off \the [target.name].") var/mob/living/silicon/robot.R = user var/obj/item/weapon/stock_parts/cell.C = target R.cell.charge = R.cell.charge + (C.charge / 3) //Instant full cell upgrades op idgaf @@ -237,15 +243,19 @@ if(!I.anchored && src.emagged) user.visible_message("[user] begins chewing up \the [target.name]. Looks like it's trying to loophole around its diet restriction!", "You begin chewing up \the [target.name]...") if(do_after(user, 100, target = I)) //Nerf dat time yo + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. Even emags don't make you magically eat things at range. + return //If they moved away, you can't eat them. visible_message("[user] chews up \the [target.name] and cleans off the debris!") - user << "You finish off \the [target.name]." + to_chat(user, "You finish off \the [target.name].") qdel(I) var/mob/living/silicon/robot.R = user R.cell.give(500) return user.visible_message("[user] begins to lick \the [target.name] clean...", "You begin to lick \the [target.name] clean...") if(do_after(user, src.cleanspeed, target = target)) - user << "You clean \the [target.name]." + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't clean them. + to_chat(user,"You clean \the [target.name].") var/obj/effect/decal/cleanable/C = locate() in target qdel(C) target.clean_blood() @@ -269,12 +279,16 @@ else if(istype(target, /obj/structure/window)) user.visible_message("[user] begins to lick \the [target.name] clean...", "You begin to lick \the [target.name] clean...") if(do_after(user, src.cleanspeed, target = target)) - user << "You clean \the [target.name]." + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't clean them. + to_chat(user, "You clean \the [target.name].") target.color = initial(target.color) else user.visible_message("[user] begins to lick \the [target.name] clean...", "You begin to lick \the [target.name] clean...") if(do_after(user, src.cleanspeed, target = target)) - user << "You clean \the [target.name]." + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't clean them. + to_chat(user, "You clean \the [target.name].") var/obj/effect/decal/cleanable/C = locate() in target qdel(C) target.clean_blood() @@ -355,16 +369,20 @@ return if(!ishuman(target)) return + if(!target.devourable) + to_chat(user, "This person is incompatible with our equipment.") + return if(target.buckled) - user << "The user is buckled and can not be put into your [src.name]." + to_chat(user, "The user is buckled and can not be put into your [src.name].") return if(patient) - user << "Your [src.name] is already occupied." + to_chat(user, "Your [src.name] is already occupied.") return user.visible_message("[hound.name] is ingesting [target.name] into their [src.name].", "You start ingesting [target] into your [src]...") - if(!patient && ishuman(target) && !target.buckled && do_after (user, 50, target)) + if(!patient && ishuman(target) && !target.buckled && do_after (user, 50, target = target)) - if(!proximity) return //If they moved away, you can't eat them. + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. if(patient) return //If you try to eat two people at once, you can only eat one. @@ -526,7 +544,7 @@ START_PROCESSING(SSobj, src) sleeperUI(usr) if(patient) - patient << "[hound.name]'s [src.name] fills with caustic enzymes around you!" + to_chat(patient, "[hound.name]'s [src.name] fills with caustic enzymes around you!") return if(cleaning) sleeperUI(usr) @@ -544,9 +562,9 @@ if(href_list["inject"] == "epinephrine" || patient.health > min_health) inject_chem(usr, href_list["inject"]) else - usr << "ERROR: Subject is not in stable condition for injections." + to_chat(usr, "ERROR: Subject is not in stable condition for injections.") else - usr << "ERROR: Subject cannot metabolise chemicals." + to_chat(usr,"ERROR: Subject cannot metabolise chemicals.") src.updateUsrDialog() sleeperUI(usr) //Needs a callback to boop the page to refresh. @@ -556,15 +574,15 @@ if(patient && patient.reagents) if(chem in injection_chems + "epinephrine") if(hound.cell.charge < 800) //This is so borgs don't kill themselves with it. - hound << "You don't have enough power to synthesize fluids." + to_chat(hound, "You don't have enough power to synthesize fluids.") return else if(patient.reagents.get_reagent_amount(chem) + 10 >= 20) //Preventing people from accidentally killing themselves by trying to inject too many chemicals! - hound << "Your stomach is currently too full of fluids to secrete more fluids of this kind." + to_chat(hound, "Your stomach is currently too full of fluids to secrete more fluids of this kind.") else if(patient.reagents.get_reagent_amount(chem) + 10 <= 20) //No overdoses for you patient.reagents.add_reagent(chem, inject_amount) drain(750) //-750 charge per injection var/units = round(patient.reagents.get_reagent_amount(chem)) - hound << "Injecting [units] unit\s of [injection_chems[chem]] into occupant." //If they were immersed, the reagents wouldn't leave with them. + to_chat(hound, "Injecting [units] unit\s of [injection_chems[chem]] into occupant.") //If they were immersed, the reagents wouldn't leave with them. /obj/item/device/dogborg/sleeper/process() @@ -651,7 +669,7 @@ //Belly is entirely empty if(!length(contents)) - hound << "Your [src.name] is now clean. Ending self-cleaning cycle." + to_chat(hound, "Your [src.name] is now clean. Ending self-cleaning cycle.") cleaning = 0 update_patient() return @@ -766,12 +784,14 @@ to_chat(user,"[brigman] is buckled and can not be put into your [src.name].") return user.visible_message("[hound.name] is ingesting [brigman] into their [src.name].", "You start ingesting [brigman] into your [src.name]...") - if(do_after(user, 30, brigman) && !patient && !brigman.buckled) + if(do_after(user, 30, target = brigman) && !patient && !brigman.buckled) + if(!in_range(src, brigman)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. brigman.forceMove(src) brigman.reset_perspective(src) update_patient() START_PROCESSING(SSobj, src) - user.visible_message("[hound.name]'s mobile brig clunks in series as [brigman] slips inside.", "Your garbage compactor groans lightly as [brigman] slips inside.") + user.visible_message("[hound.name]'s mobile brig clunks in series as [brigman] slips inside.", "Your mobile brig groans lightly as [brigman] slips inside.") playsound(hound, 'sound/effects/bin_close.ogg', 80, 1) // Really don't need ERP sound effects for robots return return @@ -810,7 +830,9 @@ to_chat(user,"\The [target] is too large to fit into your [src.name]") return user.visible_message("[hound.name] is ingesting [target.name] into their [src.name].", "You start ingesting [target] into your [src.name]...") - if(do_after(user, 30, target) && length(contents) < max_item_count) + if(do_after(user, 30, target = target) && length(contents) < max_item_count) + if(!in_range(src, target)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. This still applies to items, don't magically eat things I picked up already. target.forceMove(src) user.visible_message("[hound.name]'s garbage processor groans lightly as [target.name] slips inside.", "Your garbage compactor groans lightly as [target] slips inside.") playsound(hound, 'sound/machines/disposalflush.ogg', 50, 1) @@ -822,7 +844,7 @@ else if(ishuman(target)) var/mob/living/carbon/human/trashman = target if (!trashman.devourable) - to_chat(user, "The target registers an error code.") + to_chat(user, "\The [target] registers an error code to your [src.name]") return if(patient) to_chat(user,"Your [src.name] is already occupied.") @@ -831,7 +853,9 @@ to_chat(user,"[trashman] is buckled and can not be put into your [src.name].") return user.visible_message("[hound.name] is ingesting [trashman] into their [src.name].", "You start ingesting [trashman] into your [src.name]...") - if(do_after(user, 30, trashman) && !patient && !trashman.buckled && length(contents) < max_item_count) + if(do_after(user, 30, target = trashman) && !patient && !trashman.buckled && length(contents) < max_item_count) + if(!in_range(src, trashman)) //Proximity is probably old news by now, do a new check. + return //If they moved away, you can't eat them. trashman.forceMove(src) trashman.reset_perspective(src) update_patient()