BlindMindStudios / StarRuler2-Source

4X Space Strategy game Star Ruler 2's open source distribution.
http://starruler2.com
Other
1.46k stars 246 forks source link

Unlimited remnant pickups exploit #45

Open l29ah opened 6 years ago

l29ah commented 6 years ago

https://steamcommunity.com/app/282590/discussions/0/1290691937710672216/ Reproduced it on ba99a9a30875a4b76ff60b919d11a2e13a32c4e7 I've took a look on the corresponding .as files that govern pickup mechanics, but they all look innocent. Maybe there's some resource locking at play?

Lucas7211 commented 6 years ago

The way pickups were coded is that they destroy themselves when they get picked up, but destroy isn't an instant operation, it will take at the very least one tick to finish destroying itself (and even after that the object will linger until it can be garbage collected usually).

So if you queue multiple orders on the pickup they will all trigger on the pickup before it gets destroyed, triggering the effect multiple times.

Best solution would be for the pickup to track whether it has already been picked up internally and just early-out if it's attempted multiple times.