[2.0.71] accessing the user set description of items throws errors most of the time

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
SunBlade
Inserter
Inserter
Posts: 20
Joined: Mon Jan 15, 2018 8:27 am
Contact:

[2.0.71] accessing the user set description of items throws errors most of the time

Post by SunBlade »

Issue
the user can "freely" set the label and description of items of prototype 'item-with-label' and its child prototypes.
i suspect a typo in the lua binding for description and the derived documentation, since description should be a copy/paste of label with minor changes.


How to reproduce/test
  1. put a blueprint book, blueprint, deconstruction planner and upgrade planner in your main inventory.

    Code: Select all

    /c local inv = game.player.get_main_inventory()
    inv.clear()
    for k,v in pairs{"blueprint-book","blueprint","deconstruction-planner","upgrade-planner"} do
    	inv.insert(v)
    end
  2. reading/writing the custom label works:

    Code: Select all

    /c for k,v in pairs{"blueprint-book","blueprint","deconstruction-planner","upgrade-planner"} do
    	local itm = game.player.get_main_inventory().find_item_stack{name=v}
    	log(serpent.line(itm.label))
    	itm.label = itm.name
    	log(serpent.line(itm.label))
    end
  3. reading/writing the custom description does not work:

    Code: Select all

    /c for k,v in pairs{"blueprint-book","blueprint","deconstruction-planner","upgrade-planner"} do
    	local itm = game.player.get_main_inventory().find_item_stack{name=v}
    	log(serpent.line(itm.custom_description))
    	itm.custom_description = itm.type
    	log(serpent.line(itm.custom_description))
    end

Addendum
if i am mistaken and custom_description is really something entirely else that only 'item-with-tags' provides additionally to the user set description,
then this post is a scripting feature request.
Attachments
factorio-current.log
(19.05 KiB) Downloaded 3 times
Live your life, you got only one.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.71] accessing the user set description of items throws errors most of the time

Post by Rseding91 »

"custom_description" is unique to item-with-tags, what you're referring to with blueprints and blueprint books is blueprint_description https://lua-api.factorio.com/stable/cla ... escription
If you want to get ahold of me I'm almost always on Discord.
User avatar
SunBlade
Inserter
Inserter
Posts: 20
Joined: Mon Jan 15, 2018 8:27 am
Contact:

Re: [2.0.71] accessing the user set description of items throws errors most of the time

Post by SunBlade »

ok, i missed that. that works for BPs and books.
i assumed since label is a common property of all 'item-with-label' including subtypes, description would be the same.
so, how do i access the description of deconstruction planner and upgrade planner?
Live your life, you got only one.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.71] accessing the user set description of items throws errors most of the time

Post by Rseding91 »

It looks like there is currently no way to do that.
If you want to get ahold of me I'm almost always on Discord.
User avatar
SunBlade
Inserter
Inserter
Posts: 20
Joined: Mon Jan 15, 2018 8:27 am
Contact:

Re: [2.0.71] accessing the user set description of items throws errors most of the time

Post by SunBlade »

tests
i did some tests on:
blueprint
blueprint-book
copy-paste-tool
deconstruction-item
item-with-inventory
item-with-label
item-with-tags
selection-tool
spidertron-remote
upgrade-item
as LuaItem, LuaItemStack and where possible also LuaRecord.

as i suspected, label is a runtime overwrite for localised_name and works on the whole 'item-with-label' tree unconditionally. but is completely missing on LuaRecord.
the user can manually change the label for only 'blueprint', 'blueprint-book', 'deconstruction-item', 'item-with-inventory' and 'upgrade-item'.

the user customisable description for 'blueprint', 'blueprint-book', 'deconstruction-item' and 'upgrade-item' is displayed additionally to localised_description.
blueprint_description gives access to the user customisable description for only 'blueprint' and 'blueprint-book'.

custom_description gives access to the runtime overwrite for localised_description for only 'item-with-tags'.
my requests
use case
  • my Personal Book would greatly benefit from the ability to compare and change user customisable descriptions. (the only thing missing to check BP items for equality)
Live your life, you got only one.
Post Reply

Return to “Modding interface requests”