Skip to content

API to access item stats (both with and without talents) #54

@matpratta

Description

@matpratta

So the idea here would be adding two new functions: construct.getElementStats(id) and system.getItemStats(id).

They would work in a very similar way to each other, except the construct.getElementStats function would receive a local element id and return the element's stats with any handling talents applied, while system.getItemStats would receive the actual item id and return the base stats for that item.

Those stats would be the same as we can see when we right-click and select "Inspect" on some element:
image

Basically, this would match a Lua table like this:

{
  maxThrust = 2160000,
  warmupTime = 8,
  worksInAtmosphere = true,
  worksInSpace = false,
  fuelConsumption = 3981,
  antimatterResistance = 0.4,
  electromagneticResistance = 0.4,
  kinecticResistance = 0.3,
  thermicResistance = 0.3,
  volume: 3355.4,
  mass: 17000,
}

Those values are the base ones (system.getItemStats) but when calling them via construct.getElementStats we should get them corrected with any handling talents (piloting talents could help too, but would probably mean more complexity, so I'm not sure on that one).

This would allow for the creation of in-game item catalogs and even ship design tools, without the need of hardcoding every single element or having to manually input talent values either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions