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 #9948

Closed
Closed
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 @@ -2367,7 +2367,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 @@ -2313,7 +2313,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 @@ -2327,7 +2327,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_cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,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 @@ -2313,7 +2313,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 @@ -2315,7 +2315,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 @@ -2317,7 +2317,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 @@ -2314,7 +2314,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 @@ -2327,7 +2327,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 @@ -2315,7 +2315,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 @@ -2328,7 +2328,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 @@ -2315,7 +2315,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 @@ -2315,7 +2315,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_ro.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,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 @@ -2335,7 +2335,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 @@ -2315,7 +2315,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 @@ -2315,7 +2315,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 @@ -166,3 +166,4 @@ BalaM314
Redstonneur1256
ApsZoldat
hexagon-recursion
The4codeblocks
42 changes: 21 additions & 21 deletions core/src/mindustry/logic/LExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,27 @@ public void run(LExecutor exec){
}
}

public static class SetRateI implements LInstruction{
public int amount;

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

public SetRateI(){
}

@Override
public void run(LExecutor exec){
if(exec.build != null){
exec.build.ipt = Mathf.clamp(exec.numi(amount), 1, exec.build.block.privileged ? ((LogicBlock)exec.build.block).maxInstructionsPerTick : ((LogicBlock)exec.build.block).instructionsPerTick);
if(exec.iptIndex >= 0 && exec.vars.length > exec.iptIndex){
exec.vars[exec.iptIndex].numval = exec.build.ipt;
}
}
}
}

public static class WaitI implements LInstruction{
public int value;

Expand Down Expand Up @@ -1835,27 +1856,6 @@ public static void logicExplosion(Team team, float x, float y, float radius, flo
}
}

public static class SetRateI implements LInstruction{
public int amount;

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

public SetRateI(){
}

@Override
public void run(LExecutor exec){
if(exec.build != null && exec.build.block.privileged){
exec.build.ipt = Mathf.clamp(exec.numi(amount), 1, ((LogicBlock)exec.build.block).maxInstructionsPerTick);
if(exec.iptIndex >= 0 && exec.vars.length > exec.iptIndex){
exec.vars[exec.iptIndex].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 @@ -1803,19 +1803,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
Loading