From 0c4d6333f5be3cb6c637d3bbb3f86487e1e8a090 Mon Sep 17 00:00:00 2001 From: seb-135 Date: Wed, 20 Jan 2021 01:34:24 +0000 Subject: [PATCH] Fixed fakeplayers sometimes failing to pick up coins --- src/Me.as | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Me.as b/src/Me.as index eebb2b8..08243db 100644 --- a/src/Me.as +++ b/src/Me.as @@ -74,16 +74,25 @@ package { if (!Global.base.settings.particles) break; for (var k:int = 0; k < 4; k++) spawnCoinPatricle(cx, cy, current == ItemId.COIN_BLUE); - } else { - if ((current == ItemId.COIN_GOLD || current == 110) && (gx.indexOf(cx) == -1 || gy.indexOf(cy) == -1)) { - coins++; - gx.push(cx) - gy.push(cy); + } else if (!isme){ + var found:Boolean = false; + for (var i:int = 0; i < gx.length; i++) { + if (gx[i] == cx && gy[i] == cy) { + found = true; + break; + } } - else if ((current == ItemId.COIN_BLUE || current == 111) && (bx.indexOf(cx) == -1 || by.indexOf(cy) == -1)) { - bcoins++; - bx.push(cx); - by.push(cy); + if (!found) { + if (current == ItemId.COIN_GOLD || current == 110) { + coins++; + gx.push(cx) + gy.push(cy); + } + else if (current == ItemId.COIN_BLUE || current == 111) { + bcoins++; + bx.push(cx); + by.push(cy); + } } } break;