diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 3a450bffec..6f84e12351 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -2783,7 +2783,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Spawn a wave. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_be.properties b/core/assets/bundles/bundle_be.properties index 351be2bcfd..8a33b6908c 100644 --- a/core/assets/bundles/bundle_be.properties +++ b/core/assets/bundles/bundle_be.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_cs.properties b/core/assets/bundles/bundle_cs.properties index c88cd48576..885ecc03d7 100644 --- a/core/assets/bundles/bundle_cs.properties +++ b/core/assets/bundles/bundle_cs.properties @@ -2769,6 +2769,7 @@ lst.unitbind = Nastaví další jednotku daného typu a uloží jí do [accent]@ lst.unitcontrol = Kontroluje nastavenou jednotku. lst.unitradar = Lokalizuje jednotky kolem nastavené jednotky. lst.unitlocate = Lokalizuje daný typ pozice/budovy kdekoliv na mapě.\nVyžaduje nastavenou jednotku. + lst.getblock = Získá data dlaždice na libovolném místě. lst.setblock = Nastaví data dlaždice na libovolném místě. lst.spawnunit = Vytvoří jednotku na daném místě. @@ -2778,7 +2779,7 @@ lst.weathersense = Zkontroluje, zda je aktivní určitý typ počasí. lst.weatherset = Nastaví aktuální stav určitého typu počasí. lst.spawnwave = Zrodí vlnu. lst.explosion = Vytvoří výbuch na daném místě. -lst.setrate = Nastaví rychlost vykonávání procesoru v instrukcích/tik. +lst.setrate = Nastaví rychlost vykonávání procesoru v instrukcích/tik.\Nelze překročit maximální rychlost vykonávání. lst.fetch = Vyhledá jednotky, jádra, hráče nebo budovy podle indexu.\nIndexy začínají na 0 a končí jejich vráceným počtem. lst.packcolor = Zabalí složky RGBA [0, 1] do jednoho čísla pro kreslení nebo nastavování pravidel. lst.unpackcolor = Rozbalí složky RGBA z barvy zabalené pomocí Pack Color. diff --git a/core/assets/bundles/bundle_da.properties b/core/assets/bundles/bundle_da.properties index d806084685..9b9cf450c9 100644 --- a/core/assets/bundles/bundle_da.properties +++ b/core/assets/bundles/bundle_da.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_et.properties b/core/assets/bundles/bundle_et.properties index ccbfa4fe95..63a6783934 100644 --- a/core/assets/bundles/bundle_et.properties +++ b/core/assets/bundles/bundle_et.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_eu.properties b/core/assets/bundles/bundle_eu.properties index be4320f18b..f99804f1c3 100644 --- a/core/assets/bundles/bundle_eu.properties +++ b/core/assets/bundles/bundle_eu.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_fil.properties b/core/assets/bundles/bundle_fil.properties index 8c8d43fbf7..c71da569a5 100644 --- a/core/assets/bundles/bundle_fil.properties +++ b/core/assets/bundles/bundle_fil.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_it.properties b/core/assets/bundles/bundle_it.properties index 1a85db70ff..e8e1e47c56 100644 --- a/core/assets/bundles/bundle_it.properties +++ b/core/assets/bundles/bundle_it.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_lt.properties b/core/assets/bundles/bundle_lt.properties index 85a41bad3a..3a633d7a79 100644 --- a/core/assets/bundles/bundle_lt.properties +++ b/core/assets/bundles/bundle_lt.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_nl.properties b/core/assets/bundles/bundle_nl.properties index 870416c3b3..ae98783626 100644 --- a/core/assets/bundles/bundle_nl.properties +++ b/core/assets/bundles/bundle_nl.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_nl_BE.properties b/core/assets/bundles/bundle_nl_BE.properties index f7b332cbc3..75e5f57917 100644 --- a/core/assets/bundles/bundle_nl_BE.properties +++ b/core/assets/bundles/bundle_nl_BE.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_pt_PT.properties b/core/assets/bundles/bundle_pt_PT.properties index 124106ecb7..10e9b2318a 100644 --- a/core/assets/bundles/bundle_pt_PT.properties +++ b/core/assets/bundles/bundle_pt_PT.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Gerar uma onda. lst.explosion = Crie uma explosão em um local. -lst.setrate = Defina a velocidade de execução do processador em instruções/tick. +lst.setrate = Defina a velocidade de execução do processador em instruções/tick.\nNão pode ultrapassar a velocidade máxima de execução. lst.fetch = Pesquise unidades, núcleos, jogadores ou edifícios por índice.\nOs índices começam em 0 e terminam na contagem retornada. lst.packcolor = Empacote [0, 1] componentes RGBA em um único número para desenho ou configuração de regra. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_ro.properties b/core/assets/bundles/bundle_ro.properties index 4e131586f0..48d2eca561 100644 --- a/core/assets/bundles/bundle_ro.properties +++ b/core/assets/bundles/bundle_ro.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_sr.properties b/core/assets/bundles/bundle_sr.properties index fb467e063e..7f1da0878f 100644 --- a/core/assets/bundles/bundle_sr.properties +++ b/core/assets/bundles/bundle_sr.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Izazovi eksploziju na mestu. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_sv.properties b/core/assets/bundles/bundle_sv.properties index 02b86c499d..c7cd3431ae 100644 --- a/core/assets/bundles/bundle_sv.properties +++ b/core/assets/bundles/bundle_sv.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/assets/bundles/bundle_tk.properties b/core/assets/bundles/bundle_tk.properties index 91df3e218b..092aae5595 100644 --- a/core/assets/bundles/bundle_tk.properties +++ b/core/assets/bundles/bundle_tk.properties @@ -2778,7 +2778,7 @@ lst.weathersense = Check if a type of weather is active. lst.weatherset = Set the current state of a type of weather. lst.spawnwave = Simulate a wave being spawned at a arbitrary location.\nWill not increment the wave counter. lst.explosion = Create an explosion at a location. -lst.setrate = Set processor execution speed in instructions/tick. +lst.setrate = Set processor execution speed in instructions/tick.\nCannot surpass maximum execution speed. lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count. lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting. lst.unpackcolor = Unpack RGBA components from a color that was packed using Pack Color. diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index c6947b4afc..87b09720ee 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1207,6 +1207,26 @@ public class LExecutor{ } } + public static class SetRateI implements LInstruction{ + public LVar amount; + + public SetRateI(LVar amount){ + this.amount = amount; + } + + public SetRateI(){ + } + + @Override + public void run(LExecutor exec){ + if(exec.build == null) return; + exec.build.ipt = Mathf.clamp(amount.numi(), 1, exec.build.block.privileged ? ((LogicBlock)exec.build.block).maxInstructionsPerTick : ((LogicBlock)exec.build.block).instructionsPerTick); + if(exec.ipt != null){ + exec.ipt.numval = exec.build.ipt; + } + } + } + public static class WaitI implements LInstruction{ public LVar value; @@ -2021,26 +2041,6 @@ public class LExecutor{ } } - public static class SetRateI implements LInstruction{ - public LVar amount; - - public SetRateI(LVar amount){ - this.amount = amount; - } - - public SetRateI(){ - } - - @Override - public void run(LExecutor exec){ - if(exec.build == null) return; - exec.build.ipt = Mathf.clamp(amount.numi(), 1, ((LogicBlock)exec.build.block).maxInstructionsPerTick); - if(exec.ipt != null){ - exec.ipt.numval = exec.build.ipt; - } - } - } - @Remote(unreliable = true) public static void syncVariable(Building building, int variable, Object value){ if(building instanceof LogicBuild build){ diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index ff9a23ee95..3681c2e08c 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -2080,11 +2080,6 @@ public class LStatements{ fields(table, "ipt = ", amount, str -> amount = str); } - @Override - public boolean privileged(){ - return true; - } - @Override public LInstruction build(LAssembler builder){ return new SetRateI(builder.var(amount)); @@ -2092,7 +2087,7 @@ public class LStatements{ @Override public LCategory category(){ - return LCategory.world; + return LCategory.control; } } diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 1635b1e157..c886a04118 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -261,7 +261,7 @@ public class LogicBlock extends Block{ public Seq links = new Seq<>(); public @Nullable ObjectIntMap linkMap; public boolean checkedDuplicates = false; - //dynamic only for privileged processors + public int ipt = instructionsPerTick; /** Display name, for convenience. This is currently only available for world processors. */ public @Nullable String tag; @@ -550,11 +550,7 @@ public class LogicBlock extends Block{ if(changed){ updateLinks(); } - - if(!privileged){ - ipt = instructionsPerTick; - } - + if(state.rules.disableWorldProcessors && privileged) return; if(enabled && executor.initialized()){ @@ -778,7 +774,7 @@ public class LogicBlock extends Block{ @Override public byte version(){ - return 4; + return 5; } @Override @@ -820,6 +816,8 @@ public class LogicBlock extends Block{ if(privileged){ write.s(Mathf.clamp(ipt, 1, maxInstructionsPerTick)); + }else{ + write.s(ipt == instructionsPerTick ? 0 : Mathf.clamp(ipt, 1, instructionsPerTick)); } TypeIO.writeString(write, tag); @@ -895,6 +893,13 @@ public class LogicBlock extends Block{ ipt = Mathf.clamp(read.s(), 1, maxInstructionsPerTick); } + if(!privileged && revision >= 5){ + short iptR = read.s(); + if(iptR != 0){ + ipt = Mathf.clamp(iptR, 1, instructionsPerTick); + } + } + if(revision >= 3){ tag = TypeIO.readString(read); iconTag = (char)read.us();