HexCardsClient/modifiers/field/field.wren

60 lines
No EOL
1.4 KiB
Text

import "luxe: io" for IO
import "luxe: world" for World, Entity, Modifiers, ModifierSystem
//User facing API
//This is what the user of your modifier will interact with
class Field {
static create(entity) { Modifiers.create(This, entity) }
static destroy(entity) { Modifiers.destroy(This, entity) }
static has(entity) { Modifiers.has(This, entity) }
static get_distance(entity) {
var data = Modifiers.get(This, entity)
return data.slot_distance
}
static get_scale(entity) {
var data = Modifiers.get(This, entity)
return data.slot_scale
}
} //Field
//Your modifier system implementation.
//This speaks to the engine and your user facing API
//to do the actual work. You'll get notified when things change
//in the world and respond to them here.
class FieldSystem is ModifierSystem {
construct new() {
//called when your system is first created.
}
init(world) {
_world = world
//called when your modifier is created in a world
}
destroy() {
//called when your modifier is removed from a world
}
attach(entity, data) {
//called when attached to an entity
}
detach(entity, data) {
//called when detached from an entity, like on destroy
}
tick(delta) {
//called usually once every frame.
//called when the world that this modifier lives in, is ticked
each {|entity, data|
//use data.*
}
} //tick
} //FieldSystem
var Modifier = FieldSystem //required