Compare commits

...

2 Commits

Author SHA1 Message Date
bca366d7e5 pull events native 2022-03-01 13:21:35 +01:00
bbdbef889a i hate everything 2022-03-01 13:20:23 +01:00
3 changed files with 9 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ BUNDLE_NAME = bundle.lua
HAXE_NAME = haxe.lua
MINIFYD_NAME = bundle.min.lua
BUILD_DIR = build
HAXE_FLAGS = -D webconsole --debug
HAXE_FLAGS =
POLYFILLED_NAME = bundle.polyfill.lua
POLYFILL_SRC = src/polyfill.lua

View File

@@ -1,12 +1,11 @@
package kernel;
import lua.TableTools;
import lua.Coroutine;
import util.Vec.Vec2;
import haxe.Exception;
using tink.CoreApi;
import cc.OS;
using lua.Table;
/**
@@ -134,7 +133,7 @@ class KernelEvents {
**/
public function startEventLoop() {
while (true) {
var event:Table<Int, Dynamic> = OS.pullEventRaw();
var event:Table<Int, Dynamic> = pullEvents();
var eventName:String = event[1];
@@ -142,6 +141,10 @@ class KernelEvents {
}
}
private function pullEvents():Table<Int, Dynamic> {
return cast TableTools.pack(Coroutine.yield(null));
}
private function fireSignal(eventName: String,event:Table<Int, Dynamic> ) {
switch eventName {
case "alarm":

View File

@@ -74,11 +74,7 @@ class Routing {
data: null
}
// HACK: Because Lua is singelthreaded the computer we respond to can get overwhelmed with
// the responses and can swollow events.
new Timer(Net.instance.networkID / 3,()->{
interf.send(response.toID,Net.instance.networkID,response);
});
interf.send(response.toID,Net.instance.networkID,response);
}
private function genRouteList(): Array<{id:NetworkID,cost:Int}> {