[0.15.25] surface.create_entity{variation=...} zero based

This subforum contains all the issues which we already resolved.
Post Reply
gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

[0.15.25] surface.create_entity{variation=...} zero based

Post by gheift »

Hi,

if a entity is created with

Code: Select all

local entity = surface.create_entity{variation=...}
variation is started at 0. Changing it later with

Code: Select all

entity.graphics_variation=...
variation is started at 1.

Additionally one is able to assign values from 0 to 255 (inclusive) to variation in create_entity, but values from 0 to 65535 (inclusive) to graphics_variation.

Kind regards,
Gerhard

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.25] surface.create_entity{variation=...} zero based

Post by Rseding91 »

Thanks for the report. I've changed it so variation in create_entity is 1 based to match the API.

As for the allowed values: it internally down-converts the given value to 0-255 after converting it from 1 based to 0 based. Adding error handling when it's not within that range doesn't seem worth the time it would take since functionally it would be the same.
If you want to get ahold of me I'm almost always on Discord.

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: [0.15.25] surface.create_entity{variation=...} zero based

Post by gheift »

Rseding91 wrote:Thanks for the report. I've changed it so variation in create_entity is 1 based to match the API.

As for the allowed values: it internally down-converts the given value to 0-255 after converting it from 1 based to 0 based. Adding error handling when it's not within that range doesn't seem worth the time it would take since functionally it would be the same.
Thanks for fixing. There is already error handling in place (at least I threw errors in both cases), so I do not understand that you don't want to add handling if its already there.

Kind regards,
Gerhard

Post Reply

Return to “Resolved Problems and Bugs”