[0.12.33] scale can be set to a table

Bugs that are actually features.
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

[0.12.33] scale can be set to a table

Post by keyboardhack »

When setting the scale of an animation like this

Code: Select all

{
      filename = "__base__/graphics/entity/steam-engine/steam-engine-horizontal.png",
      width = 246,
      height = 137,
      frame_count = 32,
      line_length = 8,
      shift = {1.34, -0.06},
      scale = {r=0.545, g=0.271, b=0.075, a=1.0},
      tint = {r=0.545, g=0.271, b=0.075, a=1.0}
}
an error would be expected because the scale is a number and not a table but the game doesn't throw an error as expected. This is a problem when other mods try to use the scale value as it's now a table istead of a number.

made a little mod that sets the scale to a table.
scaleBug_1.0.0.zip
(1.12 KiB) Downloaded 81 times
Waste of bytes : P
Rseding91
Factorio Staff
Factorio Staff
Posts: 15900
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.33] scale can be set to a table

Post by Rseding91 »

That's just how Lua works. We don't do validation of any of the data in the data.raw table until all mods are finished processing. Yell at whoever puts bad data in it :)
If you want to get ahold of me I'm almost always on Discord.
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: [0.12.33] scale can be set to a table

Post by keyboardhack »

Rseding91 wrote:That's just how Lua works. We don't do validation of any of the data in the data.raw table until all mods are finished processing. Yell at whoever puts bad data in it :)
That makes sense when loading other mods afterwards, but shouldn't factorio throw an error if scaleBug was used as a standalone mod? As it's right now the mod is loaded without a problem but as i understand it factorio should complain about the incorrect type.

If i try to set the name of an entity equal an table then i get this error when loading the game:

Code: Select all

PANIC: unprotected error in call to LUA API (bad argument #-1 (string expected, got table))
Shouldn't i expect something similar when the scale is set to a table?
Waste of bytes : P
Rseding91
Factorio Staff
Factorio Staff
Posts: 15900
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.33] scale can be set to a table

Post by Rseding91 »

"scale" is not a valid property that animations use so it never gets read on the game engine side.
If you want to get ahold of me I'm almost always on Discord.
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: [0.12.33] scale can be set to a table

Post by keyboardhack »

I am pretty sure it's a valid property. Just so we are on the same page i am talking about this property https://wiki.factorio.com/index.php?tit ... tion#scale.
I have used it myself in mods so i know it changes the scale of an object.
Waste of bytes : P
Rseding91
Factorio Staff
Factorio Staff
Posts: 15900
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.33] scale can be set to a table

Post by Rseding91 »

keyboardhack wrote:I am pretty sure it's a valid property. Just so we are on the same page i am talking about this property https://wiki.factorio.com/index.php?tit ... tion#scale.
I have used it myself in mods so i know it changes the scale of an object.
Ah, I was looking at a different type of animation.

The scale in that instance ends up as a table meaning it doesn't show up when the sprite parameters look for "scale" as a property. As a result it uses the default value of 1.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”