PneumaticCraft: Repressurized

PneumaticCraft: Repressurized

50M Downloads

Drone Area Widget and Place not working too well

duncanwebb opened this issue ยท 40 comments

commented

Minecraft Version

1.16.4

Forge Version

35.1.37

Mod Version

pneumaticcraft-repressurized-1.16.4-2.9.4-124

Describe your problem, including steps to reproduce it

I'm looking at why the greenhouse program written by Tek Stack is not working well in 1.16
original video: https://youtu.be/sGnLgVPfxmE my and video https://youtu.be/Krq0BM_GA_M
program: https://pastebin.com/qLMM2w04

The first thing to notice is that the drone fails to place the sign or aphorism tile, the sign is one block west of the centre chest and the drone should place it on the east side of this block.

Screen Shot 01-30-21 at 04 05 PM

If you change to place to the west side, then the drone places it correctly on the west side of the block.

Screen Shot 01-30-21 at 04 31 PM

Here is an example for cylinders, black shows missing or added blocks and blue shows a thickness of two instead on one. I would also expect each row to be identical. The program is consistent if the shape is either a hollow cylinder or one cylinder minus a one block smaller cylinder - nice that this is consistent. It is also strange that the north and south sides are identical but do not match the west and east side.

2021-01-29_15 37 38

The done which is a filled sphere minus a one block filled sphere and minus a filled cylinder should result in a one block think spherical dome which needs about 1200 blocks but in the current version it needs 2008 block of glass.

The road is two rectangles three wide and 31 blocks long placed perpendicular to each other. When the drone is placing slabs, then it is placing them on top of each other but four blocks wide. Instead of using place the right click block is used then it works for the first 64 blocks. It then fails as the "hand" of the drone is empty instead of being refilled. I think this is a change in behaviour as I would expect the next inventory slot to be transferred to the "hand".

The centre column should be 3x3x3 but the drone builds a 4x3x3 structure. The program should place down two 3x3x3 box frames.

That's where I am at the moment.

Any other comments?

There is a duplicate bug with the smart chest with maxed magnet, speed and ranged upgrades. When an item is broken near the chest items can be duplicated.

There is another duplication bug with the program controller placing an aphorism tile. I swapped over the sides for the sign, so it places the tile on the east side of the chest. The done places the tile correctly, but the program controller duplicates the tile and places two down the two tiles.

Screen Shot 01-30-21 at 03 47 PM

I fully understand if you don't want to do anything about this as it is an old program. However, what it is doing is reasonable and the drone should still work.

commented

Just saw the jack hammer duplicated
Screen Shot 01-30-21 at 04 52 PM

commented

Forgot to mention that the preview area is no longer working from the drone debugger.

commented

Probably better to have multiple issues for separate problems (aphorism tile placement, cylinder shape, smart chest dupe, programmable controller dupe, debugger area preview). It gets hard to manage multiple threads in a single issue, but we'll manage this time.

I'll try to take a look at the various problems today...

commented

I think the smart chest dupe issue is probably the same basic problem as #332 (which was drone magnet item duping). If so, that'll be easy to fix. Haven't been able to reproduce this dupe, but I can see how it could happen. I'm also going to add magnet suppression support, which will prevent items on conveyor belts (e.g. Immersive Engineering) or near a Botania Solegnolia, being pulled.

commented

It's easy to reproduce the dupe bug. Break a drone with 35 inventory upgrades and some magnet upgrades. There is a bug in the greenhouse program in that it imports everything from the chest before starting the clearing section, so the drone is full of items. Once the area has already been cleaned the drone sits by the chest full of items then wrench the drone.

Of course, it could be the drone that is duplicating the items.

Sorry, next time I'll split the issue up to one per each task.

commented

The cylinder area problem seems awfully familiar with #609 which we never quite got to the bottom of. But I can definitely reproduce this now, so just need to figure out what's going on here...

Update: yep, think I've nailed that one - problem with block raytracing to get the placement context (a lot changed in vanilla since 1.12.2 and some of the drone block interaction code needed to be significantly rewritten to cope). Also fixed a bug where block place was using no air (now uses 100mL per placement as it used to - sorry!). And fixed drone's held item not syncing to client when it became empty.

commented

I was able to reproduce and fix the sign placement problem with drones - the drone was ignoring the specified side in the progwidget and using the first side it was able to raytrace to (which was generally what face was closest when it got in range of the block). Now it will only right-click the exact face of the block that is specified in the progwidget (and if it can't get to a place where it can "see" that face, it won't right-click at all).

