I'm trying a different approach, maybe I can fix this problem without requesting anything.
I'll leave this here, maybe it's easy enough to implement and someone might need it in the future
I have the following problem:
I have a capsule that has a low cooldown, I can't change the cooldown because of other reasons that aren't important.
When the capsule gets used the player gets a buff.
When a buff is active the capsule is used without giving a buff and the player gets the same capsule put into their inventory.
This is to simulate the capsule not being used as long as there is a buff active.
This causes the following problem:
The production consumption statistic automatically counts up every time a capsule is used.
I want to subtract one from the last time a value was added up to the current point in time.
This is probably only one tick, because I have a script effect for the capsule.
set_output_count only edits the total count.
https://lua-api.factorio.com/latest/Lua ... tput_count
Make production statistics graph editable
- MrJakobLaich
- Burner Inserter
- Posts: 10
- Joined: Fri Oct 28, 2016 8:33 pm
- Contact:
Make production statistics graph editable
I a streamer, gamer, programmer!
But am I human?
But am I human?
Re: Make production statistics graph editable
You could set the capsule to not be consumed when used:MrJakobLaich wrote: ↑Thu Sep 30, 2021 9:01 pmWhen a buff is active the capsule is used without giving a buff and the player gets the same capsule put into their inventory.
This is to simulate the capsule not being used as long as there is a buff active.
https://wiki.factorio.com/Types/UseOnSe ... uses_stack
And then if the capsule does activate the buff, consume from the stack using script yourself, and add it to the production GUI
- MrJakobLaich
- Burner Inserter
- Posts: 10
- Joined: Fri Oct 28, 2016 8:33 pm
- Contact:
Re: Make production statistics graph editable
ThanksKlonan wrote: ↑Thu Sep 30, 2021 9:11 pmYou could set the capsule to not be consumed when used:MrJakobLaich wrote: ↑Thu Sep 30, 2021 9:01 pmWhen a buff is active the capsule is used without giving a buff and the player gets the same capsule put into their inventory.
This is to simulate the capsule not being used as long as there is a buff active.
https://wiki.factorio.com/Types/UseOnSe ... uses_stack
And then if the capsule does activate the buff, consume from the stack using script yourself, and add it to the production GUI
Funnily enough that's exactly what we came up with after a lot of thinking and debating about possible solutions (I got some help from the discord )
Still do appreciate that you replied so fast
Trying to implement that right now.
EDIT:
Works 100% as intended, thanks
If anyone comes across this:
Is set
Code: Select all
capsule_action["uses_stack"] = false
Then in the control.lua I do
Code: Select all
player.remove_item{name=<item_name>, count=<remove_amount>}
Then I do
Code: Select all
game["forces"]["player"]["item_production_statistics"].on_flow(<item_name>, -1)
(-1 for the right consumption side of the prod stat)
I a streamer, gamer, programmer!
But am I human?
But am I human?