Two types - multiple inheritance?

Place to get help with not working mods / modding interface.
Theanderblast
Inserter
Inserter
Posts: 46
Joined: Fri Aug 19, 2016 2:48 pm
Contact:

Two types - multiple inheritance?

Post 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!
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5413
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Two types - multiple inheritance?

Post 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
Theanderblast
Inserter
Inserter
Posts: 46
Joined: Fri Aug 19, 2016 2:48 pm
Contact:

Re: Two types - multiple inheritance?

Post by Theanderblast »

Thanks, I'll check that out!
Theanderblast
Inserter
Inserter
Posts: 46
Joined: Fri Aug 19, 2016 2:48 pm
Contact:

Re: Two types - multiple inheritance?

Post 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.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5413
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Two types - multiple inheritance?

Post 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
Post Reply

Return to “Modding help”