HDest-Community / Ugly-as-Sin

Enhancement modules for Hideous Destructor
zlib License
21 stars 17 forks source link

Hunger: Food prep mechanics overview #178

Open caligari87 opened 2 years ago

caligari87 commented 2 years ago

Supersedes and closes #122

Some brief notes on food prep mechanics so I don't forget when I get back around to this (hopefully soonish). Note this will encompass any prep mechanic, not just cooking, so we're changing the terminology.

Prep rule data structures

Each consumable will have an array (similar to the message text arrays) which holds the steps required for preparing the consumable. When all the prep steps are complete, the consumable is automatically destroyed and actually if we revamp the consumable class to store things like Calories in the weaponstatus array, a lot of stuff can probably be done right in the consumable itself. Put out feelers on the Discord to see if this is viable, given there's lots of modded foods already and I don't want to break the.

rough idea for data class

class UaS_FoodPrepRule {
    string rule_name;
    int prep_tics;

    static UaS_FoodPrepRule Create(string n, int p = 175) {
        let r = new("UaS_FoodPrepRule");
        r.rule_name = n;
        r.prep_tics = p;
        return r;
    }

    static bool DoPrep() {
        if (prep_tics <=0) { return true; }
        prep_tics--;
        return false;
    }
}

Messkit

Basically the resurrection of the messkit. Use the trauma kit as a guide. The player will get a list of consumables on the left which have valid prep rules. On the right will be a dynamically-populated list of those rules, which the player can run.

Most rules will block the execution of other rules because you're assumed to be actively engaged in it, and will fail if you move. One exception might be passively heating items, but will cross that bridge later.

Messkits will probably start with only a basic "plate" function. Picking up more messkits will add random upgrades, making more prep options available for foods which define them.

Possible functions/tools. These don't define functionality by themselves, but rather can be required by a consumable to make a prep rule available:

Mixing?

NO PROMISES If I create a global event handler with a "database" of food descriptions and stats, I can use that to populate consumable descriptions, and have new entries added to it by the messkit. This would conceivably solve the issue of item descriptions not being persistent across inventories.

WIP

This issue is a work-in-progress and will be edited as I have more thoughts.

caligari87 commented 2 years ago

(copied from Discord)

Prep example

Each food item can define prep steps, like a recipe, and those steps can require other consumables to complete. For a very simple pseudo-code example:

Food Item: UaS_Apple
  Prep rule: Caramel Apple
    Tools: Bowl
    Requires: UaS_CaramelSaucePacket
    Time: 10 seconds
    Output Actions:
      Calories += UaS_CaramelSaucePacket calories
      Bulk += UaS_CaramelSaucePacket bulk
      Update Description: "A caramel-covered apple"
      Update Name: "Caramel Apple"

If you activate this rule, it uses up the UaS_CaramelSaucePacket and changes the Apple's properties accordingly. If you don't have the appropriate tools or ingredients, the recipe/prep routine simply won't show up in the messkit, avoiding clutter and making "easter egg" combinations possible.

There will be some generic actions. Such as "slicing" will probably be called "portion" and will simply make two copies of the consumable with half the calories. So you can portion your apple and portion your caramel sauce, and essentially get caramel covered apple slices (though this won't be reflected in the name of the consumable most likely).