kevinresol / exp-ecs

Experimental macro-powered Entity-Component-System game engine
59 stars 5 forks source link

Made `name` public #4

Closed Jarrio closed 5 years ago

Jarrio commented 5 years ago

As far as I can see this variable should be usable in a public manner, otherwise I'm not sure what the intended purpose for this var is meant to be

kevinresol commented 5 years ago

It was put there mainly for debug purpose (it is returned in toString()) and not supposed to be "used". What are you planning to do with it?

kevinresol commented 5 years ago

and I expect it to be DCE'd in production where no toString() is called.

Jarrio commented 5 years ago

I was using it to categorise entities. So this.name = "bullet"; then use it in a system like

if (node.entities.name == "bullet") {}
kevinresol commented 5 years ago

Perhaps you want a Category component. The name field is really intended for debugging only.

Jarrio commented 5 years ago

That's fine, I thought it was an oversight and not an intention!

kevinresol commented 5 years ago

Perhaps I will just rename the field as alias so it looks less "useful"