Do not unload groups asked for by quests (#2212)

This commit is contained in:
Nazrin
2023-06-16 11:04:58 -07:00
committed by GitHub
parent 89376d58bf
commit 6da5343df0
4 changed files with 11 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ public class ExecRefreshGroupSuite extends QuestExecHandler {
if (!scriptManager.refreshGroupSuite(groupId, suiteId, quest)) {
result = false;
}
scriptManager.getGroupById(groupId).dontUnload = true;
}
return result;

View File

@@ -838,7 +838,7 @@ public final class Scene {
.collect(Collectors.toSet());
for (var group : this.loadedGroups) {
if (!visible.contains(group.id) && !group.dynamic_load)
if (!visible.contains(group.id) && !group.dynamic_load && !group.dontUnload)
unloadGroup(scriptManager.getBlocks().get(group.block_id), group.id);
}

View File

@@ -266,15 +266,15 @@ public class SceneScriptManager {
suiteId,
groupId,
getScene().getId());
} else {
Grasscutter.getLogger().debug("Refreshing group {} suite {}", groupId, suiteId);
suiteId =
refreshGroup(
targetGroupInstance,
suiteId,
false); // If suiteId is zero, the value of suiteId changes
scene.broadcastPacket(new PacketGroupSuiteNotify(groupId, suiteId));
if (targetGroupInstance == null) return false;
}
Grasscutter.getLogger().debug("Refreshing group {} suite {}", groupId, suiteId);
suiteId =
refreshGroup(
targetGroupInstance,
suiteId,
false); // If suiteId is zero, the value of suiteId changes
scene.broadcastPacket(new PacketGroupSuiteNotify(groupId, suiteId));
return true;
}

View File

@@ -40,6 +40,7 @@ public final class SceneGroup {
public SceneGarbage garbages;
public SceneInitConfig init_config;
@Getter public boolean dynamic_load = false;
public boolean dontUnload = false;
public SceneReplaceable is_replaceable;