Open sky-is-winning opened 2 months ago
what happens when a room and an igloo share the same scene key? for example the Cave igloo and the actual Cave room having the same key "Cave"
if my above comment is actually an issue, then i have a proposed solution what if all igloo scene keys were appended with something like "Igloo"?
so IglooScene.js
would have the following:
constructor(key) {
super(`${key}Igloo`)
And then createIgloo
in RoomFactory.js
would be something like this:
createIgloo(args) {
let config = this.igloos[args.type]
const key = `${config.key}Igloo`
if (config.key in this.scene.manager.keys) {
this.scene.start(key, { args: args })
return this.scene.get(key)
} else {
return this.scene.add(key, config.scene, true, { args: args })
}
}
@ChrisCPI
what happens when a room and an igloo share the same scene key? for example the Cave igloo and the actual Cave room having the same key
"Cave"
You're right, I didn't test that in vanilla Yukon. It does indeed load the wrong scene in this case. Good fix proposal, will implement something similar.
Fixed.
Assets: https://drive.google.com/file/d/1BjpMunXmFGUubPLuDxZL8Y0pQpk9m1rj/view?usp=sharing
Raw: https://drive.google.com/file/d/1Bl3VFwAPguojeaiQGuW-Hxds3wo1LMUd/view?usp=sharing
Explanation of all changes
src/data/igloo.js
src/scenes/components/Button.js
src/scenes/igloos/IglooScene.js
Checks if an igloo has a floor before setting its depth. This prevents the game crashing on an igloo with no floor.
Checks for a -igloo-physics.json file first before looking for a -physics.json file. This is so IglooScenes with the same name as RoomScenes (like cave) don't accidentally use each other's physics data. Same naming convention is used with all animation, pack and multiatlas files, for the same reason.
src/scenes/interface/game/iglooedit/gridview/GridView.js
Also: