fix entity delete error

This commit is contained in:
John Alanbrook 2024-09-01 13:59:34 -05:00
parent 794e581336
commit ef0a59f489
4 changed files with 8 additions and 5 deletions

View file

@ -86,7 +86,6 @@ Resources.replstrs = function replstrs(path) {
script = Resources.rm_fn(/assert/, script); script = Resources.rm_fn(/assert/, script);
script = Resources.rm_fn(/debug\.(build|fn_break)/, script); script = Resources.rm_fn(/debug\.(build|fn_break)/, script);
} }
script = script.replace(regexp, function (str) { script = script.replace(regexp, function (str) {
var newstr = Resources.replpath(str.trimchr('"'), path); var newstr = Resources.replpath(str.trimchr('"'), path);

View file

@ -138,7 +138,10 @@ var entity = {
}, },
remove_obj(obj) { remove_obj(obj) {
delete this.objects[obj.guid]; if (this.objects)
delete this.objects[obj.guid];
else
console.warn(`Object ${this.guid} has no objects file.`);
delete this[obj.name]; delete this[obj.name];
Object.unhide(this, obj.name); Object.unhide(this, obj.name);
}, },
@ -330,7 +333,8 @@ var entity = {
/* The object needed to store an object as an instance of a master */ /* The object needed to store an object as an instance of a master */
instance_obj() { instance_obj() {
var t = this.transform(); var t = os.make_transform();
t = this.transform;
t.ur = this.ur.name; t.ur = this.ur.name;
return t; return t;
}, },

View file

@ -89,6 +89,8 @@ game.engine_start = function (s) {
appcam.transform.pos = [window.size.x,window.size.y,-100]; appcam.transform.pos = [window.size.x,window.size.y,-100];
prosperon.screencolor = render.screencolor(); prosperon.screencolor = render.screencolor();
globalThis.imgui = render.imgui_init();
s(); s();
shape.quad = { shape.quad = {

View file

@ -484,8 +484,6 @@ render.init = function() {
poly_ssbo = render.make_textssbo(); poly_ssbo = render.make_textssbo();
sprite_ssbo = render.make_textssbo(); sprite_ssbo = render.make_textssbo();
globalThis.imgui = render.imgui_init();
render.textshader = textshader; render.textshader = textshader;
os.make_circle2d().draw = function() { os.make_circle2d().draw = function() {