Compare commits
2 Commits
ecf4f9c719
...
bca366d7e5
| Author | SHA1 | Date | |
|---|---|---|---|
| bca366d7e5 | |||
| bbdbef889a |
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@ BUNDLE_NAME = bundle.lua
|
|||||||
HAXE_NAME = haxe.lua
|
HAXE_NAME = haxe.lua
|
||||||
MINIFYD_NAME = bundle.min.lua
|
MINIFYD_NAME = bundle.min.lua
|
||||||
BUILD_DIR = build
|
BUILD_DIR = build
|
||||||
HAXE_FLAGS = -D webconsole --debug
|
HAXE_FLAGS =
|
||||||
POLYFILLED_NAME = bundle.polyfill.lua
|
POLYFILLED_NAME = bundle.polyfill.lua
|
||||||
POLYFILL_SRC = src/polyfill.lua
|
POLYFILL_SRC = src/polyfill.lua
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package kernel;
|
package kernel;
|
||||||
|
|
||||||
|
import lua.TableTools;
|
||||||
|
import lua.Coroutine;
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import haxe.Exception;
|
import haxe.Exception;
|
||||||
|
|
||||||
using tink.CoreApi;
|
using tink.CoreApi;
|
||||||
|
|
||||||
import cc.OS;
|
|
||||||
|
|
||||||
using lua.Table;
|
using lua.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,7 +133,7 @@ class KernelEvents {
|
|||||||
**/
|
**/
|
||||||
public function startEventLoop() {
|
public function startEventLoop() {
|
||||||
while (true) {
|
while (true) {
|
||||||
var event:Table<Int, Dynamic> = OS.pullEventRaw();
|
var event:Table<Int, Dynamic> = pullEvents();
|
||||||
|
|
||||||
var eventName:String = event[1];
|
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> ) {
|
private function fireSignal(eventName: String,event:Table<Int, Dynamic> ) {
|
||||||
switch eventName {
|
switch eventName {
|
||||||
case "alarm":
|
case "alarm":
|
||||||
|
|||||||
@@ -74,11 +74,7 @@ class Routing {
|
|||||||
data: null
|
data: null
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: Because Lua is singelthreaded the computer we respond to can get overwhelmed with
|
interf.send(response.toID,Net.instance.networkID,response);
|
||||||
// the responses and can swollow events.
|
|
||||||
new Timer(Net.instance.networkID / 3,()->{
|
|
||||||
interf.send(response.toID,Net.instance.networkID,response);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function genRouteList(): Array<{id:NetworkID,cost:Int}> {
|
private function genRouteList(): Array<{id:NetworkID,cost:Int}> {
|
||||||
|
|||||||
Reference in New Issue
Block a user