Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Technology Menu #334

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Implement Technology Menu #334

wants to merge 2 commits into from

Conversation

BrickPi
Copy link
Contributor

@BrickPi BrickPi commented Dec 21, 2024

  • Implements the Technology Menu
  • Adds _make_modifier_effect_tooltip for single modifiers

@Spartan322 Spartan322 added the enhancement New feature or request label Dec 21, 2024
@BrickPi BrickPi requested a review from Hop311 December 21, 2024 21:17
@BrickPi BrickPi force-pushed the topbar-tech branch 2 times, most recently from 891c6c1 to 0f67b06 Compare February 1, 2025 22:07
@BrickPi BrickPi changed the title Implement Technology Schools and Technology Folders Implement Technology Menu Feb 1, 2025
@BrickPi BrickPi force-pushed the topbar-tech branch 2 times, most recently from cae21ea to 6b9a012 Compare February 2, 2025 22:44
@BrickPi BrickPi force-pushed the topbar-tech branch 2 times, most recently from 0375be8 to 1a82237 Compare February 3, 2025 00:38
Comment on lines +116 to +120
add_gui_element("country_technology", "tech_group")

var area_node : Node = get_node(^"./tech_group")

area_node.reparent(root_node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than generating at the top level and reparenting, you can use GUINode.generate_gui_element, store the result in a variable, and then add_child it to the desired parent if it's not null (applies to similar cases throughout this file)

Comment on lines 209 to 210
main_icon.mouse_filter = Control.MOUSE_FILTER_PASS
main_icon.set_tooltip_string(mod_tooltips[i])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_tooltip_string automatically changes mouse filter to PASS if it's currently IGNORE, so the change above isn't necessary unless you're changing it from something other than IGNORE

Comment on lines 226 to 237
_current_research_progressbar.set_tooltip_string_and_substitution_dict(
tr("TECHNOLOGYVIEW_RESEARCH_TOOLTIP") + "\n" +
tr("TECHNOLOGYVIEW_RESEARCH_INVESTED_TOOLTIP") +
MenuSingleton.get_tooltip_separator() +
info.get("current_research_effect_tt", ""),
{
"TECH": tr(current_research),
"DATE": info.get("current_research_finish_date", "1836.1.1"),
"INVESTED": info.get("current_research_invested", 0),
"COST": info.get("current_research_cost", 0)
}
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already generate the top half of this tooltip here, so you could separate out that code into a helper function under MenuSingleton then store its result in the info dictionary rather than passing up all the constituent parts

@Hop311
Copy link
Contributor

Hop311 commented Feb 3, 2025

Also you'll probably have to rebase onto master to account for the submodule already being updated

@Hop311
Copy link
Contributor

Hop311 commented Feb 7, 2025

Also needs for techs:

  • Allow <building>
  • Activate: <good> (based on output of production type of enabled buildings)
  • Allows construction of <unit>
  • Changes unit appearance (when optional unit_variant is set)

And for inventions:

  • Allows <crime>
  • Allows construction of <unit>
  • Allows <building>
  • Activate: <good> (based on output of production type of enabled buildings)
  • Can use Gas Attack / Can defend against Gas Attack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants