Removing the Green ammo durability bar

Place to get help with not working mods / modding interface.
PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Removing the Green ammo durability bar

Post by PrestonLeeC »

I'm changing all the data.raw.item to data.raw.tool so I can use them as science packs.

Any ideas on how to remove the green bar?

Thank you!

Image
PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Re: Removing the Green ammo durability bar

Post by PrestonLeeC »

Some things I've tried, but I haven't been able to get rid of those green bars even when I am able to delete literally the rest of the user interface:

[*]delete all the pixel data from gui.png and gui-new.png
[*]loop through every table in data.raw["gui-style"]["default"] and do things like color = {a=0}, or horizontally_stretchable = "off".

Nothing affects those green bars... :x
PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Re: Removing the Green ammo durability bar

Post by PrestonLeeC »

Next, I tried setting infinite = true, so the bars go away. Obviously, in order for science to work properly, I'd have to use control.lua to deplete the items from labs if the labs are working.

Edit: Got it "working", but now the problem is, it depletes an item every second even if that item hasn't produced a full bar of research progress yet...

Code: Select all

script.on_nth_tick(60, function()
	local surface = game.surfaces[1]
    local labs = surface.find_entities_filtered{type="lab"}
    for _, lab in pairs(labs) do
        if lab.status == defines.entity_status.working then
            local inventory = lab.get_inventory(defines.inventory.lab_input)
            for tool_name, tool_count in pairs(inventory.get_contents()) do
                inventory.remove({name=tool_name, count=1})
            end
        end
    end
end)
PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Re: Removing the Green ammo durability bar

Post by PrestonLeeC »

Alright, I wrote a bunch more code (that I'm quite proud of) and everything seems to work perfectly. Although I imagine there are others who would still love a simple solution to this.
Post Reply

Return to “Modding help”