From 1b40c727b94fa33143bae58ed17ed7033cc5eac9 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 19 Jan 2018 10:03:03 -0500 Subject: [PATCH 1/2] Merge pull request #34608 from ninjanomnom/kevin-is-terrible Fixes some dumb code in the jousting component --- code/datums/components/jousting.dm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/datums/components/jousting.dm b/code/datums/components/jousting.dm index 68621e60ec..8348e59fe2 100644 --- a/code/datums/components/jousting.dm +++ b/code/datums/components/jousting.dm @@ -19,7 +19,7 @@ /datum/component/jousting/Initialize() if(!isitem(parent)) . = COMPONENT_INCOMPATIBLE - stack_trace("Warning: Jousting component incorrectly applied to invalid parent type [parent.type]") + CRASH("Warning: Jousting component incorrectly applied to invalid parent type [parent.type]") RegisterSignal(COMSIG_ITEM_EQUIPPED, .proc/on_equip) RegisterSignal(COMSIG_ITEM_DROPPED, .proc/on_drop) RegisterSignal(COMSIG_ITEM_ATTACK, .proc/on_attack) @@ -29,9 +29,13 @@ return ..() /datum/component/jousting/proc/on_equip(mob/user, slot) - QDEL_NULL(listener) current_holder = user - listener = new(user, COMSIG_MOVABLE_MOVED, CALLBACK(src, .proc/mob_move)) + if(!listener) + listener = user.AddComponent(/datum/component/redirect, COMSIG_MOVABLE_MOVED, CALLBACK(src, .proc/mob_move)) + else + user.TakeComponent(listener) + if(QDELING(listener)) + listener = null /datum/component/jousting/proc/on_drop(mob/user) QDEL_NULL(listener)