CHANGELOG

#v1.0.1

Declarative StatModificationAdd pattern

  • ModifierInstance (CustomGameplayModifiers/Framework/Abstractions/ModifierInstance.cs): Adds a virtual StatModificationAdd property (Func<ModifierStat, GameObject, float>) returning stat bonuses declaratively.
  • Replaces the imperative AddStatModifier/RemoveStatModifier pattern — override StatModificationAdd and wire it via LiveModifier.GetStatModificationAdd = StatModificationAdd in OnActivated().
  • Eliminates tracking active/inactive state and manual cleanup of stat modifiers on removal.

Preview lifecycle

  • ItemModuleInstance (CustomGameplayModifiers/ItemModules/ItemModuleInstance.cs): Adds IsPreview property and OnPreviewActivated() virtual method.
  • When the game creates a preview instance (loadout GUI), OnPreviewActivated() automatically wires StatModificationAdd, giving accurate stat readouts without additional code.

New events

  • ShipCannonFiredEvent (CustomGameplayModifiers/Framework/EventType/ShipCannonFiredEvent.cs): Published when PlayerShip_IndividualTurretController.Fire fires.
  • AIShipDamagedEvent (CustomGameplayModifiers/Framework/EventType/AIShipDamagedEvent.cs): Published when AI_Capability_Ship_Health.DamageRecieved is called.
  • Both wired via new Harmony patches in CustomGameplayModifiers/Patches/EventHooks.cs.

Refactored examples

  • ExampleItemModule: Jump boost now uses StatModificationAdd instead of the ItemHeldChangedEvent subscription. Removed HandleHeldChanged.
  • ReloadDamageModule: Damage bonus now uses StatModificationAdd instead of manual AddStatModifier/RemoveStatModifier. Simplified HandleReload and HandleFired.
  • ExamplePlayerTrait: Completely simplified — removed FloatObserver, OnHealthChanged, ApplyBoost/RemoveBoost. Replaced with StatModificationAdd and a trivial InitWhenReady coroutine.

New example: ExampleComponentModule

  • Demonstrates targeting ship components (pilot cannons) via ItemAssetRegistry.GetAllComponentsBySubtype(ComponentSubtype.PilotCannon).
  • Uses StatModificationAdd for ModifierStat.ShipDamage.
  • Reacts to AIShipDamagedEvent to duplicate damaged enemy ships.
  • Registered in ExampleMod/Core.cs.