10-14-2018, 10:36 PM
Small update to manufacturer's html screens.
technical notes:
This could definitely be made more efficient, but these screens are never really updated and only one person can really use one at a time.
It does a check on whether the machine can build each manufacturable item as they are added to the html list, which is not very efficient. For listing each material and whether or not that type exists in the machine (which was a huuuuge pain) it has to loop through all materials the machine has inside of it, then if the current material is found, then it is drawn black, otherwise it's drawn red. This seems more efficient than using the material_check method for activating/deactivating the hyperlink, but that seems to work well enough for what I wanted to do and I assume it works perfectly for what it was meant to do, so I thought trying to go around that tried and true process for efficiency's sake wasn't worth the risk or time.
https://github.com/goonstation/goonstation-2016/pull/82
- Hyperlinks no longer work for manufacturable items that don't have enough materials to build. The text is now red.
- The required materials section underneath manufacturable items now is a bit more helpful. Materials that the manufacturer doesn't have available, now display in red lettering and materials that are available still use the current black.
technical notes:
This could definitely be made more efficient, but these screens are never really updated and only one person can really use one at a time.
It does a check on whether the machine can build each manufacturable item as they are added to the html list, which is not very efficient. For listing each material and whether or not that type exists in the machine (which was a huuuuge pain) it has to loop through all materials the machine has inside of it, then if the current material is found, then it is drawn black, otherwise it's drawn red. This seems more efficient than using the material_check method for activating/deactivating the hyperlink, but that seems to work well enough for what I wanted to do and I assume it works perfectly for what it was meant to do, so I thought trying to go around that tried and true process for efficiency's sake wasn't worth the risk or time.
https://github.com/goonstation/goonstation-2016/pull/82