From 37b1d0f12ebd2d193f8b95c3686e6e31e63b59fa Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Thu, 16 Jun 2022 10:29:08 -0500 Subject: [PATCH] Fixes the "stuck in a vertical fireman carry" curse (#67783) Fixes #67622 #66530 made it so anything with the ridable element lost the element whenever it died. Unfortunately it added NO supplementary logic that re-adds the ridable element of that thing died. Guess what uses the ridable element? Humans, for fireman carrying and piggybacking So, if you ever died, it'd permanently brick your ability to fireman carry. --- code/datums/elements/ridable.dm | 22 ++++++++++++------- .../mob/living/basic/farm_animals/cows.dm | 1 - .../mob/living/simple_animal/hostile/carp.dm | 1 - .../hostile/mining_mobs/goliath.dm | 1 - .../simple_animal/hostile/retaliate/clown.dm | 1 - .../living/simple_animal/hostile/vatbeast.dm | 2 -- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/code/datums/elements/ridable.dm b/code/datums/elements/ridable.dm index 240333125be..cd4d4714c1b 100644 --- a/code/datums/elements/ridable.dm +++ b/code/datums/elements/ridable.dm @@ -7,7 +7,7 @@ * just having the variables, behavior, and procs be standardized is still a big improvement. */ /datum/element/ridable - element_flags = ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH id_arg_index = 2 /// The specific riding component subtype we're loading our instructions from, don't leave this as default please! @@ -24,6 +24,7 @@ stack_trace("Tried attaching a ridable element to [target] with basic/abstract /datum/component/riding component type. Please designate a specific riding component subtype when adding the ridable element.") return COMPONENT_INCOMPATIBLE + target.can_buckle = TRUE riding_component_type = component_type potion_boosted = potion_boost @@ -31,10 +32,11 @@ if(isvehicle(target)) RegisterSignal(target, COMSIG_SPEED_POTION_APPLIED, .proc/check_potion) if(ismob(target)) - RegisterSignal(target, COMSIG_LIVING_DEATH, .proc/handle_removal) + RegisterSignal(target, COMSIG_MOB_STATCHANGE, .proc/on_stat_change) -/datum/element/ridable/Detach(datum/target) - UnregisterSignal(target, list(COMSIG_MOVABLE_PREBUCKLE, COMSIG_SPEED_POTION_APPLIED, COMSIG_LIVING_DEATH)) +/datum/element/ridable/Detach(atom/movable/target) + target.can_buckle = initial(target.can_buckle) + UnregisterSignal(target, list(COMSIG_MOVABLE_PREBUCKLE, COMSIG_SPEED_POTION_APPLIED, COMSIG_MOB_STATCHANGE)) return ..() /// Someone is buckling to this movable, which is literally the only thing we care about (other than speed potions) @@ -147,13 +149,17 @@ qdel(O) return TRUE -/datum/element/ridable/proc/handle_removal(datum/source) +/datum/element/ridable/proc/on_stat_change(mob/source) SIGNAL_HANDLER - var/atom/movable/ridden = source - ridden.unbuckle_all_mobs() + // If we're dead, don't let anyone buckle onto us + if(source.stat == DEAD) + source.can_buckle = FALSE + source.unbuckle_all_mobs() - Detach(source) + // If we're alive, back to being buckle-able + else + source.can_buckle = TRUE /obj/item/riding_offhand name = "offhand" diff --git a/code/modules/mob/living/basic/farm_animals/cows.dm b/code/modules/mob/living/basic/farm_animals/cows.dm index 9a5eea079c7..130a43e4342 100644 --- a/code/modules/mob/living/basic/farm_animals/cows.dm +++ b/code/modules/mob/living/basic/farm_animals/cows.dm @@ -50,7 +50,6 @@ AddComponent(/datum/component/tameable, food_types = list(/obj/item/food/grown/wheat), tame_chance = 25, bonus_tame_chance = 15, after_tame = CALLBACK(src, .proc/tamed)) /mob/living/basic/cow/proc/tamed(mob/living/tamer) - can_buckle = TRUE buckle_lying = 0 AddElement(/datum/element/ridable, /datum/component/riding/creature/cow) diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index c41b19b3711..401ad2aaa99 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -103,7 +103,6 @@ /mob/living/simple_animal/hostile/carp/proc/tamed(mob/living/tamer) tamed = TRUE - can_buckle = TRUE buckle_lying = 0 AddElement(/datum/element/ridable, /datum/component/riding/creature/carp) if(ai_controller) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm index b94d833e683..95a3e57ad80 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm @@ -118,7 +118,6 @@ user.visible_message(span_notice("You manage to put [O] on [src], you can now ride [p_them()].")) qdel(O) saddled = TRUE - can_buckle = TRUE buckle_lying = 0 add_overlay("goliath_saddled") AddElement(/datum/element/ridable, /datum/component/riding/creature/goliath) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm index 1c9db851e93..16c1b1e1ce7 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm @@ -457,7 +457,6 @@ flick("glutton_mouth", src) /mob/living/simple_animal/hostile/retaliate/clown/mutant/glutton/proc/tamed(mob/living/tamer) - can_buckle = TRUE buckle_lying = 0 AddElement(/datum/element/ridable, /datum/component/riding/creature/glutton) diff --git a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm index 3d866e60081..f35ec302998 100644 --- a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm +++ b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm @@ -37,7 +37,6 @@ QDEL_NULL(tentacle_slap) /mob/living/simple_animal/hostile/vatbeast/proc/tamed(mob/living/tamer) - can_buckle = TRUE buckle_lying = 0 AddElement(/datum/element/ridable, /datum/component/riding/creature/vatbeast) faction = list("neutral") @@ -115,4 +114,3 @@ our_action.StartCooldown() return TRUE -