diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 014cf189df2..e59a1f31680 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -676,6 +676,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define QUIRK_TRAIT "quirk_trait" /// (B)admins only. #define ADMIN_TRAIT "admin" +/// Any traits given through a smite. +#define SMITE_TRAIT "smite" #define CHANGELING_TRAIT "changeling" #define CULT_TRAIT "cult" #define LICH_TRAIT "lich" diff --git a/code/datums/components/itembound.dm b/code/datums/components/itembound.dm new file mode 100644 index 00000000000..3cd88a86fd6 --- /dev/null +++ b/code/datums/components/itembound.dm @@ -0,0 +1,30 @@ +/// When a movable has this component AND they are in the contents of a container, they will no longer be able to use their hands and be immobilized until they are removed from the container. So far, this is only useful for smites. +/datum/component/itembound + /// Weak reference to the container that the movable is inside of. + var/datum/weakref/containerref + /// Detect any movement of the container + var/datum/movement_detector/move_tracker + +/datum/component/itembound/Initialize(atom/movable/passed_container) + if(!ismovable(parent)) + return COMPONENT_INCOMPATIBLE + if(QDELETED(passed_container)) + return + containerref = WEAKREF(passed_container) + move_tracker = new(parent, CALLBACK(src, .proc/verify_containment)) + + ADD_TRAIT(parent, TRAIT_INCAPACITATED, SMITE_TRAIT) + +/// Ensure that when we move, we still are in the container. If not in the container, remove all the traits. +/datum/component/itembound/proc/verify_containment() + var/atom/movable/container = containerref.resolve() + if(!QDELETED(container) && container.contains(parent)) + return + REMOVE_TRAIT(parent, TRAIT_INCAPACITATED, SMITE_TRAIT) + qdel(src) + +/datum/component/itembound/Destroy(force, silent) + containerref = null + QDEL_NULL(move_tracker) + return ..() + diff --git a/code/game/objects/items/food/bread.dm b/code/game/objects/items/food/bread.dm index c0a33647e7b..487a3c2ff84 100644 --- a/code/game/objects/items/food/bread.dm +++ b/code/game/objects/items/food/bread.dm @@ -40,6 +40,10 @@ /obj/item/food/bread/plain/MakeProcessable() AddElement(/datum/element/processable, TOOL_KNIFE, /obj/item/food/breadslice/plain, 5, 3 SECONDS, table_required = TRUE) +// special subtype we use for the "Bread" Admin Smite (or the breadify proc) +/obj/item/food/bread/plain/smite + desc = "If you hold it up to your ear, you can hear the screams of the damned." + /obj/item/food/breadslice/plain name = "bread slice" desc = "A slice of home." diff --git a/code/modules/admin/verbs/adminfun.dm b/code/modules/admin/verbs/adminfun.dm index 1bb8e566ead..04baa88626f 100644 --- a/code/modules/admin/verbs/adminfun.dm +++ b/code/modules/admin/verbs/adminfun.dm @@ -217,9 +217,11 @@ return smite.effect(src, target) +///"Turns" people into bread. Really, we just add them to the contents of the bread food item. /proc/breadify(atom/movable/target) - var/obj/item/food/bread/plain/bread = new(get_turf(target)) - target.forceMove(bread) + var/obj/item/food/bread/plain/smite/tomb = new(get_turf(target)) + target.forceMove(tomb) + target.AddComponent(/datum/component/itembound, tomb) /** * firing_squad is a proc for the :B:erforate smite to shoot each individual bullet at them, so that we can add actual delays without sleep() nonsense diff --git a/tgstation.dme b/tgstation.dme index 1936d0d360a..e200dbd2f63 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -811,6 +811,7 @@ #include "code\datums\components\igniter.dm" #include "code\datums\components\infective.dm" #include "code\datums\components\irradiated.dm" +#include "code\datums\components\itembound.dm" #include "code\datums\components\itempicky.dm" #include "code\datums\components\jetpack.dm" #include "code\datums\components\jousting.dm"