[Solved]Science Pack | api call to change "remaining" value?

Things that already exist in the current mod API
Post Reply
paraqles
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Apr 14, 2016 3:19 pm
Contact:

[Solved]Science Pack | api call to change "remaining" value?

Post by paraqles »

I want to use the lab and its function as a user of science packs to generate "research power".
Unfortunately I can't figure out how the "remaining" of the science pack is handled and stored.'

From the API documentation, there is no corresponding value.
I tried:
- health
- durability (since a science pack is a tool)

Has someone more insight about that, and can help me with it?
Last edited by paraqles on Thu Apr 14, 2016 10:30 pm, edited 1 time in total.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Lua: Science Pack | api call to change "remaining" value?

Post by Adil »

When you insert a single portion of items in any consumer, those items disappear at the moment the work begins. If you mine the building, you don't get those back, so the remainder is likely to be stored nowhere.
I believe the lab progress bar shows how far in the consumption of currently inserted items it has gone.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

paraqles
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Apr 14, 2016 3:19 pm
Contact:

Re: Lua: Science Pack | api call to change "remaining" value?

Post by paraqles »

Sure that can be the thing.
But the "remaining" value is in the description tool tip that you get, when you hover over one of the science-pack stacks in the inventory of the lab.
Attachments
20160414174102_1.png
20160414174102_1.png (133.03 KiB) Viewed 4032 times


paraqles
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Apr 14, 2016 3:19 pm
Contact:

Re: Lua: Science Pack | api call to change "remaining" value?

Post by paraqles »

No, it does not work. Besides, that from the LuaAPI Documentation, "durability" is an unsigned integer, capped at max durability of the prototype (for science packs = 1)

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Lua: Science Pack | api call to change "remaining" value?

Post by prg »

Hold a partially used science pack in the cursor stack and run

Code: Select all

/c game.local_player.print(game.local_player.cursor_stack.durability)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

paraqles
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Apr 14, 2016 3:19 pm
Contact:

Re: Lua: Science Pack | api call to change "remaining" value?

Post by paraqles »

prg wrote:Hold a partially used science pack in the cursor stack and run

Code: Select all

/c game.local_player.print(game.local_player.cursor_stack.durability)
What the heck?
The same code i did this morning, now does what i expected it would do.

And especially it does not comply to the API Documentation.

I have to thank you, the first thought was "Ah, man I tried that already", but at least i should give a try if there is a difference between a stack in lab and stack in hand (curosr).

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

Re: Lua: Science Pack | api call to change "remaining" value?

Post by Rseding91 »

paraqles wrote:
prg wrote:Hold a partially used science pack in the cursor stack and run

Code: Select all

/c game.local_player.print(game.local_player.cursor_stack.durability)
What the heck?
The same code i did this morning, now does what i expected it would do.

And especially it does not comply to the API Documentation.

I have to thank you, the first thought was "Ah, man I tried that already", but at least i should give a try if there is a difference between a stack in lab and stack in hand (curosr).
What? It compiles perfectly with the API documentation and there's no difference between stacks in a lab vs. in the cursor.
If you want to get ahold of me I'm almost always on Discord.

paraqles
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Apr 14, 2016 3:19 pm
Contact:

Re: [Solved]Science Pack | api call to change "remaining" value?

Post by paraqles »

Sorry I may be a little unclear:
http://lua-api.factorio.com/0.12.30/Lua ... durability

Says it is "uint" => http://lua-api.factorio.com/0.12.30/Bui ... .html#uint

So it does not behave like the documentation said.
And at my first try to use the durability it just kept the durability at "1".

Post Reply

Return to “Already exists”