Both halves of the ticket, in the shape vessels have used since gas bombers and laser ships: a definition carries an ore figure and, when it wants more than ore, a dictionary that IS the price. `building_costs()` and `skill_costs()` answer it the way `product_costs()` already did, so there is one question with one answer whatever is being bought, and every payment path now goes through `spend_resources` rather than `spend`. Seven of ten structures and thirteen of seventeen doctrines now want gas, energy or dark matter alongside their rocks, and the totals climb with tree depth - structures 16/31/58/62/96 by depth, doctrines 15/30/73/96/143/258/530. The constraint that shaped the table is REACHABILITY, and it is the reason some prices stayed ore-only. Energy exists only where a gas burner stands, and a gas burner needs Power Systems - so nothing at or before that depth may be priced in energy, or it is a wall with no way through. Dark matter is rarer still and appears once, on the deepest node in the game. The extractor stays rocks-only despite its depth allowing gas, because the quest chain reaches it before it has sent the player for any. test_progressive_costs checks those as properties rather than transcribing the numbers, so rebalancing a price costs nothing while breaking the shape fails: nothing unreachable at its own depth, prices rising with depth, the ore field agreeing with the dictionary (repairs quote the field alone, since a repair drone carries ore and nothing else), and the quest chain never asking for a structure it has not funded. Two things cleaned up on the way: - The per-building cost constants in GameState are gone. Nothing but tests used them, and they were a second copy of a number the definitions already hold - exactly what would drift once a price gained a resource. - research_for_building() returns a display NAME, and the id-keyed half of the tree wants an id. That mix-up is silent - skill_depth() of a name finds no node and answers 0, so a deep structure reads as an ungated one, which is how the first draft of the test let an unreachable price through. research_node_for_building() is the id, and the name is expressed from it. PriceTag no longer rebuilds its labels when re-told the same price; it refreshes the held figures instead. The craft menu re-states prices every frame and the build menu now does too, so that was a dozen Labels being torn down and rebuilt sixty times a second.
35 lines
1.2 KiB
Text
35 lines
1.2 KiB
Text
[gd_resource type="Resource" script_class="BuildingDefinition" format=3 uid="uid://cia6vbju65sbe"]
|
|
|
|
[ext_resource type="Script" uid="uid://d10s0frtxiw62" path="res://buildings/BuildingDefinition.gd" id="1"]
|
|
[ext_resource type="PackedScene" path="res://buildings/GasBurnerBuildingVisual.tscn" id="2"]
|
|
[ext_resource type="Script" uid="uid://cydp18abylrgd" path="res://buildings/BuildingLogisticsProfile.gd" id="3"]
|
|
|
|
[sub_resource type="Resource" id="Resource_logistics"]
|
|
script = ExtResource("3")
|
|
input_buffers = {
|
|
"gas": 40
|
|
}
|
|
collected_outputs = PackedStringArray("energy")
|
|
conversion_input = "gas"
|
|
conversion_output = "energy"
|
|
conversion_rate = 1.0
|
|
conversion_yield = 2
|
|
|
|
[resource]
|
|
script = ExtResource("1")
|
|
definition_id = "gas_burner"
|
|
display_name = "Gas Burner"
|
|
description = "Burns gas into energy at its own site. Hub transporters keep it stocked with gas and collect the energy it makes."
|
|
cost = 40
|
|
build_resource_costs = {"ore": 40, "gas": 22}
|
|
action_icon = 33
|
|
menu_icon = 33
|
|
visual_scene = ExtResource("2")
|
|
capabilities = PackedStringArray("gas_burner")
|
|
logistics = SubResource("Resource_logistics")
|
|
map_color = Color(0.95, 0.35, 0.15, 1)
|
|
map_sides = 5
|
|
menu_button_name = "GasBurnerButton"
|
|
menu_label_name = "GasBurnerLabel"
|
|
menu_cost_name = "GasBurnerCost"
|
|
max_hp = 60
|