Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the matter manipulator #3222

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

RecursivePineapple
Copy link
Contributor

This adds the matter manipulator, which is meant to be a survival-usable version of world edit. The goal of this tool isn't to replace world edit completely, rather its goal is to help with building large or repetitive structures without cheating.

I'd appreciate any feedback since I want this process to be as smooth as possible. I wanted to avoid complex GUIs, so everything is done via context actions or by selecting an option in the right click radial menu. I also didn't want to add unique keybinds, which is the main reason for the odd placing controls (shift + right click the air to place blocks, this will be talked about more later).

Currently, the tool only supports a basic geometry mode and dismantling, but in the future it will have the capability to copy/paste regions of blocks (including machinery) or cut/paste a region of blocks to move it. I will also add a brush mode once I figure out a good way to implement it. The copy/paste mode will be able to set colours, add and configure covers, orient machines, connect pipes, install AE upgrades, configure AE machines, and likely more. This system will be modular, so it'll be trivial to extend once I get it working completely.

The tool can be connected to an ME network by placing it in a security terminal, and has the same requirements as all other wireless terminals (the network must have a nearby access point and it must be powered). If the tool is unconnected, it will pull items from or place items into the player's inventory. When dismantling a tank, any stored fluids will also be placed in fluid cells within the player's inventory. The ME network has a higher priority than the player's inventory, so blocks will be pulled from the inventory first and placed in the ME network first. If the player's inventory is full, the blocks will be dropped on the ground. Excess fluids will be voided.

The tool requires a variable amount of EU per operation. The EU cost is per-block and is increased quadratically depending on the distance, so blocks farther from the player take increasing amounts of energy to place. Removing blocks also requires EU. If the placed or removed block is a tile entity, the EU required is multiplied by 16. The tool's voltage is ZPM and it holds a billion EU. I will likely increase its storage or decrease its consumption, because building large shapes frequently empties it completely.

The tool can also be used to dismantle large, complex machines. It will remove items from an inventory, remove fluids from tanks, and remove covers from any gregtech machines (or anything that implements ICoverable). It will also reset a machine's strong redstone output to allow them to stack. Some inventories (such as AE upgrade slots) aren't IInventories, and do not get emptied properly. Note that this could be used to mine meteors or ore veins, although by the time the player unlocks the tool (late ZPM) it shouldn't cause balance problems.

To place blocks, the tool must be first spawned in (a recipe will be added to the coremod later).

Second, the player must select the shape by right clicking the item (without hovering over a block) to open the configuration radial menu. Please let me know if I'm missing any important shapes - I know I've missed planes, but I haven't decided how I'm going to add those to the menu yet since they require three points. I will likely just add another point that only shows up when places are selected.

2024-09-18_00 02 15

