Drones incorrectly target the closest entity regardless of target string
bartico6 opened this issue ยท 0 comments
Describe the bug
Description: Drones, when instructed to attack an entity using the Attack programmer puzzle piece with a target whitelist, behave unexpectedly:
- When the block is entered, they will correctly do nothing if no entity matching the filter exists in the given area.
- When there is an entity matching the filter in the area however, they will instead attack the nearest entity, including ones that do not match the target whitelist, as if the target whitelist didn't apply.
Video showcasing the bug: https://i.quake.tf/1754696349-51058837.mp4
Consider a VPN if you do not trust me and my website to not log your IP (a reasonable concern to have).
The program used in the video (both in form of a screenshot & paste-able json) are in the reproduction section below.
How to reproduce the bug
- Paste the following program into the Programmer and upload it to a drone.
{"version":3,"widgets":[{"pos":{"x":62,"y":58},"type":"pneumaticcraft:start"},{"pos":{"x":62,"y":69},"var":"p1","type":"pneumaticcraft:coordinate_operator"},{"pos":{"x":62,"y":80},"var":"p2","type":"pneumaticcraft:coordinate_operator"},{"pos":{"x":-25,"y":75},"type":"pneumaticcraft:entity_attack"},{"pos":{"x":-13,"y":161},"string":"@player(ftbteam_enemy=xFEM)","type":"pneumaticcraft:text"},{"area_type":{"type":"pneumaticcraft:box"},"var1":"p1","var2":"p2","pos":{"x":-10,"y":75},"type":"pneumaticcraft:area"},{"pos":{"x":77,"y":69},"var":"$drone_pos","using_var":true,"type":"pneumaticcraft:coordinate"},{"pos":{"x":92,"y":69},"coord":[64,64,64],"type":"pneumaticcraft:coordinate"},{"pos":{"x":77,"y":80},"var":"$drone_pos","using_var":true,"type":"pneumaticcraft:coordinate"},{"pos":{"x":92,"y":80},"coord":[-64,-64,-64],"type":"pneumaticcraft:coordinate"},{"pos":{"x":62,"y":91},"inv":{},"cond":{},"type":"pneumaticcraft:condition_entity"},{"pos":{"x":17,"y":161},"string":"@player(ftbteam_enemy=xFEM)","type":"pneumaticcraft:text"},{"area_type":{"type":"pneumaticcraft:box"},"var1":"p1","var2":"p2","pos":{"x":77,"y":91},"type":"pneumaticcraft:area"},{"pos":{"x":77,"y":113},"string":"update_attack","type":"pneumaticcraft:text"},{"pos":{"x":181,"y":85},"type":"pneumaticcraft:label"},{"pos":{"x":196,"y":85},"string":"update_attack","type":"pneumaticcraft:text"},{"pos":{"x":188,"y":25},"type":"pneumaticcraft:label"},{"pos":{"x":203,"y":25},"string":"update_not_attack","type":"pneumaticcraft:text"},{"pos":{"x":188,"y":36},"type":"pneumaticcraft:rename"},{"pos":{"x":181,"y":96},"type":"pneumaticcraft:rename"},{"pos":{"x":203,"y":36},"string":"0","type":"pneumaticcraft:text"},{"pos":{"x":196,"y":96},"string":"1","type":"pneumaticcraft:text"},{"pos":{"x":-25,"y":64},"type":"pneumaticcraft:label"},{"pos":{"x":-10,"y":64},"string":"xd","type":"pneumaticcraft:text"},{"pos":{"x":181,"y":107},"type":"pneumaticcraft:jump"},{"pos":{"x":188,"y":47},"type":"pneumaticcraft:jump"},{"pos":{"x":203,"y":47},"string":"xd","type":"pneumaticcraft:text"},{"pos":{"x":196,"y":107},"string":"xd","type":"pneumaticcraft:text"},{"pos":{"x":47,"y":113},"string":"update_not_attack","type":"pneumaticcraft:text"},{"pos":{"x":-10,"y":86},"string":"@mob","type":"pneumaticcraft:text"},{"pos":{"x":77,"y":102},"string":"@mob","type":"pneumaticcraft:text"}]}
Alternatively, you can recreate the program from the following screenshot (if running my json of the program makes you uneasy):

The only lines going offscreen are to update the drone's name to "1" if a target exists, and "0" if it doesn't, and then jump to label "xd" seen on the left - this is identical to the json above.
- Place the drone in the world, observe that it doesn't attack you.
- Summon any hostile mob (repro program looks for
@mobentities) - Notice how the drone will attack you instead of the mob if you are closer to it than the newly summoned mob.
Expected behavior
The expected behaviour is that once the conditions to initiate attack are met, the drone attacks the nearest entity that matches the whitelist filter.
Additional details
No response
Which Minecraft version are you using?
1.21
Which version of PneumaticCraft: Repressurized are you using?
8.2.12 & 8.2.13, on modpack FTB: Evolution
This was reported in August, and no significant changes have been made since then (none of them targeting the relevant code)
Crash log
No response