Closed ubertpendragon closed 8 months ago
Note that direct variants don't need ragdoll or animation specified. In both cases we tried a simple override for these variants to use pathfinding.
This works:
<Character inherit="Bonethresher" speciesname="DE-LairBonethresher" pathfinderpriority="1" usepathfinding="True">
<ai targetinnerwalls="False" targetouterwalls="false">
<target tag="decoy" state="Attack" priority="100" ignoreifnotinsamesub="True" />
<target tag="provocative" state="Attack" priority="100" ignoreifnotinsamesub="True"/>
</ai>
</Character>
This sends an error:
<Charactervariant inherit="Crawler_hatchling" speciesname="DE-LairCrawler_hatchling" speciestranslationoverride="Crawler" >
<ai combatstrength="50" targetinnerwalls="False" targetouterwalls="false">
<target tag="DE-Lairbroodmother" state="Protect" priority="10" reactdistance="500" ignoreinside="true" />
<target tag="DE-LairCrawler_large" state="Protect" priority="5" reactdistance="500" ignoreinside="true" />
<target tag="DE-LairCrawler" state="Protect" priority="2" reactdistance="500" ignoreinside="true" />
</ai>
<inventory />
</Charactervariant>
I also tried copying and adding the files in mod folder with path but it seems that the game tries to get the file from vanilla folder regardless
Tested against release/spring-update commit https://github.com/FakeFishGames/Barotrauma-development/commit/92aefbc12d1c1df5c104c4f7385d4600c6082aea
The issue here seems to be on the creation of a none humanoid (that is anything through the fishanimcontroller) it does not pass along any filename, only the characters species (So defining it manually will not work at all here) - FishRagdollParams.cs line 25.
As a further potential issue, It will check if the prefab to spawn has a variant of, then switch the ragdoll/animation species to that variant - however it does not check if that has a variant to check either (And which actually has ragdolls/animations) in RagdollParams.cs line 151. - Once it fails to find a file it attempts the default file, which checks based on the content package the character is in, which still doesn't exist in the case of most variants usually.
The logic essentially needs looking at (both perhaps to pass alone custom ragdoll/animation paths, and the logic related to checking variants if they have derived something else like a recursive check until a ragdoll/animation is found unless an explicit path is given.
Mod used to test (probably not correct, in debug will crash): aaaTestVariantVariant.zip
Second mod for testing animations side (doesn't error on ragdolls due to character override): aaaTestVariantVariant.zip
Fixed in FakeFishGames/Barotrauma-development@b73c74f. Note that variants of variants is not really a supported feature. There might be some other issues too. And variants of variants of variants will definitely not work.
And variants of variants of variants will definitely not work.
What does this mean? What was fixed?
Add support for loading animations and ragdolls for variants of variants. Addresses FakeFishGames/Barotrauma#13271. Also allow defining the ragdoll by path, which means it's no longer required for the ragdolls to conform to the default naming convention. They can also be located outside of the Ragdoll folder now.
Can I just define the ragdoll/animation path and it will work?
It should be possible to define it yourself, or have it get the base character's species for the ragdoll's/animations. it has yet to be tested so its not in the next version yet though.
The changes include filename's / paths as well as how it gets the variant / species to find the ragdoll / animation files, Any caveats though we won't be sure of until its tested properly but it looks intended to allow defining the ragdoll folder/path and the animation folder/path directly - likely for if it cannot find it or you want to use a different species entirely.
And variants of variants of variants will definitely not work.
Previously there was only support for variants of non-variants, not variants of variants (grandchildren). I added some support for it here and couldn't spot any issues, but there might be some still. If it's trivial to fix, we can do that but it's not something that I'd use much resources on. Deeper variance inheritance than that will not currently work, because the methods of checking the parents are not recursive.
And in practice you should now be able to do this:
<ragdoll path="Content/Characters/Mudraptor/Ragdolls/MudraptorDefaultRagdoll.xml"/>
or
<ragdolls folder="Content/Characters/Mudraptor/Ragdolls/"/>
and:
<animations folder="%ModDir%/Animations/"/>
or:
<animations folder="Content/Characters/Crawler/Animations/"/>
Tried to test this as part of: https://github.com/FakeFishGames/Barotrauma-development/pull/4930
Test mods seems to error out still, maybe @NilanthAnimosus could take another look?
Failed to spawn the character "True_Mudraptor_veteran". {[RagdollParams] Failed to load ragdoll True_mudraptor_veteran Default Ragdoll from LocalMods/aaaTestVariantVariant/True_Mudraptor_veteran/Ragdolls/True_mudraptor_veteranDefaultRagdoll.xml for the character True_Mudraptor_veteran.}
at Barotrauma.RagdollParams.GetRagdollParams[T](Identifier speciesName, Either`2 file) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Params/Ragdoll/RagdollParams.cs:line 254
at Barotrauma.RagdollParams.GetDefaultRagdollParams[T](Identifier speciesName, XElement characterRootElement) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Params/Ragdoll/RagdollParams.cs:line 163
at Barotrauma.RagdollParams.GetDefaultRagdollParams[T](Identifier speciesName, CharacterParams characterParams) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Params/Ragdoll/RagdollParams.cs:line 135
at Barotrauma.RagdollParams.GetDefaultRagdollParams[T](Character character) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Params/Ragdoll/RagdollParams.cs:line 130
at Barotrauma.FishRagdollParams.GetDefaultRagdollParams(Character character) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Params/Ragdoll/RagdollParams.cs:line 24
at Barotrauma.FishAnimController.get_FishRagdollParams() in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/FishAnimController.cs:line 25
at Barotrauma.FishAnimController.get_RagdollParams() in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/FishAnimController.cs:line 14
at Barotrauma.Ragdoll..ctor(Character character, String seed, RagdollParams ragdollParams) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs:line 461
at Barotrauma.AnimController..ctor(Character character, String seed, RagdollParams ragdollParams) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/AnimController.cs:line 225
at Barotrauma.FishAnimController..ctor(Character character, String seed, FishRagdollParams ragdollParams) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/FishAnimController.cs:line 134
at Barotrauma.Character..ctor(CharacterPrefab prefab, Vector2 position, String seed, CharacterInfo characterInfo, UInt16 id, Boolean isRemotePlayer, RagdollParams ragdollParams, Boolean spawnInitialItems) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs:line 1464
at Barotrauma.AICharacter..ctor(CharacterPrefab prefab, Vector2 position, String seed, CharacterInfo characterInfo, UInt16 id, Boolean isNetworkPlayer, RagdollParams ragdoll, Boolean spawnInitialItems) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/AICharacter.cs:line 15
at Barotrauma.Character.Create(CharacterPrefab prefab, Vector2 position, String seed, CharacterInfo characterInfo, UInt16 id, Boolean isRemotePlayer, Boolean hasAi, Boolean createNetworkEvent, RagdollParams ragdoll, Boolean spawnInitialItems) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs:line 1256
at Barotrauma.Character.Create(Identifier speciesName, Vector2 position, String seed, CharacterInfo characterInfo, UInt16 id, Boolean isRemotePlayer, Boolean hasAi, Boolean createNetworkEvent, RagdollParams ragdoll, Boolean throwErrorIfNotFound, Boolean spawnInitialItems) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs:line 1248
at Barotrauma.CharacterEditor.CharacterEditorScreen.SpawnCharacter(Identifier speciesName, RagdollParams ragdoll) in <DEV>/Barotrauma/BarotraumaClient/ClientSource/Screens/CharacterEditor/CharacterEditorScreen.cs:line 1554
at Barotrauma.CharacterEditor.CharacterEditorScreen.<CreateCharacterSelectionPanel>b__179_0(GUIComponent component, Object data) in <DEV>/Barotrauma/BarotraumaClient/ClientSource/Screens/CharacterEditor/CharacterEditorScreen.cs:line 2728
Tested against feature/spineling-variant commit https://github.com/Regalis11/Barotrauma-development/commit/b8c99dd8c0fe8b23be2667ca162fbb11a51f57df, no issues found
Both ragolls folder and ragdoll path methods work correctly, as well as setting animation paths (mod directory or content directory)
Simply specifying the ragdoll folder will pick a ragdoll out of that folder, but always the first found. If there are multiple ragdolls make sure to specify a specific ragdoll path (that is the file) you need using <ragdoll path=" over <ragdolls folder="
Deeper variance inheritance than that will not currently work, because the methods of checking the parents are not recursive.
This is outdated. It's recursive now.
Disclaimers
What happened?
When making a variant of a creature, the game doesn't load the original ragdoll/animation of the base creature even when specified. It always tries to load a ragdoll/animation using the exact creature name from within the mod folder
From what I understand:
Specified path
Refuses to load the character entirely
Reproduction steps
variantof="crawler_hatchling"
Bug prevalence
Just once
Single player or multiplayer?
Single player
-
No response
Version
v1.2.7.0 (Winter Update hotfix)
-
No response
Which operating system did you encounter this bug on?
Windows
Relevant error messages and crash reports
No response