Skip to content

JS: count*() and enum*() inconsistencies #4656

@aubergineagain

Description

@aubergineagain

There are some annoying differences/omissions between count*() functions and enum*() functions... Would it be possible to make these more consistent?

enumDroid() / countDroid()

enumDroid()

  • player param doesn't support ALL_PLAYERS, ALLIES or ENEMIES constants.

countDriod()

  • player param doesn't support ALL_PLAYERS, ALLIES or ENEMIES constants.
  • droidType param doesn't support all types, resulting in scripts falling back to slower enumDroid(...).length
  • Missing viewer param.

enumStruct() / countStruct()

Their parameters are reversed: countStruct(struct, player), vs. enumStruct(player, struct) - this keeps tripping me up, but I can't see any viable way to resolve that at this point without breaking lots of stuff :/

enumStruct()

  • player param doesn't support ALL_PLAYERS, ALLIES or ENEMIES constants.

countStruct()

  • Can't use stattype constants as filter which is hugely limiting
  • Missing viewer param. Adding this param would be extremely useful for AIs (eg. see isFullBase() method in bonecrusher's functions.js)

enumFeature() / countFeature()

enumFeature()

  • Not able to use stattype to filter, eg. OIL_DRUM or ARTIFACT

countFeature()

  • Missing function. It would be useful to count oil resources in particular.

enumRange() / countRange()

countRange()

  • Missing function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions