Method CollectSameKindNeighbours
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
CollectSameKindNeighbours(InteractiveBehaviour, HeroController)
Points the hover at every neighbouring item of the same kind, so loot that picks itself up on hover is collected as a whole pile instead of one stack per pass of the pointer.
Why it has to exist: gold, arrows and cursed coins are never dragged - their OnEnable clears OnDrag - and they collect themselves from their hover handler (GoldBehaviour.OnPlayerHover, and the OnHover subscribers in QuiverBehaviour and CursedCoinBehaviour all call PickUp). Hover is therefore the only way to pick them up, and hovering a pile of drops used to collect only the stack the ray happened to hit. The owner asked for the group to come up as a whole (2026-09-23: "when it is grouped, let it collect everything").
Same kind is the displayed name, NOT the GameObject name: names are rewritten for some loot (a cursed coin renames itself to "Coin") and would not survive a rename or a prefab rename. The comparison goes through SameKind(string, int, string, int), the same rule the nameplate piles use. An inactive neighbour is skipped, which is what keeps an already collected stack from being collected twice, and the reentrancy flag stops a neighbour's own hover from scanning the pile again (each neighbour collects itself, exactly once).
public static void CollectSameKindNeighbours(InteractiveBehaviour source, HeroController hero)
Parameters
sourceInteractiveBehaviourheroHeroController