Read from MessageBlocks/Builds (#10981)
* Added ability to read content of messages and sensing the length of the content. Also some bundle changes for read/write * this commit will make mindustry unable to compile trust * oop missed a space
This commit is contained in:
@@ -2455,8 +2455,8 @@ unit.evoke.description = Builds structures to defend the Bastion core. Repairs s
|
|||||||
unit.incite.description = Builds structures to defend the Citadel core. Repairs structures with a beam. Capable of carrying 2x2 structures.
|
unit.incite.description = Builds structures to defend the Citadel core. Repairs structures with a beam. Capable of carrying 2x2 structures.
|
||||||
unit.emanate.description = Builds structures to defend the Acropolis core. Repairs structures with beams. Capable of carrying 2x2 structures.
|
unit.emanate.description = Builds structures to defend the Acropolis core. Repairs structures with beams. Capable of carrying 2x2 structures.
|
||||||
|
|
||||||
lst.read = Read a number from a linked memory cell.
|
lst.read = Read a number from a linked memory cell.\nCan also read from variables in other processors.
|
||||||
lst.write = Write a number to a linked memory cell.
|
lst.write = Write a number to a linked memory cell.\nCan also write to variables in other processors.
|
||||||
lst.print = Add text to the print buffer.\nDoes not display anything until [accent]Print Flush[] is used.
|
lst.print = Add text to the print buffer.\nDoes not display anything until [accent]Print Flush[] is used.
|
||||||
lst.printchar = Add a UTF-16 character or content icon to the print buffer.\nDoes not display anything until [accent]Print Flush[] is used.
|
lst.printchar = Add a UTF-16 character or content icon to the print buffer.\nDoes not display anything until [accent]Print Flush[] is used.
|
||||||
lst.format = Replace next placeholder in text buffer with a value.\nDoes not do anything if placeholder pattern is invalid.\nPlaceholder pattern: "{[accent]number 0-9[]}"\nExample:\n[accent]print "test {0}"\nformat "example"
|
lst.format = Replace next placeholder in text buffer with a value.\nDoes not do anything if placeholder pattern is invalid.\nPlaceholder pattern: "{[accent]number 0-9[]}"\nExample:\n[accent]print "test {0}"\nformat "example"
|
||||||
@@ -2566,7 +2566,7 @@ laccess.size = Size of a unit/building or the length of a string.
|
|||||||
laccess.id = ID of a unit/block/item/liquid.\nThis is the inverse of the lookup operation.
|
laccess.id = ID of a unit/block/item/liquid.\nThis is the inverse of the lookup operation.
|
||||||
laccess.displaywidth = Width of a display block in pixels.
|
laccess.displaywidth = Width of a display block in pixels.
|
||||||
laccess.displayheight = Height of a display block in pixels.
|
laccess.displayheight = Height of a display block in pixels.
|
||||||
laccess.bufferusage = Number of unprocessed commands in the graphics buffer of a display.
|
laccess.bufferusage = Number of unprocessed commands in the graphics buffer of a display.\nLength of the content of a message.
|
||||||
laccess.operations = Number of operations performed on the block.\nFor displays, returns the number of drawflush operations.
|
laccess.operations = Number of operations performed on the block.\nFor displays, returns the number of drawflush operations.
|
||||||
|
|
||||||
lcategory.unknown = Unknown
|
lcategory.unknown = Unknown
|
||||||
|
|||||||
@@ -580,6 +580,8 @@ public class LExecutor{
|
|||||||
output.numval = fromVar.numval;
|
output.numval = fromVar.numval;
|
||||||
output.isobj = fromVar.isobj;
|
output.isobj = fromVar.isobj;
|
||||||
}
|
}
|
||||||
|
}else if(from instanceof MessageBuild msg){
|
||||||
|
output.setnum(address < 0 || address >= msg.message.length() ? Double.NaN : (int)msg.message.charAt(address));
|
||||||
}else if(target.isobj && target.objval instanceof CharSequence str){
|
}else if(target.isobj && target.objval instanceof CharSequence str){
|
||||||
output.setnum(address < 0 || address >= str.length() ? Double.NaN : (int)str.charAt(address));
|
output.setnum(address < 0 || address >= str.length() ? Double.NaN : (int)str.charAt(address));
|
||||||
}else if(from instanceof CanvasBuild canvas && (exec.privileged || (from.team == exec.team))){
|
}else if(from instanceof CanvasBuild canvas && (exec.privileged || (from.team == exec.team))){
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import arc.util.io.*;
|
|||||||
import arc.util.pooling.*;
|
import arc.util.pooling.*;
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.logic.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
@@ -165,6 +166,14 @@ public class MessageBlock extends Block{
|
|||||||
return !accessible() ? SystemCursor.arrow : super.getCursor();
|
return !accessible() ? SystemCursor.arrow : super.getCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double sense(LAccess sensor){
|
||||||
|
return switch(sensor){
|
||||||
|
case bufferUsage -> message.length();
|
||||||
|
default -> super.sense(sensor);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(float damage){
|
public void damage(float damage){
|
||||||
if(privileged) return;
|
if(privileged) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user