From 918eb1bafe90311235e7496a7e408f6cb8422031 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 14 Sep 2022 07:50:23 -0700 Subject: [PATCH 1/3] Fix `ContinuousLiquidTurret` not changing bullets when changing liquids. (#7561) * Wrong liquid, don't keep bullet alive. * Better transition * Annihilate unnecessary code duplication * Further reduce duplicated code * Unnecessary imports --- .../turrets/ContinuousLiquidTurret.java | 11 +++- .../defense/turrets/ContinuousTurret.java | 52 ++++++++++--------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java index c7869207ef..c57eb300a7 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java @@ -72,6 +72,11 @@ public class ContinuousLiquidTurret extends ContinuousTurret{ super.updateTile(); } + @Override + public boolean canConsume(){ + return hasCorrectAmmo() && super.canConsume(); + } + @Override public BulletType useAmmo(){ //does not consume ammo upon firing @@ -85,7 +90,11 @@ public class ContinuousLiquidTurret extends ContinuousTurret{ @Override public boolean hasAmmo(){ - return ammoTypes.get(liquids.current()) != null && liquids.currentAmount() >= 1f / ammoTypes.get(liquids.current()).ammoMultiplier; + return hasCorrectAmmo() && ammoTypes.get(liquids.current()) != null && liquids.currentAmount() >= 1f / ammoTypes.get(liquids.current()).ammoMultiplier; + } + + public boolean hasCorrectAmmo(){ + return !bullets.any() || bullets.first().bullet.type == peekAmmo(); } @Override diff --git a/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java index 61d6770bb2..60632a27ac 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java @@ -81,30 +81,7 @@ public class ContinuousTurret extends Turret{ if(bullets.any()){ for(var entry : bullets){ - float - bulletX = x + Angles.trnsx(rotation - 90, shootX + entry.x, shootY + entry.y), - bulletY = y + Angles.trnsy(rotation - 90, shootX + entry.x, shootY + entry.y), - angle = rotation + entry.rotation; - - entry.bullet.rotation(angle); - entry.bullet.set(bulletX, bulletY); - - //target length of laser - float shootLength = Math.min(dst(targetPos), range); - //current length of laser - float curLength = dst(entry.bullet.aimX, entry.bullet.aimY); - //resulting length of the bullet (smoothed) - float resultLength = Mathf.approachDelta(curLength, shootLength, aimChangeSpeed); - //actual aim end point based on length - Tmp.v1.trns(rotation, lastLength = resultLength).add(x, y); - - entry.bullet.aimX = Tmp.v1.x; - entry.bullet.aimY = Tmp.v1.y; - - if(isShooting() && hasAmmo()){ - entry.bullet.time = entry.bullet.lifetime * entry.bullet.type.optimalLifeFract * shootWarmup; - entry.bullet.keepAlive = true; - } + updateBullet(entry); } wasShooting = true; @@ -113,6 +90,33 @@ public class ContinuousTurret extends Turret{ } } + protected void updateBullet(BulletEntry entry){ + float + bulletX = x + Angles.trnsx(rotation - 90, shootX + entry.x, shootY + entry.y), + bulletY = y + Angles.trnsy(rotation - 90, shootX + entry.x, shootY + entry.y), + angle = rotation + entry.rotation; + + entry.bullet.rotation(angle); + entry.bullet.set(bulletX, bulletY); + + //target length of laser + float shootLength = Math.min(dst(targetPos), range); + //current length of laser + float curLength = dst(entry.bullet.aimX, entry.bullet.aimY); + //resulting length of the bullet (smoothed) + float resultLength = Mathf.approachDelta(curLength, shootLength, aimChangeSpeed); + //actual aim end point based on length + Tmp.v1.trns(rotation, lastLength = resultLength).add(x, y); + + entry.bullet.aimX = Tmp.v1.x; + entry.bullet.aimY = Tmp.v1.y; + + if(isShooting() && hasAmmo()){ + entry.bullet.time = entry.bullet.lifetime * entry.bullet.type.optimalLifeFract * shootWarmup; + entry.bullet.keepAlive = true; + } + } + @Override protected void updateReload(){ //continuous turrets don't have a concept of reload, they are always firing when possible From 8a50aa931b125e4237b8d976072f16c579c1d189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D1=80=D0=BA=D0=BD=D0=B5=D1=81=D1=81=233729?= <79508138+Darkness6030@users.noreply.github.com> Date: Thu, 15 Sep 2022 01:26:15 +0300 Subject: [PATCH 2/3] Why it uses name instead of id? (#7562) --- core/src/mindustry/ui/fragments/PlayerListFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/ui/fragments/PlayerListFragment.java b/core/src/mindustry/ui/fragments/PlayerListFragment.java index c805057bf3..81ed310b04 100644 --- a/core/src/mindustry/ui/fragments/PlayerListFragment.java +++ b/core/src/mindustry/ui/fragments/PlayerListFragment.java @@ -200,7 +200,7 @@ public class PlayerListFragment{ button.button(Icon.hammer, ustyle, () -> ui.showConfirm("@confirm", Core.bundle.format("confirmvotekick", user.name()), - () -> Call.sendChatMessage("/votekick " + user.name()))) + () -> Call.sendChatMessage("/votekick #" + user.id))) .size(h); } From f4ecd6849f3a69a37cc0035dae38e979e6243424 Mon Sep 17 00:00:00 2001 From: AB <70777952+RayanZ22@users.noreply.github.com> Date: Wed, 14 Sep 2022 19:26:26 -0300 Subject: [PATCH 3/3] Update servers_v7.json (#7571) --- servers_v7.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/servers_v7.json b/servers_v7.json index 961bdb32ef..2b507d8b6d 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -111,5 +111,9 @@ { "name": "Eradicationdustry", "address": ["n1.yeet.ml:6577", "n1.yeet.ml:6576", "n1.yeet.ml:6602", "n1.yeet.ml:6669", "eradicationmindustry.yeet.ml:9547"] - } + }, + { + "name": "AlternightBR", + "address": ["mindustry.ga:6567","mindustry.ga:6565","mindustry.ga:7770","mindustry.ga:6564","mindustry.ga:6566"] + } ]