mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
[MIRROR] fix buckling to a vehicle not setting your initial sprite position correctly (#6733)
* fix buckling to a vehicle not setting your initial sprite position correctly (#59999) * fix buckling to a vehicle not setting your initial sprite position correctly Co-authored-by: Bobbahbrown <bobbahbrown@gmail.com>
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_ATOM_DIR_CHANGE, .proc/vehicle_turned)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_UNBUCKLE, .proc/vehicle_mob_unbuckle)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, .proc/vehicle_mob_buckle)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/vehicle_moved)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_BUMP, .proc/vehicle_bump)
|
||||
|
||||
@@ -84,6 +85,14 @@
|
||||
if(!movable_parent.has_buckled_mobs())
|
||||
qdel(src)
|
||||
|
||||
/// This proc is called when a rider buckles, allowing for offsets to be set properly
|
||||
/datum/component/riding/proc/vehicle_mob_buckle(datum/source, mob/living/rider, force = FALSE)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/atom/movable/movable_parent = parent
|
||||
handle_vehicle_layer(movable_parent.dir)
|
||||
handle_vehicle_offsets(movable_parent.dir)
|
||||
|
||||
/// Some ridable atoms may want to only show on top of the rider in certain directions, like wheelchairs
|
||||
/datum/component/riding/proc/handle_vehicle_layer(dir)
|
||||
var/atom/movable/AM = parent
|
||||
|
||||
@@ -68,6 +68,12 @@
|
||||
rider.Knockdown(4 SECONDS)
|
||||
living_parent.unbuckle_mob(rider)
|
||||
|
||||
/datum/component/riding/creature/vehicle_mob_buckle(datum/source, mob/living/rider, force = FALSE)
|
||||
// Ensure that the /mob/post_buckle_mob(mob/living/M) does not mess us up with layers
|
||||
// If we do not do this override we'll be stuck with the above proc (+ 0.1)-ing our rider's layer incorrectly
|
||||
rider.layer = initial(rider.layer)
|
||||
return ..()
|
||||
|
||||
/datum/component/riding/creature/vehicle_mob_unbuckle(mob/living/living_parent, mob/living/former_rider, force = FALSE)
|
||||
if(istype(living_parent) && istype(former_rider))
|
||||
living_parent.log_message("is no longer being ridden by [former_rider]", LOG_ATTACK, color="pink")
|
||||
|
||||
Reference in New Issue
Block a user