Page 1 of 1

[solved] Entity prototype without placing entity?

Posted: Thu Oct 20, 2016 11:21 pm
by aubergine18
EDIT: LuaGameScript.entity_prototypes

My mods remote interface allows other mods to register certain entities with it, but I need to validate their prototype values to ensure they are set correctly (otherwise throw an error so the mod author can make required changes).

Problem is, it appears that I can only access the prototype of entities already placed on map - I don't really want to place an entity just so I can read its prototype then destroy it.

Is there a way to access prototype for an entity by it's name, rather than an actual instance of it on the map?

Re: Entity prototype (control.lua) without placing entity?

Posted: Thu Oct 20, 2016 11:24 pm
by Supercheese
I believe the table game.entity_prototypes is indexed by prototype name. So game.entity_prototypes["prototype-name"] should work for ya.

Re: [solved] Entity prototype without placing entity?

Posted: Thu Oct 20, 2016 11:25 pm
by aubergine18
Yup, that's exactly what I want :)