From 38462bceaca4af2a55afe46cd4bb2dacf5fa3514 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sat, 19 Feb 2022 17:52:24 -0600 Subject: [PATCH] ecs: added eid cmd --- src/common/ecs/ecs.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/ecs/ecs.ts b/src/common/ecs/ecs.ts index cd1e4cf6..563588cc 100644 --- a/src/common/ecs/ecs.ts +++ b/src/common/ecs/ecs.ts @@ -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]); }