From 11b6f771427ffdef771ff476880cb8b4aade7d4f Mon Sep 17 00:00:00 2001 From: quotefox Date: Thu, 28 Apr 2022 01:57:53 +0100 Subject: [PATCH] Railing climb animation and fixes --- code/__HELPERS/unsorted.dm | 12 ++++++++++-- hyperstation/code/game/objects/railings.dm | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 3ceb1547a..1ceef52c5 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1109,7 +1109,7 @@ B --><-- A /proc/get_random_station_turf() return safepick(get_area_turfs(pick(GLOB.the_station_areas))) - + /proc/get_safe_random_station_turf() for (var/i in 1 to 5) var/list/L = get_area_turfs(pick(GLOB.the_station_areas)) @@ -1273,6 +1273,14 @@ GLOBAL_REAL_VAR(list/stack_trace_storage) animate(src, transform = M, time = halftime, easing = ELASTIC_EASING) animate(src, transform = OM, time = halftime, easing = ELASTIC_EASING) +/atom/proc/do_twist(targetangle = 45, timer = 20) + var/matrix/OM = matrix(transform) + var/matrix/M = matrix(transform) + var/halftime = timer * 0.5 + M.Turn(pick(-targetangle, targetangle)) + animate(src, transform = M, time = halftime, easing = ELASTIC_EASING) + animate(src, transform = OM, time = halftime, easing = QUAD_EASING) + /atom/proc/do_squish(squishx = 1.2, squishy = 0.6, timer = 20) var/matrix/OM = matrix(transform) var/matrix/M = matrix(transform) @@ -1526,7 +1534,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) blocked |= typesof(/obj/item/reagent_containers/food/drinks/prospacillin, /obj/item/reagent_containers/food/drinks/diminicillin ) - + return pick(subtypesof(/obj/item/reagent_containers/food/drinks) - blocked) //For these two procs refs MUST be ref = TRUE format like typecaches! diff --git a/hyperstation/code/game/objects/railings.dm b/hyperstation/code/game/objects/railings.dm index 561765f68..2c01a1721 100644 --- a/hyperstation/code/game/objects/railings.dm +++ b/hyperstation/code/game/objects/railings.dm @@ -151,15 +151,18 @@ usr.visible_message("[user] starts climbing onto \the [src]!") - if(!do_after(user, 20)) + if(!do_after(user, 15, src)) return if(get_turf(user) == get_turf(src)) + usr.dir = get_dir(usr.loc, get_step(src, src.dir))//turn and face railing usr.forceMove(get_step(src, src.dir)) else + usr.dir = get_dir(usr.loc, loc)//turn and face railing usr.forceMove(get_turf(src)) usr.visible_message("[user] climbed over \the [src]!") + usr.do_twist(targetangle = 45, timer = 8) /obj/structure/railing/handrail name = "handrail"