Skip to content

Unit art implementation that also supports variations and pedia icons#915

Open
stavrosfa wants to merge 1 commit intoC7-Game:Developmentfrom
stavrosfa:feature/unit-art-and-variations
Open

Unit art implementation that also supports variations and pedia icons#915
stavrosfa wants to merge 1 commit intoC7-Game:Developmentfrom
stavrosfa:feature/unit-art-and-variations

Conversation

@stavrosfa
Copy link
Contributor

This PR tackles something that was discussed a few months ago on discord, Unit art.

This is by no means how the final product should look like, it's rather a step towrads it.

In short this PR does the following:

  1. Parses the PediaIcons.txt for the game/scenario, extracts the Unit art, the unit's icon indexes, and pedia entries, and creates an Art object that contains all the art for each unit.
  2. This includes variations for Eras, the captured worker textures, and Leader/Army textures. Workers/Settlers change their textures dynamically if we enter the next Era (usually Industrial).
  3. The only thing that is not covered are Scientific Leaders, but I have left some relevant TODOs.
  4. The Science Advisor is also updated as a consequence of this to show the unit icons.

I tested this with .sav, .biq and .json, everything seemed to be in order

Let me know what you think on the proposed scheme for the art.

As I said, this doesn't need to remain as is in the future, as we can incorporate the INI details, custom animation details, etc, and finally even detach the whole Art json from the main json and have it as a separate one, but I think it's a good first step.

Also, this PR has a dependency on C7-Game/Assets#3


function unit_icons:map_object_to_sprite(unit_prototype)
if (unit_prototype:GetType().Name ~= "UnitPrototype") then
local function isKeyInDictionary(dict, targetKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

If dict behaves like a regular Lua table, this function can be replaced by a one-liner: dict and dict[targetKey]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants