NNaso / ValheimMods

0 stars 5 forks source link

Visual compatibility issue with RandyKnapp's Agua #12

Open OceanSnipe17 opened 11 months ago

OceanSnipe17 commented 11 months ago

https://valheim.thunderstore.io/package/RandyKnapp/Auga/

Randyknapp's Auga is a UI overhaul mod and SpeedyPath's buff icons do not appear with the Agua mod. The increase movement speed still works but the icon itself does not appear. I reported this to the maker of Auga and they came back with this:

Thanks for letting me know about this. I took a look at SpeedyPaths, and they are actually plugging Status Effects in to the system incorrectly.

    [HarmonyPatch(typeof(Hud), "UpdateStatusEffects")]
    [HarmonyPrefix]
    static void UpdatePathIcon( Hud __instance, List<StatusEffect> statusEffects )
    {
        if( !Player.m_localPlayer.IsDead() && _showHudStatus.Value && _activeSpeedModifier != 1.0f )
        {
            if( _pathBuffSEDummy == null)
            {
                _pathBuffSEDummy = ScriptableObject.CreateInstance(typeof(StatusEffect)) as StatusEffect;
            }
            _pathBuffSEDummy.m_name = _hudDynamicStatusText.Value ? _activeStatusText : _hudStatusText.Value;
            _pathBuffSEDummy.m_icon = _activeStatusSprite;

            if( _activeSpeedModifier != 1.0f )
            {
                if( _activeSpeedModifier != _prevModValue )
                {
                    _pathBuffSEDummy.m_isNew = true;
                }
                statusEffects.Add(_pathBuffSEDummy);
            }
            _prevModValue = _activeSpeedModifier;
        }
    }

They should be patching on the SEMan methods. There's a couple they can choose from, I would use SEMan.GetHudStatusEffects.

But to add status effects, they should use SEMan.AddStatusEffect() and use the SEMan.RemoveStatusEffect() to remove it.

Just wanted to update you and would love to see this updated in the future!

ZenDragonX commented 10 months ago

I also experience this problem. I hope it can be fixed.