fix gadget infinity create

This commit is contained in:
Akka
2022-06-23 13:12:58 +08:00
committed by Melledy
parent b796372042
commit 1c6c581399
3 changed files with 23 additions and 7 deletions

View File

@@ -351,6 +351,16 @@ public class SceneScriptManager {
}
public EntityGadget createGadget(int groupId, int blockId, SceneGadget g) {
if(g.isOneoff){
var hasEntity = getScene().getEntities().values().stream()
.filter(e -> e instanceof EntityGadget)
.filter(e -> e.getGroupId() == g.group.id)
.filter(e -> e.getConfigId() == g.config_id)
.findFirst();
if(hasEntity.isPresent()){
return null;
}
}
EntityGadget entity = new EntityGadget(getScene(), g.gadget_id, g.pos);
if (entity.getGadgetData() == null){