Reduce exports from input.js

This commit is contained in:
John Alanbrook 2024-04-03 08:37:29 -05:00
parent 033b7c5109
commit ccdcfafdf2
4 changed files with 13 additions and 10 deletions

View file

@ -29,7 +29,7 @@ actor.timers = [];
actor.kill = function(){
if (this.__dead__) return;
this.timers.forEach(t => t());
Player.do_uncontrol(this);
input.do_uncontrol(this);
Event.rm_obj(this);
if (this.master) this.master.rm_pawn(this);
this.padawans.forEach(p => p.kill());

View file

@ -323,6 +323,8 @@ var gameobject = {
if (ent.tag) game.tag_add(ent.tag, ent);
if (callback) callback(ent);
return ent;
},
@ -523,7 +525,7 @@ var gameobject = {
this.timers.forEach(t => t());
this.timers = [];
Event.rm_obj(this);
Player.do_uncontrol(this);
input.do_uncontrol(this);
physics.collide_rm(this);
if (this.master) {
@ -670,7 +672,7 @@ gameobject.doc = {
motor: 'Keeps the relative angular velocity of this body to to at a constant rate. The most simple idea is for one of the bodies to be static, to the other is kept at rate.',
layer: 'Bitmask for collision layers.',
drawlayer: 'Layer for drawing. Higher numbers draw above lower ones.',
warp_layer: 'Bitmask for selecting what warps should affect this entity.',
warp_filter: 'Bitmask for selecting what warps should affect this entity.',
};
global.ur = {};

View file

@ -318,12 +318,6 @@ var Player = {
}
},
do_uncontrol(pawn) {
this.players.forEach(function(p) {
p.pawns = p.pawns.filter(x => x !== pawn);
});
},
obj_controlled(obj) {
for (var p in Player.players) {
if (p.pawns.contains(obj))
@ -358,6 +352,13 @@ var Player = {
},
};
input.do_uncontrol = function(pawn)
{
Player.players.forEach(function(p) {
p.pawns = p.pawns.filter(x => x !== pawn);
});
}
for (var i = 0; i < 4; i++) {
Player.create();
}

View file

@ -197,7 +197,7 @@ transform2d sprite2t(sprite *s)
return (transform2d){
.pos = s->pos,
.scale = s->scale,
.angle = s->angle
.angle = HMM_TurnToRad*s->angle
};
}