feldoh / TotalControl

Enables the complete customization of faction pawn's appearance
MIT License
1 stars 2 forks source link

Unable to edit pawnkinds unique to VEF: Settlers' Bandit faction #27

Open Limfjorden opened 4 months ago

Limfjorden commented 4 months ago

Observed: The unique pawnkinds Outlaw, Bandit, and Bandit leader are not available for editing.

Expected: All pawnkinds for the faction to be editable

To reproduce:

Possible solution: VEF: Settlers includess three factions. SettlerCivil, SettlerRough, and SettlerSavage (bandits). They all derive from SettlerBasic which are the pawnkinds that are editable.

feldoh commented 4 months ago

Can’t check right now but most likely this is going to be similar to the ancients case where those factions don’t actually have their own pawnkinds and instead reuse some dynamic selection which prevents them from being edited with total control.

When the game does something like DefDatabase.where(…).RandomElement() TC doesn’t have a pawnkind to attach it’s edits to

On Wed, 19 Jun 2024 at 09:22, Limfjorden @.***> wrote:

Observed: The unique pawnkinds Outlaw, Bandit, and Bandit leader are not available for editing.

Expected: All pawnkinds for the faction to be editable

To reproduce:

  • Open mod settings
  • Open Total Control
  • Add new preset
  • Choose bandits as a new faction for editing
  • Observe that only pawnkinds from SettlerBase are visible, and not the unique bandit ones.

Possible solution: VEF: Settlers includess three factions. SettlerCivil, SettlerRough, and SettlerSavage (bandits). They all derive from SettlerBasic which are the pawnkinds that are editable.

— Reply to this email directly, view it on GitHub https://github.com/feldoh/TotalControl/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3LY26DCGGXVSNACFDFORDZIE5SZAVCNFSM6AAAAABJRRTUYOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3DCNZQGI3DQMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

feldoh commented 4 months ago

They are indeed not actually associated with the faction at all as such TC cannot control them. They are defined but not configured to be a part of the faction in the FactionDef. They are generated here in VE Code

https://github.com/Vanilla-Expanded/VanillaFactionsExpanded-Settlers/blob/e0d7a3af8266fdac00ffa581b5891efd82d6ff30/Source/VFE_Settlers/Utilities/UtilityPawn.cs#L17

Which just does:

PawnKindDef result = null;
            result = enemyFaction.RandomPawnKind();
            if (result == null)
            {
                result = DefDatabase<PawnKindDef>.AllDefsListForReading.Where((PawnKindDef kind) => kind.race.race.Humanlike).RandomElement();
            }

This happens occasionally and is a limitation of TC because otherwise you'd have to be able to edit every pawn kind in the entire game, potentially hundreds of them most of which wouldn't even be used, and I can't know how they're used to update the factionDef appropriately, e.g. if I were to let you force edit a BanditChief, as there's no config you'd also have to manually go and configure how it hooks into the faction which with that code would also mean you'd then only ever get bandit chiefs and nothing else. Ancients have the same issue because they intentionally draw from every pawnkind in the game.

Some of the global edit fields should still work; any that get applied late like specific apparel but that'd apply to ALL of the ones you can't configure directly which also isn't useful; sorry, this is just a limitation of how VE Settlers is coded I think and the way TC applies it's changes.