Skip to content

Commit 54e7e40

Browse files
committed
Scale particle count based on payload size
1 parent 23cec5a commit 54e7e40

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/extrasandredux/world/blocks/storage/FlowrateVoid.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import extrasandredux.ui.*;
1818
import extrasandredux.util.*;
1919
import mindustry.core.*;
20-
import mindustry.game.*;
2120
import mindustry.game.EventType.*;
21+
import mindustry.game.*;
2222
import mindustry.gen.*;
2323
import mindustry.graphics.*;
2424
import mindustry.type.*;
@@ -37,6 +37,7 @@ public class FlowrateVoid extends PayloadVoid{
3737
public float extraAbsorbOffset = 6f;
3838
public float extraAbsorbEffectMinDelay = 15f, extraAbsorbEffectMaxDelay = 35f;
3939
public float absorbPitch = 1f, absorbVolume = 0.2f;
40+
public float sclMax = 20f;
4041
public Color effectColor = Color.valueOf("1d053a");
4142

4243
protected TextureRegion baseRegion, spaceRegion;
@@ -222,16 +223,19 @@ public void consumePayload(){
222223
payloads.add(payload.content());
223224
}
224225

225-
payload = null;
226226
incinerateEffect.at(x, y, effectColor);
227227
incinerateSound.at(x, y, absorbPitch, absorbVolume);
228228

229-
for(int i = 0; i < extraAbsorbEffects; i++){
229+
float scl = Mathf.clamp(payload.size() / sclMax);
230+
int count = (int)(extraAbsorbEffects * scl * scl);
231+
for(int i = 0; i < count; i++){
230232
Time.run(Mathf.random(extraAbsorbEffectMinDelay, extraAbsorbEffectMaxDelay), () -> {
231-
Vec2 pos = ESRUtls.randomPoint(extraAbsorbOffset);
233+
Vec2 pos = ESRUtls.randomPoint(extraAbsorbOffset * scl);
232234
incinerateEffect.at(x + pos.x, y + pos.y, effectColor);
233235
});
234236
}
237+
238+
payload = null;
235239
}
236240

237241
@Override

0 commit comments

Comments
 (0)