democratizedspace / dspace

Free, open source space exploration idle game. Build your home base on earth, gather resources, and launch into orbit.
https://democratized.space
BSD Zero Clause License
4 stars 2 forks source link

refactor QuestChatOption.svelte to reuse a component for Goto and Finish #44

Open futuroptimist opened 1 year ago

futuroptimist commented 1 year ago

Motivation: the ability to block finishing a quest on obtaining some item from a process. Right now the only workaround is blocking behind another Goto option that takes you to a new dialogue step.

example (implement this change to close this bug):

        {
            "id": "charge",
            "text": "Now all that's left is starting the charging process! Push the big button and energy will flow from the Sun into that battery! Isn't technology amazing? Once you've started the charge, feel free to finish the quest! You'll get a reward for your hard work!",
            "options": [
                {
                    "type": "process",
                    "process": "solar-200Wh",
                    "text": "Let there be light!"
                },
                {
                    "type": "finish",
                    "text": "You've made my day, Orion! Thanks so much!!"
                }
            ]
        }
    {
        "id": "solar-200Wh",
        "title": "Generate 200 Wh of electricity using solar",
        "requireItems": [
            {
                "id": "81",
                "count": 1
            }
        ],
        "consumeItems": [
        ],
        "createItems": [
            {
                "id": "22",
                "count": 200
            },
            {
                "id": "61",
                "count": 200

            }
        ],
        "duration": "1h"
    },

solar-200Wh grants 200 dSolar (id = "61"). Gate the "type": "finish" option on 200 dSolar.