mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
* Micro-optimize qdel by only permitting one parameter (#80628) Productionizes #80615. The core optimization is this: ```patch - var/hint = to_delete.Destroy(arglist(args.Copy(2))) // Let our friend know they're about to get fucked up. + var/hint = to_delete.Destroy(force) // Let our friend know they're about to get fucked up. ``` We avoid a heap allocation in the form of copying the args over to a new list. A/B testing shows this results in 33% better overtime, and in a real round shaving off a full second of self time and 0.4 seconds of overtime--both of these would be doubled in the event this is merged as the new proc was only being run 50% of the time. * Micro-optimize qdel by only permitting one parameter --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
/// Heirloom component. For use with the family heirloom quirk, tracks that an item is someone's family heirloom.
|
|
/datum/component/heirloom
|
|
/// The mind that actually owns our heirloom.
|
|
var/datum/mind/owner
|
|
/// Flavor. The family name of the owner of the heirloom.
|
|
var/family_name
|
|
|
|
/datum/component/heirloom/Initialize(new_owner, new_family_name)
|
|
if(!isitem(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
owner = new_owner
|
|
family_name = new_family_name
|
|
|
|
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
|
|
|
|
/datum/component/heirloom/Destroy(force)
|
|
owner = null
|
|
return ..()
|
|
|
|
/**
|
|
* Signal proc for [COMSIG_ATOM_EXAMINE].
|
|
*
|
|
* Shows who owns the heirloom on examine.
|
|
*/
|
|
/datum/component/heirloom/proc/on_examine(datum/source, mob/user, list/examine_list)
|
|
SIGNAL_HANDLER
|
|
|
|
var/datum/mind/examiner_mind = user.mind
|
|
|
|
if(examiner_mind == owner)
|
|
examine_list += span_notice("It is your precious [family_name] family heirloom. Keep it safe!")
|
|
return
|
|
|
|
var/datum/antagonist/obsessed/our_creeper = examiner_mind?.has_antag_datum(/datum/antagonist/obsessed)
|
|
if(our_creeper?.trauma.obsession == owner)
|
|
examine_list += span_nicegreen("This must be [owner]'s family heirloom! It smells just like them...")
|
|
return
|
|
|
|
examine_list += span_notice("It is the [family_name] family heirloom, belonging to [owner].")
|