Open
Description
(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