Skip to content

[BUG] Thread view overwrites PC attributes when a later [PC:] tag is partial #33

@Snifer

Description

@Snifer

Description

In the Lonelog Threads panel, player characters ([PC:...]) lose previously defined attributes when a later mention of the same character only includes a partial subset of their fields.

The parser currently takes the latest partial mention and replaces the full list of attributes instead of merging attributes by key.

Example:

### S1 *TEST*
[PC:Primus | HIT 3 | GRIT 5 | WILL 4 ]
@ Aventura corta
=> [PC:Primus | HIT 3 | GRIT 5 | WILL 4 | Fichas Aventura 15 ]
tbl: Misión de inicio 4d6 = 5, 3, 6, 3 🎲
### S1 *TEST*

[PC:Primus | Fichas Aventura 15]

In this case, the final PC state in the Threads view only shows Fichas Aventura 15 instead of preserving the previous stats.

Steps to Reproduce

  1. Create a note with a PC tag that defines several attributes, for example:
    [PC:Primus | HIT 3 | GRIT 5 | WILL 4]
  2. In a later section of the same note, reference the same PC with only a subset of attributes, for example
    [PC:Primus | Fichas Aventura 15]
  3. Open the Lonelog Threads panel and inspect the PC entry for Primus.

Expected Behavior

The Threads view should keep previously defined attributes for the PC and update only the attributes present in the new mention.

Using the example, the final state for Primus should be:

HIT 3 | GRIT 5 | WILL 4 | Fichas Aventura 15

Later, if another tag appears like:

[PC:Primus | HIT 0]

then the final state should become:

HIT 0 | GRIT 5 | WILL 4 | Fichas Aventura 15

Actual Behavior

The Threads panel discards prior attributes and only shows the attributes from the latest partial mention.

Using the example above, Primus ends up showing only:

Fichas Aventura 15

Additional Context

From a quick look, this seems to be caused by how entity merging works in the parser: when it encounters a new mention with normal attributes, it replaces the entire attribute list instead of merging fields by key.

issue reported by @kaisermzn

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions