Composable Tokens
// modules/avatars/module.rell
module;
import equippables; // import our first module
import lib.yours;// modules/avatars/model.rell
entity avatar {
key yours.token; // the avatar itself is a token as well
}
entity equipment {
key avatar, yours.token;
}// modules/avatars/functions.rell
function attach(token: yours.token) {
yours.attach_module(token, rell.meta(avatar).module_name);
create avatar(token);
}
function equip(avatar: avatar, item: yours.token) {
require(equippables.get_equippable(item) != null, "Item must be equippable");
create equipment(avatar, item);
}
function get_avatar(token: yours.token): avatar? {
return avatar @? { token };
}Equipping Items
Last updated