Fix Librarian Story Quest (#2218)

* Fix Librarian Story Quest

* People die if they are killed

You want to die people instead of remove them so they play their sweet death animations.

* Nope. I take it back. Scriptlib is the wierd one to think removeEntity removes the entity.

* One must stop editing the code directly.

* Update EntityType.java

* Add warnings per Hartie

* Per Hartie, change getEntityType to EntityType
This commit is contained in:
Nazrin
2023-06-20 13:37:00 -07:00
committed by GitHub
parent 97b28b13fe
commit b58caf0632
6 changed files with 42 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ import emu.grasscutter.game.quest.enums.QuestContent;
import emu.grasscutter.game.quest.enums.QuestState;
import emu.grasscutter.game.world.SceneGroupInstance;
import emu.grasscutter.net.proto.EnterTypeOuterClass;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import emu.grasscutter.scripts.constants.EventType;
import emu.grasscutter.scripts.constants.GroupKillPolicy;
import emu.grasscutter.scripts.data.SceneGroup;
@@ -610,6 +611,11 @@ public class ScriptLib {
logger.debug("[LUA] Call CreateGadget with {}",
printTable(table));
var configId = table.get("config_id").toint();
//TODO: figure out what creating gadget configId 0 does
if (configId == 0){
Grasscutter.getLogger().warn("Tried to CreateGadget with config_id 0: {}", printTable(table));
return 0;
}
var group = getCurrentGroup();
@@ -704,7 +710,7 @@ public class ScriptLib {
return EntityType.None.getValue();
}
return entity.getEntityType();
return entity.getEntityType().getValue();
}
public int GetQuestState(int entityId, int questId){
@@ -739,11 +745,11 @@ public class ScriptLib {
val entity = getSceneScriptManager().getScene().getEntityByConfigId(configId, groupId);
if(entity == null || entity.getEntityType() != entityType){
if(entity == null || entity.getEntityType().getValue() != entityType){
return 1;
}
getSceneScriptManager().getScene().removeEntity(entity);
getSceneScriptManager().getScene().removeEntity(entity, VisionType.VISION_TYPE_REMOVE);
return 0;
}
@@ -819,7 +825,7 @@ public class ScriptLib {
}
public int IsPlayerAllAvatarDie(int sceneUid){
logger.warn("[LUA] Call unimplemented IsPlayerAllAvatarDie {}", sceneUid);
var playerEntities = getSceneScriptManager().getScene().getEntities().values().stream().filter(e -> e.getEntityType() == EntityIdType.AVATAR.getId()).toList();
var playerEntities = getSceneScriptManager().getScene().getEntities().values().stream().filter(e -> e.getEntityType() == EntityType.Avatar).toList();
for (GameEntity p : playerEntities){
var player = (EntityAvatar)p;
if(player.isAlive()){