Page 1 of 1

Add ability to get the leg entities of a spider-vehicle

Posted: Thu Jan 13, 2022 4:17 am
by asher_sky
It would be really nice if you could add a .legs (array of spider legs) to spider-vehicles, and even a .spider (LuaEntity of spider-vehicle controlling this leg) to the leg entities.

It could also be something like entity.linked_entities or entity.grouped_entities.

Thank you!

Re: Add ability to get the leg entities of a spider-vehicle

Posted: Thu Jan 13, 2022 12:07 pm
by Klonan
Can you provide some insight on your usecase for such an interface?

Re: Add ability to get the leg entities of a spider-vehicle

Posted: Thu Jan 13, 2022 5:56 pm
by asher_sky
Klonan wrote:
Thu Jan 13, 2022 12:07 pm
Can you provide some insight on your usecase for such an interface?
Yes, I’ve been working recently with renderings, and want to make a mod that adds glowing colored trails wherever the spidertron walks. I can make it work pretty well at the moment using a generic rainbow cycle for the colors, but I would really like to have the color trails sync their color to the spidertron the legs belong to.

However this has proven difficult so far because I’m having trouble finding and keeping track of the correct spidertron, when many spidertrons are in close proximity to eachother.

Here you can see I got it kind of working, but the legs keep forgetting their spidertron owner and searching for nearby spiders to get a color from: https://youtu.be/w6st6LT2l0A

It would be much more convenient to be able to keep track of the spidertrons and then `for _,leg in pairs(spidertron.legs) do …` instead of trying to search and associate them myself

Re: Add ability to get the leg entities of a spider-vehicle

Posted: Mon Jan 17, 2022 3:49 pm
by boskid
1.1.51 wrote:Added LuaEntity::get_spider_legs()

Re: Add ability to get the leg entities of a spider-vehicle

Posted: Tue Jan 18, 2022 5:59 pm
by asher_sky
Amazing! Thank you :D