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
In an ideal world, it would be possible to also set position and orientation, to actually reconfigure constructs dynamically. This could result in illegal placements, however, so perhaps would not be a good idea.
Cores And Elements
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:
All other properties can then be read from the existing element API:
A few element API additions would be good:
In an ideal world, it would be possible to also set position and orientation, to actually reconfigure constructs dynamically. This could result in illegal placements, however, so perhaps would not be a good idea.