Resources
Resources are singleton objects that live on the world. They are not attachable to entities. They are declared with classes that inherit from the Resource class provided by the SDK.
ts
import { Resource } from '@vaguevoid/fiasco'
class WorldState extends Resource {
anyDataHere = [1,2,3] // initialize with data
something?: string // or just specify a type
}
TIP
Resources have serialization abilities built-in, but they can be overriden by specifying serialize
and deserialize
methods on the resource class.
Resources must be exported with the magic export resources
from the root file of the project.
ts
export const resources = [new WorldState()]