没技术,是菜鸡 发表于 2025-3-16 18:07:48

starfarer.api.campaign.SectorEntityToken.getContainingLocation() error

本帖最后由 没技术,是菜鸡 于 2025-3-16 18:09 编辑

最近浏览Starsector的Discord社区时发现他们那边也有人汇报这个错误,但是我自己除非用控制台爆炸全星系殖民地否则很难遇到。

时至今日,所有此类报错在中文论坛上均以存档损坏无法解决为终点解决。

因此我在这里备注一下一种解决方法:(给 @forrevenge 和 @Tick_Tock_Man )
英文原文(from Histidine,据说原始控制台代码来自Alex)
Fixed the runcode in the linked thread, see if this helps (copypaste into console once you finish loading into the save) will find the affected routes and hack a fix for them
runcode import com.fs.starfarer.api.impl.campaign.fleets.RouteManager;
      RouteManager manager = RouteManager.getInstance();
      Console.showMessage("Looking for routes with null from and null to");
      for (LocationAPI location: Global.getSector().getAllLocations()) {
            for (RouteManager.RouteData data: manager.getRoutesInLocation(location)) {
                if (data.getCurrent().from == null && data.getCurrent().to == null) {
                  Console.showMessage("Faction: " + data.getFactionId() + " Market: " + data.getMarket() + " Source: " + data.getSource());
                  data.getCurrent().from = (SectorEntityToken)location.getAllEntities().get(0);
                }
            }
      }

翻译:一旦你成功读档就马上在控制台里复制黏贴这条命令并执行,它会检测所有两端有问题的航路,并通过一个hack来尝试将其修复。

forrevenge 发表于 2025-3-16 19:19:10

行,也就是那个幽灵部队的闪退是吧

極光 发表于 2025-3-16 19:40:56

{:tieba_03:}{:tieba_03:}还有这种问题吗。。。mark一下,出问题了就来拉代码修修

JCan 发表于 2025-3-17 22:27:52

forrevenge 发表于 2025-3-16 19:19
行,也就是那个幽灵部队的闪退是吧

并不是同一个,幽灵的那个最近更新修了

koioijio 发表于 2025-3-18 14:02:54

我也出现这报错了,复制输入这代码后还是不行

koioijio 发表于 2025-3-18 16:45:05

把之前的存档都删了后,只保留最后的几个存档,就没这问题了,奇怪
页: [1]
查看完整版本: starfarer.api.campaign.SectorEntityToken.getContainingLocation() error