Closed BrainSlugs83 closed 1 year ago
figured I would give a bit of an update on my pathfinding updates, since I've been racking my brain for a few hours working on it. Luggage will now only pathfind to items it can see and reach. I'm still trying to finalize this, as there still couple cases where it'll try to grab items it can't reach (like having an item on a tree for example) but it works pretty damn well for the most part. I do have a catch case for this, however. If Luggage detects it reached where it was supposed to go and didn't grab the item, it'll run back to you. This does occasionally create a loop of it running back and forth between you and the item. I'm still trying to figure that bit out. If you get far enough away from where it's trying to run though it won't run back however. Whistling will now put Luggage on a cooldown for fetching items. It sets a 10 second cooldown before it will attempt to seek out items again. This should also fix your 4th and 5th point, as it shouldn't run off immediately. (I would also like to say that if your Luggage is in unloaded chunks and you whistle it won't come to you. This is unfortunately out of my control, as I can't fetch unloaded entities. Sorry!) Placing the item will also create a 3 second cooldown. I added a second keybind command to make Luggage sit still until the key is pressed again. This will affect all Luggages you own in an 8 block radius around you. I'm still trying to figure out a good sound to use for this. I'll do something about the bed thing as well lol
One time when it wasn't responding to whistles, it found an old boat to sit in and got stuck there as well... -- Like nothing I did could make it leave the boat or respond to whistles... it just saw a boat and was like, "I live here now".
I feel like... if the player isn't in the boat... maybe it should be able to respond to whistles at least... if not just flat out leave the boat... (I never sat in the boat while it was spawned, it just found it and that's where it lived until I chopped down the boat).
This does occasionally create a loop of it running back and forth between you and the item. I'm still trying to figure that bit out.
Is it picking the exact same X,Y,Z location to go to each time? -- You could make an heat map of recent locations it visited and put minor cooldowns / priorities on them (like with an LRU cache, or a dictionary object?) -- i.e. once a location is visited push it to the bottom of the priority list / or put a decaying weight on it (if a dictionary is used).
It would still eventually loop back there (once it moves up the priority list or the dictionary weight decays)... but less often... kind of like when you go to the fridge, and then you remember there's still no food... so maybe you wait 5 minutes before forgetting and trying the fridge again...
Edit: I suppose you could just do this with object Ids too, instead of X,Y,Z locations... basically once an attempt is given up on, move it to the bottom of the priority list.
One time when it wasn't responding to whistles, it found an old boat to sit in and got stuck there as well
This is fixable in 2 ways. I can either make it so Luggage can't sit in vehicles, or I can make it dismount vehicles when called. Up to you, both are easy to implement
About the loop thing, ideally, I want to figure out how to make it not even consider objects it can't reach. I'm still toying around with some stuff, but I may ask some people I know for advice if it drives me a little too crazy
good news, figured out the issue where it was trying to grab items it couldn't reach. Thanks to all the feedback I've received this feels like a much more tolerable companion to have around. Gonna test this for a little bit and hopefully I'll have an update out soon!
This is fixable in 2 ways. I can either make it so Luggage can't sit in vehicles, or I can make it dismount vehicles when called. Up to you, both are easy to implement.
I was thinking... you could have it dismount when called...?
Like maybe just look at what the players state is...? if the player mounted in a vehicle when calling, have it mount... but when a player is dismounted and calling have it dismount?
Fabric update was pushed today. Hope this fixes all of your problems with Luggage and makes it a better companion to be around. Enjoy, and I really appreciate the feedback!