Logic data instruction (#9935)
* Logic `data` instruction * Rename to `clientdata` & reliable option * frog Co-authored-by: Anuken <arnukren@gmail.com> --------- Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ public class LExecutor{
|
||||
maxDisplayBuffer = 1024,
|
||||
maxTextBuffer = 400;
|
||||
|
||||
|
||||
public LInstruction[] instructions = {};
|
||||
/** Non-constant variables used for network sync */
|
||||
public LVar[] vars = {};
|
||||
@@ -1761,6 +1762,31 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
|
||||
public static class ClientDataI implements LInstruction{
|
||||
public LVar channel, value, reliable;
|
||||
|
||||
public ClientDataI(LVar channel, LVar value, LVar reliable){
|
||||
this.channel = channel;
|
||||
this.value = value;
|
||||
this.reliable = reliable;
|
||||
}
|
||||
|
||||
public ClientDataI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec) {
|
||||
if(channel.obj() instanceof String c){
|
||||
Object v = value.isobj ? value.objval : value.numval;
|
||||
if(reliable.bool()){
|
||||
Call.clientLogicDataReliable(c, v);
|
||||
}else{
|
||||
Call.clientLogicDataUnreliable(c, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class GetFlagI implements LInstruction{
|
||||
public LVar result, flag;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user