Jump to content

About emotions animations when Dupe receiving an effect.


Sanchozz
  • Branch: Live Branch Version: Linux Pending

Once upon a time, in a galaxy far, far away, Duplicants played an emotion animation when receiving certain effects. Such as "Sore Back", "Soggy Feet", "Sopping Wet", "Soiled Suit", "Popped Eardrums", etc.
But some time ago, these animations no longer played. After U43 update, if I remember correctly.

Currently, it looks like this:

 

But it should look like this:

 

I found the reason why the animations aren't playing. More precisely, a combination of several reasons. Let's talk about it.

Look at the Klei.AI.EffectInstance.RegisterEmote method. 
These are two methods, almost identical, both need to be fixed.
The NegativeInfinity parameter value here means that the Reactable object will expire immediately. And the animation won't play. Should replace NegativeInfinity with some reasonable value, maybe 5f or 10f seconds.

EffectInstance_324664.png.6342eeeca46d9ad790a762d07ad5de2a.png

 

Look at the RadiationMonitor.CheckRadiationLevel method. Here, too, should replace NegativeInfinity with some reasonable value.

RadiationMonitor_321654654.png.e78493dc307474f3695682db61191a4a.png

 

Let's walk through the execution flow. 
ReactionMonitor.Instance.AddSelfEmoteReactable calls ReactionMonitor.Instance.CanReact first.
It calls Klei.AI.Emote.IsValidForController. And this is the only place where Klei.AI.Emote.IsValidForController is called.

Look at the Klei.AI.Emote.IsValidForController method. There are three problems here.

1. This block of code at the beginning will always return false. Because the animController doesn't yet contain the required animation. Because the ApplyAnimOverrides / AddAnimOverrides hasn't been called yet. This block of code should be rethought or removed entirely.

2. I hope the screenshot explains everything clearly.

3. Should use kanimFileData.GetAnim(...).hash instead of kanimFileData.GetAnim(...).id here.
hash is a HashedString created based on anim.name
id is a HashedString created based on animFile.name + "." + anim.name
Using id for equality here will always return false.

Emote_32165461.png.0829b22e0ccb89070c67fbd5910da6db.png

Therefore, due to these three problems, the Klei.AI.Emote.IsValidForController method will always return false, the Reactable object won't be created at all, and the animation won't play.

Test Emotes.sav EffectEmotesFix.cs


Steps to Reproduce

Load the attached file, watch Catalina, and make sure that the emotion animations don't play when receiving effects.

  • Like 3
  • Big Ups 2



User Feedback


Since Bug Fix Update is coming, now might be a good time to take a look and fix it.
but if you don't want to fix it, please tell me. then I just publish the mod.

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...