Skip to content

Direct Access To Element Objects #34

Open
@samdeane

Description

@samdeane

(originally posted here)

It seems fairly crazy that we can iterate the core to get basic information about the id, type, etc of each element (using getElementIdList(), getElementNameById, ...), but we can't get the actual element objects that way. We have to link them, then access the named variables connected with each link. If we want to iterate all linked elements, we have to build our own table and write manual code to add the elements to it.
That doesn't make a lot of sense!

I would suggest deprecating most of the existing API, and just having two element related methods:

  • getElementIdList() -- return a list of the ids of all elements in this core
  • getElementById(uid) -- return the element object for the given element

All other properties can then be read from the existing element API:

  • getElementClass()
  • getHitPoints()
  • getMaxHitPoints()
  • getMass()
    etc...

A few element API additions would be good:

  • getName()
  • setName(newName)
  • getSize() -- return the size (xs, s, m, l, xl)
  • getPosition() -- position in construct local coordinates
  • getOrientation() -- orientation in construct local coordinates

Metadata

Metadata

Assignees

No one assigned

    Labels

    NQ-COMMENTEDThis issue or pull request already existsenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions