mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
better error handling for checkandplaysounds
This commit is contained in:
parent
3f7a7bfdc3
commit
66f84a00f3
2 changed files with 12 additions and 7 deletions
Binary file not shown.
|
@ -217,19 +217,24 @@ namespace Rimworld_Animations {
|
|||
|
||||
}
|
||||
|
||||
//do the same for all the child nodes
|
||||
foreach (PawnRenderNode node in rootNode.children)
|
||||
{
|
||||
if (node?.AnimationWorker is AnimationWorker_KeyframesExtended childrenAnimWorker)
|
||||
{
|
||||
SoundDef sound = childrenAnimWorker.soundAtTick(node.tree.AnimationTick);
|
||||
if (sound != null)
|
||||
{
|
||||
sound.PlayOneShot(new TargetInfo(pawn.Position, pawn.Map));
|
||||
}
|
||||
|
||||
if (rootNode?.children != null)
|
||||
{
|
||||
foreach (PawnRenderNode node in rootNode?.children)
|
||||
{
|
||||
if (node?.AnimationWorker is AnimationWorker_KeyframesExtended childrenAnimWorker)
|
||||
{
|
||||
SoundDef sound = childrenAnimWorker.soundAtTick(node.tree.AnimationTick);
|
||||
if (sound != null)
|
||||
{
|
||||
sound.PlayOneShot(new TargetInfo(pawn.Position, pawn.Map));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//do the same for all the child nodes
|
||||
|
||||
}
|
||||
|
||||
public bool AnimationMakesUseOfProp(AnimationPropDef animationProp)
|
||||
|
|
Loading…
Reference in a new issue