Prepping cooking
This commit is contained in:
1
cooking/CookBook.gd.uid
Normal file
1
cooking/CookBook.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bu1fdc6j7aep5
|
||||
@@ -1 +1,27 @@
|
||||
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
42
cooking/Recipe.gd
Normal 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
1
cooking/Recipe.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cuxhuep2pi734
|
||||
14
cooking/RecipeBook.gd
Normal file
14
cooking/RecipeBook.gd
Normal 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()
|
||||
1
cooking/RecipeBook.gd.uid
Normal file
1
cooking/RecipeBook.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cucoo6enonu3v
|
||||
8
cutscene/CutsceneResource.gd
Normal file
8
cutscene/CutsceneResource.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends Resource
|
||||
class_name CutsceneResource
|
||||
|
||||
func queue(_cutscene:Cutscene) -> void:
|
||||
pass
|
||||
|
||||
func canRun() -> bool:
|
||||
return true
|
||||
1
cutscene/CutsceneResource.gd.uid
Normal file
1
cutscene/CutsceneResource.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bbjol1dxa3wvo
|
||||
18
cutscene/cooking/CookingStartAction.gd
Normal file
18
cutscene/cooking/CookingStartAction.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
class_name CookingStartAction
|
||||
|
||||
static func startCookingCallable(params:Dictionary) -> int:
|
||||
assert(params.has("recipe"))
|
||||
|
||||
SCENE.setScene(SceneSingleton.SceneType.COOKING)
|
||||
COOKING.start({
|
||||
'recipe': params['recipe'],
|
||||
'cutscene': params.get('cutscene', null)
|
||||
})
|
||||
return Cutscene.CUTSCENE_CONTINUE
|
||||
|
||||
static func getStartCookingCallable(params:Dictionary) -> Dictionary:
|
||||
assert(params.has("recipe"))
|
||||
return {
|
||||
"function": startCookingCallable,
|
||||
'recipe': params['recipe']
|
||||
}
|
||||
1
cutscene/cooking/CookingStartAction.gd.uid
Normal file
1
cutscene/cooking/CookingStartAction.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b8b43y70xfy04
|
||||
6
cutscene/cutscene/TestCutscene.gd
Normal file
6
cutscene/cutscene/TestCutscene.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
class_name TestCutscene extends CutsceneResource
|
||||
|
||||
func queue(cutscene:Cutscene) -> void:
|
||||
cutscene.addCallable(CookingStartAction.getStartCookingCallable({
|
||||
'recipe': Recipe.Id.BAKED_POTATO
|
||||
}))
|
||||
1
cutscene/cutscene/TestCutscene.gd.uid
Normal file
1
cutscene/cutscene/TestCutscene.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b5c8g5frishjs
|
||||
@@ -38,7 +38,7 @@ static var ITEM_NULL = itemDefine({
|
||||
'type': Type.NULL
|
||||
})
|
||||
|
||||
static var ITEM_POTION = itemDefine({
|
||||
static var POTION = itemDefine({
|
||||
'id': Id.POTION,
|
||||
'handle': "potion",
|
||||
'type': Type.MEDICINE
|
||||
|
||||
@@ -12,7 +12,7 @@ enum InteractType {
|
||||
NONE,
|
||||
CONVERSATION,
|
||||
ONE_TIME_ITEM,
|
||||
TEST_BATTLE
|
||||
CUTSCENE
|
||||
};
|
||||
|
||||
@export_category("Identification")
|
||||
@@ -29,9 +29,8 @@ var button := func():
|
||||
@export_category("Interactions")
|
||||
@export var interactType:InteractType = InteractType.NONE
|
||||
@export var conversation:Array[ConversationResource] = []
|
||||
|
||||
@export_category("One-Time Item")
|
||||
@export var oneTimeItem:ItemResource = null
|
||||
@export var cutscene:CutsceneResource = null
|
||||
|
||||
# TEST BATTLE
|
||||
@export_category("Test Battle")
|
||||
|
||||
@@ -11,10 +11,15 @@ func isInteractable() -> bool:
|
||||
return false
|
||||
|
||||
if entity.interactType == Entity.InteractType.CONVERSATION:
|
||||
if entity.conversation.size() != 0:
|
||||
return true
|
||||
if entity.conversation.size() == 0:
|
||||
return false
|
||||
return true
|
||||
|
||||
if entity.interactType == Entity.InteractType.TEST_BATTLE:
|
||||
if entity.interactType == Entity.InteractType.CUTSCENE:
|
||||
if entity.cutscene == null:
|
||||
return false
|
||||
if !entity.cutscene.canRun():
|
||||
return false
|
||||
return true
|
||||
|
||||
if entity.interactType == Entity.InteractType.ONE_TIME_ITEM:
|
||||
@@ -53,11 +58,9 @@ func onInteract(other:Entity) -> void:
|
||||
_onItemInteract(other)
|
||||
return
|
||||
|
||||
Entity.InteractType.TEST_BATTLE:
|
||||
Entity.InteractType.CUTSCENE:
|
||||
var cutscene:Cutscene = Cutscene.new()
|
||||
cutscene.addCallable(BattleStartAction.getStartBattleCallable({
|
||||
BATTLE.BattlePosition.RIGHT_TOP_FRONT: PartySingleton.PARTY_JOHN,
|
||||
}))
|
||||
entity.cutscene.queue(cutscene)
|
||||
cutscene.start()
|
||||
return
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://d0ywgijpuqy0r"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://d0ywgijpuqy0r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://xe6pcuq741xi" path="res://overworld/map/TestMap.gd" id="1_6ms5s"]
|
||||
[ext_resource type="PackedScene" uid="uid://cluuhtfjeodwb" path="res://overworld/map/TestMapBase.tscn" id="1_ox0si"]
|
||||
[ext_resource type="PackedScene" uid="uid://by4a0r2hp0w6s" path="res://overworld/entity/Entity.tscn" id="2_jmygs"]
|
||||
[ext_resource type="Script" uid="uid://yn7kxdargafx" path="res://cutscene/conversation/ConversationResource.gd" id="3_p7git"]
|
||||
[ext_resource type="Script" uid="uid://38ya6vphm5bu" path="res://item/ItemResource.gd" id="4_xf0pb"]
|
||||
[ext_resource type="Script" uid="uid://b5c8g5frishjs" path="res://cutscene/cutscene/TestCutscene.gd" id="5_125nt"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xf0pb"]
|
||||
script = ExtResource("3_p7git")
|
||||
@@ -18,6 +19,10 @@ item = 1
|
||||
quantity = 1
|
||||
metadata/_custom_type_script = "uid://38ya6vphm5bu"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_tr4a0"]
|
||||
script = ExtResource("5_125nt")
|
||||
metadata/_custom_type_script = "uid://b5c8g5frishjs"
|
||||
|
||||
[node name="TestMap" type="Node3D"]
|
||||
script = ExtResource("1_6ms5s")
|
||||
|
||||
@@ -33,6 +38,12 @@ entityId = "ad5a1504-7fbf-45d6-b1bf-6e7af6314066"
|
||||
interactType = 2
|
||||
oneTimeItem = SubResource("Resource_125nt")
|
||||
|
||||
[node name="NotPlayer3" parent="." instance=ExtResource("2_jmygs")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.29413, 1.11219, 1.45094)
|
||||
entityId = "ad5a1504-7fbf-45d6-b1bf-6e7af6314066"
|
||||
interactType = 3
|
||||
cutscene = SubResource("Resource_tr4a0")
|
||||
|
||||
[node name="TestMapBase" parent="." instance=ExtResource("1_ox0si")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_jmygs")]
|
||||
|
||||
@@ -17,8 +17,8 @@ config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
PAUSE="*res://singleton/Pause.gd"
|
||||
TRANSITION="*res://singleton/Transition.tscn"
|
||||
PAUSE="*res://scene/Pause.gd"
|
||||
TRANSITION="*res://scene/Transition.tscn"
|
||||
QUEST="*res://quest/Quest.tscn"
|
||||
OVERWORLD="*res://overworld/Overworld.gd"
|
||||
SCENE="*res://scene/Scene.gd"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c8shl8u156rfi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dfpml5awf5i35" path="res://singleton/Load.gd" id="1_a3iwn"]
|
||||
[ext_resource type="Script" uid="uid://dfpml5awf5i35" path="res://scene/Load.gd" id="1_a3iwn"]
|
||||
|
||||
[node name="Load" type="Node"]
|
||||
script = ExtResource("1_a3iwn")
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://i4ukelrrsujw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://iu3m73wtjlho" path="res://singleton/Transition.gd" id="1_isjic"]
|
||||
[ext_resource type="Script" uid="uid://iu3m73wtjlho" path="res://scene/Transition.gd" id="1_isjic"]
|
||||
|
||||
[node name="Transition" type="Control"]
|
||||
layout_mode = 3
|
||||
@@ -1 +0,0 @@
|
||||
uid://cxx6dl53tc5ym
|
||||
Reference in New Issue
Block a user