Small documentation improvement requests

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
GlassBricks
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Jun 11, 2021 5:20 pm
Contact:

Re: Small documentation improvement requests

Post by GlassBricks »

It seems LocalisedString also allows boolean values (and even nil in many cases); this could be documented.

-> Thanks, this is clarified for the next release.

InappropriatePenguin
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Sep 13, 2021 6:53 pm
Contact:

Re: Small documentation improvement requests

Post by InappropriatePenguin »

LuaGameScript.delete_surface() (https://lua-api.factorio.com/latest/Lua ... te_surface)

This function appears to be similar to LuaSurface.delete_chunk() and LuaSurface.clear() in that it does not run immediately when called but rather appears to run either at the end of the current tick or some time in the next game tick. That is at least when it seems to raise its associated events.

I would suggest adding a note to its description to make that clear.


-> This is a good point. A proper system for documenting when an event fires is in the works, and should be ready soon, so I will not add a note for this single thing for now.

fredthedeadhead
Inserter
Inserter
Posts: 23
Joined: Mon Oct 18, 2021 6:13 pm
Contact:

Re: Small documentation improvement requests

Post by fredthedeadhead »

I think I've found some mis-typed fields:

[list=1]
[*] https://lua-api.factorio.com/latest/Con ... l#Position

Position x and y are documented as being ints, but when I get the player's position, it returns floating point numbers with decimal places.

Code: Select all

/c local p = game.player p.print(p.position.x.." "..p.position.y)  
-0.05078125, 46.48828125

[*] https://lua-api.factorio.com/latest/Lua ... ce.daytime

LuaSurface.daytime is documented as a float, but is actually a double.
[/list]


-> Thanks for the hints, both of these are fixed for the next release.

InappropriatePenguin
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Sep 13, 2021 6:53 pm
Contact:

Re: Small documentation improvement requests

Post by InappropriatePenguin »

LuaEntity.damage(damage, force, type, dealer)
[https://lua-api.factorio.com/latest/Lua ... ity.damage]

It appears that the `dealer` entity must be located on the same surface as the entity being damaged, or it will raise an error. Perhaps this can be mentioned, either in the parameter description or as a note next to "Can only be used if this is EntityWithHealth"?


-> Noted for the next release, thanks.

User avatar
JohnTheCF
Burner Inserter
Burner Inserter
Posts: 19
Joined: Thu Jun 22, 2017 7:15 pm
Contact:

Re: Small documentation improvement requests

Post by JohnTheCF »

https://wiki.factorio.com/Types/MapGenP ... c_settings

`autoplace_settings` just has type of table and there is no explanation what its structure is supposed to be.


-> Thank you for pointing this out. The explanation for this from the runtime docs has now also been added to the wiki.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1276
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Small documentation improvement requests

Post by Pi-C »

https://lua-api.factorio.com/1.1.49/LuaEntity.html#LuaEntity.destructible wrote: destructible :: boolean [Read/Write]

When the entity is not destructible it can't be damaged.
I've neglected this flag so far because its effect seemed to be the same as giving an entity full resistance against all damage types. However, a posting by posila let me realize that setting this flag set to false will prevent enemy units and turrets from attacking this unit (if the flag is set to true, they may attack it although they can't damage it). I'd suggest changing the description to

Code: Select all

 destructible :: boolean [Read/Write]

When the entity is not destructible it can't be damaged and won't be automatically attacked.
-> Thanks, clarified for the next release.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

-DeadlyKitten
Inserter
Inserter
Posts: 37
Joined: Sat Dec 14, 2019 3:26 am
Contact:

Re: Small documentation improvement requests

Post by -DeadlyKitten »

the page https://wiki.factorio.com/Types/SpawnPoint
lists this
Types/SpawnPoint ... evolution_factor or 1 ... spawn_weight or 2
in testing however i found that it is called weight not spawn_weight

-> It's called spawn_weight in the data stage (which is what the wiki page is about) and weight during runtime (https://lua-api.factorio.com/latest/Con ... Definition).

fredthedeadhead
Inserter
Inserter
Posts: 23
Joined: Mon Oct 18, 2021 6:13 pm
Contact:

Re: Small documentation improvement requests

Post by fredthedeadhead »

fredthedeadhead wrote:
Sun Nov 28, 2021 9:50 am
-> Thanks for the hints, both of these are fixed for the next release.
Hi, I see that LuaSurface is updated, thanks! But Position x/y is not, they still show ints.

Concepts.html#Position

-> The Position concept has been removed for the next version, everything now uses the specialized positions like MapPosition and TilePosition. So this is now fixed by it no longer being confusing what Position is for.

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 388
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Small documentation improvement requests

Post by Silari »

fredthedeadhead wrote:
Wed Dec 22, 2021 10:11 pm
fredthedeadhead wrote:
Sun Nov 28, 2021 9:50 am
-> Thanks for the hints, both of these are fixed for the next release.
Hi, I see that LuaSurface is updated, thanks! But Position x/y is not, they still show ints.

https://lua-api.factorio.com/latest/Con ... l#Position
LUAControl.position, which LUAPlayer inherits from, returns a MapPosition, not a Position. Pretty sure that was the correction made.

Honktown
Filter Inserter
Filter Inserter
Posts: 889
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Small documentation improvement requests

Post by Honktown »

Compared to the documentation, it appears the behavior of on_gui_closed may have changed without notice https://lua-api.factorio.com/1.1.50/eve ... gui_closed Emphasis: "This is only called if the player explicitly closed the GUI." and this does not seem to be the case. I'm playing 1.1.49, but it's also present in those docs...

Attached is a command to cause events (open a thing to trigger it). The first command was to "reset" the code someone else was testing at the time, who brought up the issue.
Attachments
testing.jpg
testing.jpg (30.55 KiB) Viewed 1540 times
open_close_order.lua
(956 Bytes) Downloaded 243 times
Last edited by Honktown on Fri Dec 24, 2021 8:28 pm, edited 1 time in total.
I have mods! I guess!
Link

curiosity
Fast Inserter
Fast Inserter
Posts: 176
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Small documentation improvement requests

Post by curiosity »

Speaking of MapPosition, it says "table" next to it whereas other position concepts are "table_or_array". And according to the description, MapPosition can also be an array.
-> Nice catch, fixed for the next version.

Besides, the introduction of MapPosition is absolutely redundant. There's already TilePosition, which has integer coordinates. So it just had to be properly noted which of the Position values are actually TilePosition and fix Position to correctly specify fractional coordinates. And now TilePosition's description doesn't even make sense! "This uses the same format as Position except it rounds any x/y down to whole numbers." Rounds down what? The fractional part of an integer?
-> The Position concept has been removed for the next version, everything now uses the specialized positions like MapPosition (with fractional coordinates) and TilePosition. So these descriptions should no longer be confusing.

curiosity
Fast Inserter
Fast Inserter
Posts: 176
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Small documentation improvement requests

Post by curiosity »

https://lua-api.factorio.com/next/Conce ... rintEntity: "The representation of an entity inside of a blueprint. It has at least these fields, but can contain additional ones depending on the kind of entity."
What are the additional fields?

-> There's dozens, it's on the TODO list to write them down at some point, just FYI.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 1207
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Small documentation improvement requests

Post by FuryoftheStars »

curiosity wrote:
Thu Dec 23, 2021 3:36 pm
And now TilePosition's description doesn't even make sense! "This uses the same format as Position except it rounds any x/y down to whole numbers." Rounds down what? The fractional part of an integer?
That’s what “rounds […] down to whole numbers” means, yes.

robot256
Filter Inserter
Filter Inserter
Posts: 436
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Small documentation improvement requests

Post by robot256 »

The page for LuaBootstrap::raise_event() should note that invocations are ignored without producing an error when the "data" table contains any invalid LuaEntity references. I (re)learned this recently (viewtopic.php?f=23&t=101002).

Thanks!


-> Thanks, noted for the next release.

curiosity
Fast Inserter
Fast Inserter
Posts: 176
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Small documentation improvement requests

Post by curiosity »

FuryoftheStars wrote:
Sun Dec 26, 2021 3:20 pm
That’s what “rounds […] down to whole numbers” means, yes.
Seems to me like you are missing the point. There is nothing to round down, the coordinates are already integer.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5032
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Small documentation improvement requests

Post by Klonan »

curiosity wrote:
Sun Dec 26, 2021 5:15 pm
FuryoftheStars wrote:
Sun Dec 26, 2021 3:20 pm
That’s what “rounds […] down to whole numbers” means, yes.
Seems to me like you are missing the point. There is nothing to round down, the coordinates are already integer.
The documentation goes both ways, so its describing read behavior and write behavior

When reading a TilePosition, naturally it is only integers

But when writing it to the game engine, you can give it any number, and that will be rounded internally,

For instance with this 'Get hidden tile': https://lua-api.factorio.com/latest/Lua ... idden_tile
You don't have to give it integers, but whatever position you give it, it will be rounded down

So for instance, you can read an entity MapPosition, which has a precision of 1/256 tiles,
and then use that same table to call a method asking for a TilePosition, without any worry

curiosity
Fast Inserter
Fast Inserter
Posts: 176
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Small documentation improvement requests

Post by curiosity »

Klonan wrote:
Sun Dec 26, 2021 6:14 pm
But when writing it to the game engine, you can give it any number, and that will be rounded internally,
...
So for instance, you can read an entity MapPosition, which has a precision of 1/256 tiles,
and then use that same table to call a method asking for a TilePosition, without any worry
Are you saying it's not the case for Position? Which also has integer coordinates according to the docs.
-> The Position concept has been removed for the next version, everything now uses the specialized positions like MapPosition and TilePosition. So this is now fixed by it no longer being confusing what Position is for.

curiosity
Fast Inserter
Fast Inserter
Posts: 176
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Small documentation improvement requests

Post by curiosity »

LuaEntity.neighbours's first line of description is a list item, so it displays weird in the property list. It should probably have a generalized summary of all the cases before the list.

-> Good spot, thanks, fixed for the next release.

curiosity
Fast Inserter
Fast Inserter
Posts: 176
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Small documentation improvement requests

Post by curiosity »

https://wiki.factorio.com/Prototype/ElectricPole#active_picture - what is this for?
-> Description added on the page.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 430
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Small documentation improvement requests

Post by Xorimuth »

https://wiki.factorio.com/Types/SpiderV ... _positions what does light_positions do? I'm trying to improve the create_spidertron function in base so that it correctly scales the lights as well.

Seems to be the locations that the eye_light is placed.

-> Thank you for adding this yourself!

Post Reply

Return to “Modding interface requests”