-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance, add vote draw plugin, minor fixes #815
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Handle missing GUIChat element gracefully. * Handle local player classes that have no GetTeamNumber method when checking commander tag visibility.
The existing require usage depends on a package loader added in TraceTracker.lua, which doesn't return error messages. This provides the same behaviour, but with the added benefit of a clear error message when loading fails.
In places that handle dispatching arbitrary numbers of arguments, use code generation to provide fixed argument size variations of dispatchers rather than taking a vararg. This avoids NYI aborts, allowing these code paths to be compiled. Additionally, a few other places that caused aborts have been fixed, such as colour checking (getmetatable on cdata aborts traces) and extension event insertion (replacing closures with callable tables). The overall result of this is an order of magnitude performance improvement in hook calling/broadcasting and SGUI child event propagation, as well as other minor improvements from LuaJIT being more free to compile code.
This maintains backwards compatibility, even if it isn't ideal behaviour.
Use the maximum of a custom handler's argument count, and the original function's argument count.
This provides a vote to end the current round as a draw. It only considers votes from players that are playing in the round, and has a lengthy delay and high vote count requirement by default.
Make the background the only element that eases.
Converts easing functions from the built-in easing library into a form that can be used with SGUI.
* Fix labels sometimes becoming invisible. * Fix a rare script error due to modifying the layout elements directly. * Improve fading to fade out the background segment of an entry along with the label.
* Add a distance tolerance to account for players that are stuck but still jittering slightly. * Use the player's view position as the origin to look for spawn points from to avoid small objects at the player's feet being considered walls.
Track when the mouse enters and leaves elements, and only call the OnMouseMove event for child elements when the mouse is inside their parent or the mouse has just left the parent. These changes also simplify mouse bounds checks, removing highlight multipliers and moving custom bounds to their own method.
Automatically queue the destruction to run after the event has been called to avoid destroying GUIItems that may be used in later parts of the event.
* Make easing callbacks pass the SGUI control as the first argument. This makes avoiding closures much easier. * Allow passing data with timers to avoid needing closures for callbacks. * Refactor various places that create functions at runtime to use either callable tables or pre-defined functions instead. * Remove some tail calls that fail to compile.
This avoids using Client.GetCursorPosScreen which doens't compile.
When destroying inside an event, detach the control to avoid it showing up in iterations.
Use it for calls to AddProperty/AddBoundProperty to pre-populate it with most setter names.
This avoids needing a closure when creating binding sources.
This generates more optimal code that avoids loops and upvalues.
If the bar is clicked during fade-in, make sure the fade is cancelled.
If a map vote starts while the player has yet to trigger the ClientConfirmConnect event, they would not have the datatable values that indicate the type of vote. Datatables will now be sent at client connection time to ensure they are immediately in sync.
Also fire the property change event.
* Fix map selection state not being set properly when opening the menu. * Fix error when opening the menu due to highlighting changing before the tile is setup.
When becoming visible again, or changing parent, the mouse state should be invalidated.
Server.GetOwner is not compiled.
Now extension hooks are added directly with Hook.Add using a unique key. This avoids a second level of dispatching which improves performance.
There's no reason for priorities to be integers, and this allows extension callbacks to keep their -19.5 priority.
ffi.istype returns true for ctypes as well as cdata, which breaks if the colour or vector ctypes end up in a table that's being printed (e.g. if they're in a stack trace).
Avoid needing to check every plugin if no plugins have hooked into a given event or the newly enabled plugin has no method for it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Chatbox
Map Vote
Unstuck
MovementToleranceDistance
option which controls the maximum distance a player's position is allowed to move from the location they request to be unstuck from. This can help in cases where a player is stuck jittering around a location.Vote Draw
The
votedraw
plugin is a new plugin that provides a vote to end the current round as a draw. Players on both teams can vote after a configurable time has passed since the round started. This can be used as an alternative to conceding when the game reaches a stalemate and neither team wishes to lose.For more information see the wiki page.
Misc
API
shine/lib/codegen.lua
to create specialised variations of general-purpose code that LuaJIT can compile.OnMouseEnter
andOnMouseLeave
events, or theControl:HasMouseEntered()
method. These changes also mean thatOnMouseMove
is now only called if the mouse is inside the parent control, or has just left it.SetupGlobalHook
andSetupClassHook
functions now take the exact number of arguments the original function does, unless the original function has a var-arg. To pass through additional arguments, use a custom function for the hook mode and declare any extra arguments on it.Data
field.