TTT-2 / TTT2

Trouble in Terrorist Town 2 for Garry's Mod (gmod)
https://steamcommunity.com/sharedfiles/filedetails/?id=1357204556
178 stars 74 forks source link

Edit equipment hierarchy doesn't work correctly #1485

Open laeyon85002 opened 7 months ago

laeyon85002 commented 7 months ago

Your version of TTT2 (mandatory)

Describe the bug (mandatory)

I think there is a bug in the logic of the "Edit equipment" master. If I have a CheckBox that activates/deactivates a complete section and this has a subordinate element (also a CheckBox), which in turn has another sub-element, then this lowest setting is incorrectly enabled when the editor is reopened. Category 2 must first be enabled and category 1 then disabled, then the subitem of category 2 is enabled when the editor is reopened, although category 1 is disabled. The changes seem to be correct as long as the window is open - afterwards, when reopened, it is incorrect.

To reproduce

Steps to reproduce the behaviour:

  1. Add the attached addon to your collection
  2. Go to 'F1 > Edit equip bug'
  3. Scroll down to the custom settings
  4. Enable "Enable main feature", enable "Enable sub feature", enable "My option value"
  5. Now disable "Enable main feature" and reopen the "Edit equipment"-browser
  6. The option "My option value" is enabled, although the superordinate categories are disabled

Expected behaviour

The entire hierarchy must be taken into account and not just the option directly above it, so that the option at the lowest level is not displayed if the options above it are switched off. Apparently the behavior only seems to be wrong when you open the window again - it seems to be correct when the window is open.

Context (please provide as much as you can)

The last option is still set as enabled but the controls are disabled (correct behavior until I reopen the window):

image

After reopening the controls of the last option are enabled, although the parent control is disabled:

image

Additional context

editEquipmentBug.zip

TimGoll commented 7 months ago

@ZenBre4ker you probably know the most about the UI requesting data from the server?

ZenBre4ker commented 7 months ago

This looks like a simple clientside logic error not including any data from the server.

Maybe because the 1st sub element is deactivated by the master, the 2nd sub element doesnt get deactivated. We never had more than one level under one master.

TimGoll commented 7 months ago

We have multiple levels under master and it works fine for convar based settings (check the karma menu for example)

This seems to be a database based issue