Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not privileged setrate [POSTREFORMAT] #10520

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2462,7 +2462,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_be.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_bg.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2425,7 +2425,7 @@ lst.weathersense = Check if a type of weather is active.
lst.weatherset = Set the current state of a type of weather.
lst.spawnwave = Симулира пусната вълна на произволно място.\nНяма да увеличи бройката на вълните.
lst.explosion = Създава експлозия на избрано място.
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.setrule = Поставяне на правило за игра.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_et.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_eu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_fil.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_lt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_nl_BE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_pt_PT.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,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.setrule = Defina uma regra do jogo.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_ro.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_sr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2425,7 +2425,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.setrule = Postavi pravilo igre.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,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.setrule = Set a game rule.
Expand Down
2 changes: 1 addition & 1 deletion core/assets/bundles/bundle_tk.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,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.setrule = Set a game rule.
Expand Down
1 change: 1 addition & 0 deletions core/assets/contributors
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,4 @@ BlueTheCube
sasha0552
1ue999
6-BennyLi-9
The4codeblocks
39 changes: 20 additions & 19 deletions core/src/mindustry/logic/LExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,26 @@ public void run(LExecutor exec){
}
}

public static class SetRateI implements LInstruction{
public LVar amount;

public SetRateI(LVar amount){
this.amount = amount;
}

public SetRateI(){
}

@Override
public void run(LExecutor exec){
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;

Expand Down Expand Up @@ -1765,25 +1785,6 @@ public static void logicExplosion(Team team, float x, float y, float radius, flo
}
}

public static class SetRateI implements LInstruction{
public LVar amount;

public SetRateI(LVar amount){
this.amount = amount;
}

public SetRateI(){
}

@Override
public void run(LExecutor exec){
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){
Expand Down
7 changes: 1 addition & 6 deletions core/src/mindustry/logic/LStatements.java
Original file line number Diff line number Diff line change
Expand Up @@ -1864,19 +1864,14 @@ public void build(Table table){
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));
}

@Override
public LCategory category(){
return LCategory.world;
return LCategory.control;
}
}

Expand Down