#145 - the extractor quest could never be completed. Extractors are placed onto a planet from space and live in GameState.extractors, with their own position, stock and id; they are not in `buildings`. So the goal asked has_building_of_type("extractor"), which is false however many the player builds. Not the death the reporter guessed at - the quest was simply asking a question that had no yes. structure_exists() is the question anything wanting "does the player have one of these" should ask, and the quest model asks it now. The regression test builds every structure quest's target THE WAY THE GAME BUILDS IT and watches the goal flip, rather than knowing which array each one lands in - the knowing is what got this wrong in the first place. #144 - the build menu's status line is anchored to the top of the panel and its grid to the panel's centre, so the gap between the two is half the panel height. It was a written-down constant, correct only at 1280 tall; at 1080 the grid started four pixels ABOVE the status line and drew through it. Nothing about that geometry is written against a screen size any more. The band is measured from the header that is actually there, the pitch closes up to fit it (never below a row's own height, which is what makes overlap impossible rather than unlikely), and the column count rises until the rows fit - so a short window gets a wide grid instead of one running off the bottom. Ten structures now lay out as 5 columns at 900px tall, 4 at 1080, 3 at 1280 and 2 at 1600, clearing the header at every one, which is what the test walks. #143 - a hangar caption is "Gas Bomber\n2 available": two lines before autowrap and three after it in a narrow column, at a size fixed in the scene. Labels do not clip by default, so the third line was drawn over the icon of the row below. The size is fitted to the box the layout works out, and the box clips - the first keeps it legible, the second keeps it correct however the vessel names grow. Its box also overhung by exactly HANGAR_LABEL_GAP: the layout subtracted one gap where it needed two, above the caption and below it. Two pixels, but two pixels inside the next row's icon.
This commit is contained in:
parent
90c34f6c74
commit
2206b55873
5 changed files with 267 additions and 55 deletions
|
|
@ -2097,6 +2097,24 @@ func has_building_of_type(type: String) -> bool:
|
|||
return false
|
||||
|
||||
|
||||
# Whether a structure of this type exists ANYWHERE, however it is stored.
|
||||
#
|
||||
# #145: extractors are not in `buildings`. They are placed onto a planet from
|
||||
# space and live in `extractors`, with their own position, their own stock
|
||||
# and their own id - so has_building_of_type("extractor") is false no matter
|
||||
# how many the player has built. The quest that asks for one (#133) was
|
||||
# asking a question that could never be answered yes, and no amount of
|
||||
# building extractors was going to finish it.
|
||||
#
|
||||
# Anything asking "does the player have one of these" wants THIS, and
|
||||
# has_building_of_type() only where the answer really is about the
|
||||
# `buildings` list itself.
|
||||
func structure_exists(type: String) -> bool:
|
||||
if type == BUILDING_EXTRACTOR:
|
||||
return not extractors.is_empty()
|
||||
return has_building_of_type(type)
|
||||
|
||||
|
||||
func remove_buildings_of_type(type: String) -> int:
|
||||
var kept: Array = []
|
||||
var removed_hub_ids: Array = []
|
||||
|
|
@ -3032,7 +3050,7 @@ func quest_progress(quest: Dictionary) -> Vector2i:
|
|||
return Vector2i(mini(available_resource(String(goal.get("resource",
|
||||
RESOURCE_ORE))), want), want)
|
||||
QUESTS.GOAL_BUILDING:
|
||||
return Vector2i(1 if has_building_of_type(String(goal.get("building", ""))) else 0, 1)
|
||||
return Vector2i(1 if structure_exists(String(goal.get("building", ""))) else 0, 1)
|
||||
QUESTS.GOAL_FLEET_VESSEL:
|
||||
var need: int = int(goal.get("count", 1))
|
||||
return Vector2i(mini(vessel_count_in_fleet(String(goal.get("vessel", ""))),
|
||||
|
|
|
|||
Loading…
Reference in a new issue