边缘世界 RimWorld

边缘世界 RimWorld

Vanilla Outposts Expanded: Additional Outposts
此主题已被锁定
Imperator 2022 年 12 月 17 日 上午 10:48
Troubleshooting Custom Factions and Prisoners
I think there are room for improvements in the code for generating prisoners (e.g. from the Prison and Border Outpost) in games that have custom factions. It sounds like your selection criteria in the LINQ query may be skipping factions in some scenarios and there is likely also room for for adding error handling and a fallback method. We likely can find a short putt to fix the issue by modifying the LINQ query.

I worked on compatibility patches for Empire x Save Our Ship 2 and Rim War in 1.3. I think I can show you how to fix this if you share the source code with me. Do you have a git hub page I can submit to?
< >
正在显示第 1 - 5 条,共 5 条留言
[Zerg03] MrHydralisk  [开发者] 2022 年 12 月 17 日 下午 4:44 
Tbh, I pretty new to git, so I'm not very familiar with it yet. Since part of code that causing issue is quite small and self-sufficient, so it should be fine just sending it here. Will it be enough this way?
最后由 [Zerg03] MrHydralisk 编辑于; 2022 年 12 月 17 日 下午 4:55
[Zerg03] MrHydralisk  [开发者] 2022 年 12 月 17 日 下午 4:47 
First it trying to get all hostile factions that have humanlike type:
List<Faction> hostileFactions = Find.FactionManager.AllFactionsVisibleInViewOrder.Where((Faction f) => !f.temporary && !f.IsPlayer && f.PlayerRelationKind == FactionRelationKind.Hostile && f.def.humanlikeFaction).ToList();
Then it generating pawn from one of this factions:
Pawn prisoner = PawnGenerator.GeneratePawn(PawnKindDefOf.Villager, hostileFactions.ElementAt(Rand.Range(0, hostileFactions.Count())));
Your error seems to be caused somewhere inside LINQ, which should be fine from what I understand, since it all vanilla fields.
Imperator 2022 年 12 月 18 日 上午 12:28 
I would say that if you sent me the source code I could compile it and test it with my mod set using additional logging to isolate where exactly the error is produced. Do you want help setting up a github project where you are marked as the code author?
Imperator 2022 年 12 月 18 日 上午 12:31 
Without seeing more I can't even say for certain that the problem is certainly that the issue comes from the linq expression. I believe you, but it reasonably could be an if statement or something one level above that otherwise causes hostileFactions to be null. I am honestly inclined to believe that someone else's custom faction is just made incorrectly and lacks what would be a normal field, but my aim is to find out for sure.
[Zerg03] MrHydralisk  [开发者] 2022 年 12 月 23 日 上午 6:17 
Fixed
最后由 [Zerg03] MrHydralisk 编辑于; 2022 年 12 月 25 日 上午 2:09
< >
正在显示第 1 - 5 条,共 5 条留言
每页显示数: 1530 50