wizguin / yukon

HTML5 virtual world
MIT License
78 stars 36 forks source link

Add every igloo #23

Open sky-is-winning opened 2 months ago

sky-is-winning commented 2 months ago

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


src/scenes/interface/game/iglooedit/gridview/GridView.js


Also:

ChrisCPI commented 1 month 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"

ChrisCPI commented 1 month ago

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 })
        }
    }
sky-is-winning commented 1 month ago

@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.

sky-is-winning commented 1 month ago

Fixed.