Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: walking on tables #4508

Merged
merged 33 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bc08486
bugfix: walking on tables
xTrogwaRx Feb 26, 2024
09a400b
bugfix: walking on tables
xTrogwaRx Feb 26, 2024
6a2e401
bugfix: walking on tables
xTrogwaRx Feb 26, 2024
33c6160
bugfix: walking on tables
xTrogwaRx Feb 26, 2024
d1516f3
add: climbing animation
xTrogwaRx Mar 2, 2024
01d72f5
Merge branch 'ss220-space:master220' into table-fix
xTrogwaRx Mar 2, 2024
e9379a8
bugfix: climbing in clown shoes
xTrogwaRx Mar 2, 2024
44509a1
add: fall animation
xTrogwaRx Mar 2, 2024
b4bdaba
add: hopping animation
xTrogwaRx Mar 2, 2024
b2ecb2c
add: hopping animation
xTrogwaRx Mar 2, 2024
5ba73ca
bugfix: disables climb animation
xTrogwaRx Mar 2, 2024
27ae7e6
bugfix: walking on tables
xTrogwaRx Mar 2, 2024
17183f9
Update structures.dm
xTrogwaRx Mar 3, 2024
e1a6c28
Update tables_racks.dm
xTrogwaRx Mar 3, 2024
ebbb133
bugfix: walking on tables
xTrogwaRx Mar 3, 2024
4f45962
bugfix: walking on tables
xTrogwaRx Mar 3, 2024
4d170af
bugfix: walking on tables
xTrogwaRx Mar 3, 2024
205afcf
bugfix: disables climb animation
xTrogwaRx Mar 3, 2024
1e873eb
add: hopping animation
xTrogwaRx Mar 3, 2024
52a04c8
bugfix: walking on tables
xTrogwaRx Mar 3, 2024
dd58146
bugfix: walking on tables
xTrogwaRx Mar 3, 2024
707a85e
bugfix: move stuctures with mob
xTrogwaRx Mar 9, 2024
f461a67
refactor: changed 'usr' to 'user'
xTrogwaRx Mar 9, 2024
5604210
refactor: changed 'usr' to 'user'
xTrogwaRx Mar 9, 2024
e4cd91f
refactor: changed 'usr' to 'user'
xTrogwaRx Mar 9, 2024
483cc72
refactor: changed 'usr' to 'user'
xTrogwaRx Mar 9, 2024
95d693a
bugfix: moving a tray table with something on it
xTrogwaRx Mar 9, 2024
f308cbd
bugfix: table drop damage for anthropomorphs only
xTrogwaRx Mar 10, 2024
0e40b1f
bugfix: multi-person fall
xTrogwaRx Mar 13, 2024
921c58e
refactor: change <span> to proc
xTrogwaRx Mar 13, 2024
83361ef
bugfix: Oops!
xTrogwaRx Mar 13, 2024
ecdbae0
refactor: usr to user
xTrogwaRx Mar 14, 2024
1ebd935
refactor: standardization
xTrogwaRx Mar 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions code/datums/elements/waddling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
Waddle(target)

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

user.pixel_z = initial(user.pixel_z)

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

/obj/structure/Destroy()
if(climbable)
structure_gone(src)
if(SSticker)
GLOB.cameranet.updateVisibility(src)
if(smooth)
Expand All @@ -49,14 +51,16 @@
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 @@ -79,6 +83,32 @@

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 @@ -94,18 +124,28 @@
return T
return null

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

usr.visible_message("<span class='warning'>[user] starts climbing onto \the [src]!</span>")
return TRUE

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

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

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

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

clumse_stuff(climber)

climber = null

return TRUE
Expand Down Expand Up @@ -165,49 +206,65 @@
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) return //No spamming this on people.
if(M.lying)
continue //No spamming this on people.

M.Weaken(10 SECONDS)
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()
to_chat(M, span_warning("You topple as \the [src] moves under you!"))

get_fall_damage(M)

return

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

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

/obj/structure/proc/prevents_buckled_mobs_attacking()
return FALSE
Expand Down
25 changes: 25 additions & 0 deletions code/game/objects/structures/fence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@
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: 44 additions & 7 deletions code/game/objects/structures/railings.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,53 @@
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)
. = ..()
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)

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
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
Loading