fix input bug
This commit is contained in:
parent
b2a45fcfdd
commit
1ff46c3975
|
@ -535,10 +535,8 @@ Object.unhide = function(obj, ...props)
|
|||
{
|
||||
for (var prop of props) {
|
||||
var p = Object.getOwnPropertyDescriptor(obj,prop);
|
||||
if (!p) {
|
||||
console.warn(`No property of name ${prop}.`);
|
||||
return;
|
||||
}
|
||||
if (!p)
|
||||
continue;
|
||||
p.enumerable = true;
|
||||
Object.defineProperty(obj, prop, p);
|
||||
}
|
||||
|
|
|
@ -354,6 +354,7 @@ function process()
|
|||
var st = profile.now();
|
||||
prosperon.window_render(window.rendersize);
|
||||
prosperon.draw();
|
||||
prosperon.debug();
|
||||
prosperon.gui();
|
||||
prosperon.screengui();
|
||||
prosperon.hookend?.();
|
||||
|
|
|
@ -300,15 +300,20 @@ var Player = {
|
|||
|
||||
raw_input(cmd, state, ...args) {
|
||||
for (var pawn of this.pawns.reversed()) {
|
||||
if (typeof pawn.inputs?.any === 'function') {
|
||||
if (!pawn.inputs) {
|
||||
console.error(`pawn no longer has inputs object.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof pawn.inputs.any === 'function') {
|
||||
pawn.inputs.any(cmd);
|
||||
|
||||
if (!pawn.inputs.fallthru)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pawn.inputs?.[cmd]) {
|
||||
if (pawn.inputs?.block) return;
|
||||
if (!pawn.inputs[cmd]) {
|
||||
if (pawn.inputs.block) return;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -330,6 +335,7 @@ var Player = {
|
|||
|
||||
if (typeof fn === 'function') {
|
||||
fn.call(pawn, ... args);
|
||||
if (!pawn.inputs) continue; // TODO: OK? Checking if the call uncontrolled the pawn
|
||||
pawn.inputs.post?.call(pawn);
|
||||
}
|
||||
|
||||
|
@ -370,6 +376,10 @@ var Player = {
|
|||
pawns: [],
|
||||
|
||||
control(pawn) {
|
||||
if (!pawn.inputs) {
|
||||
console.warn(`attempted to control a pawn without any input object.`);
|
||||
return;
|
||||
}
|
||||
this.pawns.push_unique(pawn);
|
||||
},
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void mYughLog(int category, int priority, int line, const char *file, const char
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
if (priority >= LOG_ERROR) {
|
||||
if (priority >= LOG_PANIC) {
|
||||
js_stacktrace();
|
||||
#ifdef __WIN32
|
||||
DebugBreak();
|
||||
|
|
Loading…
Reference in a new issue