They can then select "Set Shape" followed by whatever shape they want (I'll use cube as an example).

2024-09-18_00 02 18

Fourth, the player must select the two corners by right clicking on two blocks. Shift right clicking a block will select the block's position, otherwise the position will be offset based on the side clicked.

2024-09-18_00 03 10

Fifth, the player must select which blocks they want to place by opening the menu, then selecting "Select Blocks" followed by one of the options in the menu. Alternatively, the player can use the middle mouse button to set the active block (similar to creative mode). The tool can also be used to remove regions of blocks by clearing the selected block. This will "place" air, although it is mainly useful for clearing out underground rooms or dismantling machines.

To actually place the blocks, the player must hold shift + right click for a short amount of time. There is a 10 tick wind up before anything is placed to make sure the player actually wants to place the blocks. Every 10 ticks afterwards, another set of blocks will be placed. The tool will only place one type of block per interval, but it can place or remove up to 256 blocks every interval.

There are also various ways to select the target coordinates. While the primary way is to right click, they can also be moved interactively, which updates the hologram preview.

moving.coord.mp4

The player can move one coordinate at a time, or both, which maintains the coordinates' relative positions but allows the player to make adjustments without having to set both several times.

moving.both.mp4

By default, right clicking will interleave coordinate A and coordinate B, but it's also possible to only set A or B in case that's useful (I haven't found a purpose, but I also don't have a reason to not add it).

@RecursivePineapple RecursivePineapple added ongoing freeze - do not merge PR tagged with this do not meet the requirement to be merged during a freeze. new feature Add something new. Please explain in detail how it works. labels Sep 18, 2024
@Divran
Copy link

Divran commented Sep 18, 2024

Before any dev comes in and dislikes this PR I would just like to point out that this is basically schematica except actually good, and usable. Schematica is already in the pack, but it's just so shit that it's practically useless because it can't paste half the things you want it to, and the other half are pasted with the wrong orientations. The reason we use worldedit to copy/paste shit is specifically because schematica is garbage, but this tool would allow us to uninstall worldedit (or at least stop using it in case we need it for actual real admin purposes). Once this tool is finished, schematica could honestly just be deleted from the pack.

@RecursivePineapple If this is not merged for some weird reason, you should release it separately. I will 100% install and use it and no doubt so will many others

When dismantling a tank, any stored fluids will also be placed in fluid cells within the player's inventory. The ME network has a higher priority than the player's inventory, so blocks will be pulled from the inventory first and placed in the ME network first. If the player's inventory is full, the blocks will be dropped on the ground. Excess fluids will be voided.

in this case I also hope it places fluids into ae fluid storage first, before attempting to put them in the player's inventory

I will likely increase its storage or decrease its consumption, because building large shapes frequently empties it completely.

another solution would be to allow it to be charged at any speed via gt wireless chargers (of any tier). which it may already be able to do. so if you don't have enough power to place things, just make more wireless chargers

@boubou19
Copy link
Member

looks good overall, but why putting effort into making it specially in GT rather than working on fixing schematica? I'm not opposed to this stuff, it looks very cool, but i'm curious. Fixing schematica would have allowed us to release it for the whole scene just not for NH. It kind of feel like a duplicate feature, so if this makes it in the pack i guess we will ditch schematica.

@Divran
Copy link

Divran commented Sep 18, 2024

looks good overall, but why putting effort into making it specially in GT rather than working on fixing schematica? I'm not opposed to this stuff, it looks very cool, but i'm curious. Fixing schematica would have allowed us to release it for the whole scene just not for NH. It kind of feel like a duplicate feature, so if this makes it in the pack i guess we will ditch schematica.

I don't see a reason why this wouldn't work outside gtnh. the gtnh specific features most likely simply wouldn't be used in that case. could even have a simple check during launch to see if gregtech is installed and if it isn't, it could switch to using RF power instead, for example.

@boubou19
Copy link
Member

We don't support our GT5U outside of NH.

@chochem chochem added the Affects Balance Change affecting balance. Requires admin approval before merging. label Sep 18, 2024
@RecursivePineapple
Copy link
Contributor Author

RecursivePineapple commented Sep 18, 2024

@Divran

in this case I also hope it places fluids into ae fluid storage first, before attempting to put them in the player's inventory

Yes, that's what it does. It only places stuff in the player's inventory if it can't place it in their AE system. Looks like I forgot to mention that.

another solution would be to allow it to be charged at any speed via gt wireless chargers

Wireless chargers work well with it, but it's somewhat slow even with fast charging enabled. I think I'll probably just make the distance curve less harsh (^1.25 or something), because that's what consumes most of the power. Chargers push power, so I can't do much on my end to increase the transfer speed.

@boubou19

why putting effort into making it specially in GT rather than working on fixing schematica

I'm just not a fan of schematica. It works, but it's quite tedious to use since you have to wait for block dependencies to finish and you have to move around the whole structure several times to build it. I figured there was a good reason for those behaviours so the thought didn't even cross my mind to improve it.
The BlockAnalyzer class is completely isolated, so once I get that code working it can be integrated into schematica if someone wants to (and fairly trivially, since its interface is only a few methods and its result will be serializable).

@RecursivePineapple
Copy link
Contributor Author

New AE dismantling:

dismantle.ae.mp4

@Dream-Master Dream-Master requested a review from a team September 18, 2024 20:25
@Divran
Copy link

Divran commented Sep 18, 2024

Wireless chargers work well with it, but it's somewhat slow even with fast charging enabled. I think I'll probably just make the distance curve less harsh (^1.25 or something), because that's what consumes most of the power. Chargers push power, so I can't do much on my end to increase the transfer speed.

yeah but did you check if having a shitload of wireless chargers at once makes it charge faster? or can only one wireless charger connect at a time?

@RecursivePineapple
Copy link
Contributor Author

@Divran I can't load into a world to double check because gt5u's master branch has a problem, but from the code it looks multiple chargers can charge a player's tools at the same time

@ddelconte
Copy link

I really like this idea. In fact, I was looking for something like this as an alternative to schematica the other day to no avail. Well done and I look forward to this getting merged.

My only concern is that waiting until ZPM for this is a little too excessive, considering that schematica is available at all times. Perhaps add different tiers of the item but with restricted abilities (smaller volumes that it could work with, etc.) that can be obtained much earlier, perhaps even in LV/MV.

@Divran
Copy link

Divran commented Sep 19, 2024

My only concern is that waiting until ZPM for this is a little too excessive, considering that schematica is available at all times. Perhaps add different tiers of the item but with restricted abilities (smaller volumes that it could work with, etc.) that can be obtained much earlier, perhaps even in LV/MV.

I think zpm should be ok since you don't really need any sort of machine spam before that. I wouldn't want to put it much later than that though. That said, I also definitely wouldn't be against having it earlier

@YannickMG
Copy link
Contributor

Depending on what people want it for, you could consider unlocking specific functionality across several tiers.

For instance the very first model available might only be able to manipulate decoration blocks and not machines, and could gradually gain support for tile entities, inventories, liquid tanks and machine/AE2 configuration.

@ddelconte
Copy link

I think zpm should be ok since you don't really need any sort of machine spam before that. I wouldn't want to put it much later than that though. That said, I also definitely wouldn't be against having it earlier

Ay, but it does more than just machine spam. It's essentially an all in one build tool and when unlocked in LV could serve as a far superior alternative to the builder's wand, which is our only option at that point. If RecursivePineapple is into the idea of splitting it into tiers, then what Yannick suggested is probably closer to the most reasonable approach.

@RecursivePineapple
Copy link
Contributor Author

Well done and I look forward to this getting merged.

@ddelconte Thanks!

you could consider unlocking specific functionality across several tiers.

I can see about making a T1 version that can only place basic blocks with a somewhat limited range (needs titanium), a T2 that can place tile entities, connect to AE, and disassemble with a larger range (needs osmium) and a T3 with everything unlocked (needs naq alloy).

when unlocked in LV could serve as a far superior alternative to the builder's wand, which is our only option at that point

If the T1 version is too late, I can make a T0 that requires an equal trade focus or a builders wand (or any other magic teleporter around LV/MV, maybe just enderpearls or something). It'd still be powered by EU and largely function the same, but it would be limited to a radius of 32 blocks with a buffer of ~1mil EU along with the T1 restrictions. To prevent it from becoming junk it can be used in an cheaper alternative T1 recipe. Each tier would require the previous tier as an ingredient, but T1 would have two recipes (one with the T0 and one without).

I want the series of items to be teleporter themed, so the 'first' one should include some sort of non-magical teleporter in the recipe. I don't mind the T0 not having a teleporter, but it shouldn't be the 'first' one, it should be more of a barely-working prototype lore-wise.

@ddelconte
Copy link

ddelconte commented Sep 19, 2024

I think this is an excellent approach. A good T0/LV recipe could include field generators, emitters, steel plates, a small lithium battery, a builder's wand, and an enderman head (why not?). All instances of teleportation tech in the gregverse (at least, before the end game) rely on ender/nether technology to function (field generators, etc.), so I don't think you'd be violating the lore by incorporating them. Obviously, though, you'd want to make the recipe involved and not something they can just throw together quickly.

@YannickMG
Copy link
Contributor

YannickMG commented Sep 20, 2024

I'd suggest having the thing (at least T0) run on ender pearls somehow just to justify having an enderman stuck in a smeltery, but that might not be the right incentive.

@Divran
Copy link

Divran commented Sep 25, 2024

random idea: add a feature to allow this tool to request the missing blocks (and/or items) from ae before pasting

basically add a button in your radial menu that does the same thing as ctrl-clicking a recipe in the terminal: opens request windows for one item at a time for any item you don't already have enough of. The user can then choose to press this button as many times as needed to request all the items before pasting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects Balance Change affecting balance. Requires admin approval before merging. new feature Add something new. Please explain in detail how it works. ongoing freeze - do not merge PR tagged with this do not meet the requirement to be merged during a freeze.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants