TeamPneumatic / pnc-repressurized

A port of PneumaticCraft to MC1.12+
Other
121 stars 50 forks source link

"Follow" Routine for Drones #190

Open PaladinWho opened 6 years ago

PaladinWho commented 6 years ago

Would it be possible to implement a sort of "Follow Player" program piece or upgrade for the drones?

I always wanted to go around the world with my drone following me, killing mobs, picking up items, etc. for me

I understand that hacking your drone makes it follow you but it also stops the routine so an actually implemented follow player and interact with nearby objects/kill nearby mobs mode/program would be nice

Tekstack commented 6 years ago

@PaladinWho I have a Remote Program that I wrote a while back (updated recently) that will "light the way", bridge gaps in the direction you are walking, and protect you as you explore. Also, you can set a home location to have the drone come to pick you up and take you home. The program isn't perfect by any means, but if you want to give it a try/look at how some of the logic is used you can get the 2 programs below. I tried to put in as many tooltips to help guide you.

----Drone Remote Layout--- https://pastebin.com/3SimGbvP To import this, hold a remote in your hand and sneak + right click; on the left you will see "Import/Export...from pastebin" click that drop in the link above

---Drone Programer Remote--- https://pastebin.com/xDnReV6Z Same import steps but with the Programmer this time

Now that you have everything imported, you will need to set 3 cords in the program. -Home location -Chest location to be used to import sword, torches, and cobble -Charging station (Your drone will return here when you put him in Standby) These are noted within the program and you may want to change the sword item filter I have a diamond sword set by default

To use the Remote post setup

You'll be greeted with a fairly blank screen once you right click with the remote in your hand, but there will be two checkboxes in the upper right-hand corner. Once you check those, you will be given more options. See below for a couple screenshots.

1 2

Note: The drone will need 3 dispenser upgrades to carry the items or he will do nothing. Also, if you don't have it all ready, I highly recommend installing the In-Game Wiki mod, it contains some great documentation. It is a client-side mod that doesn't need to be on a server if you are playing on a server.

@desht I don't mean to piggy-back a thread, but if you could check out the program, I ran into issues with the Light Level Condition piece. I have tried everything to get it to behave, even went as far as putting in a Foreach and block condition piece to filter out "Air." My original approach that worked previously can be found in V3 of the remote and program here: https://pastebin.com/nn96PFzs --->Remote https://pastebin.com/jCh5M7Ax --->Programmer Basically, I would like to scan an area and return True/False if any blocks have x light level. Air blocks and blocks that are completely enclosed break this approach.

Also, the drone isn't switching to the sword when attacking. Is there a way to prioritize the drone to switch the item with highest damage value if an attack piece is activated?

Sorry for the long post, but I hope this helps!

desht commented 6 years ago

Sure, both of those (weapon switching & light detection) sound like things that should be there.

wrincewind commented 6 years ago

Speaking of 'prioritizing the drone to switch the item with highest damage value' is there a generic way to get the drone to pick a specific item out of its current inventory? Mostly i'm just curious, as currently it 'holds' the most recently picked up item. Is there a way to get it to, say, 'swap to item $number' in your inventory'?

desht commented 6 years ago

@wrincewind there isn't any way right now, although it wouldn't be too hard to add an 'Equip Item' puzzle piece. What would be the use case(s) for that, though?

desht commented 6 years ago

@Tekstack while looking at optimal weapon picking, I realised that drones absolutely suck at melee now (took about 10 hits to kill a spider with a diamond sword)... they still spam their attacks like they did in 1.7.10 :) Drones will need to learn 1.9+ fighting techniques just like players did... (I'll see about adding an attack cooldown)

wrincewind commented 6 years ago

@desht you know, now that i look back, I can't recall. It could be useful for e.g. equipping a wrench before right-clicking on a block, or equipping a Wand of the Forest to help with automating Botania's rune creation, say? Or am I overthinking it and there are easier ways to do that?

desht commented 6 years ago

@Tekstack I think your problem with the light levels might be down to a simple derp on my part, getting a comparison order wrong when refactoring that program widget. Can you give build 223 a go and let me know if it works better?

Tekstack commented 6 years ago

Ahh just saw your comment about the sword swing timer and I didn't even think about it. I'll test build 223 in reference to the light level check. Also, I can't wait to give the new armor a spin, looks awesome.