Skip to content

Commit

Permalink
revert: bugfix: walking on tables (#4636)
Browse files Browse the repository at this point in the history
Revert "bugfix: walking on tables (#4508)"

This reverts commit 28dc080.
  • Loading branch information
Vladisvell authored Mar 15, 2024
1 parent 28dc080 commit 08ae11c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 212 deletions.
7 changes: 3 additions & 4 deletions code/datums/elements/waddling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
Waddle(target)

/datum/element/waddling/proc/Waddle(atom/movable/target)
var/current_pixel_z = target.pixel_z
animate(target, pixel_z = target.pixel_z + 4, time = 0)
animate(target, pixel_z = 4, time = 0)
var/prev_trans = matrix(target.transform)
animate(pixel_z = target.pixel_z - 4, transform = turn(target.transform, pick(-12, 0, 12)), time = 2)
animate(pixel_z = current_pixel_z, transform = prev_trans, time = 0)
animate(pixel_z = 0, transform = turn(target.transform, pick(-12, 0, 12)), time = 2)
animate(pixel_z = 0, transform = prev_trans, time = 0)
2 changes: 0 additions & 2 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,6 @@
if(isspaceturf(get_turf(user))) // Can't fall onto nothing.
return

user.pixel_z = initial(user.pixel_z)

if(user.m_intent == MOVE_INTENT_RUN)
user.Weaken(10 SECONDS)
else
Expand Down
155 changes: 49 additions & 106 deletions code/game/objects/structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
return ..()

/obj/structure/Destroy()
if(climbable)
structure_gone(src)
if(SSticker)
GLOB.cameranet.updateVisibility(src)
if(smooth)
Expand All @@ -51,16 +49,14 @@
if(!..())
return FALSE

if(climbable)
structure_gone(old)

if(creates_cover)
if(isturf(old))
REMOVE_TRAIT(old, TRAIT_TURF_COVERED, UNIQUE_TRAIT_SOURCE(src))
if(isturf(loc))
ADD_TRAIT(loc, TRAIT_TURF_COVERED, UNIQUE_TRAIT_SOURCE(src))
return TRUE


/obj/structure/has_prints()
return TRUE

Expand All @@ -83,32 +79,6 @@

do_climb(usr)

/obj/structure/proc/animate_jumping_off(mob/living/user)
if(!user.flying && user.mob_has_gravity())
var/delay = user.movement_delay()/4
sleep(delay)
animate(user, pixel_z = initial(user.pixel_z), time = 3, easing = BACK_EASING|EASE_IN)

/obj/structure/proc/animate_climb(mob/living/user)
if(!istype(user))
return
if(!user.checkpass(PASSTABLE) && !user.flying && user.mob_size > MOB_SIZE_SMALL)
var/delay = user.movement_delay()/2
sleep(delay)
animate(user, pixel_z = 16, time = 1, easing = LINEAR_EASING)
if(user.floating)
user.float(TRUE)

/obj/structure/Uncrossed(atom/movable/mover)
. = ..()
if(!istype(mover, /mob/living))
return
if(climbable)
var/turf/T = get_turf(mover)
var/obj/structure/other_structure = locate(/obj/structure) in T
if(!other_structure?.climbable)
animate_jumping_off(mover)

/obj/structure/MouseDrop_T(atom/movable/dropping, mob/user, params)
. = ..()
if(!. && dropping == user)
Expand All @@ -124,28 +94,18 @@
return T
return null

/obj/structure/proc/climb_check(mob/living/user)
if(user.mob_size == MOB_SIZE_SMALL)
return FALSE
if(user.flying)
return FALSE
/obj/structure/proc/do_climb(var/mob/living/user)
if(!can_touch(user) || !climbable)
return FALSE
var/blocking_object = density_check()
if(blocking_object)
to_chat(user, span_warning("You cannot climb [src], as it is blocked by \a [blocking_object]!"))
return FALSE
var/turf/T = src.loc
if(!T || !istype(T))
to_chat(user, "<span class='warning'>You cannot climb [src], as it is blocked by \a [blocking_object]!</span>")
return FALSE

return TRUE

/obj/structure/proc/do_climb(mob/living/user)
if(!climb_check(user))
return FALSE
var/turf/T = src.loc
if(!T || !istype(T)) return FALSE

user.visible_message(span_warning("[user] starts climbing onto \the [src]!"))
usr.visible_message("<span class='warning'>[user] starts climbing onto \the [src]!</span>")
climber = user
if(!do_after(user, 50, target = src))
climber = null
Expand All @@ -155,13 +115,12 @@
climber = null
return FALSE

user.loc = get_turf(src)
animate_climb(user)

usr.loc = get_turf(src)
if(get_turf(user) == get_turf(src))
user.visible_message(span_warning("[user] climbs onto \the [src]!"))
usr.visible_message("<span class='warning'>[user] climbs onto \the [src]!</span>")

clumse_stuff(climber)

climber = null

return TRUE
Expand Down Expand Up @@ -206,65 +165,49 @@
AM.force /= force_mult
AM.throwforce /= force_mult

/obj/structure/proc/get_fall_damage(mob/living/L)
if(prob(25))

var/damage = rand(15,30)
var/mob/living/carbon/human/H = L
if(!istype(H))
to_chat(H, span_warning("You land heavily!"))
L.adjustBruteLoss(damage)
return

var/obj/item/organ/external/affecting

switch(pick(list("ankle","wrist","head","knee","elbow")))
if("ankle")
affecting = H.get_organ(pick(BODY_ZONE_PRECISE_L_FOOT, BODY_ZONE_PRECISE_R_FOOT))
if("knee")
affecting = H.get_organ(pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
if("wrist")
affecting = H.get_organ(pick(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND))
if("elbow")
affecting = H.get_organ(pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM))
if("head")
affecting = H.get_organ(BODY_ZONE_HEAD)

if(affecting)
to_chat(L, span_warning("You land heavily on your [affecting.name]!"))
affecting.receive_damage(damage, 0)
if(affecting.parent)
affecting.parent.add_autopsy_data("Misadventure", damage)
else
to_chat(H, span_warning("You land heavily!"))
H.adjustBruteLoss(damage)

H.UpdateDamageIcon()

/obj/structure/proc/structure_gone(atom/location)
for(var/mob/living/carbon/human/H in get_turf(location))
H.pixel_z = initial(H.pixel_z)
if(H.lying || H.mob_size <= MOB_SIZE_SMALL)
continue
to_chat(H, span_warning("You stop feeling \the [src] beneath your feet."))
if(H.m_intent == MOVE_INTENT_WALK)
H.Weaken(3 SECONDS)
if(H.m_intent == MOVE_INTENT_RUN)
H.Weaken(10 SECONDS)
get_fall_damage(H)

/obj/structure/proc/structure_shaken()

for(var/mob/living/M in get_turf(src))

if(M.lying)
continue //No spamming this on people.
if(M.lying) return //No spamming this on people.

M.Weaken(10 SECONDS)
to_chat(M, span_warning("You topple as \the [src] moves under you!"))

get_fall_damage(M)

to_chat(M, "<span class='warning'>You topple as \the [src] moves under you!</span>")

if(prob(25))

var/damage = rand(15,30)
var/mob/living/carbon/human/H = M
if(!istype(H))
to_chat(H, "<span class='warning'>You land heavily!</span>")
M.adjustBruteLoss(damage)
return

var/obj/item/organ/external/affecting

switch(pick(list("ankle","wrist","head","knee","elbow")))
if("ankle")
affecting = H.get_organ(pick(BODY_ZONE_PRECISE_L_FOOT, BODY_ZONE_PRECISE_R_FOOT))
if("knee")
affecting = H.get_organ(pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
if("wrist")
affecting = H.get_organ(pick(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND))
if("elbow")
affecting = H.get_organ(pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM))
if("head")
affecting = H.get_organ(BODY_ZONE_HEAD)

if(affecting)
to_chat(M, "<span class='warning'>You land heavily on your [affecting.name]!</span>")
affecting.receive_damage(damage, 0)
if(affecting.parent)
affecting.parent.add_autopsy_data("Misadventure", damage)
else
to_chat(H, "<span class='warning'>You land heavily!</span>")
H.adjustBruteLoss(damage)

H.UpdateDamageIcon()
return

/obj/structure/proc/can_touch(mob/living/user)
Expand All @@ -286,14 +229,14 @@
. = ..()
if(!(resistance_flags & INDESTRUCTIBLE))
if(resistance_flags & ON_FIRE)
. += span_warning("It's on fire!")
. += "<span class='warning'>It's on fire!</span>"
if(broken)
. += span_notice("It appears to be broken.")
. += "<span class='notice'>It appears to be broken.</span>"
var/examine_status = examine_status(user)
if(examine_status)
. += examine_status
if(climbable)
. += span_info("You can <b>Click-Drag</b> someone to [src] to put them on the structure after a short delay.")
. += "<span class='info'>You can <b>Click-Drag</b> someone to [src] to put them on the table after a short delay.</span>"

/obj/structure/proc/examine_status(mob/user) //An overridable proc, mostly for falsewalls.
var/healthpercent = (obj_integrity/max_integrity) * 100
Expand All @@ -304,7 +247,7 @@
. += "It appears heavily damaged."
if(0 to 25)
if(!broken)
. += span_warning("It's falling apart!")
. += "<span class='warning'>It's falling apart!</span>"

/obj/structure/proc/prevents_buckled_mobs_attacking()
return FALSE
Expand Down
25 changes: 0 additions & 25 deletions code/game/objects/structures/fence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,6 @@
return TRUE
return FALSE

/obj/structure/fence/do_climb(mob/living/user)
if(!climb_check(user))
return FALSE

user.visible_message("<span class='warning'>[user] starts climbing onto \the [src]!</span>")
climber = user
if(!do_after(user, CLIMB_TIME, target = src))
climber = null
return FALSE

if(!can_touch(user) || !climbable)
climber = null
return FALSE

user.loc = get_turf(src)

if(get_turf(user) == get_turf(src))
user.visible_message("<span class='warning'>[user] climbs onto \the [src]!</span>")

clumse_stuff(climber)

climber = null

return TRUE

/*
Shock user with probability prb (if all connections & power are working)
Returns TRUE if shocked, FALSE otherwise
Expand Down
51 changes: 7 additions & 44 deletions code/game/objects/structures/railings.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,53 +138,16 @@
return TRUE
return FALSE

/obj/structure/railing/proc/hopping(mob/living/user)
if(!istype(user))
return
var/delay = user.movement_delay()/2
sleep(delay)
animate(user, pixel_z = 10, time = 3, easing = CIRCULAR_EASING|EASE_OUT)
delay = user.movement_delay()/4
sleep(delay)
animate(user, pixel_z = initial(user.pixel_z), time = 3, easing = CIRCULAR_EASING|EASE_OUT)
if(user.floating)
user.float(TRUE)

/obj/structure/railing/do_climb(mob/living/user)
if(!climb_check(user))
return FALSE

var/initial_mob_loc = get_turf(user)

user.visible_message("<span class='warning'>[user] starts climbing onto \the [src]!</span>")
climber = user
if(!do_after(user, 50, target = src))
climber = null
return FALSE

if(!can_touch(user) || !climbable)
climber = null
return FALSE

user.loc = get_turf(src)
hopping(user)

if(get_turf(user) == get_turf(src))
user.visible_message("<span class='warning'>[user] climbs onto \the [src]!</span>")

clumse_stuff(climber)

climber = null

currently_climbed = TRUE

if(initial_mob_loc != get_turf(src)) // If we are on the railing, we want to move in the same dir as the railing. Otherwise we get put on the railing
. = ..()
if(.)
currently_climbed = TRUE
if(initial_mob_loc != get_turf(src)) // If we are on the railing, we want to move in the same dir as the railing. Otherwise we get put on the railing
currently_climbed = FALSE
return
user.Move(get_step(user, dir), TRUE)
currently_climbed = FALSE
return TRUE
user.loc = get_step(user, dir)
currently_climbed = FALSE

return TRUE

/obj/structure/railing/proc/can_be_rotated(mob/user)
if(anchored)
Expand Down
Loading

0 comments on commit 08ae11c

Please sign in to comment.