Skip to content

Additional features

Deyan Dobromirov edited this page Feb 18, 2024 · 59 revisions

Frequent pieces list access frame ATTACK2 ( Def: Hit world. 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 single player game. Sorting the list can be performed by clicking the top of the column where the name is displayed. You can copy any value in this list with the exception of the model, which is copied by selecting a line from the list. 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. You can also press SHIFT while issuing the export to generate auto-run configuration file for the type selected. When no line is chosen will use the type of the holder model. 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. Selecting this will switch the model (9) to be used in the track building process.
  • (11): This displays the currently selected model from the cache for the current line (10) the user has clicked on.

External DSV databases panel USE + ATTACK2 ( Def: Hit World. E + Right mouse button )

AddonScriptAdd

This frame is designed, so the user can access the external DSV databases list on the local machine the game instance is running on. It is a direct representation of the DSV external database list located here. The elements are explained below what they do:

  • (1): This is the external DSV pluggable databases tab. It contains all the currently available external database information and if they are active or not.
  • (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 see 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 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.
  • (7): This column stores the unique database prefix of the external database sent to the system. They must be sequential and mandatory.
  • (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. You can right-click on it to show various option related to its DSV management.
  • (10): This is the context menu being shown when the line (9) gets right-clicked. It can copy various values from the line data. Either the cell value or the entire line. Enable/Disable toggles the selected line where you can also create, remove or modify it.
  • (11): You can add your line information and hit enter to add it to the list.
  • (12): Click on this button to automatically read the DSV file and populate the list view with its content.
  • (13): Click on this button to export the current state of the list view to the DSV file list.

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:

<>    : Mouse left click decrements the slider, right one increments it
+/-   : Reverses the sign of the slider if its value is different than zero
@M    : Stores the slider into the user clipboard. Left click to paste and right to copy
@D    : Updates the slider value to the default. Left click to update and right to copy
@45   : Snaps the slider to 45 degrees magnitude. Left click for negative and right for positive
@90   : Snaps the slider to 90 degrees magnitude. Left click for negative and right for positive
@135  : Snaps the slider to 135 degrees magnitude. Left click for negative and right for positive
@180  : Snaps the slider to 180 degrees magnitude. Left click for negative and right for positive

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.

Server-based tasks for spawning/snapping

There was a huge problem when TA was attempting to stack many pieces in a single frame. This needed to be changed somehow to reduce the server lagging with Connection problem 4000. The server had to stall for a bit until the stacking is completed so the players could not move or do anything until the process is finished. That's how this update was born which basically adds a TA complained tasks inside a queue list. This list is later looped by the server to see are there any tasks to be done and does them. When a player has already submitted a queue task, he must wait for the server to do all the player requests that came before him and cannot start another task as the items are registered per player so it will return that the server is busy because it is currently about to process his request unless via trackassembly_enmultask the multitasking is enabled. Every server-based task has dedicated data place, player and arguments.

Curved track generation

This was a major tool update derived from pull request #23. Its major goal was to update TA, so the user could do things with TA that he/she couldn't be able to do before. By using the curving option, the user can create a server-based task that generates a curve passing through a bunch of control points. This curve is later fitted with straight segments of the model which are automatically fitted along it.

Flip over normal position and angle

This was a major tool update derived from pull request #23. It was dedicated to flipping over ( mirroring ) a bunch of tracks across given position and normal vector. If you have a track that is the same in some direction you can just mirror it by right-clicking its pieces and left-clicking on the origin you pick.

Tool dedicated con-var menu

This was a major tool update derived from pull request #23. I know it was crappy to use the console and it is more convenient to use an actual menu to setup stuff so I made the exact thing. The menu is divided to user and admin dedicated sections. First ones are just user preferences and the second ones only the server admins can manipulate.

Bezier curving for smooth transition turns

This feature is derived from the following commit. This adds Brazier curving to produce smoother turns when cornering. The curve will use the control points as weighted stretch marks when it generates the track so your trains can enter and exit the curve more smoothly than the regular quarter-circled arc that most of the track packs use nowadays.