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

Open
wants to merge 51 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

@RecursivePineapple
Copy link
Contributor Author

@Divran I really like that idea. It'll need some sort of base station to request the items properly (so that I can put all of them in one crafting request), but I already planned on adding something similar.

@Divran
Copy link

Divran commented Oct 4, 2024

@Divran I really like that idea. It'll need some sort of base station to request the items properly (so that I can put all of them in one crafting request), but I already planned on adding something similar.

it doesnt even really need to be one request. ctrl+clicking ingame right now will request one item at a time and that works fine. you can yoink the existing code for now and improve it later if you really want to merge it into one request

@Divran
Copy link

Divran commented Oct 11, 2024

random idea that will probably be broken op and therefore not included. steal recursive blueprints from factorio. add a machine that can do everything your radial menu can, including requesting missing blocks, and allow it to paste itself. nothing can possibly go wrong with this, ever

@Divran
Copy link

Divran commented Oct 11, 2024

random other idea: ability to replace all copies of selected block with another block. useful when upgrading mebf coils or borosilicate glass tiers. or especially dtpf coils since the wand swap upgrade thingy isn't able to replace blocks that aren't visible, and the dtpf has several coils which are not visible so they don't get replaced

@RecursivePineapple
Copy link
Contributor Author

@Divran

add a machine that can do everything your radial menu can, including requesting missing blocks, and allow it to paste itself

That's a bit excessive IMO. Honestly, I don't even know what you'd use this for. I've been using the manipulator for real building and you don't even need to automate it. I was going to add arraying to the copy mode, but it's not even necessary because you can just make a row then copy it for each column.

ability to replace all copies of selected block with another block

I'll have to think about it some more. I want to add something similar to the equal trade focus, but I'm not sure what the best way to go about it is. It'd have to be functionally similar to the focus (ie right click -> blocks swapped without any other actions) but that could very easily lead to too many blocks getting changed.

@Divran
Copy link

Divran commented Oct 15, 2024

That's a bit excessive IMO. Honestly, I don't even know what you'd use this for. I've been using the manipulator for real building and you don't even need to automate it. I was going to add arraying to the copy mode, but it's not even necessary because you can just make a row then copy it for each column.

yeah it was a joke suggestion

I'll have to think about it some more. I want to add something similar to the equal trade focus, but I'm not sure what the best way to go about it is. It'd have to be functionally similar to the focus (ie right click -> blocks swapped without any other actions) but that could very easily lead to too many blocks getting changed.

it doesnt have to be similar to the wand focus imo. you can just make it so you gotta select a cube first just like when you copy paste and then it will swap the selected block inside the cube. really the only 2 reasons I want this feature is A) more range, even at the expense of more eu cost. and B) ability to swap blocks that arent visible

the built-in ability to use items directly from ae would be a nice bonus as well. as would the ability to just press one button to start the swapping and then waiting for a minute or so for it to complete (as opposed to the wand focus where you have to fly around and click a ton of places to complete the swap, and also you have to manually swap hidden blocks as already mentioned)

- Added AE & quantum downlinks + their recipes
- Improved EntityItemLarge (still not working 100% though)
- Added superchest emptying
- Removed gl error check from BoxRenderer because it kept printing an
  error from an unrelated gl call
- Fixed lots of @SideOnly issues
- Worked on quantum uplink a bit
- Added a cable mode to MK1's and up
  - Mode can place AE or GT cables/pipes in a straight line (connects GT
    cables properly)
- Fixed placing in SP
- Misc refactors
@Dream-Master Dream-Master marked this pull request as ready for review October 24, 2024 18:58
- Refactored pseudo inventory system to use IAEItemStacks
- Moved inventory logic to MMInventory
- Changed p2ps to paste inputs as an input instead of an output
- Fixed planning and un-WIP'd the quantum uplink
- Added an item provider for AE patterns (allows the player to copy
  interfaces with patterns easily)
- Improved planning options (added distinction between all & missing
  modes)
- Fixed cable mode end connections
- Added recipes for quantum uplink machines
- Fixed ender io conduit integration spamming errors
- Added pattern support for facade ME interfaces
- Fixed manipulator charging
- Added keybindings for copying/moving
- Improved preview hint culling
- Removed custom connector hatch recipe syncing since it isn't needed
- Changed cable mode to respect existing cable connections
- Fixed singleblocks not getting their output face set properly
- Cleaned up old hotswappable code in uplink structure check
- Changed uplink to send update packets periodically
- Fixed uplink not resetting efficiency when turned off
- Fixed keybindings not working
- Fixed facade ME interfaces not getting their priority copied
- Fixed machine facing logic for ALs
- Commented everything that should be commented
- Added dynamic sound range to fix far sounds not doing anything
- Refactored tons of old code
- Added pattern copying to AE facade interfaces
- Changed ZPM tier to place 512 blocks every 5 ticks
- Reduced wind-up time to 10 ticks from 20
- Fixed bedrock/warded glass getting removed
- Added nbt serialization for uplink hatch stored items
- Gated debug logs behind GTValues.D1 since they aren't needed anymore
Copy link
Member

@chochem chochem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this adding a metaitem4? that seems very unnecessary.

why are the recipes not starting in zpm like the pr description says? this is very much high tier technology.

- Fixed the manipulator tooltip lines for ME/uplink not working on MP
- Fixed the uplink not resetting its texture when turned off
- Fixed plans not getting their name set
@Divran
Copy link

Divran commented Nov 9, 2024

Just to reiterate, I'd be fine with it being gated to zpm but personally I don't believe it should be higher than that.

Also, another idea for you @RecursivePineapple if you want to do as chochem asks but you don't want to completely delete the recipes you made to allow unlocking earlier, how about you hide those recipes behind a config? That way, if the server owner wants it to be unlockable earlier than zpm, they can enable that in a config and your work on the recipe doesn't go to waste. (also we probably would enable that setting haha)

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.

6 participants