Skip to content

CwlOnCreateEvent

Namespace: Cwl.Patches.Sources;

Event raised when a Card is created in the game. You need to use the derived attributes CwlCharaOnCreateEvent or CwlThingOnCreateEvent to register the events for when the game instantiates Chara and Thing, respectively.

CwlThingOnCreateEvent

cs
[CwlThingOnCreateEvent]
internal static void OnThingSpawned(Thing thing)
{
    if (thing.id == "some_item") {
        // do stuff
    }
}

CwlCharaOnCreateEvent

cs
[CwlCharaOnCreateEvent]
internal static void OnCharaInstantiation(Chara chara)
{
    if (chara.id == "chicken") {
        chara.Destroy();
    }
}