diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm
index 4dba4393f5f..e45f6bf845c 100644
--- a/code/game/objects/structures.dm
+++ b/code/game/objects/structures.dm
@@ -1,11 +1,12 @@
-obj/structure
+/obj/structure
icon = 'icons/obj/structures.dmi'
+ var/climbable
-obj/structure/blob_act()
+/obj/structure/blob_act()
if(prob(50))
del(src)
-obj/structure/ex_act(severity)
+/obj/structure/ex_act(severity)
switch(severity)
if(1.0)
qdel(src)
@@ -17,9 +18,90 @@ obj/structure/ex_act(severity)
if(3.0)
return
-obj/structure/meteorhit(obj/O as obj)
+/obj/structure/meteorhit(obj/O as obj)
del(src)
+
/obj/structure/Destroy()
if(hascall(src, "unbuckle"))
- src:unbuckle()
\ No newline at end of file
+ src:unbuckle()
+
+/obj/structure/New()
+ ..()
+ if(climbable)
+ verbs += /obj/structure/proc/do_climb
+
+/obj/structure/proc/do_climb()
+
+ set name = "Climb structure"
+ set desc = "Climbs onto a structure."
+ set category = "Object"
+ set src in oview(1)
+
+ if (!can_touch(usr) || !climbable)
+ return
+
+ usr.visible_message("[usr] starts climbing onto \the [src]!")
+
+ if(!do_after(usr,50))
+ return
+
+ usr.loc = get_turf(src)
+ if (get_turf(usr) == get_turf(src))
+ usr.visible_message("[usr] climbs onto \the [src]!")
+
+/obj/structure/proc/structure_shaken()
+
+ for(var/mob/living/M in get_turf(src))
+
+ if(M.lying) return //No spamming this on people.
+
+ M.Weaken(5)
+ M << "\red You topple as \the [src] moves under you!"
+
+ if(prob(25))
+
+ var/damage = rand(15,30)
+ var/mob/living/carbon/human/H = M
+ if(!istype(M))
+ H << "\red You land heavily!"
+ M.adjustBruteLoss(damage)
+ return
+
+ var/datum/organ/external/affecting
+
+ switch(pick(list("ankle","wrist","head","knee","elbow")))
+ if("ankle")
+ affecting = H.get_organ(pick("l_foot", "r_foot"))
+ if("knee")
+ affecting = H.get_organ(pick("l_leg", "r_leg"))
+ if("wrist")
+ affecting = H.get_organ(pick("l_hand", "r_hand"))
+ if("elbow")
+ affecting = H.get_organ(pick("l_arm", "r_arm"))
+ if("head")
+ affecting = H.get_organ("head")
+
+ if(affecting)
+ M << "\red You land heavily on your [affecting.display_name]!"
+ affecting.take_damage(damage, 0)
+ if(affecting.parent)
+ affecting.parent.add_autopsy_data("Misadventure", damage)
+ else
+ H << "\red You land heavily!"
+ H.adjustBruteLoss(damage)
+
+ H.UpdateDamageIcon()
+ H.updatehealth()
+ return
+
+/obj/structure/proc/can_touch(var/mob/user)
+ if (!user)
+ return 0
+ if (user.stat || user.restrained() || user.paralysis || user.sleeping || user.stunned || user.weakened)
+ return 0
+ if (issilicon(user))
+ user << "You need hands for this."
+ return 0
+ return 1
+
diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm
index a44d9c47ba2..d902bacd5bb 100644
--- a/code/game/objects/structures/crates_lockers/crates.dm
+++ b/code/game/objects/structures/crates_lockers/crates.dm
@@ -7,39 +7,10 @@
icon_state = "crate"
icon_opened = "crateopen"
icon_closed = "crate"
+ climbable = 1
// mouse_drag_pointer = MOUSE_ACTIVE_POINTER //???
var/rigged = 0
-//Maybe move both of these procs to a root structure somewhere and have a 'climbable' var on structures.
-/obj/structure/closet/crate/proc/can_touch(var/mob/user)
- if (!user)
- return 0
- if (user.stat) //zombie goasts go away
- return 0
- if (issilicon(user))
- user << "You need hands for this."
- return 0
- return 1
-
-/obj/structure/closet/crate/verb/do_climb()
-
- set name = "Climb crate"
- set desc = "Climbs onto a crate."
- set category = "Object"
- set src in oview(1)
-
- if (!can_touch(usr))
- return
-
- usr.visible_message("[usr] starts climbing onto \the [src]!")
-
- if(!do_after(usr,50))
- return
-
- usr.loc = get_turf(src)
- if (get_turf(usr) == get_turf(src))
- usr.visible_message("[usr] climbs onto \the [src]!")
-
/obj/structure/closet/crate/can_open()
return 1
@@ -67,44 +38,9 @@
icon_state = icon_opened
src.opened = 1
- for(var/mob/living/M in get_turf(src))
+ if(climbable)
+ structure_shaken()
- if(M.lying) return //No spamming this on people.
-
- M.Weaken(5)
- M << "\red You topple as \the [src] moves under you!"
-
- if(prob(100))
-
- var/mob/living/carbon/human/H = M
- if(!istype(M))
- H << "\red You land heavily!"
- M.adjustBruteLoss(rand(15,30))
- return
-
- var/datum/organ/external/affecting
-
- switch(pick(list("ankle","wrist","head","knee","elbow")))
- if("ankle")
- affecting = H.get_organ(pick("l_foot", "r_foot"))
- if("knee")
- affecting = H.get_organ(pick("l_leg", "r_leg"))
- if("wrist")
- affecting = H.get_organ(pick("l_hand", "r_hand"))
- if("elbow")
- affecting = H.get_organ(pick("l_arm", "r_arm"))
- if("head")
- affecting = H.get_organ("head")
-
- if(affecting)
- M << "\red You land heavily on your [affecting.display_name]!"
- affecting.take_damage(rand(15,30), 0)
- else
- H << "\red You land heavily!"
- H.adjustBruteLoss(rand(15,30))
-
- H.UpdateDamageIcon()
- H.updatehealth()
return
/obj/structure/closet/crate/close()
diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm
index 5877cb9133a..ba0efb73d2c 100644
--- a/code/game/objects/structures/tables_racks.dm
+++ b/code/game/objects/structures/tables_racks.dm
@@ -19,6 +19,8 @@
anchored = 1.0
layer = 2.8
throwpass = 1 //You can throw objects over this, despite it's density.")
+ climbable = 1
+
var/parts = /obj/item/weapon/table_parts
var/flipped = 0
var/health = 100
@@ -415,34 +417,6 @@
return 0
return T.straight_table_check(direction)
-/obj/structure/table/proc/can_touch(var/mob/user)
- if (!user)
- return 0
- if (user.stat) //zombie goasts go away
- return 0
- if (issilicon(user))
- user << "You need hands for this."
- return 0
- return 1
-
-/obj/structure/table/verb/do_climb()
- set name = "Climb table"
- set desc = "Climbs onto a table."
- set category = "Object"
- set src in oview(1)
-
- if (!can_touch(usr))
- return
-
- usr.visible_message("[usr] starts climbing onto \the [src]!")
-
- if(!do_after(usr,50))
- return
-
- usr.loc = get_turf(src)
- if (get_turf(usr) == get_turf(src))
- usr.visible_message("[usr] climbs onto \the [src]!")
-
/obj/structure/table/verb/do_flip()
set name = "Flip table"
set desc = "Flips a non-reinforced table"
@@ -458,44 +432,9 @@
usr.visible_message("[usr] flips \the [src]!")
- for(var/mob/living/M in get_turf(src))
+ if(climbable)
+ structure_shaken()
- if(M.lying) return //No spamming this on people.
-
- M.Weaken(5)
- M << "\red You topple as \the [src] moves under you!"
-
- if(prob(100))
-
- var/mob/living/carbon/human/H = M
- if(!istype(M))
- H << "\red You land heavily!"
- M.adjustBruteLoss(rand(15,30))
- return
-
- var/datum/organ/external/affecting
-
- switch(pick(list("ankle","wrist","head","knee","elbow")))
- if("ankle")
- affecting = H.get_organ(pick("l_foot", "r_foot"))
- if("knee")
- affecting = H.get_organ(pick("l_leg", "r_leg"))
- if("wrist")
- affecting = H.get_organ(pick("l_hand", "r_hand"))
- if("elbow")
- affecting = H.get_organ(pick("l_arm", "r_arm"))
- if("head")
- affecting = H.get_organ("head")
-
- if(affecting)
- M << "\red You land heavily on your [affecting.display_name]!"
- affecting.take_damage(rand(15,30), 0)
- else
- H << "\red You land heavily!"
- H.adjustBruteLoss(rand(15,30))
-
- H.UpdateDamageIcon()
- H.updatehealth()
return
/obj/structure/table/proc/do_put()