Page 1 of 1

Two types - multiple inheritance?

Posted: Thu May 18, 2017 1:07 pm
by Theanderblast
I'm trying to make a powered floor mod, so I want my prototype to have both type = "electric-pole" and type = "tile" features. I assume there is no type ="electric-pole, tile" syntax. So I started with type = "electric-pole" and tried to add concrete-y bits to it, but I suspect I need to make my powered-floor based on something higher up the tree - like "item".

Is there lua code somewhere that I can copy that implements these two types (which I think of as base classes) ? Is there a reference for what the types themselves actually are? I see examples of types in the base code, but haven't seen any type definitions.

Apologies if this has been answered previously, my searching of the forum for this wasn't fruitful.

Also, if someone has already done this mod, let me know!

Re: Two types - multiple inheritance?

Posted: Thu May 18, 2017 1:53 pm
by Klonan
It isn't possible for a single entity to have behaviors of two types of entity,

However it is possible to use scripting to create seperate entities when a single one is created, so called 'compound entities',
Such as this mod:

https://mods.factorio.com/mods/Klonan/Concrete_Lamppost

Re: Two types - multiple inheritance?

Posted: Thu May 18, 2017 7:31 pm
by Theanderblast
Thanks, I'll check that out!

Re: Two types - multiple inheritance?

Posted: Fri May 19, 2017 1:13 pm
by Theanderblast
Those are sweet looking lampposts, by the way! Nice artwork!

Note - get rid of the spaces around the = signs in your locale.cfg.

Re: Two types - multiple inheritance?

Posted: Fri May 19, 2017 6:50 pm
by Klonan
Theanderblast wrote:Those are sweet looking lampposts, by the way! Nice artwork!

Note - get rid of the spaces around the = signs in your locale.cfg.
Right... serves me right for updating the lazy way