add entity start on play
This commit is contained in:
parent
dc25e23aa8
commit
2c1f34177b
|
@ -201,10 +201,12 @@ var entity = {
|
||||||
check_registers(ent);
|
check_registers(ent);
|
||||||
|
|
||||||
if (ent.load instanceof Function) ent.load();
|
if (ent.load instanceof Function) ent.load();
|
||||||
if (sim.playing())
|
if (sim.playing()) {
|
||||||
|
ent._started = true;
|
||||||
if (ent.start instanceof Function) ent.start();
|
if (ent.start instanceof Function) ent.start();
|
||||||
|
}
|
||||||
|
|
||||||
Object.hide(ent, 'ur', 'components', 'objects', 'timers', 'guid', 'master');
|
Object.hide(ent, 'ur', 'components', 'objects', 'timers', 'guid', 'master', 'guid');
|
||||||
|
|
||||||
ent._ed = {
|
ent._ed = {
|
||||||
selectable: true,
|
selectable: true,
|
||||||
|
|
|
@ -28,6 +28,12 @@ sim.mode = "play";
|
||||||
sim.play = function () {
|
sim.play = function () {
|
||||||
this.mode = "play";
|
this.mode = "play";
|
||||||
os.reindex_static();
|
os.reindex_static();
|
||||||
|
game.all_objects(o => {
|
||||||
|
if (!o._started) {
|
||||||
|
o._started = true;
|
||||||
|
o.start?.();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
sim.playing = function () {
|
sim.playing = function () {
|
||||||
return this.mode === "play";
|
return this.mode === "play";
|
||||||
|
|
Loading…
Reference in a new issue