From a8432993c0f701b3b4718cde6a2b546ccb22ce67 Mon Sep 17 00:00:00 2001 From: ikarrus Date: Wed, 11 Jun 2014 21:50:41 -0600 Subject: [PATCH 1/3] Cyborgs can no longer strip people or search storage items -Secborgs can still use their handcuff module to uncuff people --- code/_onclick/observer.dm | 4 ++++ code/game/objects/items/weapons/handcuffs.dm | 18 +++++++++++------- .../objects/items/weapons/storage/storage.dm | 2 +- code/modules/mob/mob.dm | 6 +++++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 5c81116661e..e245e649b08 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -84,6 +84,10 @@ else user << "[src] has no destination." +/obj/item/weapon/storage/attack_ghost(mob/user as mob) + orient2hud(user) + show_to(user) + // ------------------------------------------- // This was supposed to be used by adminghosts // I think it is a *terrible* idea diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm index 799b5e57d52..43e869959b6 100644 --- a/code/game/objects/items/weapons/handcuffs.dm +++ b/code/game/objects/items/weapons/handcuffs.dm @@ -104,14 +104,18 @@ /obj/item/weapon/handcuffs/cyborg/attack(mob/living/carbon/C, mob/user) if(isrobot(user)) if(!C.handcuffed) - var/turf/user_loc = user.loc - var/turf/C_loc = C.loc playsound(loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) C.visible_message("[user] is trying to put handcuffs on [C]!", \ "[user] is trying to put handcuffs on [C]!") - if(do_after(user, 30)) - if(!C || C.handcuffed) + if(do_mob(user, C, 30)) + if(C.handcuffed) return - if(user_loc == user.loc && C_loc == C.loc) - C.handcuffed = new /obj/item/weapon/handcuffs(C) - C.update_inv_handcuffed(0) + C.handcuffed = new /obj/item/weapon/handcuffs(C) + C.update_inv_handcuffed(0) + else + C.visible_message("[user] tries to remove [C]'s handcuffs.", \ + "[user] tries to remove [C]'s handcuffs.") + if(do_mob(user, C, 30)) + if(!C.handcuffed) + return + C.unEquip(C.handcuffed) \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 728ec9fe470..bc1466f3ba2 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -25,7 +25,7 @@ /obj/item/weapon/storage/MouseDrop(obj/over_object) - if(ismob(usr)) //all the check for item manipulation are in other places, you can safely open any storages as anything and its not buggy, i checked + if(iscarbon(usr)) //all the check for item manipulation are in other places, you can safely open any storages as anything and its not buggy, i checked var/mob/M = usr if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index b3f3e3137ce..309c24fb3ed 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -480,12 +480,14 @@ var/list/slot_equipment_priority = list( \ var/t1 = text("window=[href_list["mach_close"]]") unset_machine() src << browse(null, t1) + return if(href_list["refresh"]) if(machine && in_range(src, usr)) show_inv(machine) + return - if(!usr.stat && usr.canmove && !usr.restrained() && Adjacent(usr)) + if(!usr.canUseTopic(src) && !iscarbon(usr)) if(href_list["item"]) var/slot = text2num(href_list["item"]) var/obj/item/what = get_item_by_slot(slot) @@ -494,12 +496,14 @@ var/list/slot_equipment_priority = list( \ usr.stripPanelUnequip(src,what,slot) else usr.stripPanelEquip(src,what,slot) + return if(usr.machine == src) if(Adjacent(usr)) show_inv(usr) else usr << browse(null,"window=mob\ref[src]") + return // The src mob is trying to strip an item from someone // Defined in living.dm From e71b9876a26441db3bbff023ca976b2aa86cde84 Mon Sep 17 00:00:00 2001 From: ikarrus Date: Thu, 12 Jun 2014 00:30:41 -0600 Subject: [PATCH 2/3] OOP --- code/modules/mob/living/carbon/carbon.dm | 28 +++++++++++++++ code/modules/mob/living/living.dm | 43 +++++------------------- code/modules/mob/mob.dm | 2 +- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 5745bcea0e5..adb315fc458 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -483,3 +483,31 @@ var/const/GALOSHES_DONT_HELP = 8 /mob/living/carbon/fall(var/forced) loc.handle_fall(src, forced)//it's loc so it doesn't call the mob's handle_fall which does nothing + + +// The src mob is trying to strip an item from someone +// Override if a certain type of mob should be behave differently when stripping items (can't, for example) +/mob/living/carbon/stripPanelUnequip(mob/who, obj/item/what, where) + if(what.flags & NODROP) + src << "You can't remove \the [what.name], it appears to be stuck!" + return + visible_message("[src] tries to remove [who]'s [what.name].", \ + "[src] tries to remove [who]'s [what.name].") + what.add_fingerprint(src) + if(do_mob(src, who, STRIP_DELAY)) + if(what && Adjacent(who)) + who.unEquip(what) + +// The src mob is trying to place an item on someone +// Override if a certain mob should be behave differently when placing items (can't, for example) +/mob/living/carbon/stripPanelEquip(mob/who, obj/item/what, where) + what = src.get_active_hand() + if(what && (what.flags & NODROP)) + src << "You can't put \the [what.name] on [who], it's stuck to your hand!" + return + if(what && what.mob_can_equip(who, where, 1)) + visible_message("[src] tries to put [what] on [who].") + if(do_mob(src, who, STRIP_DELAY * 0.5)) + if(what && Adjacent(who)) + src.unEquip(what) + who.equip_to_slot_if_possible(what, where, 0, 1) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 51fade8fd0b..84cd7222219 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -425,7 +425,7 @@ if(HULK in usr.mutations) C.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) - + C.visible_message("[C] manages to break [I]!", \ "You successfully break [I].") qdel(I) @@ -436,11 +436,11 @@ else C.update_inv_legcuffed(0) C.legcuffed = null - - + + /mob/living/proc/cuff_resist(obj/item/I, mob/living/carbon/C) var/breakouttime = 600 - var/displaytime = 1 + var/displaytime = 1 if(istype(I, /obj/item/weapon/handcuffs)) var/obj/item/weapon/handcuffs/HC = C.handcuffed breakouttime = HC.breakouttime @@ -456,15 +456,15 @@ if(do_after(C, 50)) if(!I || C.buckled) return - cuff_break(I, C) + cuff_break(I, C) else - + C.visible_message("[usr] attempts to remove [I]!", \ "You attempt to remove [I]. (This will take around [displaytime] minutes and you need to stand still.)") spawn(0) if(do_after(C, breakouttime)) if(!I || C.buckled) - return + return C.visible_message("[C] manages to remove [I]!", \ "You successfully remove [I].") @@ -588,31 +588,4 @@ floating = 1 else if(!on && floating) animate(src, pixel_y = initial(pixel_y), time = 10) - floating = 0 - -// The src mob is trying to strip an item from someone -// Override if a certain type of mob should be behave differently when stripping items (can't, for example) -/mob/living/stripPanelUnequip(mob/who, obj/item/what, where) - if(what.flags & NODROP) - src << "You can't remove \the [what.name], it appears to be stuck!" - return - visible_message("[src] tries to remove [who]'s [what.name].", \ - "[src] tries to remove [who]'s [what.name].") - what.add_fingerprint(src) - if(do_mob(src, who, STRIP_DELAY)) - if(what && Adjacent(who)) - who.unEquip(what) - -// The src mob is trying to place an item on someone -// Override if a certain mob should be behave differently when placing items (can't, for example) -/mob/living/stripPanelEquip(mob/who, obj/item/what, where) - what = src.get_active_hand() - if(what && (what.flags & NODROP)) - src << "You can't put \the [what.name] on [who], it's stuck to your hand!" - return - if(what && what.mob_can_equip(who, where, 1)) - visible_message("[src] tries to put [what] on [who].") - if(do_mob(src, who, STRIP_DELAY * 0.5)) - if(what && Adjacent(who)) - src.unEquip(what) - who.equip_to_slot_if_possible(what, where, 0, 1) + floating = 0 \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 309c24fb3ed..b2735bb779d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -487,7 +487,7 @@ var/list/slot_equipment_priority = list( \ show_inv(machine) return - if(!usr.canUseTopic(src) && !iscarbon(usr)) + if(!usr.canUseTopic(src)) if(href_list["item"]) var/slot = text2num(href_list["item"]) var/obj/item/what = get_item_by_slot(slot) From f00c623514b02d245aa438ac718b6cf0665af6c9 Mon Sep 17 00:00:00 2001 From: ikarrus Date: Thu, 12 Jun 2014 09:29:45 -0600 Subject: [PATCH 3/3] Reverted stripping restrictions --- code/game/objects/items/weapons/handcuffs.dm | 18 ++++---- code/modules/mob/living/carbon/carbon.dm | 28 ------------- code/modules/mob/living/living.dm | 43 ++++++++++++++++---- code/modules/mob/mob.dm | 6 +-- 4 files changed, 43 insertions(+), 52 deletions(-) diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm index 43e869959b6..799b5e57d52 100644 --- a/code/game/objects/items/weapons/handcuffs.dm +++ b/code/game/objects/items/weapons/handcuffs.dm @@ -104,18 +104,14 @@ /obj/item/weapon/handcuffs/cyborg/attack(mob/living/carbon/C, mob/user) if(isrobot(user)) if(!C.handcuffed) + var/turf/user_loc = user.loc + var/turf/C_loc = C.loc playsound(loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2) C.visible_message("[user] is trying to put handcuffs on [C]!", \ "[user] is trying to put handcuffs on [C]!") - if(do_mob(user, C, 30)) - if(C.handcuffed) + if(do_after(user, 30)) + if(!C || C.handcuffed) return - C.handcuffed = new /obj/item/weapon/handcuffs(C) - C.update_inv_handcuffed(0) - else - C.visible_message("[user] tries to remove [C]'s handcuffs.", \ - "[user] tries to remove [C]'s handcuffs.") - if(do_mob(user, C, 30)) - if(!C.handcuffed) - return - C.unEquip(C.handcuffed) \ No newline at end of file + if(user_loc == user.loc && C_loc == C.loc) + C.handcuffed = new /obj/item/weapon/handcuffs(C) + C.update_inv_handcuffed(0) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index adb315fc458..5745bcea0e5 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -483,31 +483,3 @@ var/const/GALOSHES_DONT_HELP = 8 /mob/living/carbon/fall(var/forced) loc.handle_fall(src, forced)//it's loc so it doesn't call the mob's handle_fall which does nothing - - -// The src mob is trying to strip an item from someone -// Override if a certain type of mob should be behave differently when stripping items (can't, for example) -/mob/living/carbon/stripPanelUnequip(mob/who, obj/item/what, where) - if(what.flags & NODROP) - src << "You can't remove \the [what.name], it appears to be stuck!" - return - visible_message("[src] tries to remove [who]'s [what.name].", \ - "[src] tries to remove [who]'s [what.name].") - what.add_fingerprint(src) - if(do_mob(src, who, STRIP_DELAY)) - if(what && Adjacent(who)) - who.unEquip(what) - -// The src mob is trying to place an item on someone -// Override if a certain mob should be behave differently when placing items (can't, for example) -/mob/living/carbon/stripPanelEquip(mob/who, obj/item/what, where) - what = src.get_active_hand() - if(what && (what.flags & NODROP)) - src << "You can't put \the [what.name] on [who], it's stuck to your hand!" - return - if(what && what.mob_can_equip(who, where, 1)) - visible_message("[src] tries to put [what] on [who].") - if(do_mob(src, who, STRIP_DELAY * 0.5)) - if(what && Adjacent(who)) - src.unEquip(what) - who.equip_to_slot_if_possible(what, where, 0, 1) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 84cd7222219..51fade8fd0b 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -425,7 +425,7 @@ if(HULK in usr.mutations) C.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) - + C.visible_message("[C] manages to break [I]!", \ "You successfully break [I].") qdel(I) @@ -436,11 +436,11 @@ else C.update_inv_legcuffed(0) C.legcuffed = null - - + + /mob/living/proc/cuff_resist(obj/item/I, mob/living/carbon/C) var/breakouttime = 600 - var/displaytime = 1 + var/displaytime = 1 if(istype(I, /obj/item/weapon/handcuffs)) var/obj/item/weapon/handcuffs/HC = C.handcuffed breakouttime = HC.breakouttime @@ -456,15 +456,15 @@ if(do_after(C, 50)) if(!I || C.buckled) return - cuff_break(I, C) + cuff_break(I, C) else - + C.visible_message("[usr] attempts to remove [I]!", \ "You attempt to remove [I]. (This will take around [displaytime] minutes and you need to stand still.)") spawn(0) if(do_after(C, breakouttime)) if(!I || C.buckled) - return + return C.visible_message("[C] manages to remove [I]!", \ "You successfully remove [I].") @@ -588,4 +588,31 @@ floating = 1 else if(!on && floating) animate(src, pixel_y = initial(pixel_y), time = 10) - floating = 0 \ No newline at end of file + floating = 0 + +// The src mob is trying to strip an item from someone +// Override if a certain type of mob should be behave differently when stripping items (can't, for example) +/mob/living/stripPanelUnequip(mob/who, obj/item/what, where) + if(what.flags & NODROP) + src << "You can't remove \the [what.name], it appears to be stuck!" + return + visible_message("[src] tries to remove [who]'s [what.name].", \ + "[src] tries to remove [who]'s [what.name].") + what.add_fingerprint(src) + if(do_mob(src, who, STRIP_DELAY)) + if(what && Adjacent(who)) + who.unEquip(what) + +// The src mob is trying to place an item on someone +// Override if a certain mob should be behave differently when placing items (can't, for example) +/mob/living/stripPanelEquip(mob/who, obj/item/what, where) + what = src.get_active_hand() + if(what && (what.flags & NODROP)) + src << "You can't put \the [what.name] on [who], it's stuck to your hand!" + return + if(what && what.mob_can_equip(who, where, 1)) + visible_message("[src] tries to put [what] on [who].") + if(do_mob(src, who, STRIP_DELAY * 0.5)) + if(what && Adjacent(who)) + src.unEquip(what) + who.equip_to_slot_if_possible(what, where, 0, 1) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index b2735bb779d..b3f3e3137ce 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -480,14 +480,12 @@ var/list/slot_equipment_priority = list( \ var/t1 = text("window=[href_list["mach_close"]]") unset_machine() src << browse(null, t1) - return if(href_list["refresh"]) if(machine && in_range(src, usr)) show_inv(machine) - return - if(!usr.canUseTopic(src)) + if(!usr.stat && usr.canmove && !usr.restrained() && Adjacent(usr)) if(href_list["item"]) var/slot = text2num(href_list["item"]) var/obj/item/what = get_item_by_slot(slot) @@ -496,14 +494,12 @@ var/list/slot_equipment_priority = list( \ usr.stripPanelUnequip(src,what,slot) else usr.stripPanelEquip(src,what,slot) - return if(usr.machine == src) if(Adjacent(usr)) show_inv(usr) else usr << browse(null,"window=mob\ref[src]") - return // The src mob is trying to strip an item from someone // Defined in living.dm