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>
32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
/datum/component/unbreakable
|
|
COOLDOWN_DECLARE(surge_cooldown)
|
|
|
|
/datum/component/unbreakable/Initialize()
|
|
if(!ishuman(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
ADD_TRAIT(parent, TRAIT_UNBREAKABLE, INNATE_TRAIT)
|
|
|
|
/datum/component/unbreakable/Destroy(force)
|
|
REMOVE_TRAIT(parent, TRAIT_UNBREAKABLE, INNATE_TRAIT)
|
|
return ..()
|
|
|
|
/datum/component/unbreakable/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_MOB_STATCHANGE, PROC_REF(surge))
|
|
|
|
/datum/component/unbreakable/UnregisterFromParent()
|
|
UnregisterSignal(parent, COMSIG_MOB_STATCHANGE)
|
|
|
|
/datum/component/unbreakable/proc/surge(mob/living/carbon/human/surged, new_stat)
|
|
SIGNAL_HANDLER
|
|
if(new_stat < SOFT_CRIT || new_stat >= DEAD)
|
|
return
|
|
if(!COOLDOWN_FINISHED(src, surge_cooldown))
|
|
return
|
|
COOLDOWN_START(src, surge_cooldown, 1 MINUTES)
|
|
surged.balloon_alert(surged, "you refuse to give up!")//breaks balloon alert conventions by using a "!" for a fail message but that's okay because it's a pretty awesome moment
|
|
surged.heal_overall_damage(brute = 15, burn = 15, required_bodytype = BODYTYPE_ORGANIC)
|
|
if(surged.reagents.get_reagent_amount(/datum/reagent/medicine/ephedrine) < 20)
|
|
surged.reagents.add_reagent(/datum/reagent/medicine/ephedrine, 10)
|
|
if(surged.reagents.get_reagent_amount(/datum/reagent/medicine/epinephrine) < 20)
|
|
surged.reagents.add_reagent(/datum/reagent/medicine/epinephrine, 10)
|