feat(items): add ChestItemData resource and RoomChestConfig static config
TDD: 4 tests written first (FAIL), then implemented — all 151 tests pass.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
## ChestItemData — configuration for a single item slot inside a RoomChest.
|
||||
class_name ChestItemData extends Resource
|
||||
|
||||
@export var item_id: String = ""
|
||||
@export var item_type: String = "holdable"
|
||||
@export var outfit_layer: int = 1
|
||||
@export var spawn_offset: Vector2 = Vector2.ZERO
|
||||
@@ -0,0 +1,100 @@
|
||||
## RoomChestConfig — static item configuration for all room chests.
|
||||
## Maps chest_id strings to ChestItemData arrays. No assets needed: item_id strings only.
|
||||
class_name RoomChestConfig
|
||||
|
||||
|
||||
static func get_items(chest_id: String) -> Array[ChestItemData]:
|
||||
match chest_id:
|
||||
"reception_desk":
|
||||
return _make([
|
||||
["clipboard", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["pen", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["bandage", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"giftshop_shelf":
|
||||
return _make([
|
||||
["gift_box", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["ribbon", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["balloon", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"restaurant_counter":
|
||||
return _make([
|
||||
["teacup", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["plate", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["spoon", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"emergency_cabinet":
|
||||
return _make([
|
||||
["bandage_roll", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["syringe", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["ice_pack", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"xray_cabinet":
|
||||
return _make([
|
||||
["xray_sheet", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["lead_apron", "outfit", 1, Vector2(0.0, -80.0)],
|
||||
["marker", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"pharmacy_medicine":
|
||||
return _make([
|
||||
["pill_bottle", "holdable", 1, Vector2(-50.0, -60.0)],
|
||||
["syrup", "holdable", 1, Vector2(50.0, -60.0)],
|
||||
])
|
||||
"pharmacy_tools":
|
||||
return _make([
|
||||
["mortar", "holdable", 1, Vector2(-50.0, -60.0)],
|
||||
["spatula", "holdable", 1, Vector2(50.0, -60.0)],
|
||||
])
|
||||
"lab_bench":
|
||||
return _make([
|
||||
["test_tube", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["pipette", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["microscope_slide", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"patient_cabinet":
|
||||
return _make([
|
||||
["thermometer", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["stethoscope", "outfit", 2, Vector2(0.0, -80.0)],
|
||||
["pillow", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"ultrasound_cart":
|
||||
return _make([
|
||||
["gel_tube", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["probe", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["towel", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"delivery_cabinet":
|
||||
return _make([
|
||||
["swaddle", "outfit", 1, Vector2(-70.0, -60.0)],
|
||||
["scissors", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["cord_clamp", "holdable", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"nursery_shelf":
|
||||
return _make([
|
||||
["bottle", "holdable", 1, Vector2(-70.0, -60.0)],
|
||||
["rattle", "holdable", 1, Vector2(0.0, -80.0)],
|
||||
["blanket", "outfit", 1, Vector2(70.0, -60.0)],
|
||||
])
|
||||
"garden_table":
|
||||
return _make([
|
||||
["teapot", "holdable", 1, Vector2(-50.0, -60.0)],
|
||||
["cake", "holdable", 1, Vector2(50.0, -60.0)],
|
||||
])
|
||||
"garden_storage":
|
||||
return _make([
|
||||
["confetti", "holdable", 1, Vector2(-50.0, -60.0)],
|
||||
["party_hat", "outfit", 1, Vector2(50.0, -60.0)],
|
||||
])
|
||||
return []
|
||||
|
||||
|
||||
static func _make(data: Array) -> Array[ChestItemData]:
|
||||
var result: Array[ChestItemData] = []
|
||||
for entry: Array in data:
|
||||
var d: ChestItemData = ChestItemData.new()
|
||||
d.item_id = entry[0]
|
||||
d.item_type = entry[1]
|
||||
d.outfit_layer = entry[2]
|
||||
d.spawn_offset = entry[3]
|
||||
result.append(d)
|
||||
return result
|
||||
Reference in New Issue
Block a user