FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.68k stars 394 forks source link

Debug Menus #13810

Open Jade-Harleyy opened 2 months ago

Jade-Harleyy commented 2 months ago

Adds entity lists and inspectors for easier debugging and mod-making. In addition to what's layed out below, I also plan to add more features such as an item spawner window and individual toggles for certain debug overlays.

Console Commands

Windows

All windows can be dragged, and closed with either their respective Close button, or with the close|closeall commands.

Entity Explorers

A list of every loaded entity if opened with the console, or a list of entities under the cursor if opened with the entity inspector.

On the left of an entry is its name (if available), its class, and its location. On the right is its ID, and a button to destroy the entity. Entries can be clicked to open an entity editor window.

Entity Editors

A list of serializable entity editors; same as what would be seen in the submarine and character editors.

GUI Explorers

A heirarchy of GUI elements, with parents above the focused element, and children below. Opening one of these windows from the console focuses Screen.Selected.Frame, while opening one from the GUI inspector focuses GUI.MouseOn.

On the left of an entry is its class, and its style. On the right is its update order, a visibility toggle, and a button to orphan the element. Elements whose parents are the GUI canvas cannot be orphaned. Hovering over an entry will outline its rect, holding Ctrl will outline each element in its parent heirarchy, and holding Alt will fill in the outlines at half opacity. Clicking on an entry will open a new GUI Explorer window focused on that element.

Entity Spawner

A categorized list of entities, same as in the Submarine Editor but with only items.

The quality of selected items can be changed with the buttons at the bottom of the window. Left-clicking an entity in the list will add one to the cursor, while right-clicking will remove one. Selecting/deselecting items is split based on the selected quality. For example, if "Good" is selected, only "Good" quality items will be added/removed.

When the cursor is off of the window, left clicking in the world will spawn the entities at that location, while clicking on the controlled character's inventory slots will spawn them in the character's inventory. Holding shift while clicking will preserve the entities in the cursor, allowing them to be spawned multiple times without having to be reselected.

Similar to the inspector modes, clicking the right mouse button or pressing escape outside the window will clear the selected items. All inspectors override this mode.

Inspector Modes

Regardless of its current mode, clicking the right mouse button or pressing escape will disable the inspector.

Entities

Displays the cursor's current position in the world, and a list of entities under the cursor. Each entry on the list displays the entity's name (if applicable), and its class.

Clicking the left mouse button will create an Entity Explorer window with a list of each entity under the cursor, as well as any items contained in selected items' or characters' inventories (if applicable).

GUI

Displays the cursor's current position on the screen, and the selected GUI element's class and style.

Hovering over an element will outline its rect, holding Ctrl will outline each element in its parent heirarchy, and holding Alt will fill in the outlines at half opacity.

Clicking the left mouse button will create a GUI Explorer window focused on the currently selected element.

New Content

GUI Styles

  <GUITickBoxNoMinimum color="White" hovercolor="White" selectedcolor="White" disabledcolor="Gray">
    <Sprite name="GUITickBox.None" texture="Content/UI/UIAtlasGeneral.png" state="None" sourcerect="6,112,36,36" tile="false"/>
    <Sprite name="GUITickBox.Pressed" texture="Content/UI/UIAtlasGeneral.png" state="Pressed" sourcerect="109,112,36,36" tile="false"/>
    <Sprite name="GUITickBox.Hover" texture="Content/UI/UIAtlasGeneral.png" state="Hover" sourcerect="160,112,36,36" tile="false"/>
    <Sprite name="GUITickBox.Selected" texture="Content/UI/UIAtlasGeneral.png" state="Selected" sourcerect="57,112,36,36" tile="false"/>
    <Sprite name="GUITickBox.HoverSelected" texture="Content/UI/UIAtlasGeneral.png" state="HoverSelected" sourcerect="211,112,36,36" tile="false"/>
    <GUITextBlock textcolor="GUI.TextColorNormal" hovertextcolor="White" disabledtextcolor="Gray" selectedcolor="255,153,0,76" padding="10,0,10,0"/>
  </GUITickBoxNoMinimum>

English Localization

<qualityname0>Normal</qualityname0>
<qualityname1>Good</qualityname1>
<qualityname2>Excellent</qualityname2>
<qualityname3>Masterwork</qualityname3>

Media

GUI Explorer image Entity Inspector image Entity Explorer and Entity Editors image Item Spawner image