1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-22 14:33:51 +00:00

ecs: added eid cmd

This commit is contained in:
Steven Hugg 2022-02-19 17:52:24 -06:00
parent eb30e5cf85
commit 38462bceac

View File

@ -775,6 +775,7 @@ class ActionEval {
case '$': return this.__local(args);
case '^': return this.__use(args);
case '#': return this.__arg(args);
case '&': return this.__eid(args);
case '<': return this.__get([arg0, '0']);
case '>': return this.__get([arg0, '8']);
default:
@ -842,6 +843,11 @@ class ActionEval {
return this.dialect.indexed_x(ident, index); //TODO?
}
}
__eid(args: string[]) {
let e = this.scope.getEntityByName(args[0] || '?');
if (!e) throw new ECSError(`can't find entity named "${args[0]}"`, this.action);
return e.id.toString();
}
__use(args: string[]) {
return this.scope.includeResource(args[0]);
}