I couldn't reproduce the sign dupe issue with the programmable controller (using the same test program I used to fix the orientation problem), but it's very possible the fixes I made there helped with this too.

commented

Instead of using place the right click block is used then it works for the first 64 blocks. It then fails as the "hand" of the drone is empty instead of being refilled. I think this is a change in behaviour as I would expect the next inventory slot to be transferred to the "hand".

It doesn't work this way right now (and looking at historical 1.12 & 1.7 code, I don't think it ever did), and this could open a huge can of worms. As it stands, the drone will only attempt to use the "held" item, which is the item in slot 0 of its inventory.

This is one of the reasons why the right-click widget isn't recommended for block placing. Fortunately the fixes I made to the cylinder should help with this too and make the block place widget work as expected. I will be pushing a build shortly for you to test out...

commented

Forgot to mention that the preview area is no longer working from the drone debugger.

I can't reproduce this one. It's working fine here...

commented

Give build 130 a go when you get a chance...

commented

Wow! That was rapid. I'll give build 130 a try after lunch :-)

commented

Amazing, the building is perfect, many thanks.

Haven't reproduced the duplication bug again.

It is strange that the positions are shown for you and not for me, could this have something to do with variables?

The build ran out of dirt and glass
2021-01-31_18 21 56

I still have a problem placing the aphorism tile, can't get this to place either at all or randomly.

The other part that does not work is placing the water, not sure quite why. The drone imports the four water buckets correctly and places a bucket at a time and then puts the empty bucket in the chest. The positions are 6, -1, 6 from the chest. In this image, I renamed the positions. I'm sort of surprised that this worked in the past as you say the inventory slot 0 is not automatically replaced.

Screen Shot 01-31-21 at 06 13 PM

Again many thanks.

commented

I still have a problem placing the aphorism tile, can't get this to place either at all or randomly.

I had no problems placing a tile - Right Click Block widget, use "Click Item" mode, choose the side of the block, and make sure the "Sneaking" box is checked if the block has a GUI, like a Chest.

commented

The other part that does not work is placing the water, not sure quite why. The drone imports the four water buckets correctly and places a bucket at a time and then puts the empty bucket in the chest. The positions are 6, -1, 6 from the chest. In this image, I renamed the positions. I'm sort of surprised that this worked in the past as you say the inventory slot 0 is not automatically replaced.

I could be reading the old code wrong. I will take a look at the right click code again and check the feasibility of auto-equipping the filtered item...

commented

Update: with a little more tweaking, I think I have the drone now reliably placing water bucket, with the position of the air block in each hole (i.e. existing functionality). It wasn't a positioning problem, just a little bug in the code I'm adding.

So next build should handle the existing program reliably...

commented

It is strange that the positions are shown for you and not for me, could this have something to do with variables?

Yep, I think you're right there. A drone's variable values aren't sync'd to client, and there is no variable manager object client-side. Again, I think this has always been the case, at least from looking at the original 1.7.10 code. It might be possible to add this, but performance is a concern (needing to sync the variables of a debugged drone on a regular basis...).

commented

Not sure how that program worked before. What it appears to be doing:

  • Import 4 water buckets (OK)
  • Right-click hole 1 - fills it, because it's holding a water bucket (OK)
  • Export an empty bucket to the chest (OK)
  • Right-click hole 2- nothing happens! Because there's no item filter, the drone just right-clicks with an empty "hand", which is a valid operation.

I've updated the code to check for and swap in (if necessary) a valid item, and added a "water bucket" item filter to the right-click widget. Now it almost works, but seems to fail unpredictably - I think the problem might be that the drone can sometimes dip into the block space it's trying to click the bucket in, and that messes things up a bit.

The best option is probably a water tank with 4 buckets of water in it, and use the drone liquid import and export widgets to fill the holes...

I appreciate this has changed quite a bit since 1.7.10 days when this program was written, but unfortunately vanilla code around block interaction is also very different these days, and drones do need to work with that to a large degree.

commented

Build 131 should handle water buckets a lot better...

commented

There is another way to place buckets and this is like this, it might use fewer pieces:
image
However, with build 131 the drone drops into each hole and doesn't place the water.

Didn't know that you can export fluids into the world, will have to try that, thanks.

commented

