diff --git a/Makefile b/Makefile index 7d4b5a5..0883793 100755 --- a/Makefile +++ b/Makefile @@ -99,6 +99,8 @@ DEPENDS = $(objects:.o=.d) ENGINE = $(BIN)libengine.a INCLUDE = $(BIN)include +SCRIPTS = $(shell ls source/scripts/*.js) + LINK = $(LIBPATH) $(LINKER_FLAGS) $(ELIBS) MYTAG = $(VER)_$(PTYPE)_$(INFO) @@ -114,7 +116,7 @@ $(BIN)$(NAME): $(objprefix)/source/engine/yugine.o $(ENGINE) $(BIN)libquickjs.a $(CC) $< $(LINK) -o $(BIN)$(NAME) @echo Finished build -$(BIN)$(DIST): $(BIN)$(NAME) source/shaders/* source/scripts/* assets/* +$(BIN)$(DIST): $(BIN)$(NAME) source/shaders/* $(SCRIPTS) assets/* @echo Creating distribution $(DIST) @mkdir -p $(BIN)dist @cp $(BIN)$(NAME) $(BIN)dist diff --git a/source/scripts/base.js b/source/scripts/base.js index 8814d65..98d9dbe 100644 --- a/source/scripts/base.js +++ b/source/scripts/base.js @@ -24,6 +24,12 @@ Object.defineProperty(Object.prototype, 'getOwnPropertyDescriptors', { } }); +Object.defineProperty(Object.prototype, 'obscure', { + value: function(name) { + Object.defineProperty(this, name, { enumerable: false }); + } +}); + Object.defineProperty(Object.prototype, 'hasOwn', { value: function(x) { return this.hasOwnProperty(x); } }); @@ -609,3 +615,4 @@ function sortpointsccw(points) return ccw.map(function(x) { return x.add(cm); }); } + diff --git a/source/scripts/components.js b/source/scripts/components.js index 70a20ae..912b0ec 100644 --- a/source/scripts/components.js +++ b/source/scripts/components.js @@ -136,10 +136,14 @@ var char2d = clone(sprite, { make(go) { var char = clone(this); char.curplaying = char.anims.array()[0]; + char.obscure('curplaying'); Object.defineProperty(char, 'id', {value:make_sprite(go,char.curplaying.path,this.pos)}); + char.obscure('id'); char.frame = 0; char.timer = timer.make(char.advance.bind(char), 1/char.curplaying.fps); char.timer.loop = true; + char.obscure('timer'); + char.obscure('rect'); char.setsprite(); return char; }, diff --git a/source/scripts/diff.js b/source/scripts/diff.js index 05444d3..b12348d 100644 --- a/source/scripts/diff.js +++ b/source/scripts/diff.js @@ -85,9 +85,11 @@ function deep_merge(target, source) Log.warn("Doing a deep merge ..."); for (var key in source) { if (typeof source[key] === 'object' && !Array.isArray(source[key])) { + Log.warn(`Deeper merge on ${key}`); deep_merge(target[key], source[key]); } else { + Log.warn(`Setting key ${key}`); target[key] = source[key]; } } diff --git a/source/scripts/engine.js b/source/scripts/engine.js index 86b3e38..184e360 100644 --- a/source/scripts/engine.js +++ b/source/scripts/engine.js @@ -1761,3 +1761,5 @@ for (var key in prototypes) { } function save_gameobjects_as_prototypes() { slurpwrite(JSON.stringify(gameobjects,null,2), "proto.json"); }; + +Resources = {};