waduk wrote:Yes, exactly that.
I'm aware there are no config option, i have to add the code.
I see in control.lua this line at 77 :
Code: Select all
normal = {
name = "name",
total = "total",
woc = "wooden-chest",
irc = "iron-chest",
stc = "steel-chest",
smc = "smart-chest",
}
I also search where else the code being referenced, found it on main.lua :
So, is that the two files that i have to changed/add if i want to add my custom chest, or is more complicated than that ?
I'm a complete noob on modding btw.
Yes you are on the right track.. but it's not really straightforward and you will run into issues.
so you can add your custom chest to the list above, the left code is just an internal code and you can use anything here, the code to the right is the actual entity name, but simply adding a new chest type here won't work and it will cause errors, mainly because these codes are used to load the styles for the sorting/filter icons, so if you do add your own custom chest with a custom code, the mod won't be able to find it's style and will crash.
a simple solution here would be to replace on of the existing chests on the list with your own, for example the smart-chest, to do that just replace "smart-chest" on the codeToName list to your custom entity name "custom-chest" or whatever
the harder solution involves 2 options, one would involve code changes, which i will list here if you feel like doing it :
gui\items.lua - Line 70 - you need to increase the table colspan by how many new chest types you have added, the default is 8, so if you added just the one chest type make it 9
gui\items.lua - Line 97 - this is where the table headers including the chest icons are generated using the table you mentioned, at this point you really have two options.. add button styles for the chest type you add using the code you used which is too much work i guess, or just add a conditional exception in this loop for the chest type you added forcing it not to load the button style or load a different style or maybe just a text..
the code below is what you should use to replace line 97, note here i am having it use the actual item icon -- didn't really test it so might not work
Code: Select all
if code == "customcode" then
codeFlow.add({type = "checkbox", name = "itemSort_" .. code, style = "item-icons-" .. field})
else
codeFlow.add({type = "button", name = "itemSort_" .. code, style = "lv_button_" .. code .. buttonStyle})
end
gui\widgets.lua - lines 291 - 298 is where the chest filters are added you need to do the same here as well..
On line 295 :
Code: Select all
if code == "customcode" then
chestsFilterFrame.add({type = "checkbox", name = "itemInfoFilter_" .. code, style = "item-icons-" .. name .. buttonStyle})
else
chestsFilterFrame.add({type = "button", name = "itemInfoFilter_" .. code, style = "lv_button_" .. code .. buttonStyle})
end
NOTE:
if you'd like to skip these code edits, you could just add new button styles for your custom chest, this is done in styles/main.lua look around line 1456, each button has two style for example lv_button_ppc / lv_button_ppc_selected is for the passive provider chests..
so you'd need to add your own styles and also link them to an image, or just use one of the existing styles and just rename the code part "ppc, apc.." ect