mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
* Move MouseEntered to a queue, such that only the most recently hovered atom will be processed (#63567) bout The Pull Request MouseEntered currently fires multiple (multiple) times per frame, presumably over every atom that was hovered in some timeframe (though it appears to be much worse than that). This makes MouseEntered only add to a queue, while a per-tick subsystem ensures only the most recent MouseEntered gets the screentip work done on it, through a generic on_mouse_enter proc call. Contextual screen tips are coming and are going to make the screen tip code more computationally expensive, so slimming it down is going to be a must. Would like to hear from @ LemonInTheDark if this makes any obvious difference in time dilation, since it of course won't be as easy as just checking MouseEntered overtime anymore. * Move MouseEntered to a queue, such that only the most recently hovered atom will be processed Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
24 lines
893 B
Plaintext
24 lines
893 B
Plaintext
/// Defers MouseEntered inputs to only apply to the most recently hovered over atom in the tick
|
|
SUBSYSTEM_DEF(mouse_entered)
|
|
name = "MouseEntered"
|
|
wait = 1
|
|
flags = SS_NO_INIT | SS_TICKER
|
|
priority = FIRE_PRIORITY_MOUSE_ENTERED
|
|
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
|
|
|
var/list/hovers = list()
|
|
|
|
/datum/controller/subsystem/mouse_entered/fire()
|
|
for (var/hovering_client in hovers)
|
|
var/atom/hovering_atom = hovers[hovering_client]
|
|
if (isnull(hovering_atom))
|
|
continue
|
|
|
|
hovering_atom.on_mouse_enter(hovering_client)
|
|
|
|
// This intentionally runs `= null` and not `-= hovering_client`, as we want to prevent the list from shrinking,
|
|
// which could cause problems given the heat of MouseEntered.
|
|
// Lummox has teased this for 515: https://www.byond.com/forum/post/2621745
|
|
// ...though you're most likely reading this on BYOND version 600.
|
|
hovers[hovering_client] = null
|