Skip to content

Additional features

Deyan Dobromirov edited this page Oct 16, 2019 · 59 revisions

Frequent pieces list access frame ATTACK2 ( Def: Right mouse button )

AddonScriptAdd

This frame is designed, so the user can access the most frequent pieces on the server every time they are needed. In multiplayer, many users will populate this list rather than only one user in a singleplayer game. Sorting the list can be performed by clicking the top of the column where the name is displayed. You can see what each panel element is used for in the list below:

  • ( 1): Database export button. It is used to export the client-side database as an external file. The file unique prefix starts with cl_ and the result data is located here. Keep in mind that the user has to set trackassembly_exportdb 1 from this to work.
  • ( 2): This combo box contains a list of columns which a search can be made using the Lua pattern written in (3). The result is displayed in the list view columns database below (5), (6), (7) and (8) containing the matched records.
  • ( 3): This text field accepts Lua pattern from the user input and when ENTER is pressed, searches in the list view column selected by (3) to match the pattern with. The result will populate the list view only with the matched data rows in (5), (6), (7) or (8).
  • ( 4): This is the title of the frame. It contains the user nickname and current tool version the client is running. You can check for the version here.
  • ( 5): The Used column contains the amount of time in seconds the piece stays in the cache taken as a difference between cache read request and the panel open invoke request.
  • ( 6): The End column contains the amount of active track ends available on the piece for snapping. This will be always larger than one.
  • ( 7): The Type column contains the type under each piece persists in the cache and a grouping string that contains a bunch of models being under the same category.
  • ( 8): The Name column contains the track piece name, usually auto-generated from the model or directly inserted into the database.
  • ( 9): The tool hint for each row will display the actual track model path.
  • (10): This is the current model quickly retrieved from the cache
  • (11): This displays the currently selected model from the cache for the current line (10) the user has clicked on.

External DSV databases manipulation panel USE + ATTACK2 ( Def: E + Right mouse button )

AddonScriptAdd

This frame is designed, so the user can access the most frequent pieces on the server every time they are needed. In multiplayer, many users will populate this list rather than only one user in a singleplayer game. You can track what each panel element is used for in the list below:

  • (1): The external DSV pluggable databases tab. It contains all the currently available external database information and if they are active or not. With ATTACK1 ( Def: Left mouse button ) you can remove lines 9 from the list and with ATTACK2 ( Def: Right mouse button ) you can copy the panel data from the list to use it anywhere. When holding SPEED ( Def: SHIFT ), these settings will be applied directly to the DSV list file, where ATTACK1 deletes it and ATTACK2 exports the current list state into the file.
  • (2): This tab is dedicated to the PIECES table. It contains all the configuration buttons linked to the unique prefixes in 1. In the dedicated table-related tabs you can sing a bunch of buttons. Press ATTACK2 to open the external database menu from the current table. If you want to know what this menu looks like, just watch the video.

  • (3): This tab is dedicated to the ADDITIONS table. It contains all the configuration buttons linked to the unique prefixes in (1)
  • (4): This tab is dedicated to the PHYSPROPERTIES table. It contains all the configuration buttons linked to the unique prefixes in (1)
  • (5): This is the title of the frame. It contains the user nickname and current tool version the client is running. You can check for the version here.
  • (6): This column stores the unique database prefix of the external database sent to the system. They must be sequential and mandatory.
  • (7): This shows whenever a given database unique prefix is active or not. If it's active, then it is not commented in the file using the # token.
  • (8): This is the current line (9) hint, which will display the origin file that is responsible for attaching the external database prefix given in (6)
  • (9): This displays the current mouse hovered line from the DSV file for the unique database prefix.

Physgun snapping feature

This is used to include the same functionality from an addon called Rollercoaster assistant. It was very old and I used to love it, however, the author is nowhere to be found just like the addon itself. That's why I coded my own personal version for the same thing. You can see it in action here:

Ray intersection snapping feature

When building a track layout, the user cannot place the curve piece precisely to obtain a smooth transition between two snapped pieces. For 45 or 90 degree curves eye-balling the track, is very hard because the user is looking at a projection of a 3D world over a flat 2D screen. This sometimes results in bad depth perception and hard to connect two segments with freezing them in place. That's why a script was made to do just that. You can see it in action here:

Dealing with track pieces additions

Additions are generally entities that have to be created and attached to the track piece spawned. They are often used as track needles, switching levers and additional scenery. This is not to be mistaken with the bodygroups which are visuals for an entity. A good example for additions database is Shinji's track pack and his switchers:

Button controlled slider panels

These items are introduced in the tool major update derived from merge request matrix POA. Their main purpose is for the user to be able to interact with the slider faster. This panel also includes a snap increment/decrement, where the angular amount is controlled by the convar trackassembly_incsnpang and the liner amount is controlled by trackassembly_incsnplin Here are the dedicated button functionalities and what they do:

+     : Performs a snap-incremental adjustment to the slider
-     : Performs a snap-decremental adjustment to the slider
+/-   : Reverses the sign of the slider if its value is different than zero
@90   : Snaps the sider to 90 degrees magnitude. Zero snaps to positive
@180  : Snaps the sider to 180 degrees magnitude. Zero snaps to positive
@M    : Stores the slider into the user clipboard
@0    : Resets the only the chosen slider amount and does not touch others

Matrix-based interpolation snap and dynamic translations

The matrix class in Garry's mod gives astonishing functionality related to translation and rotation. They can be represented in this case by a matrix, and so transforming a matrix is done by multiplying the source matrix to the rotation/translation matrix. In this case when snapping the tool solves the matrix equation for the new basis Spawn * Holder = Trace where Spawn, Holder and Trace are matrices with dimensions 4x4. The spawn matrix Spawn then becomes equal to Spawn = Trace * Holder⁻¹. When the equation is solved by the Gmod Lua API, the translation and rotation can get easily extracted. If you are searching for how to translate the script or anything related to the translations, you better see the following page.

Working mode radial menu selection

The working mode switch drop-down menu is used quite often by the player during the track building process. Every time the user must open the spawn menu and click on the working mode selection drop-down menu then choosing the working mode he/she needs. The radial menu is designed to be a micro-optimization of that process. By enabling it via a console variable trackassembly_enradmenu, the payer can press its action key ( Currently Mouse-3 MOUSE_MIDDLE ) and use a radial menu for working mode selection. You can see it in action below:

Extended physics gun snap ghosting and general adviser

Sometimes the user cannot predict where exactly the physics gun snapped piece will go at when adjusting the additional position and angle offsets. That's why some kind of extended drawing was needed. The hook DRAW_PHYSGUN automatically draws the spawn structure while extracting the position and angle from the table to precisely show where the piece position will go at and what angle will be used when snapping. When the user has enabled the ghosting via trackassembly_ghostcnt the hook will draw an additional ghost stack filled with only one single prop client-side to assist the user in the 3D space.

Context menu for entity direct value export and manipulation

The bodygroup/skin manipulation feature needed an upgrade, so the context menu was developed. Among this feature, I decided to slip on some others, which are decent to be controlled via the right-click. The option related to the track assembly tool can be located using the name of the tool depending on the current game language. From there the user can pick various options for value exports like the model, bodygroup/skin, mass. It also manipulates physgun-ignore, freeze, gravity and attached constraints. That way the user has additional control over a single track piece.