Still have a problem placing the tile, this is what it is doing, and it doesn't matter if either east of west side is used. I've tried right click item and block with and without a filtered item.

place-tile.mp4

The code is:
image

commented

However, with build 131 the drone drops into each hole and doesn't place the water.

I believe the Right Click widget needs a filter of a water bucket there. Otherwise it will attempt to just right-click the block with whatever it's holding at the time - and if it's just dropped an empty bucket off, that will be an empty hand. By adding a filter piece of a water bucket, you're forcing the drone to find a water bucket in its inventory and equip that before right-clicking.

Still have a problem placing the tile

The problem here I think is that the drone is trying to right click the block adjacent to the chest, i.e. the air block. It should be sneak-right-clicking the chest itself, same as you would if you were trying to place a sign on a chest.

commented

Problem with the tile is you have "Click Block" when it should be "Click Item".

commented

Already tried Click Item and Click Block for both the tile and the water buckets, unfortunately it doesn't place the tile or the water.

commented

Yeah, found another little problem - raytracing again; the drone is above the chest, so can't see the east side. But it's close enough that it doesn't think it needs to move. I think I can fix that easily enough so I'll push another build shortly.

Your test program worked fine with placing the 4 water holes, though. The drone dug out and filled all 4 holes as expected.

commented

Build 132 will be ready momentarily...

commented

Thanks, can't get it to work, here's a test program https://pastebin.com/knRZUXbf and this is what it does.

done-right-click.mp4

Seems to double right click, no idea what it is doing with the tile.

commented

Placing the sign now works as expected. Many thanks again.

Placing water buckets doesn't work. The green house program right-clicks the bucket on the top of the block on the floor of the water hole. What is happening is that the drone places the water bucket in whole and then drops into the hole and voids off the water.

What I have also tried is to right-click item and right-click block on the north side of the block south of the hole.

image

As an aid, the right click puzzle price could show which side is being clicked and if sneaking.

Right-clicking does seem to be a bit of a problem, it will right-click wheat seeds and potatoes but not melon and pumpkin seeds, which is really strange.

commented

I honestly don't know. It works fine for me (right-clicking filled bucket into the hole position itself, that is). I think when I tried clicking the side of a block in the hole, it didn't work very well (probably because the drone is in that block space already).

Update: yeah. the changes I made to get sign placement working broke water bucket placement :( Alright, let's see if I can find a way to get both working...

commented

This is the drone click item on the block below the hole

click-item-1.mp4

This is the drone click item in the hole

click-item-0.mp4
commented

Build 133 might be the charm... who knows!

commented

https://pastebin.com/Ytb4CWRP this is the program for the second video.

image

Maybe you have a test program?

commented

This is the program I'm using, which works fine for both placing the Aphorism Tile and filling the water holes: https://pastebin.com/PqjQaXcv

commented

No worries, it happens! Good to know my code isn't broken after all :)

Would you consider this issue resolved? Did we miss anything?

commented

Figured it out...

Screen Shot 02-03-21 at 11 51 AM

Not sure why this drone has three security upgrades, normally I have only one per drone.

Very sorry about that.

commented

2021-02-03_14 18 56

Almost but the water is placed one extra block away from the centre with the program controller, I moved the water blocks in the above picture.

2021-02-03_14 45 16

The only other thing that bothers me a little is placing down the tile. Drones are not like players in that they can place anything anywhere in an air block, such as the diagonal glass in the dome.

So, the drone should be able to place the tile on any face of an air block. The reason is that it make the position on the sign trickier than it needs to be. We need two positions, the block to place the tile against and the position on the tile to write on.

Thanks again and thanks for your patience.

commented

I know how to fix this, by right-clicking the bucket on the top of the block below the water source.

image

commented

https://pastebin.com/LneqsDW9 Greenhouse for 1.16

commented

Excellent. Yeah, it actually makes more sense to right-click the bucket there. The whole right-click (and place) system has changed a bit, both in 1.12 and again in 1.16, due to the way vanilla has changed the system (to actually do stuff as a fake player, I need to go through the same raytracing procedure as a real player would). So it has been a bit of a pain to get working reliably, and a lot of stuff still feels a bit kludgy there.

I'll take a look at the place code too and ensure there's a way for drones to continue placing blocks in mid-air.

commented

I tested the placement of signs as well as the tile, they work flawlessly.

The greenhouse built correctly and may have uses less blocks than the original.

Thanks again.

commented

Fixed in 2.10.0 release