Open MauveCloud opened 4 years ago
Item inventory - is it really worth saving this, rather than letting the items drop if the player neglects to deal with them beforehand?
Yes it be nice to keep molds, shapes, integrated circuits.
Notes about persisting machine covers and orientation:
Currently, machine front is determined when placing. This is absolutely ok to stay as-is. But output side is always default rear, except for single-block generators who ave their output side at front. Covers are persisted but their data is stored as absolute world side. I mean it would be much more practicable to have covers persisted relative to the front side, so as when placing a previously harvested machines, left, right, rear, front covers are still left, right, rear front relative to player, regardless of the new machine placement. This would also fix the issue of covers dropping to the ground when the new front side world orientation occupy the world side of a previous cover which is not allowed on the front side.
Yes it be nice to keep molds, shapes, integrated circuits.
Okay, good point. Just be aware you'd lose them if you toss the machine in an arc furnace or macerator without removing those items first, or if you for some reason decide to take a pickaxe to the machine instead of a wrench.
Covers are persisted but their data is stored as absolute world side. I mean it would be much more practicable to have covers persisted relative to the front side, so as when placing a previously harvested machines, left, right, rear, front covers are still left, right, rear front relative to player, regardless of the new machine placement. This would also fix the issue of covers dropping to the ground when the new front side world orientation occupy the world side of a previous cover which is not allowed on the front side.
This could be tricky to implement, especially considering that covers on pipes and cables (which have no obvious "front") are handled by the same code, but I'll look into it. Also, related to the above, saving item inventory would also affect item pipes (at least by default, I might be able to add special conditions for that), so breaking a clogged item pipe would no longer work to drop the contents.
Battery slot is a good place to persist.
Makes me think that if machine had dedicated configuration slot for circuits, molds, shapes, blades... you'd only persist this one and the battery slot.
A good GUI place for a configuration slot would be atop of the progress indicator.
A configuration slot would exclusively accept configuration items, with input slot blacklisting configuration items to maintain backward compatibility with existing automation setups; where the configuration item is piped-in and out alongside input items.
There is already code for saving and loading the entire machine inventory (presumably triggered when the chunk unloads/loads), I'd just have to copy that part to the function called when the machine is harvested, and remove the code that drops the contents on the ground. Persisting specific inventory slots and not others would actually be more difficult.
As far as piping the configuration item both in and out of a dedicated slot, how would it stay in there long enough for the recipe to work? The recipes could be changed to "consume" the configuration item and put it an output slot when finished, but then it would be a pain to have to move it back to the input slot when not using some form of automation.
Wait, here's an idea I just came up with: what if piping in a configuration item pushed any existing one into the output (if there's room)? Sort of outside the scope of the current suggestion, but wouldn't really need a new dedicated slot.
You would not be able to remove the configuration item.
Thinking about this "dedicated slot for configuration items" idea more, it might be more hassle to implement than it's worth:
Originally suggested by leagris in #1544
Looking at the changelog, https://mechaenetia.com/changelog/#Changelog I think you are slightly mistaken about the motivation:
Admittedly, the item pipe system can alternately be cleared by connecting a chest. I'm not sure about essentia containers and tubes.
As far as making the tilemachine NBT data persisted on harvest, the framework is already there: https://github.com/Blood-Asp/GT5-Unofficial/blob/77a3c956e510b7c8ef4654054bcb16a0fccb86f7/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java#L1249 It's just that most GT tile entities don't do anything yet with that "setItemNBT" method. A lot can be copied from the "saveNBTData" method, but there are a few details that probably shouldn't be saved when harvested: