mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-15 18:14:22 +01:00
lazily initialize /datum/element/weapon_description on examine (#92489)
## About The Pull Request currently, `/datum/element/weapon_description` is added during every single item init, even tho it only ever affects examines. i noticed while looking at tracy traces downstream that it spent a bit much time adding the weapon description, so why not just lazily initialize it during examine instead? direct port of the same thing from https://github.com/Monkestation/Monkestation2.0/pull/7502 ## Why It's Good For The Game less wasted time during item init ## Changelog 🆑 code: Item weapon description elements are now initialized when first examined, instead of immediately upon initialization. /🆑
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user