Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
First Intention: Improve EventValues Registration
This PR implements
EventContext
andEventValueContext
that completely overwrites theEventValues
class and changes how event values are created, stored and accessed.When registering an event value, an
EventContext
will be created for the event and time state (if not already created) and create a newEventValueContext
to be stored within theEventContext
.This allows for direct checking and grabbing, rather than the old system of looping all
EventValueInfo
s and crosschecking the stored event class and stored event value class.Variable names of the methods and stored data now reflect exactly what they are and how they are used.
When parsing a script that uses an event-value, the current system checks if an exact value and converter is present, if not, it will do 4 extensive loop checking ensuring a value can be grabbed. But will do it for each instance of the event-value.
Now, after the first instance, data will be stored in the correlating
EventContext
skipping the extensive checking for every instance afterwards.Second Intention: Runtime Context (Replacing Event)
-deleted-
Third Intention: Original Event Value
With the implementation of the prior intentions, this brings along a little syntax update to
ExprEventExpression
allowing to get the original event value of when an event is called.This is done by, when an
Event
is first triggered fromSkriptEventHandler
it grabs theEventContext
correlating to the triggeredEvent
. It's worth noting at this time thatEventContext
andEventValueContext
are templates. When successfully grabbing theEventContext
it is proceeded to bebuilt
which loops through the storedEventValueContext
s, building each one, grabbing and storing the event-value if it contains only a singular converter (Meaning it wont error from "multiple values for this event").Comments
This PR is marked as draft because I still have a lot of testing to do to ensure it's viability.
However, I wanted to atleast expose this implementation and idea to obtain feedback (granted it's not negative feedback) that way I can further solidify it.
Thank you for coming to my TED Talk.
Target Minecraft Versions: any
Requirements: none
Related Issues: none