Skip to content

Commit

Permalink
Disable collider on MagicCandleBehaviour billboard
Browse files Browse the repository at this point in the history
Any mod registering a custom activation to candle sprite will result in a collider on magic candle billboard.
This can block spells and be a nuisance to player.
MagicCandleBehaviour will now disable collider on children at start. This only happens when effect is instantiated, such as first cast or loading a game.
There should only be a single collider on child billboard in this scenario.
  • Loading branch information
Interkarma committed Oct 2, 2023
1 parent 02a2b40 commit 3c23458
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Assets/Scripts/Game/MagicAndEffects/MagicCandleBehaviour.cs
Expand Up @@ -41,6 +41,11 @@ private void Start()

// Observe spell shadow setting
GetComponent<Light>().shadows = (DaggerfallUnity.Settings.EnableSpellShadows) ? LightShadows.Soft : LightShadows.None;

// Disable candle collider on start (if present)
// This can happen when a mod has registered a custom activation to candle sprite
// The magic candle sprite should remain non-collidable or it will block spells
DisableCollider();
}

private void Update()
Expand Down Expand Up @@ -68,6 +73,13 @@ public void DestroyCandle()
Destroy(gameObject);
}

public void DisableCollider()
{
Collider collider = GetComponentInChildren<Collider>();
if (collider)
collider.enabled = false;
}

private void StartGameBehaviour_OnNewGame()
{
DestroyCandle();
Expand Down

0 comments on commit 3c23458

Please sign in to comment.