From b692c071badb000ee8907e9616fd0b93dcf1bc61 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 8 Apr 2023 21:37:33 -0400 Subject: [PATCH] Fixed shoot pattern overrides not working in mods --- core/src/mindustry/entities/pattern/ShootMulti.java | 2 +- core/src/mindustry/entities/pattern/ShootPattern.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/entities/pattern/ShootMulti.java b/core/src/mindustry/entities/pattern/ShootMulti.java index 10fe77ac3e..f54ccdcd81 100644 --- a/core/src/mindustry/entities/pattern/ShootMulti.java +++ b/core/src/mindustry/entities/pattern/ShootMulti.java @@ -35,7 +35,7 @@ public class ShootMulti extends ShootPattern{ if(move != null) move.move(b); if(mover != null) mover.move(b); }); - }); + }, null); } }, barrelIncrementer); } diff --git a/core/src/mindustry/entities/pattern/ShootPattern.java b/core/src/mindustry/entities/pattern/ShootPattern.java index 2738eb5656..4cb15187df 100644 --- a/core/src/mindustry/entities/pattern/ShootPattern.java +++ b/core/src/mindustry/entities/pattern/ShootPattern.java @@ -14,14 +14,15 @@ public class ShootPattern implements Cloneable{ /** Called on a single "trigger pull". This function should call the handler with any bullets that result. */ public void shoot(int totalShots, BulletHandler handler, @Nullable Runnable barrelIncrementer){ - for(int i = 0; i < shots; i++){ - handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i); - } + //the default implementation calls the "soft deprecated" variant for mod compatibility, so overrides from older mods can function properly + shoot(totalShots, handler); } /** Called on a single "trigger pull". This function should call the handler with any bullets that result. */ public void shoot(int totalShots, BulletHandler handler){ - shoot(totalShots, handler, null); + for(int i = 0; i < shots; i++){ + handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i); + } } /** Subclasses should override this to flip its sides. */