Skip to content
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

The final* update #889

Merged
merged 157 commits into from
Nov 4, 2023
Merged

The final* update #889

merged 157 commits into from
Nov 4, 2023

Conversation

Person8880
Copy link
Owner

@Person8880 Person8880 commented Jul 29, 2023

This branch is a culmination of lots of little side projects and ideas I've had over the years. Given the end of development of NS2 at the start of the year, there's no longer a big risk of any of this breaking with game updates, so rather than have it be lost to time, I've put together one final* update.

*final here meaning this is likely the last big update, and any further updates will just be maintenance if needed.

This branch adds the following:

General

  • The standard webpage window now shows the URL and a security indicator (tied to the browser's notion of a "secure context") as well as back, forward and refresh buttons.
    webpage_controls
  • Redesigned client config plugins tab, with a much more readable list, switches for enabled/disabled state, and the ability for plugins to define a translated name and description. Official plugins (i.e. those in the official mod) are highlighted with a blue tick.
    client_plugins_tab
  • Removed the beta extensions concept. Plugins can now avoid being added to the base config by omitting the DefaultState key. This accomplishes the same goal as the beta system, but without needing extra config and complexity in the code.

Admin Menu

  • Redesigned the plugins tab.
    • Instead of a list, it now shows cards for each plugin with controls to enable/disable, as well as seeing whether the current state has been saved.
    • Official plugins (i.e. those in the official mod) are marked with a blue tick.
    • A search box has been added to find plugins by name.
      admin_menu_plugins_tab
  • Redesigned the maps tab.
    • The list now has a preview section on the right showing the map's loading page/workshop preview image (same as the map vote menu).
    • Human readable names are displayed in the map list if the map vote plugin is enabled.
    • If the map has mods assigned to it, they are listed and can be viewed in the workshop.
    • A search box has been added to search over maps by name.
      admin_menu_maps_tab

Fun Commands

  • Added the following new commands:
    • sh_goto_location - teleports to the given location name.
    • sh_sendto - sends the given player to another player's position.
    • sh_sendto_location - sends the given player to the given location name.

Improved Chat

  • Shadows are now rendered on chat text when using the improved chat plugin (most noticeable when the background opacity is 0).
  • Emoji support has been added to the chat, including rich text editing in the chatbox, auto-completion, and an emoji picker that remembers frequently used emoji.
    • The default emoji set covers the basic unicode emoji smilies, emotes and hand gestures.
    • Additional emoji can be added by server operators, just have to declare a simple JSON file describing where to find the texture file(s) for them.
    • Emoji can be restricted per group.
    • Each emoji is internally encoded in chat messages to have a fixed length, so the length of an emoji's name does not affect how many can be in a chat message.
    • Adverts and welcome messages can include emoji by specifying "ParseEmoji": true in the advert/welcome message definition.
      rich_text_edit_emoji
      emoji_picker

Map Vote

  • Added the GroupCycleMode config option (resolves FEATURE REQUEST Votemaps by group tweek #669):
    • SEQUENTIAL retains the current group cycle behaviour, advancing through groups at every map change, with the current group limiting the vote options.
    • WEIGHTED_CHOICE allows using groups as buckets to select maps from. Specify a select value on each group to control how many maps are selected from the group (if omitted, all maps from the group are included). For example:
{
    "groups": [
        {
            "name": "Classic Maps",
            "maps": [
                "ns2_docking",
                "ns2_tram",
                "ns2_summit",
                "ns2_veil"
            ],
            "select": 2
        },
        {
            "name": "Update Maps",
            "maps": [
                "ns2_descent",
                "ns2_kodiak",
                "ns2_eclipse",
                "ns2_biodome",
                "ns2_derelict",
                "ns2_metro",
                "ns2_origin",
                "ns2_ayumi",
                "ns2_tanith"
            ],
            "select": 6
        }
    ]
}

Name Filter

  • Filters can now define a set of excluded NS2 IDs in addition to just a single NS2 ID by providing an array or object to the Excluded field.
  • Improved config validation.

Pregame

Tweaks Plugin

  • This is a new plugin that provides small tweaks on the client.
  • Currently this consists of minimap location highlighting, which works on all maps by generating highlighted minimap segment textures dynamically using the location trigger bounds for each location.
    minimap_highlight_marine_glow
    minimap_highlight_alien_glow
    minimap_highlight_hostile_glow
  • Colours can be configured in the config menu:
    tweaks_config

API

  • Added a new BitSet object, which can be used to efficiently store and network numeric values in the 32-bit signed integer range.
  • Added the Map:Filter( Predicate, Context ) method, which can be used to inline-filter map key-values in an efficient manner.
  • Multimaps can now store a secondary value against a key-value pair using Multimap:AddPair( Key, Value1, Value2 ).
    • Retrieve pairs using Multimap:GetPairs( Key ), which returns a Map of pairs, or Multimap:GetPairValue( Key, Value ) to get the second value for a given key-value.
    • Values added with Multimap:Add( Key, Value ) store the given value as the secondary value.
  • Plugins can now implement logic within the prediction VM, with the following limitations:
    • Network messages don't get received by the prediction VM despite it having a function to hook them. Thus only data table variables can be used for networking.
    • Only plugins that have a predict.lua file will be loaded in the prediction VM.
    • No Think hook exists in the prediction VM (as it has no update event), use OnProcessMove instead.
  • Added the Colour client setting type, which expects configured values to be an array of 3 integers between 0 and 255, and presents a colour picker in the client config menu.
  • Added the colour console command argument type, which parses a comma or space separated list of 3 integers between 0 and 255, and outputs them as an array.
  • Shine.StackDump handles stack overflows more gracefully, avoiding repeating duplicate lines and handling errors extracting local variables at a given stack level.

SGUI

  • Fixed windows rendering beneath the team info HUD (the counters at the top of the screen).
  • Fixed script error printing destroyed controls that have no debug name assigned.
  • Shadow rendering can now be applied to SGUI windows (used by the admin and client config menus). This is backed by a generic render pipeline system that can be used to construct arbitrary shader pipelines for many different use cases in a simple, declarative format.
  • Improved tab panel layout, with much less wasted space and room for many more tabs before needing to scroll (used by the admin and client config menus).
    tabs_layout
  • Alpha inheritance can now be propagated automatically without having to manually divide alpha values, this allows for seamless fading of windows by just applying a transition to the window itself using the new "AlphaMultiplier" easer.
  • Added a rounded-rectangle shader with the ability to set a corner radius on each corner of an SGUI element's background (top left, top right, bottom right, bottom left). This is currently used to make radio checkboxes circular, and for the new switch control.
    radio_checkboxes
  • Text entries can now be disabled to use them purely for display.
  • Controls can now specify multiple style names by passing a table to SetStyleName(), which will be applied in the order they are added.
  • The default light theme has had a few enhancements to try to improve contrast and legibility.
Layout Engine
  • Cropping elements (panels and lists) now optimise their event calling on child elements, avoiding dispatching think events to elements out of view. This is especially noticeable on first load of large lists/panels with complex child layouts, as layout evaluation is deferred for elements that are not visible.
  • Layouts can now apply transitions to elements automatically when their position or size is updated during the layout phase. This has been applied in a few places in the admin menu.
  • Significantly optimised layout invalidation performance to stop unnecessary invalidations. Initial layouts that previously took 60+ms now take 10ms or less, and subsequent changes are now properly isolated to the branch in which they reside, rather than causing a cascade of layout invalidations.
  • Improved word/text wrapping performance (SGUI.WordWrap) by ~50%.
  • Scrollable panels now properly handle centre and max-aligned children when using a layout, aligning them based on the total content size, rather than the size of the panel.
  • Added the following new layout units:
    • OppositeAxisPercentage - computes a percentage of the parent size on the opposite axis (e.g. a percentage of the parent's height if given as the value for width).
    • PercentageOfElement - computes a percentage of the size of another element in the tree, usually an ancestor, optionally specifying the axis to use.
Controls
  • Added the following new controls:
    • Colour picker - provides a button that opens a colour picker (see the tweaks plugin config screenshot above).
    • Modal dialog - this darkens the host window and automatically closes when clicking away. This is now used everywhere that used to popup a dialog window (admin menu add-ban window, webpage open-in-Steam dialog).
      modal_dialog
    • Rich text entry - allows displaying rich text (images and text) as a user edits text, with behaviour otherwise matching the existing text entry control (see the emoji input screenshot above).
    • Switch control - an alternative to a checkbox for more prominent actions.
    • Vertical sliders - call Slider:SetVertical( true ) on the existing Slider control to make it vertically oriented, with the max value and label at the top of the slider.
    • Virtual scroll panel - provides a way to handle near-infinite vertical scrolling without performance issues (used by the chatbox emoji picker).
    • Web page controls - provides basic controls for a given Webpage control (see the MOTD screenshot above).

This makes them a bit easier to read on brighter backgrounds, and also
helps if the background gradient is disabled.
Use smaller, horizontal tabs in vertical layout with more spacing and a
more distinct selection colour. This allows for more tabs in the same
vertical space.
Ensure it doesn't exceed 25% of the total panel size when auto-sizing
is enabled.
Provides a more standardised way of managing dialog windows with an
open and close animation.
This allows adding a box shadow to elements such as windows, which gives
them greater depth and emphasis.

The rendering pipeline system is generic and can be used for more than
just shadows, any multi-pass shader rendering can be performed with it.
Also add a box shadow to the webpage window.
This makes it much easier to focus on the modal's contents, and ties it
more clearly to its intended host window.
This control is similar to a checkbox, but it implies some immediate
action will take place.
Use a list of cards for each plugin rather than a table, and allow
plugins to provide a short description and friendly name.
Automatically re-render any borrowed textures using their original
pipeline parameters and copy the result back into the existing texture
name.
Only consider Lua files when finding plugins.
Similar to the client config menu, use a list of cards for each plugin
with buttons to reload, toggle enabled, and save the enabled state.

This view also now makes it clear when a plugin's current state differs
from its configured state.
Allows for automatic easing between positions and sizes as part of the
layout process without having to do any manual calculations.
Preserve the layout but remove everything else.
If opened while already open, bring their window into focus.
Only refresh the state for elements using the default skin when the
default is changed.
Add a summary box on the right that shows a preview of the map just like
the full-screen map vote menu, and that indicates whether the map is a
mod. The summary also provides links to the mods that have been
configured against the map if there are any.
Defaults to the old layout and styling to preserve backwards
compatibility.
Keep applying the tooltip unless a tooltip is set externally.
* Add auto-ellipsis to the duration hint to stop it expanding beyond
the size of the modal.
* Disable the "Add Ban" button until an NS2ID and duration have been
provided.
* Call deselection event when removing a row that was selected, either
individually or by clearing the list.
* Fix error when setting columns on a list that already has columns.
Automatically re-populate the list if the map vote plugin is loaded to
allow viewing previews.
When alpha inheritance propagation is enabled and alpha is set to be
inherited, automatically compensate for parent alpha values to ensure
that the alpha requested in a given colour is the alpha that an item
renders with.

This removes the tedium of having to manually compensate for alpha
inheritance, making it all seamlessly automatic.
* Avoid showing scrollbars for tiny differences in size values between
panel size and max element offset.
* Avoid applying auto-ellipsis for tiny differences in max width and
text width.
* Avoid applying word/text wrapping for tiny differences in max width
and text width.
* Fix chatbox settings element sizes not matching the parent panel size
when rounding is applied.
Avoid re-using outdated overflow size calculations when a panel's size
is changed.
Compute content size upfront before positioning elements to allow
layouts that are directly attached to a scrollable control to resize
themselves.

This avoids needing a two-pass layout invalidation to apply content
size to scrolling.

Additionally, these changes fix some bugs with layouts not being
invalidated when needed during auto-wrapping.
* Avoid storing direct references to passed in vectors to ensure
mutations do not affect the internal state.
* Handle GUIItem:GetSize() returning 1 for the z-component.
Pass the opposite axis parent size where it's needed.
Remove unused variables, replace branches with callbacks, and ensure
the same layout size is used when positioning elements as was calculated
originally.
Empty tables are serialised as an array by default, but these fields
are intended to be objects.
Specifying "ParseEmoji": true on an advert/welcome message will enable
emoji in its text content.
Avoid repeating config validation checks in Each/EachKeyValue and
remove their redundant message (each individual value has its own
message).
* Allow specifying a set of excluded IDs for a given pattern to exclude
more than one player.
* Improve config validation.
This was broken with the main menu replacement. Fixing it here is mostly
for the benefit of local development, most players aren't going to have
the mod enabled in the main menu as it doesn't do anything.
Use math.log10 as it doesn't have precision issues.
Add indeterminate state to create a perpetually spinning wheel.
Bias towards suggesting more frequently used emoji first.
Some maps use location triggers as a hack to display text on the
minimap. Hide these from the possible teleport destinations.
@Person8880 Person8880 marked this pull request as ready for review November 1, 2023 16:24
@Person8880 Person8880 merged commit 0d611b6 into develop Nov 4, 2023
@Person8880 Person8880 mentioned this pull request Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PreGame ] [Bug] [Low Priority] - Reloading guns in pregame FEATURE REQUEST Votemaps by group tweek
1 participant