fix(trol): True Form no longer switches itself off as it comes on
The plugin adds TrolRace itself, but Instance did not know that and built a second copy on first read, so two Updates read every key. Past Fader the True Form key is a toggle: one copy put the form on, the other saw it on in the same frame and took it off. The Trol grew and shrank back with no status. Awake now registers the plugin's copy and removes any other. FurlingRace had the same pattern, harmless there, and gets the same fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b555da99f2
commit
83bade65cb
2 changed files with 33 additions and 0 deletions
|
|
@ -10,6 +10,24 @@ namespace RacesOfValheim
|
|||
public class TrolRace : MonoBehaviour
|
||||
{
|
||||
private static TrolRace _instance;
|
||||
|
||||
// THE PLUGIN ADDS THIS COMPONENT ITSELF, in RacesOfValheim.Awake, and nothing used to tell
|
||||
// Instance so. The first read of Instance - CreateModAssets, on every start - found _instance
|
||||
// empty and built a second TrolRace on a GameObject of its own, and from then on two Updates
|
||||
// read every key. At Fader and past it the True Form key is a toggle: one copy put the form
|
||||
// on and began to grow, the other saw the form already on in the same frame, was not itself
|
||||
// transforming, and took it straight off. The Trol grew and shrank back, with no status and
|
||||
// - since past Fader there is none - no cooldown.
|
||||
private void Awake()
|
||||
{
|
||||
if (_instance != null && _instance != this)
|
||||
{
|
||||
Destroy(this);
|
||||
return;
|
||||
}
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
public static TrolRace Instance
|
||||
{
|
||||
get
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue