Skip to content

DBM Event Register Needs Review #95

Description

@MysticalOS

The whole event manager probably needs complete rewriting, because registershorttermevents was a hacky addition and and apparently has actually been broken for years. Fortunately no mods currently seem affected by the breakage since the way it's broken doesn't affect way most mods register/unregister events. As such this task is mostly for tracking purposes for when this is eventually modularized.

Intent: DBM was supposed to support better registering and unregistering events at both core and mod level in short term. Meaning events don't stay registered all the time and wasting CPU.

Function: Register short term events is supposed to be stand alone from register events regular (which is intended mostly for events that stay registered all the time). Unregister short term events is supposed to only clear the short term events that were registered.

Actuality: Register short term events shoves short term events into same table as long term events. Unregister short term event that's also a long term event just nukes both. Fortunately there is no mod that actually does this (not even core thankfully)

Likely need: Because every part of event handler runs through a single table for registered events, probably still need a single table tracking what's registered (long or short term). However when long or short term events are actually registered THESE should probably each be in their own table. Then when unregistering short term events, We remove any events in short term table that aren't also in long term table from the main event tracker table.. Something like

if shortTermEvents[event] then
	if not longTermEvents[event] then
		shortTermEvents[event] = nil
		--run actual event unregister for event
		registeredEvents[event] = nil--Untrack from main tracked events table
	else
		shortTermevents[event] = nil--Only wipe from short term events, but not unregister it if it's still being used by long term events
	end
end

Metadata

Metadata

Assignees

Labels

Low PriorityThis issue will not be worked on unless there are no high or medium tasks lefthelp wantedExtra attention is needed🐛 BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions