diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm index 8b0aad161c2..1828f736a89 100644 --- a/code/__DEFINES/obj_flags.dm +++ b/code/__DEFINES/obj_flags.dm @@ -51,6 +51,8 @@ #define NO_BLOOD_ON_ITEM (1 << 19) /// Whether this item should skip the /datum/component/fantasy applied on spawn on the RPG event. Used on things like stacks #define SKIP_FANTASY_ON_SPAWN (1<<20) +/// If an item has had its /datum/element/weapon_description initialized or not. +#define WEAPON_DESCRIPTION_INITIALIZED (1<<21) // Flags for the clothing_flags var on /obj/item/clothing diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 56f9fae8cbd..f58f55899ea 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -284,8 +284,6 @@ if(damtype == BRUTE) hitsound = SFX_SWING_HIT - add_weapon_description() - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_ITEM, src) setup_reskinning() @@ -499,6 +497,13 @@ /obj/item/examine_descriptor(mob/user) return "item" +/obj/item/examine(mob/user) + // lazily initialize the weapon description element if it hasn't been already + if(!(item_flags & WEAPON_DESCRIPTION_INITIALIZED)) + add_weapon_description() + item_flags |= WEAPON_DESCRIPTION_INITIALIZED + return ..() + /obj/item/examine_more(mob/user) . = ..() if(HAS_TRAIT(user, TRAIT_RESEARCH_SCANNER))