include getters, ignore unnescessary imports
All checks were successful
studiorailgun/highlevel-netcode-gen/pipeline/head This commit looks good
All checks were successful
studiorailgun/highlevel-netcode-gen/pipeline/head This commit looks good
This commit is contained in:
parent
445d9aeeed
commit
0c38bb77d1
@ -88,7 +88,7 @@ public class UpdateEntityState implements VirtualMethod {
|
||||
|
||||
//add server trees
|
||||
for(BehaviorTree bTree : projectStructure.getBehaviorTrees()){
|
||||
if(bTree.getName().contains("client")){
|
||||
if(bTree.getName().contains("client") && bTree.getSynchronizedFields() != null && bTree.getSynchronizedFields().size() > 0){
|
||||
rVal.add(bTree.getTargetFile().getQualifiedPath());
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public class ApplyStateCollection implements VirtualMethod {
|
||||
String updateCases = "";
|
||||
for(BehaviorTree serverTree : projectStructure.getBehaviorTrees()){
|
||||
//counterintuitively, want to only update client for server behavior tree ids
|
||||
if(serverTree.isServer()){
|
||||
if(serverTree.isServer() && shouldIncludeTree(projectStructure, serverTree)){
|
||||
BehaviorTree clientEquivalent = projectStructure.getTree(serverTree.getCorrespondingTreeName());
|
||||
String clientTreeName = clientEquivalent.getClassName();
|
||||
updateCases = updateCases + " case BehaviorTreeIdEnums." + BTreeIdEnum.getTreeIdEnum(serverTree) + ": {\n";
|
||||
@ -71,7 +71,9 @@ public class ApplyStateCollection implements VirtualMethod {
|
||||
|
||||
//add server trees
|
||||
for(BehaviorTree bTree : projectStructure.getBehaviorTrees()){
|
||||
rVal.add(bTree.getTargetFile().getQualifiedPath());
|
||||
if(shouldIncludeTree(projectStructure,bTree)){
|
||||
rVal.add(bTree.getTargetFile().getQualifiedPath());
|
||||
}
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
@ -81,4 +83,16 @@ public class ApplyStateCollection implements VirtualMethod {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this tree should be included in the synchronization manager
|
||||
* @param serverTree The server behavior tree
|
||||
* @return true if should be included, false otherwise
|
||||
*/
|
||||
private boolean shouldIncludeTree(ProjectStructure projectStructure, BehaviorTree serverTree){
|
||||
return
|
||||
serverTree.getSynchronizedFields() != null &&
|
||||
serverTree.getSynchronizedFields().size() > 0
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -78,7 +78,10 @@ public class GetStateCollection implements VirtualMethod {
|
||||
* @return true if should be included, false otherwise
|
||||
*/
|
||||
private boolean shouldIncludeTree(ProjectStructure projectStructure, BehaviorTree serverTree){
|
||||
return true;
|
||||
return
|
||||
serverTree.getSynchronizedFields() != null &&
|
||||
serverTree.getSynchronizedFields().size() > 0
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,9 +4,11 @@ import java.util.List;
|
||||
|
||||
import electrosphere.main.core.VirtualProject;
|
||||
import electrosphere.main.core.btree.BehaviorTree;
|
||||
import electrosphere.main.core.btree.methods.ClientFieldGetter;
|
||||
import electrosphere.main.core.btree.methods.ClientFieldSetter;
|
||||
import electrosphere.main.core.btree.methods.ClientTransition;
|
||||
import electrosphere.main.core.btree.methods.FromTypeConversion;
|
||||
import electrosphere.main.core.btree.methods.ServerFieldGetter;
|
||||
import electrosphere.main.core.btree.methods.ServerFieldSetter;
|
||||
import electrosphere.main.core.btree.methods.ToTypeConversion;
|
||||
import electrosphere.main.core.syncfield.SynchronizedField;
|
||||
@ -92,8 +94,10 @@ public class MainParser {
|
||||
tree.addSynchronizedField(field);
|
||||
if(tree.isServer()){
|
||||
tree.addMethod(new ServerFieldSetter(tree, field.getTypeName(), field.getFieldName()));
|
||||
tree.addMethod(new ServerFieldGetter(tree, field.getTypeName(), field.getFieldName()));
|
||||
} else {
|
||||
tree.addMethod(new ClientFieldSetter(tree, field.getTypeName(), field.getFieldName()));
|
||||
tree.addMethod(new ClientFieldGetter(tree, field.getTypeName(), field.getFieldName()));
|
||||
if(field.containsAnnotation("serverSendTransitionPacket")){
|
||||
tree.addMethod(new ClientTransition(tree, field.getTypeName(), field.getFieldName()));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user