rework of the event system, allowing apps to function more independently and allowing for player scoped apps to handle global events. fixes #596
This commit is contained in:
1 parent
926c1a8e63
commit
d29f49967f
13 files changed
+367
-246
No files matched your search
@@ -961,6 +961,7 @@ public class Auxiliary {
|
||||
{
|
||||
if (lv.size() == 0)
|
||||
throw new InternalExpressionException("'signal' requires at least one argument");
|
||||
CarpetContext cc = (CarpetContext)c;
|
||||
CarpetScriptServer server = ((CarpetScriptHost)c.host).getScriptServer();
|
||||
String eventName = lv.get(0).evalValue(c).getString();
|
||||
// no such event yet
|
||||
@@ -975,10 +976,10 @@ public class Auxiliary {
|
||||
args = FunctionValue.resolveArgs(lv.subList(2, lv.size()), c, t);
|
||||
}
|
||||
}
|
||||
int counts = ((CarpetScriptHost)c.host).getScriptServer().events.signalEvent(eventName, (CarpetScriptHost) c.host, player, args);
|
||||
int counts = ((CarpetScriptHost)c.host).getScriptServer().events.signalEvent(eventName, cc, player, args);
|
||||
if (counts < 0) return LazyValue.NULL;
|
||||
Value ret = new NumericValue(counts);
|
||||
return (cc, tt) -> ret;
|
||||
return (c_, t_) -> ret;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user