eager-doctor-25844
10/17/2022, 1:18 PMclass Interactable implements Namespace {
related: {
owners: Player []
parents: Plot []
}
permits = {
interact: (ctx: Context): boolean =>
this.related.owners.includes(ctx.subject) ||
this.related.parents.traverse((p) => p.residents.includes(ctx.subject)) // residents of parents plot can interact with this object
}
}
class Chest implements Interactable { // NOTE: not sure whether support inheritance or not.
permits = {
interact: (ctx: Context): boolean =>
this.related.owners.includes(ctx.subject) ||
this.related.owners.traverse((p) => p.closefriends.includes(ctx.subject)) // only owner and close friends can open the chest.
}
}
steep-lamp-91158