Select command from reconstructor / Units save command when controlled

This commit is contained in:
Anuken
2023-05-30 20:08:48 -04:00
parent 7911a22cc9
commit b6f5d424da
8 changed files with 103 additions and 9 deletions

View File

@@ -34,6 +34,14 @@ public class Annotations{
}
/** Indicates that a field should not be synced to clients (but may still be non-transient) */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE)
public @interface NoSync{
}
/** Indicates that a component field is imported from other components. This means it doesn't actually exist. */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE)

View File

@@ -118,7 +118,7 @@ public class EntityIO{
}
}
void writeSync(MethodSpec.Builder method, boolean write, Seq<Svar> syncFields, Seq<Svar> allFields) throws Exception{
void writeSync(MethodSpec.Builder method, boolean write, Seq<Svar> allFields) throws Exception{
this.method = method;
this.write = write;
@@ -138,6 +138,7 @@ public class EntityIO{
//add code for reading revision
for(RevisionField field : rev.fields){
Svar var = allFields.find(s -> s.name().equals(field.name));
if(var == null || var.has(NoSync.class)) continue;
boolean sf = var.has(SyncField.class), sl = var.has(SyncLocal.class);
if(sl) cont("if(!islocal)");

View File

@@ -490,7 +490,7 @@ public class EntityProcess extends BaseProcessor{
//SPECIAL CASE: sync I/O code
if((first.name().equals("readSync") || first.name().equals("writeSync"))){
io.writeSync(mbuilder, first.name().equals("writeSync"), syncedFields, allFields);
io.writeSync(mbuilder, first.name().equals("writeSync"), allFields);
}
//SPECIAL CASE: sync I/O code for writing to/from a manual buffer