[solved] Entity prototype without placing entity?

Place to get help with not working mods / modding interface.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

[solved] Entity prototype without placing entity?

Post 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?
Last edited by aubergine18 on Thu Oct 20, 2016 11:25 pm, edited 2 times in total.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

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

Post by Supercheese »

I believe the table game.entity_prototypes is indexed by prototype name. So game.entity_prototypes["prototype-name"] should work for ya.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [solved] Entity prototype without placing entity?

Post by aubergine18 »

Yup, that's exactly what I want :)
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Post Reply

Return to “Modding help”