Make TreePrototype inherit from EntityWithOwner.

Things that we aren't going to implement
MichaelMichael
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Nov 21, 2024 11:44 pm
Contact:

Make TreePrototype inherit from EntityWithOwner.

Post by MichaelMichael »

Tree prototype currently inherits from EntityWithHealth only, plants the player are farming are inherited from trees.
Plants as entities can never be modded to have a quality value due to this.

While I appreciate devs don't want quality plantables on base game, it should be at least _possible_ to mod in. Currently the only way to mod in quality tree mechanics is with a custom assembler. (see my quality seeds mod), which is unable to use the agricultural tower mechanic at all.

Proposed for Plants to inherit from EntityWithOwner somehow, so they can be planted with quality. Or for Quality to updated internally such that it also can affect plant entities as well as EntityWithOwner.

Cheers
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3463
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Make TreePrototype inherit from EntityWithOwner.

Post by boskid »

As the title is stated, that is a Wont implement.

Reasons why Tree will not inherit from EntityWIthOwner:
1/ EntityWithOwner adds couple of data: it binds entity to a specific force, it knows who was last touching it, knows the quality of entity, gets a unit number assigned and can become a military target. That is already 16 extra bytes. Given how many trees are usually in every save file, this is a little bit too much.
2/ EntityWithOwner would make trees belong to a specific force. That would mean trees would become only deconstructible by players that belong to that force. That reason alone makes this a wont implement.

You are incorrect thinking that entity must be an EntityWIthOwner to support quality: there are other entities that support quality (ArtilleryFlare, ArtilleryProjectile, Beam, Projectile, SmokeWithTrigger, Sticker) while not being based on EntityWithOwner. It is possible to add support for quality without making trees inherit from EntityWithOwner.

Two months ago just for fun i did a quick and dirty tree quality support for lulz and that is what i got back then:
12-19-2024, 02-12-28.png
12-19-2024, 02-12-28.png (2.27 MiB) Viewed 279 times
MichaelMichael
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Nov 21, 2024 11:44 pm
Contact:

Re: Make TreePrototype inherit from EntityWithOwner.

Post by MichaelMichael »

Thanks so much for the explanation, that all makes sense, and your quite right I didn't realise that quality was supported on other entities that weren't EntityWithOwner.

A small follow-up:
Would it be possible for you to lead me in the direction of some resource that shows how you achieved your "quick and dirty add quality support to trees"... I have been trying to figure it out for a while now, and simply wanted to add it to plants such that agricultural towers plant quality trees.
(As that is the core request of my post).
I always hoping it'd be as simply as adding in some flag somewhere to activate quality, or add the PlantPrototype to a quality list somewhere?
Anyway, even just a short quip as to the steps/methods you took would be appreciated.

Cheers!
Post Reply

Return to “Won't implement”