-
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
More refactoring and polishing #488
Merged
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
Get rid of the validation and generally make things a little nicer.
Fixed some issues with negation, and added a test to make sure it behaves correctly.
The server now only contains those that can load on the server, and the client contains only those that can load on the client. This will save a small bit of processing in hooks, and also allow the base config to check only server-side extensions are in the active extensions set.
- Moved extension event calling out of the hook system and into its own method. - Added Hook.CallOnce, which calls an event then removes all registered hooks. - Removed duplication between class and global hooking strategies. - Removed the protected hooks logic, the commands hook shouldn't error.
Instead of always going through the whole plugin list and constantly checking for them being enabled and having a method, build a list of plugins that have an event on the first call to the event, then use that thereafter. If a plugin is loaded or unloaded, simply flush the cache and each subsequent event call will rebuild it again when needed.
Concatenates based on the string value returned for each value, and the given separator.
Use it for the plugin list, so that when sorting by enabled state, the names are alphabetical at the same time.
Highlight colour on the selected row is no longer lost, and the selected row is reset correctly.
Disconnected players were not being removed until switching the tab away and back again.
Lua's sorting is unstable, which is not desirable for UI lists.
and add secondary sorting by name when sorting by team for the player list.
Cut out the first level of the traceback which points to the error handler, and use a single standard error handler function for all areas.
Escape any control characters (except * as that denotes a wildcard).
Make any changes to the list or its rows queue a re-order on the next frame.
Does not rely on a GUI item. Instead, relies on whatever overload of GetSize() is provided by a control. Also, box checking no longer overlaps between elements.
Apply it to buttons and labels.
and make them clickable, to open in the Steam overlay.
and cleanup the code around the plugin list.
Bans are now networked in order from closest to expiry time to furthest. Also, the expiry column now sorts by the real underlying expiry time rather than the string representation. Finally, the name and banned by columns indicate the NS2ID of the player in square brackets after their name.
and make number/string keys a bit easier to distinguish.
and only refresh the sorting when updating the column text if there's no data assigned to the column.
tostring always returns a value.
An easier to follow error than complaining when it gets to next( Table ).
Sorts ascending using natural ordering of the elements.
Get rid of table.remove, and instead just keep track of how much we've removed, moving data down as we ascend the table.
Use stream filtering, and get rid of old and bad random choice logic.
Checkboxes don't fade in on opening the settings, and the settings button only makes a sound when it causes the settings to show/hide.
Forgot to change the argument order
- Renamed players become a variant of NSPlayer instead of garbled text. - Patterns can be set to plain text with the "PlainText": true flag. - Invalid patterns produce a console warning and are ignored in subsequent name filter runs.
Respawn ready room players (it's never worked for them the old way) and make the notification green to indicate success rather than dull grey.
Define the colour with Plugin.NotifyPrefixColour, and tag name with Plugin.PrintName.
Makes it more consistent with the team argument.
The console already kinda supports this, it provides quoted arguments with their quotes as a single entry. We don't want the quotes, and we also need chat commands to work. This means you can now do commands such as: sh_kick "Name with spaces" Here's the reason.
In the event of a failed match.
Person8880
added a commit
that referenced
this pull request
Dec 26, 2015
More refactoring and polishing
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.
Bug Fixes/Enhancements
Bug Fixes
sh_unstuck
command not working in the ready room.Enhancements
sh_kick "Name with spaces" Reason here.
would match a player whose name matchesName with spaces
and the kick reason would beReason here.
as before.\
before them. For example:"Name \"with quotes\""
."PlainText": true
to a filter to make it search for the exact text.NSPlayerYYYY
, whereYYYY
is some random number.API Changes
Table Sorting
Added
table.MergeSort( Table[, Comparator] )
. Performs an in-line sort of the given table using the merge sort algorithm. This provides a sort that will always keep equal precedence elements in the same order, unlike Lua's standardtable.sort()
. Comparators provided to this function have a slightly different contract to those provided totable.sort
. They must return a single number with the following rules:Comparators
Added
Comparator:CompileStable()
for use with the newtable.MergeSort()
.Streams
Added
Stream:Concat()
,Stream:ForEach()
andStream:StableSort()
.Concat
builds a single string from the stream's values.ForEach
runs a function over all values without editing the table.StableSort
performs a sort usingtable.MergeSort()
and the given comparator.Stream:Filter()
is also now much more efficient than usingtable.remove
multiple times.SGUI
Lists
Mixins
lua/shine/lib/gui/mixins
folder, and registering them usingSGUI:RegisterMixin( Name, MixinTable )
.SGUI:AddMixin( ControlTable, MixinName )
. When added, the mixin will add any of its methods the control does not have to the control. Any remaining methods will not replace those that the control defines. Instead, a control can access any of its mixins throughself.Mixins.MixinName
.Clickable
mixin has been added toButton
,Label
andColourLabel
. This mixin provides simple button press behaviour, with left and right click events.Plugins
Plugin:Notify()
is now a standard method. To set the text in the tag, set the fieldPlugin.PrintName
. To set the tag's colour, setPlugin.NotifyPrefixColour
. For example:would set the plugin to display
[My Plugin] Message here
where[My Plugin]
is displayed in red.Hooks
Added
Hook.CallOnce( EventName, ... )
to call an event then remove all registered hooks for it. This is useful for events that are guaranteed to fire only once.