62 lines
1.9 KiB
GDScript
62 lines
1.9 KiB
GDScript
class_name SupplyCatalog
|
|
extends RefCounted
|
|
|
|
## Explicit P1 tuning values. The existing raw_food -> basic_meal IDs and
|
|
## recipe remain compatible with facility data; cooking points/tableware are
|
|
## a later specification change, not silently introduced by this catalogue.
|
|
const RAW_FOOD := &"ingredient/raw_food"
|
|
const BASIC_MEAL := &"ingredient/basic_meal"
|
|
const RAW_TARGET := 8
|
|
const KITCHEN_TARGET_DEFAULT := 8
|
|
const KITCHEN_TARGET_MAX := 16
|
|
const BATCH_INPUT := 4
|
|
const BATCH_OUTPUT := 4
|
|
const PRODUCTION_MINUTES := 15
|
|
const PRODUCTION_PURPOSE := &"kitchen_production"
|
|
|
|
|
|
static func get_item(item_id: StringName) -> Dictionary:
|
|
match item_id:
|
|
RAW_FOOD:
|
|
return {
|
|
&"item_id": RAW_FOOD, &"display_name": "調理用食材",
|
|
&"unit_price": 3, &"unit_weight": 1, &"shelf_life_minutes": 1440,
|
|
&"purchasable": true,
|
|
}
|
|
BASIC_MEAL:
|
|
return {
|
|
&"item_id": BASIC_MEAL, &"display_name": "基本料理",
|
|
&"unit_price": 0, &"unit_weight": 1, &"shelf_life_minutes": 720,
|
|
&"purchasable": false,
|
|
}
|
|
return {}
|
|
|
|
|
|
static func get_purchase_items() -> Array[Dictionary]:
|
|
return [get_item(RAW_FOOD)]
|
|
|
|
|
|
static func storage_capacity(definition_id: StringName) -> int:
|
|
match definition_id:
|
|
&"warehouse": return 100
|
|
&"kitchen": return 40
|
|
&"cafeteria": return 24
|
|
return 0
|
|
|
|
|
|
static func get_recipe() -> Dictionary:
|
|
return {
|
|
&"input_item_id": RAW_FOOD, &"input_quantity": BATCH_INPUT,
|
|
&"output_item_id": BASIC_MEAL, &"output_quantity": BATCH_OUTPUT,
|
|
&"duration_minutes": PRODUCTION_MINUTES, &"minimum_staff": 1,
|
|
}
|
|
|
|
|
|
## All physical stacks, including reserved/expired goods, occupy storage until
|
|
## the inventory owner actually removes them.
|
|
static func inventory_weight(inventory: InventoryService, inventory_id: StringName) -> int:
|
|
var total := 0
|
|
for stack: Dictionary in inventory.get_stacks(inventory_id):
|
|
total += int(stack[&"quantity"]) * int(stack[&"unit_weight"])
|
|
return total
|