diff --git a/code/datums/elements/elevation.dm b/code/datums/elements/elevation.dm index a2c6511c034..a461528dada 100644 --- a/code/datums/elements/elevation.dm +++ b/code/datums/elements/elevation.dm @@ -150,17 +150,37 @@ UnregisterSignal(gone, COMSIG_LIVING_SET_BUCKLED) /datum/element/elevation_core/proc/elevate_mob(mob/living/target, z_shift = pixel_shift, elevate_time = ELEVATE_TIME) + var/buckled_to_vehicle = FALSE + if(target.buckled) + if(isvehicle(target.buckled)) + buckled_to_vehicle = TRUE + else if(!isliving(target.buckled)) + return animate(target, pixel_z = z_shift, time = elevate_time, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) - if(target.buckled && isvehicle(target.buckled)) + if(buckled_to_vehicle) animate(target.buckled, pixel_z = z_shift, time = elevate_time, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) -///Vehicles or other things the mob is buckled too also are shifted. +/** + * If the mob is buckled or unbuckled to/from a vehicle, shift it up/down + *. + * Null the pixel shift if the mob is buckled to something different that's not a mob or vehicle + * + * The reason is that it's more important for a mob to look like they're actually buckled to a bed + * or something anchored to the floor than atop of whatever else is on the same turf. + */ /datum/element/elevation_core/proc/on_set_buckled(mob/living/source, atom/movable/new_buckled) SIGNAL_HANDLER - if(source.buckled && isvehicle(source.buckled)) - animate(source.buckled, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) - if(new_buckled && isvehicle(new_buckled)) - animate(source.buckled, pixel_z = pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) + if(source.buckled) + if(isvehicle(source.buckled)) + animate(source.buckled, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) + else if(!isliving(source.buckled)) + animate(source, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) + if(!new_buckled) + return + if(isvehicle(new_buckled)) + animate(new_buckled, pixel_z = pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) + else if(!isliving(new_buckled)) + animate(source, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) /datum/element/elevation_core/proc/on_reset_elevation(turf/source, list/current_values) SIGNAL_HANDLER diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index 140ff025196..177cd540040 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -25,15 +25,6 @@ /obj/machinery/stasis/Destroy() . = ..() -///Just like beds, the elevation looks good while standing, but not when buckled to the bed. -/obj/machinery/stasis/post_buckle_mob(mob/living/buckled) - . = ..() - buckled.pixel_y -= 6 - -/obj/machinery/stasis/post_unbuckle_mob(mob/living/buckled) - . = ..() - buckled.pixel_y += 6 - /obj/machinery/stasis/examine(mob/user) . = ..() . += span_notice("Alt-click to [stasis_enabled ? "turn off" : "turn on"] the machine.") diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm index b1d38c61a24..08543558643 100644 --- a/code/game/objects/structures/beds_chairs/bed.dm +++ b/code/game/objects/structures/beds_chairs/bed.dm @@ -67,16 +67,6 @@ deconstruct(disassembled = TRUE) return TRUE -/obj/structure/bed/post_buckle_mob(mob/living/buckled) - . = ..() - buckled.base_pixel_y -= elevation - buckled.pixel_y -= elevation - -/obj/structure/bed/post_unbuckle_mob(mob/living/buckled) - . = ..() - buckled.base_pixel_y += elevation - buckled.pixel_y += elevation - /// Medical beds /obj/structure/bed/medical name = "medical bed" @@ -342,13 +332,11 @@ /obj/structure/bed/double/post_buckle_mob(mob/living/target) . = ..() if(buckled_mobs.len > 1 && !goldilocks) // Push the second buckled mob a bit higher from the normal lying position - target.base_pixel_y += 12 - target.pixel_y += 12 + target.pixel_y += 6 goldilocks = target /obj/structure/bed/double/post_unbuckle_mob(mob/living/target) . = ..() if(target == goldilocks) - target.base_pixel_y -= 12 - target.pixel_y -= 12 + target.pixel_y -= 6 goldilocks = null diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index e482be10f2b..80c2bb7715a 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -766,16 +766,14 @@ visible_message(span_notice("[user] lays [pushed_mob] on [src].")) ///Align the mob with the table when buckled. -/obj/structure/bed/post_buckle_mob(mob/living/buckled) +/obj/structure/table/optable/post_buckle_mob(mob/living/buckled) . = ..() - buckled.base_pixel_y -= 6 - buckled.pixel_y -= 6 + buckled.pixel_y += 6 ///Disalign the mob with the table when unbuckled. -/obj/structure/bed/post_unbuckle_mob(mob/living/buckled) +/obj/structure/table/optable/post_unbuckle_mob(mob/living/buckled) . = ..() - buckled.base_pixel_y += 6 - buckled.pixel_y += 6 + buckled.pixel_y -= 6 /// Any mob that enters our tile will be marked as a potential patient. They will be turned into a patient if they lie down. /obj/structure/table/optable/proc/mark_patient(datum/source, mob/living/carbon/potential_patient)