cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 04:24 PM |
Is there a way I can ignore a single (or multiple) instances? I'm doing this recursively (GetConnectedParts(true)) and in some cases, it might be connected to the BasePlate which might connect it with other instances much further away, but still on the BasePlate.
I've tried making all the sides of the BasePlate 'unjoinable' but it still is returned in GetConnectedParts.
I don't want to have to loop over all the returned parts, check if it's BasePlate and GetConnnectedParts(false) with that and remove those from the original table because that just a little bit extreme. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 04:32 PM |
Never mind I just realized something like this is going to be very hard. I guess I'll just recursively GetConnectedParts(false) |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2015 04:36 PM |
| does GetConnectedParts return a table? if so, just loop thru the table and remove the parts you DONT WAnT |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 04:40 PM |
That's the thing, I won't always know what parts I don't want since it's constantly changing. Imagine redstone on minecraft, the 'ground' doesn't transfer electricity past more than 1 part. prntscr/7gmjtc
Say my target is the top-most part of the left-column, I only want the left-column returned. |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2015 04:41 PM |
| maybe check if the part isnt equal to a redstone part and then if it isnt, remove it from the table |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 04:43 PM |
How do you suppose I do that? The right-most column are all redstone parts. GetConnectedParts(true) will return EVERYTHING connected to the object directly or indirectly. Sure I can filter out non-redstone parts but the redstone parts that were indirectly connected to begin with won't be filtered out. |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2015 04:46 PM |
so
redstone redstone redstone non-redstone baseplate?
baseplate:GetConnectedParts(true)
for i,v in next, ^^^^ do if v.Name == "non-redstone" then table.remove(^^^^, v) end end
idk jus tryin to help |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 04:47 PM |
I know what you're saying, but look at the picture. If the baseplate connects redstone parts even when those redstone parts aren't in contact to each other directly/indirectly (excluding the baseplate), those can't get filtered out so easily.
If I just filter out non-redstone, I will still have a table filled with redstones that might not be touching in any way. |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2015 04:49 PM |
OH you're trying to find redstone connected to redstone to the baseplate?
uh... idk then. that sounds rly complicated, but you could do it another way... i think? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 04:51 PM |
Yeah I'm doing it another way, but it was so simple with the recursive argument of GCP D:
I thought maybe there was a method I didn't know about that might do something similar with an ignore list idk |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 05:34 PM |
| well, it works right now but i think it's pretty inefficient, maybe i'll rewrite it soon but for now :) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jun 2015 05:41 PM |
Yay http://www.roblox.com/games/183611668/Testing-Place
It's going to cause lag if you have a lot probably (I'm going to rewrite it to work with filtering and make sure the server does everything, so I don't have to 'turn off the power every tick') but it works :) |
|
|
| Report Abuse |
|
|