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();
    }
}