mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 01:34:01 +00:00
* Optimizes timer insertion by 80% (W QDEL_IN micro) (#76214) <!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request [Reduces timer insertion cost by 80%](c9e5b285ed) Timer name generation involved a LOT of string shit, some in ways where the string only existed for a moment. This costs a good bit of time, and can be reduced with only minimal impacts on the end product, so let's do that. Includes a compile flag to flip it back if we ever have trouble in future. This is about 0.1s off init, since we do a lot of timer stuff then too [Removes STOPPABLE flag from QDEL_IN, moves it to a bespoke macro](e7a5d7f2a7) Its a waste most of the time, tho I would LOVE to analyze at compile time to work out if we care ## Why It's Good For The Game I like it when we don't spend all of our cpu time just setting the name var on timers. that's good and not bad. This saves time fucking everywhere. 15% off explosions, 0.1 seconds off init, bunch of time off foam. it's just good. Cherry picked out of #76104 since that was too cluttered (sannnnnn) <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. --> * Optimizes timer insertion by 80% (W QDEL_IN micro) --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
108 lines
3.4 KiB
Plaintext
108 lines
3.4 KiB
Plaintext
/// Fake alert hallucination. Causes a fake alert to be thrown to the hallucinator.
|
|
/datum/hallucination/fake_alert
|
|
abstract_hallucination_parent = /datum/hallucination/fake_alert
|
|
random_hallucination_weight = 1
|
|
|
|
var/del_timer_id
|
|
/// The duration of the alert being thrown.
|
|
var/duration
|
|
/// The category of the fake alert
|
|
var/alert_category
|
|
/// The type of the fake alert. Can be a list, if you want it to draw from multiple types (randomly).
|
|
var/alert_type
|
|
/// Optional, the severity of the alert.
|
|
var/optional_severity
|
|
|
|
/datum/hallucination/fake_alert/New(mob/living/hallucinator, duration = 15 SECONDS)
|
|
src.duration = duration
|
|
return ..()
|
|
|
|
/datum/hallucination/fake_alert/Destroy()
|
|
if(del_timer_id)
|
|
deltimer(del_timer_id)
|
|
if(!QDELETED(hallucinator))
|
|
hallucinator.clear_alert(alert_category, clear_override = TRUE)
|
|
return ..()
|
|
|
|
/datum/hallucination/fake_alert/start()
|
|
var/picked_type = islist(alert_type) ? pick(alert_type) : alert_type
|
|
|
|
feedback_details += "Alert type: [alert_category], Actual type: [alert_type]"
|
|
|
|
hallucinator.throw_alert(
|
|
category = alert_category,
|
|
type = picked_type,
|
|
severity = optional_severity,
|
|
override = TRUE,
|
|
)
|
|
|
|
del_timer_id = QDEL_IN_STOPPABLE(src, duration)
|
|
return TRUE
|
|
|
|
/datum/hallucination/fake_alert/need_oxygen
|
|
alert_category = ALERT_NOT_ENOUGH_OXYGEN
|
|
alert_type = /atom/movable/screen/alert/not_enough_oxy
|
|
|
|
/datum/hallucination/fake_alert/need_plasma
|
|
alert_category = ALERT_NOT_ENOUGH_PLASMA
|
|
alert_type = /atom/movable/screen/alert/not_enough_plas
|
|
|
|
/datum/hallucination/fake_alert/need_co2
|
|
alert_category = ALERT_NOT_ENOUGH_CO2
|
|
alert_type = /atom/movable/screen/alert/not_enough_co2
|
|
|
|
/datum/hallucination/fake_alert/bad_oxygen
|
|
alert_category = ALERT_TOO_MUCH_OXYGEN
|
|
alert_type = /atom/movable/screen/alert/too_much_oxy
|
|
|
|
/datum/hallucination/fake_alert/bad_plasma
|
|
alert_category = ALERT_TOO_MUCH_PLASMA
|
|
alert_type = /atom/movable/screen/alert/too_much_plas
|
|
|
|
/datum/hallucination/fake_alert/bad_co2
|
|
alert_category = ALERT_TOO_MUCH_CO2
|
|
alert_type = /atom/movable/screen/alert/too_much_co2
|
|
|
|
/datum/hallucination/fake_alert/nutrition
|
|
alert_category = ALERT_NUTRITION
|
|
alert_type = list(/atom/movable/screen/alert/fat, /atom/movable/screen/alert/starving)
|
|
|
|
/datum/hallucination/fake_alert/gravity
|
|
alert_category = ALERT_GRAVITY
|
|
alert_type = /atom/movable/screen/alert/weightless
|
|
|
|
/datum/hallucination/fake_alert/fire
|
|
alert_category = ALERT_FIRE
|
|
alert_type = /atom/movable/screen/alert/fire
|
|
|
|
/datum/hallucination/fake_alert/hot
|
|
alert_category = ALERT_TEMPERATURE
|
|
alert_type = /atom/movable/screen/alert/hot
|
|
optional_severity = 3
|
|
|
|
/datum/hallucination/fake_alert/cold
|
|
alert_category = ALERT_TEMPERATURE
|
|
alert_type = /atom/movable/screen/alert/cold
|
|
optional_severity = 3
|
|
|
|
/datum/hallucination/fake_alert/pressure
|
|
alert_category = ALERT_PRESSURE
|
|
alert_type = list(/atom/movable/screen/alert/highpressure, /atom/movable/screen/alert/lowpressure)
|
|
optional_severity = 2
|
|
|
|
/datum/hallucination/fake_alert/law
|
|
alert_category = ALERT_NEW_LAW
|
|
alert_type = /atom/movable/screen/alert/newlaw
|
|
|
|
/datum/hallucination/fake_alert/locked
|
|
alert_category = ALERT_LOCKED
|
|
alert_type = /atom/movable/screen/alert/locked
|
|
|
|
/datum/hallucination/fake_alert/hacked
|
|
alert_category = ALERT_HACKED
|
|
alert_type = /atom/movable/screen/alert/hacked
|
|
|
|
/datum/hallucination/fake_alert/need_charge
|
|
alert_category = ALERT_CHARGE
|
|
alert_type = /atom/movable/screen/alert/emptycell
|