From 2387963936de244db8bfd19d7adbc40351763d83 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sat, 20 Jan 2024 22:50:22 +0800 Subject: [PATCH 01/29] hell --- core/src/mindustry/logic/LogicSound.java | 110 +++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 core/src/mindustry/logic/LogicSound.java diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java new file mode 100644 index 0000000000..8a37df0688 --- /dev/null +++ b/core/src/mindustry/logic/LogicSound.java @@ -0,0 +1,110 @@ +package mindustry.logic; + +import mindustry.gen.*; + +public enum LogicSound{ + artillery(Sounds.artillery), + bang(Sounds.bang), + bigshot(Sounds.bigshot), + blaster(Sounds.blaster), + bolt(Sounds.bolt), + boom(Sounds.boom), + break(Sounds.break), + buttonClick(Sounds.buttonClick), + cannon(Sounds.cannon), + cannonLarge(Sounds.largeCannon), + click(Sounds.click), + coreExplode(Sounds.corexplode), + door(Sounds.door), + drillImpact(Sounds.drillImpact), + explosion(Sounds.explosion), + explosionBig(Sounds.explosionbig), + explosionDull(Sounds.dullExplosion), + explosionLarge(Sounds.largeExplosion), + explosionTitan(Sounds.titanExplosion), + flame(Sounds.flame), + flame2(Sounds.flame2), + laser(Sounds.laser), + laserBig(Sounds.laserbig), + laserCharge(Sounds.lasercharge), + laserCharge2(Sounds.lasercharge2), + laserShoot(Sounds.lasershoot), + malignShoot(Sounds.malignShoot), + mineDeploy(Sounds.mineDeploy), + mineBeam(Sounds.mineBeam), + missile(Sounds.missile), + missileLarge(Sounds.missileLarge), + missileLaunch(Sounds.missileLaunch), + missileSmall(Sounds.missileSmall), + mud(Sounds.mud), + noAmmo(Sounds.noammo), + pew(Sounds.pew), + place(Sounds.place), + plantBreak(Sounds.plantBreak), + plasmaBoom(Sounds.plasmaboom), + plasmaDrop(Sounds.plasmadrop), + pulseBlast(Sounds.pulseBlast), + railgun(Sounds.railgun), + release(Sounds.release), + respawn(Sounds.respawn), + rockBreak(Sounds.rockBreak), + sap(Sounds.sap), + shockBlast(Sounds.shockBlast), + shoot(Sounds.shoot), + shootAlt(Sounds.shootAlt), + shootAltLong(Sounds.shootAltLong), + shootBig(Sounds.shootBig), + shootSmite(Sounds.shootSmite), + shootSnap(Sounds.shootSnap), + shotgun(Sounds.shotgun), + spark(Sounds.spark), + splash(Sounds.splash), + wave(Sounds.wave), + wind3(Sounds.wind3), + + beamLoop(Sounds.beam), + bioLoop(Sounds.bioLoop), + buildLoop(Sounds.build), + combustionLoop(Sounds.combustion), + conveyorLoop(Sounds.conveyor), + cutterLoop(Sounds.cutter), + drillLoop(Sounds.drill), + drillChargeLoop(Sounds.drillCharge), + extractLoop(Sounds.extractLoop), + fireLoop(Sounds.fire), + fluxLoop(Sounds.flux), + glowLoop(Sounds.glow), + grindingLoop(Sounds.grinding), + humLoop(Sounds.hum), + humElectricLoop(Sounds.electricHum), + laserBeamLoop(Sounds.laserbeam), + machineLoop(Sounds.machine), + missileTrailLoop(Sounds.missileTrail), + pulseLoop(Sounds.pulse), + rainLoop(Sounds.rain), + respawnLoop(Sounds.respawning), + shieldLoop(Sounds.shield), + smelterLoop(Sounds.smelter), + spellLoop(Sounds.spell), + sprayLoop(Sounds.spray), + steamLoop(Sounds.steam), + techLoop(Sounds.techloop), + thrusterLoop(Sounds.thruster), + torchLoop(Sounds.torch), + tractorBeamLoop(Sounds.tractorbeam), + windLoop(Sounds.wind), + wind2Loop(Sounds.wind2), + windHowlLoop(Sounds.windhowl), + + backUi(Sounds.back), + chatMessageUi(Sounds.chatMessage), + messageUi(Sounds.message), + pressUi(Sounds.press), + unlockUi(Sounds.unlock); + + public final Sound sound; + + LogicSound(Sound sound){ + this.sound = sound; + } +} \ No newline at end of file From eed30eb2e781c83e278c32e38b3b6e9b789d9144 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sat, 20 Jan 2024 22:53:14 +0800 Subject: [PATCH 02/29] hell --- core/src/mindustry/logic/LogicSound.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index 8a37df0688..a1d41d9241 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -85,7 +85,7 @@ public enum LogicSound{ respawnLoop(Sounds.respawning), shieldLoop(Sounds.shield), smelterLoop(Sounds.smelter), - spellLoop(Sounds.spell), + spellLoop(Sounds.spellLoop), sprayLoop(Sounds.spray), steamLoop(Sounds.steam), techLoop(Sounds.techloop), @@ -107,4 +107,4 @@ public enum LogicSound{ LogicSound(Sound sound){ this.sound = sound; } -} \ No newline at end of file +} From 1edfd9b0e1d91070e4f91b2997aaea332f756bea Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sat, 20 Jan 2024 22:55:32 +0800 Subject: [PATCH 03/29] issue --- core/src/mindustry/logic/LogicSound.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index a1d41d9241..96a9996159 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -9,7 +9,8 @@ public enum LogicSound{ blaster(Sounds.blaster), bolt(Sounds.bolt), boom(Sounds.boom), - break(Sounds.break), + /* break(Sounds.break), + one hell of a problem */ buttonClick(Sounds.buttonClick), cannon(Sounds.cannon), cannonLarge(Sounds.largeCannon), From 2b0653bda29ac08366612b6cd5012b46e7c425f3 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sat, 20 Jan 2024 22:59:45 +0800 Subject: [PATCH 04/29] aaaa --- core/src/mindustry/logic/LogicSound.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index 96a9996159..37a51a42d7 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -1,5 +1,6 @@ package mindustry.logic; +import arc.audio.*; import mindustry.gen.*; public enum LogicSound{ @@ -32,7 +33,6 @@ public enum LogicSound{ laserShoot(Sounds.lasershoot), malignShoot(Sounds.malignShoot), mineDeploy(Sounds.mineDeploy), - mineBeam(Sounds.mineBeam), missile(Sounds.missile), missileLarge(Sounds.missileLarge), missileLaunch(Sounds.missileLaunch), @@ -80,6 +80,7 @@ public enum LogicSound{ humElectricLoop(Sounds.electricHum), laserBeamLoop(Sounds.laserbeam), machineLoop(Sounds.machine), + mineBeam(Sounds.minebeam), missileTrailLoop(Sounds.missileTrail), pulseLoop(Sounds.pulse), rainLoop(Sounds.rain), From 57e317fa3f3532c40e058a18f83eb72f9b7655d3 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sat, 20 Jan 2024 23:00:15 +0800 Subject: [PATCH 05/29] foror --- core/src/mindustry/logic/LogicSound.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index 37a51a42d7..00a78870a9 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -80,7 +80,7 @@ public enum LogicSound{ humElectricLoop(Sounds.electricHum), laserBeamLoop(Sounds.laserbeam), machineLoop(Sounds.machine), - mineBeam(Sounds.minebeam), + mineBeamLoop(Sounds.minebeam), missileTrailLoop(Sounds.missileTrail), pulseLoop(Sounds.pulse), rainLoop(Sounds.rain), From 05d499fb18c8d27ceef531bbb048d0723bfc951d Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:09:52 +0800 Subject: [PATCH 06/29] bingor --- core/src/mindustry/logic/LExecutor.java | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 91cb4575e2..ade424afd4 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2023,6 +2023,34 @@ public class LExecutor{ } } + public static class PlaySoundI implements LInstruction{ + public boolean positional; + public LogicSound sound; + public int volume, pitch, pan, x, y; + + public PlaySoundI(){ + } + + public PlaySoundI(boolean positional, LogicSound sound, int volume, int pitch, int pan, int x, int y){ + this.positional = positional; + this.sound = sound; + this.volume = volume; + this.pitch = pitch; + this.pan = pan; + this.x = x; + this.y = y; + } + + @Override + public void run(LExecutor exec){ + if(positional){ + sound.sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); + }else{ + sound.sound.play(exec.numf(volume), exec.numf(pitch), exec.numf(pan)); + } + } + } + public static class SetMarkerI implements LInstruction{ public LMarkerControl type = LMarkerControl.pos; public int id, p1, p2, p3; From 63783a17951460a33c37043ed071a505c0e86a63 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:15:32 +0800 Subject: [PATCH 07/29] why don't you do this by default --- core/src/mindustry/logic/LExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index ade424afd4..91d62b1a06 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2046,7 +2046,7 @@ public class LExecutor{ if(positional){ sound.sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); }else{ - sound.sound.play(exec.numf(volume), exec.numf(pitch), exec.numf(pan)); + sound.sound.play(exec.numf(volume) * Core.audio.sfxVolume, exec.numf(pitch), exec.numf(pan)); } } } From 38b5ce0853fb0b76e702116ee22e749e38198925 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:22:05 +0800 Subject: [PATCH 08/29] i have no idea how to do this automatically --- core/src/mindustry/logic/LogicSound.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index 00a78870a9..fdd4322ff9 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -10,8 +10,7 @@ public enum LogicSound{ blaster(Sounds.blaster), bolt(Sounds.bolt), boom(Sounds.boom), - /* break(Sounds.break), - one hell of a problem */ + breakBlock(Sounds.breaks), buttonClick(Sounds.buttonClick), cannon(Sounds.cannon), cannonLarge(Sounds.largeCannon), From 75106282c323c6114764b7e3df1191a09378d76b Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:35:32 +0800 Subject: [PATCH 09/29] forgor --- core/src/mindustry/logic/LogicSound.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index fdd4322ff9..f655e612fd 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -104,6 +104,8 @@ public enum LogicSound{ unlockUi(Sounds.unlock); public final Sound sound; + + public static final LMarkerControl[] all = values(); LogicSound(Sound sound){ this.sound = sound; From e9a4699c8b686697134c70613e71f5d62572c535 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:36:02 +0800 Subject: [PATCH 10/29] the ctrl+c ctrl+v is real --- core/src/mindustry/logic/LogicSound.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java index f655e612fd..4d7b13731b 100644 --- a/core/src/mindustry/logic/LogicSound.java +++ b/core/src/mindustry/logic/LogicSound.java @@ -105,7 +105,7 @@ public enum LogicSound{ public final Sound sound; - public static final LMarkerControl[] all = values(); + public static final LogicSound[] all = values(); LogicSound(Sound sound){ this.sound = sound; From 780f13be57ba98f4fd8c4d9ad9c2cfbcc9c261a5 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:02:25 +0800 Subject: [PATCH 11/29] el ui --- core/src/mindustry/logic/LStatements.java | 67 +++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 31cce56e0c..86336f9c77 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -2085,6 +2085,73 @@ public class LStatements{ return LCategory.world; } } + + @RegisterStatement("playsound") + public static class PlaySoundStatement extends LStatement{ + public boolean positional; + public LogicSound sound = LogicSound.pew; + public String volume = "1", pitch = "1", pan = "0", x = "@thisx", y = "@thisy"; + + @Override + public void build(Table table){ + rebuid(table); + } + + void rebuild(Table table){ + table.clearChildren(); + + table.button(positional ? "positional" : "global", Styles.logict, () -> { + positional = !positional; + rebuild(table); + }).size(160f, 40f).pad(4f).color(table.color); + + row(table); + + table.add("play"); + + table.button(b -> { + b.label(() -> sound.name()); + b.clicked(() -> showSelect(b, LogicSound.all, sound, s -> { + sound = s; + rebuild(table); + }, 3, cell -> cell.size(150, 50))); + }, Styles.logict, () -> {}).size(190, 40).color(table.color).left().padLeft(2); + + row(table); + + fieldst(table, "volume", volume, str -> volume = str); + fieldst(table, "pitch", pitch, str -> pitch = str); + + row(table); + + if(positional){ + table.add("at "); + + fields(table, x, str -> x = str); + + table.add(", "); + + fields(table, y, str -> y = str); + }else{ + fieldst(table, "pan", pan, str -> pan = str); + } + } + + @Override + public boolean privileged(){ + return true; + } + + @Override + public LInstruction build(LAssembler builder){ + return new PlaySoundI(positional, sound, builder.var(volume), builder.var(pitch), builder.var(pan), builder.var(x), builder.var(y)); + } + + @Override + public LCategory category(){ + return LCategory.world; + } + } @RegisterStatement("setmarker") public static class SetMarkerStatement extends LStatement{ From 67fc5ba15b40e1f02253c3f03267c61fb62807ba Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:47:58 +0800 Subject: [PATCH 12/29] h --- core/src/mindustry/logic/LExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 91d62b1a06..ade424afd4 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2046,7 +2046,7 @@ public class LExecutor{ if(positional){ sound.sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); }else{ - sound.sound.play(exec.numf(volume) * Core.audio.sfxVolume, exec.numf(pitch), exec.numf(pan)); + sound.sound.play(exec.numf(volume), exec.numf(pitch), exec.numf(pan)); } } } From c77b866e567d37bba759939852441f5d1aca5cb1 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:58:54 +0800 Subject: [PATCH 13/29] much error --- core/src/mindustry/logic/LStatements.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 86336f9c77..87160a1afd 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -2094,7 +2094,7 @@ public class LStatements{ @Override public void build(Table table){ - rebuid(table); + rebuild(table); } void rebuild(Table table){ From 74cf56d43c5ea9bb295b0261dc41c915e163eb17 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:03:32 +0800 Subject: [PATCH 14/29] h --- core/src/mindustry/logic/LExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index ade424afd4..db7a528f63 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2046,7 +2046,7 @@ public class LExecutor{ if(positional){ sound.sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); }else{ - sound.sound.play(exec.numf(volume), exec.numf(pitch), exec.numf(pan)); + sound.sound.play(exec.numf(volume) * (Core.settings.getInt("sfxvol") / 100f), exec.numf(pitch), exec.numf(pan)); } } } From 23aa93fe12374ad7d0b32d99cf966ba4504d7ab4 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:45:46 +0800 Subject: [PATCH 15/29] rear --- core/assets/contributors | 1 + 1 file changed, 1 insertion(+) diff --git a/core/assets/contributors b/core/assets/contributors index 3b3153b7ee..9ef53eb655 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -165,3 +165,4 @@ OpalSoPL BalaM314 Redstonneur1256 ApsZoldat +Mythril382 From 753e992d6e3abbdf08bf7d95e8910c1d8a73dc84 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 21:48:49 +0800 Subject: [PATCH 16/29] slight desktop issue --- core/src/mindustry/logic/LStatements.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 87160a1afd..c88b4e7426 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -2122,7 +2122,7 @@ public class LStatements{ fieldst(table, "volume", volume, str -> volume = str); fieldst(table, "pitch", pitch, str -> pitch = str); - row(table); + table.row(); if(positional){ table.add("at "); From 64986a58e1fb6219cd72d85ec6892e408e2a28b1 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 12 Apr 2024 21:55:47 +0800 Subject: [PATCH 17/29] tooltip --- core/assets/bundles/bundle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index cbf4f022d1..ec9d1e7c21 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -2366,6 +2366,7 @@ lst.getflag = Check if a global flag is set. lst.setprop = Sets a property of a unit or building. lst.effect = Create a particle effect. lst.sync = Sync a variable across the network.\nLimited to 20 times a second per variable. +lst.playsound = Plays a sound either at input position\nif positional or anywhere if global. lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world. lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.\n[accent]null []values are ignored. lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first. From bc2be5de25b4433861941ec1249a8a4d22692819 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 27 May 2024 02:10:12 +0800 Subject: [PATCH 18/29] Delete core/src/mindustry/logic/LogicSound.java --- core/src/mindustry/logic/LogicSound.java | 113 ----------------------- 1 file changed, 113 deletions(-) delete mode 100644 core/src/mindustry/logic/LogicSound.java diff --git a/core/src/mindustry/logic/LogicSound.java b/core/src/mindustry/logic/LogicSound.java deleted file mode 100644 index 4d7b13731b..0000000000 --- a/core/src/mindustry/logic/LogicSound.java +++ /dev/null @@ -1,113 +0,0 @@ -package mindustry.logic; - -import arc.audio.*; -import mindustry.gen.*; - -public enum LogicSound{ - artillery(Sounds.artillery), - bang(Sounds.bang), - bigshot(Sounds.bigshot), - blaster(Sounds.blaster), - bolt(Sounds.bolt), - boom(Sounds.boom), - breakBlock(Sounds.breaks), - buttonClick(Sounds.buttonClick), - cannon(Sounds.cannon), - cannonLarge(Sounds.largeCannon), - click(Sounds.click), - coreExplode(Sounds.corexplode), - door(Sounds.door), - drillImpact(Sounds.drillImpact), - explosion(Sounds.explosion), - explosionBig(Sounds.explosionbig), - explosionDull(Sounds.dullExplosion), - explosionLarge(Sounds.largeExplosion), - explosionTitan(Sounds.titanExplosion), - flame(Sounds.flame), - flame2(Sounds.flame2), - laser(Sounds.laser), - laserBig(Sounds.laserbig), - laserCharge(Sounds.lasercharge), - laserCharge2(Sounds.lasercharge2), - laserShoot(Sounds.lasershoot), - malignShoot(Sounds.malignShoot), - mineDeploy(Sounds.mineDeploy), - missile(Sounds.missile), - missileLarge(Sounds.missileLarge), - missileLaunch(Sounds.missileLaunch), - missileSmall(Sounds.missileSmall), - mud(Sounds.mud), - noAmmo(Sounds.noammo), - pew(Sounds.pew), - place(Sounds.place), - plantBreak(Sounds.plantBreak), - plasmaBoom(Sounds.plasmaboom), - plasmaDrop(Sounds.plasmadrop), - pulseBlast(Sounds.pulseBlast), - railgun(Sounds.railgun), - release(Sounds.release), - respawn(Sounds.respawn), - rockBreak(Sounds.rockBreak), - sap(Sounds.sap), - shockBlast(Sounds.shockBlast), - shoot(Sounds.shoot), - shootAlt(Sounds.shootAlt), - shootAltLong(Sounds.shootAltLong), - shootBig(Sounds.shootBig), - shootSmite(Sounds.shootSmite), - shootSnap(Sounds.shootSnap), - shotgun(Sounds.shotgun), - spark(Sounds.spark), - splash(Sounds.splash), - wave(Sounds.wave), - wind3(Sounds.wind3), - - beamLoop(Sounds.beam), - bioLoop(Sounds.bioLoop), - buildLoop(Sounds.build), - combustionLoop(Sounds.combustion), - conveyorLoop(Sounds.conveyor), - cutterLoop(Sounds.cutter), - drillLoop(Sounds.drill), - drillChargeLoop(Sounds.drillCharge), - extractLoop(Sounds.extractLoop), - fireLoop(Sounds.fire), - fluxLoop(Sounds.flux), - glowLoop(Sounds.glow), - grindingLoop(Sounds.grinding), - humLoop(Sounds.hum), - humElectricLoop(Sounds.electricHum), - laserBeamLoop(Sounds.laserbeam), - machineLoop(Sounds.machine), - mineBeamLoop(Sounds.minebeam), - missileTrailLoop(Sounds.missileTrail), - pulseLoop(Sounds.pulse), - rainLoop(Sounds.rain), - respawnLoop(Sounds.respawning), - shieldLoop(Sounds.shield), - smelterLoop(Sounds.smelter), - spellLoop(Sounds.spellLoop), - sprayLoop(Sounds.spray), - steamLoop(Sounds.steam), - techLoop(Sounds.techloop), - thrusterLoop(Sounds.thruster), - torchLoop(Sounds.torch), - tractorBeamLoop(Sounds.tractorbeam), - windLoop(Sounds.wind), - wind2Loop(Sounds.wind2), - windHowlLoop(Sounds.windhowl), - - backUi(Sounds.back), - chatMessageUi(Sounds.chatMessage), - messageUi(Sounds.message), - pressUi(Sounds.press), - unlockUi(Sounds.unlock); - - public final Sound sound; - - public static final LogicSound[] all = values(); - - LogicSound(Sound sound){ - this.sound = sound; - } -} From 7f80a1879e156d661f3b560c39b6fe079c3c8cfb Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 27 May 2024 03:35:37 +0800 Subject: [PATCH 19/29] sound id --- core/src/mindustry/logic/GlobalVars.java | 16 ++++++++++++- core/src/mindustry/logic/LExecutor.java | 15 +++++++----- core/src/mindustry/logic/LStatements.java | 28 +++++++++++++++-------- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/core/src/mindustry/logic/GlobalVars.java b/core/src/mindustry/logic/GlobalVars.java index 65df2c3821..8648697edb 100644 --- a/core/src/mindustry/logic/GlobalVars.java +++ b/core/src/mindustry/logic/GlobalVars.java @@ -1,6 +1,7 @@ package mindustry.logic; import arc.*; +import arc.audio.*; import arc.files.*; import arc.graphics.*; import arc.math.*; @@ -9,6 +10,7 @@ import arc.util.*; import mindustry.*; import mindustry.content.*; import mindustry.ctype.*; +import mindustry.gen.*; import mindustry.game.*; import mindustry.logic.LExecutor.*; import mindustry.type.*; @@ -35,7 +37,9 @@ public class GlobalVars{ private IntSet privilegedIds = new IntSet(); private UnlockableContent[][] logicIdToContent; private int[][] contentIdToLogicId; - + + public static final Seq soundNames = new Seq<>(); + public void init(){ putEntryOnly("sectionProcessor"); @@ -89,6 +93,16 @@ public class GlobalVars{ put("@ctrlProcessor", ctrlProcessor); put("@ctrlPlayer", ctrlPlayer); put("@ctrlCommand", ctrlCommand); + + //sounds + for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ + if(sound != Sounds.none && sound != Sounds.swish){ + String name = sound.toString(); + name = name.substring(20, name.length - 4); + soundNames.put(name); + put("@sfx-" + name, Sounds.getSoundId(sound)); + } + } //store base content diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index db7a528f63..e62d0b65b7 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1,6 +1,7 @@ package mindustry.logic; import arc.*; +import arc.audio.*; import arc.graphics.*; import arc.math.*; import arc.math.geom.*; @@ -2025,15 +2026,14 @@ public class LExecutor{ public static class PlaySoundI implements LInstruction{ public boolean positional; - public LogicSound sound; - public int volume, pitch, pan, x, y; + public int id, volume, pitch, pan, x, y; public PlaySoundI(){ } - public PlaySoundI(boolean positional, LogicSound sound, int volume, int pitch, int pan, int x, int y){ + public PlaySoundI(boolean positional, int id, int volume, int pitch, int pan, int x, int y){ this.positional = positional; - this.sound = sound; + this.id = id; this.volume = volume; this.pitch = pitch; this.pan = pan; @@ -2043,10 +2043,13 @@ public class LExecutor{ @Override public void run(LExecutor exec){ + Sound sound = Sounds.getSound(exec.numi(id)); + if(sound == Sounds.none || sound == Sounds.swish) sound = Sounds.pew; //no. + if(positional){ - sound.sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); + sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); }else{ - sound.sound.play(exec.numf(volume) * (Core.settings.getInt("sfxvol") / 100f), exec.numf(pitch), exec.numf(pan)); + sound.play(exec.numf(volume) * (Core.settings.getInt("sfxvol") / 100f), exec.numf(pitch), exec.numf(pan)); } } } diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index c88b4e7426..9142d0dc0c 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -1,6 +1,7 @@ package mindustry.logic; import arc.*; +import arc.audio.*; import arc.func.*; import arc.graphics.*; import arc.scene.style.*; @@ -2089,8 +2090,9 @@ public class LStatements{ @RegisterStatement("playsound") public static class PlaySoundStatement extends LStatement{ public boolean positional; - public LogicSound sound = LogicSound.pew; - public String volume = "1", pitch = "1", pan = "0", x = "@thisx", y = "@thisy"; + public String id = "@sfx-pew", volume = "1", pitch = "1", pan = "0", x = "@thisx", y = "@thisy"; + + private transient TextField tfield; @Override public void build(Table table){ @@ -2107,15 +2109,18 @@ public class LStatements{ row(table); - table.add("play"); + table.add("play "); + + tfield = field(table, id, str -> id = str).padRight(0f).get(); table.button(b -> { - b.label(() -> sound.name()); - b.clicked(() -> showSelect(b, LogicSound.all, sound, s -> { - sound = s; + b.image(Icon.pencilSmall); + + b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), id, t -> { + sid("@sfx-" + t); rebuild(table); - }, 3, cell -> cell.size(150, 50))); - }, Styles.logict, () -> {}).size(190, 40).color(table.color).left().padLeft(2); + }, 4, cell -> cell.size(160, 50))); + }, Styles.logict, () -> {}).size(40).color(table.color).left().padLeft(-1); row(table); @@ -2137,6 +2142,11 @@ public class LStatements{ } } + private void sid(String text){ + tfield.setText(text); + id = text; + } + @Override public boolean privileged(){ return true; @@ -2144,7 +2154,7 @@ public class LStatements{ @Override public LInstruction build(LAssembler builder){ - return new PlaySoundI(positional, sound, builder.var(volume), builder.var(pitch), builder.var(pan), builder.var(x), builder.var(y)); + return new PlaySoundI(positional, builder.var(id), builder.var(volume), builder.var(pitch), builder.var(pan), builder.var(x), builder.var(y)); } @Override From d24f031cb46dfc858fdf23140614eda909ff4bb8 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 27 May 2024 04:13:35 +0800 Subject: [PATCH 20/29] it's 4:14, i should sleep anuke was right, this is a mess --- core/src/mindustry/logic/GlobalVars.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/GlobalVars.java b/core/src/mindustry/logic/GlobalVars.java index 8648697edb..defc11f01f 100644 --- a/core/src/mindustry/logic/GlobalVars.java +++ b/core/src/mindustry/logic/GlobalVars.java @@ -98,7 +98,10 @@ public class GlobalVars{ for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ if(sound != Sounds.none && sound != Sounds.swish){ String name = sound.toString(); - name = name.substring(20, name.length - 4); + int startIndex = name.indexOf("sounds/") + 7; + int endIndex = name.indexOf(".ogg"); + if(endIndex == -1) endIndex = name.indexOf(".mp3"); + name = name.substring(startIndex, endIndex); soundNames.put(name); put("@sfx-" + name, Sounds.getSoundId(sound)); } From 580d35cf1e2ac15277bf5ee7fb66f15f02f578e1 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 27 May 2024 12:54:27 +0800 Subject: [PATCH 21/29] the arc pr --- core/src/mindustry/logic/GlobalVars.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/src/mindustry/logic/GlobalVars.java b/core/src/mindustry/logic/GlobalVars.java index defc11f01f..9a8de13755 100644 --- a/core/src/mindustry/logic/GlobalVars.java +++ b/core/src/mindustry/logic/GlobalVars.java @@ -97,11 +97,7 @@ public class GlobalVars{ //sounds for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ if(sound != Sounds.none && sound != Sounds.swish){ - String name = sound.toString(); - int startIndex = name.indexOf("sounds/") + 7; - int endIndex = name.indexOf(".ogg"); - if(endIndex == -1) endIndex = name.indexOf(".mp3"); - name = name.substring(startIndex, endIndex); + String name = sound.file.nameWithoutExtension(); soundNames.put(name); put("@sfx-" + name, Sounds.getSoundId(sound)); } From dbb62bd87cff823feb85148a76fc9c4347756b08 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 27 May 2024 23:10:07 +0800 Subject: [PATCH 22/29] nullcheck --- core/src/mindustry/logic/LExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index e62d0b65b7..6dc97e0598 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2044,7 +2044,7 @@ public class LExecutor{ @Override public void run(LExecutor exec){ Sound sound = Sounds.getSound(exec.numi(id)); - if(sound == Sounds.none || sound == Sounds.swish) sound = Sounds.pew; //no. + if(sound == null || sound == Sounds.none || sound == Sounds.swish) sound = Sounds.pew; //no. if(positional){ sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); From ff35e6a7d81b43f2fd3327f8a5969d09b0ce8bcf Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 27 May 2024 23:13:43 +0800 Subject: [PATCH 23/29] mythril that's a seq, NOT an objectmap --- core/src/mindustry/logic/GlobalVars.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/GlobalVars.java b/core/src/mindustry/logic/GlobalVars.java index 9a8de13755..2823c8c771 100644 --- a/core/src/mindustry/logic/GlobalVars.java +++ b/core/src/mindustry/logic/GlobalVars.java @@ -98,7 +98,7 @@ public class GlobalVars{ for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ if(sound != Sounds.none && sound != Sounds.swish){ String name = sound.file.nameWithoutExtension(); - soundNames.put(name); + soundNames.add(name); put("@sfx-" + name, Sounds.getSoundId(sound)); } } From 0067af0e2c54580f8e27a7f0df0da3848273cdf4 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Tue, 28 May 2024 00:31:00 +0800 Subject: [PATCH 24/29] changes --- core/src/mindustry/logic/LExecutor.java | 2 +- core/src/mindustry/logic/LStatements.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 6dc97e0598..77ee71e9fe 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -2044,7 +2044,7 @@ public class LExecutor{ @Override public void run(LExecutor exec){ Sound sound = Sounds.getSound(exec.numi(id)); - if(sound == null || sound == Sounds.none || sound == Sounds.swish) sound = Sounds.pew; //no. + if(sound == null || sound == Sounds.swish) sound = Sounds.none; //no. if(positional){ sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 9142d0dc0c..02b4791933 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -2109,17 +2109,17 @@ public class LStatements{ row(table); - table.add("play "); + table.add(" play "); tfield = field(table, id, str -> id = str).padRight(0f).get(); table.button(b -> { b.image(Icon.pencilSmall); - b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), id, t -> { + b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), id.substring(4), t -> { sid("@sfx-" + t); rebuild(table); - }, 4, cell -> cell.size(160, 50))); + }, 2, cell -> cell.size(160, 50))); }, Styles.logict, () -> {}).size(40).color(table.color).left().padLeft(-1); row(table); From 5e3ee08c2c40a83e402bfaffda68646873075335 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Tue, 28 May 2024 00:38:05 +0800 Subject: [PATCH 25/29] remove that --- core/assets/contributors | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/assets/contributors b/core/assets/contributors index 9ef53eb655..d72d494713 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -165,4 +165,4 @@ OpalSoPL BalaM314 Redstonneur1256 ApsZoldat -Mythril382 +Mythril From 30480a6eda1d5550471d3ab8899650aa5ee33746 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sun, 2 Jun 2024 16:18:43 +0800 Subject: [PATCH 26/29] wack --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index dd42df65ea..f6e7927c9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=eac3d7211c +archash=480129c79d From 07d20a8da5c3ec76be72863ac5ccd3a7f1d713b3 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Mon, 17 Jun 2024 02:21:55 +0800 Subject: [PATCH 27/29] refactor 1 --- core/src/mindustry/logic/LExecutor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index b5c7583f43..03a214c93f 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1913,12 +1913,12 @@ public class LExecutor{ public static class PlaySoundI implements LInstruction{ public boolean positional; - public int id, volume, pitch, pan, x, y; + public LVar id, volume, pitch, pan, x, y; public PlaySoundI(){ } - public PlaySoundI(boolean positional, int id, int volume, int pitch, int pan, int x, int y){ + public PlaySoundI(boolean positional, LVar id, LVar volume, LVar pitch, LVar pan, LVar x, LVar y){ this.positional = positional; this.id = id; this.volume = volume; @@ -1930,13 +1930,13 @@ public class LExecutor{ @Override public void run(LExecutor exec){ - Sound sound = Sounds.getSound(exec.numi(id)); + Sound sound = Sounds.getSound(id.numi()); if(sound == null || sound == Sounds.swish) sound = Sounds.none; //no. if(positional){ - sound.at(World.unconv(exec.numf(x)), World.unconv(exec.numf(y)), exec.numf(pitch), exec.numf(volume)); + sound.at(World.unconv(x.numf()), World.unconv(y.numf()), pitch.numf(), volume.numf()); }else{ - sound.play(exec.numf(volume) * (Core.settings.getInt("sfxvol") / 100f), exec.numf(pitch), exec.numf(pan)); + sound.play(volume.numf() * (Core.settings.getInt("sfxvol") / 100f), pitch.numf(), pan.numf()); } } } From 94ebec4b6d1e7afdf36e9343f225436e7b7ba232 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:50:48 +0800 Subject: [PATCH 28/29] should --- core/src/mindustry/logic/LExecutor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 03a214c93f..45b5125db0 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1934,9 +1934,9 @@ public class LExecutor{ if(sound == null || sound == Sounds.swish) sound = Sounds.none; //no. if(positional){ - sound.at(World.unconv(x.numf()), World.unconv(y.numf()), pitch.numf(), volume.numf()); + sound.at(World.unconv(x.numf()), World.unconv(y.numf()), pitch.numf(), Math.min(volume.numf(), 2f)); }else{ - sound.play(volume.numf() * (Core.settings.getInt("sfxvol") / 100f), pitch.numf(), pan.numf()); + sound.play(Math.min(volume.numf() * (Core.settings.getInt("sfxvol") / 100f), 2f), pitch.numf(), pan.numf()); } } } From 36f07c2590039e98a51ee7f1732422a2482f1612 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sat, 6 Jul 2024 12:17:22 +0800 Subject: [PATCH 29/29] im not even sure if this is reliable --- core/src/mindustry/logic/GlobalVars.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/logic/GlobalVars.java b/core/src/mindustry/logic/GlobalVars.java index 9c0d128ec0..47292d4130 100644 --- a/core/src/mindustry/logic/GlobalVars.java +++ b/core/src/mindustry/logic/GlobalVars.java @@ -92,11 +92,13 @@ public class GlobalVars{ put("@ctrlCommand", ctrlCommand); //sounds - for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ - if(sound != Sounds.none && sound != Sounds.swish){ - String name = sound.file.nameWithoutExtension(); - soundNames.add(name); - put("@sfx-" + name, Sounds.getSoundId(sound)); + if(Core.assets != null){ + for(Sound sound : Core.assets.getAll(Sound.class, new Seq<>(Sound.class))){ + if(sound != Sounds.none && sound != Sounds.swish){ + String name = sound.file.nameWithoutExtension(); + soundNames.add(name); + put("@sfx-" + name, Sounds.getSoundId(sound)); + } } }