Prepping cooking

This commit is contained in:
2026-01-15 17:28:39 -06:00
parent 098a9d47f9
commit 3b7de160dc
27 changed files with 151 additions and 19 deletions

1
cooking/CookBook.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://bu1fdc6j7aep5

View File

@@ -1 +1,27 @@
class_name CookingSingleton extends Node
class_name CookingSingleton extends Node
# Cooking State
var cutscene:Cutscene = null
var active:bool = false
# Signals
signal cookingStarted
func start(params:Dictionary) -> void:
assert(params.has('recipe'))
assert(!active)
if params['cutscene'] != null:
cutscene = params['cutscene']
else:
cutscene = Cutscene.new()
# TODO: Add cooking things here
# Emit signals
active = true
cookingStarted.emit()
# Start the cutscene.
if !cutscene.running:
cutscene.start()

42
cooking/Recipe.gd Normal file
View File

@@ -0,0 +1,42 @@
class_name Recipe
enum Id {
NULL,
BAKED_POTATO,
}
# Data storage
static var RECIPES = []
# Initializer
static func defineRecipe(params:Dictionary) -> Dictionary:
assert(params.has("id"))
assert(params.has("handle"))
var recipe = {
"id": params["id"],
"handle": params.get("handle"),
}
RECIPES.insert(params["id"], recipe)
return recipe
# Instances
static var RECIPE_NULL = defineRecipe({
"id": Id.NULL,
"handle": "unknown"
})
static var BAKED_POTATO = defineRecipe({
"id": Id.BAKED_POTATO,
"handle": "baked_potato"
})
# Getters
static func getData(id:int) -> Dictionary:
if RECIPES.size() <= id || id < 0:
return RECIPE_NULL
return RECIPES[id]
static func getRecipeHandle(id:Id) -> String:
return getData(id)["handle"]

1
cooking/Recipe.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://cuxhuep2pi734

14
cooking/RecipeBook.gd Normal file
View File

@@ -0,0 +1,14 @@
class_name RecipeBook
static var RECIPES_KNOWN:Array[Recipe.Id] = []
static func learnRecipe(recipeId:Recipe.Id) -> void:
if recipeId in RECIPES_KNOWN:
return
RECIPES_KNOWN.append(recipeId)
static func isRecipeKnown(recipeId:Recipe.Id) -> bool:
return recipeId in RECIPES_KNOWN
static func getKnownRecipes() -> Array[Recipe.Id]:
return RECIPES_KNOWN.duplicate()

View File

@@ -0,0 +1 @@
uid://cucoo6enonu3v