From c7e9e1aa2acb442ef28a8182fac56e1c0b088689 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Sun, 29 Jun 2014 09:40:37 +0930 Subject: [PATCH] Fixed It won't budge! from crates, added drag and drop for table climbing, added Adajcent check to table climbing. --- code/game/objects/structures.dm | 35 ++++++++++++++----- .../structures/crates_lockers/closets.dm | 3 +- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 36d428ec5b0..8044f3d4fe5 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -24,26 +24,40 @@ /obj/structure/New() ..() if(climbable) - verbs += /obj/structure/proc/do_climb + verbs += /obj/structure/proc/climb_on -/obj/structure/proc/do_climb() +/obj/structure/proc/climb_on() set name = "Climb structure" set desc = "Climbs onto a structure." set category = "Object" set src in oview(1) - if (!can_touch(usr) || !climbable) + do_climb(usr) + +/obj/structure/MouseDrop(atom/over_object) + + var/mob/living/H = over_object + if(!istype(H)) return ..() + + do_climb(H) + +/obj/structure/proc/do_climb(var/mob/living/user) + + if (!can_touch(user) || !climbable) return - usr.visible_message("[usr] starts climbing onto \the [src]!") + usr.visible_message("[user] starts climbing onto \the [src]!") - if(!do_after(usr,50)) + if(!do_after(user,50)) + return + + if (!can_touch(user) || !climbable) return usr.loc = get_turf(src) - if (get_turf(usr) == get_turf(src)) - usr.visible_message("[usr] climbs onto \the [src]!") + if (get_turf(user) == get_turf(src)) + usr.visible_message("[user] climbs onto \the [src]!") /obj/structure/proc/structure_shaken() @@ -93,7 +107,12 @@ /obj/structure/proc/can_touch(var/mob/user) if (!user) return 0 - if (user.stat || user.restrained() || user.paralysis || user.sleeping || user.lying || user.weakened) + if(!Adjacent(user)) + return 0 + if (user.restrained() || user.buckled) + user << "You need your hands and legs free for this." + return 0 + if (user.stat || user.paralysis || user.sleeping || user.lying || user.weakened) return 0 if (issilicon(user)) user << "You need hands for this." diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 129171a435d..1fc814dc091 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -120,8 +120,9 @@ return 1 /obj/structure/closet/proc/toggle(mob/user as mob) + var/orig = src.opened . = src.opened ? src.close() : src.open() - if(!.) + if(. == orig) user << "It won't budge!" return