Vixen
c7401864
csharp
public readonly record struct GameplayEvent

Something happened: a kill, a pickup, a discovery, a purchase.

Read the guide page for this →

Remarks

The other half of doc 28's dependency spine. The spine says that where two features genuinely need to meet — loot dropping from a raid encounter, a quest counting a kill — they meet "through tags and events rather than through a reference". Tags were built in G0 and events were not, which left the sentence half true: a quest library that had to be told about kills by name would need a reference to combat, and the horizontal edge the spine forbids would be back.

A verb, a subject and a place, and nothing about who is watching. What makes the seam work is that a poster names what happened in its own vocabulary and never names an audience. Combat posts Event.Kill with the victim's tags; whether that advances a quest, an achievement, a dynamic event or nothing at all is not combat's business and it costs combat nothing when the answer is nothing.

⚠ Tags is borrowed for the duration of the dispatch and must not be kept. It is the subject's own live set — the victim's tags, the item's tags — passed by reference so that filtering a thousand kills allocates nothing. A subscriber that stored it would be holding a set that goes on changing, and for a corpse, one that is about to be recycled.

Fields and properties (6)

  • public GameplayTag Verb

    What happened — Event.Kill. The one field every filter tests first.

  • public DefId Subject

    What it happened to or with: the creature, the item, the recipe, the currency.

  • public DefId Scene

    Where, as a map's address. None for nowhere in particular.

  • public int Amount

    How many or how much. One kill, thirty ore, five hundred gold.

  • public PlayerId Instigator

    Who caused it, or None for the world itself.

  • public GameplayTagSet? Tags

    The subject's tags, borrowed. Null when it has none.

Methods (1)

Used by (10)

  • CollectionRecordVixen.Gameplay.Collections
  • CollectionTestsVixen.Gameplay.Collections.Tests
  • ContentVixen.Gameplay.Quests.Tests
  • DynamicEventTestsVixen.Gameplay.Quests.Tests
  • EventBusTestsVixen.Gameplay.Quests.Tests
  • GameplayEventBusVixen.Gameplay
  • GameplayEventFilterVixen.Gameplay
  • IQuestObjectiveVixen.Gameplay.Quests
  • ObjectiveTrackerVixen.Gameplay.Quests
  • QuestJournalTestsVixen.Gameplay.Quests.Tests