Skip to content

Commit

Permalink
fix the other spawn stuff
Browse files Browse the repository at this point in the history
+ assets
  • Loading branch information
Govorunb committed May 1, 2024
1 parent 9f27959 commit 6122fc8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
21 changes: 14 additions & 7 deletions SCHIZO/Items/Components/DisableUntilStoryGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
namespace SCHIZO.Items.Components;
partial class DisableUntilStoryGoal : IStoryGoalListener
{
private string storyGoal;
private string _storyGoal;
public void Start()
{
storyGoal = RetargetHelpers.Pick(storyGoalSN, storyGoalBZ);
_storyGoal = RetargetHelpers.Pick(storyGoalSN, storyGoalBZ);
StoryGoalManager.main.AddListener(this);
UpdateActive();
}
Expand All @@ -17,19 +17,26 @@ private void OnDestroy()
StoryGoalManager.main.RemoveListener(this);
}

public void NotifyGoalComplete(string key) => UpdateActive(key);
private void OnEnable()
{
UpdateActive();
}

public void NotifyGoalComplete(string key) => UpdateActive(key);
public void NotifyGoalReset(string key) => UpdateActive(key);

public void NotifyGoalsDeserialized() => UpdateActive();

private void UpdateActive(string key = null)
{
if (key is { } && !StoryGoalHelpers.Matches(key, storyGoal))
if (key is { } && !StoryGoalHelpers.Matches(key, _storyGoal))
return;

bool shouldBeActive = StoryGoalHelpers.IsCompleted(_storyGoal);
if (shouldBeActive == gameObject.activeSelf) return;

Pickupable pickupable = GetComponent<Pickupable>();
if (pickupable && pickupable.attached) return; // otherwise inventory items swim away
gameObject.SetActive(StoryGoalHelpers.IsCompleted(storyGoal));
if (pickupable && pickupable.attached) return; // otherwise inventory items swim away/are invisible

gameObject.SetActive(shouldBeActive);
}
}
4 changes: 2 additions & 2 deletions SCHIZO/Items/FumoItem/SneakyFumoSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private IEnumerator GetPrefab()
LOGGER.LogError("Could not get prefab for fumo item, will not spawn in lifepod");
// if there's no prefab, unlocking it is probably not a good idea
// KnownTech.Add(_fumoItem, false, false);
Destroy(this);
Destroy(gameObject);
yield break;
}
}
Expand All @@ -67,6 +67,6 @@ private IEnumerator TheFumoAppears()
fumo.transform.parent = transform.parent; // reparent to drop pod (keeping the spawner's local pos/rot)
LargeWorldEntity.Register(fumo);

Destroy(this);
Destroy(gameObject);
}
}
2 changes: 1 addition & 1 deletion SCHIZO/Resources/AssetBundles/Assets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SCHIZO.Resources;

public static class Assets
{
private const int _rnd = -292401825;
private const int _rnd = -320920638;

private static readonly UnityEngine.AssetBundle _a = ResourceManager.GetAssetBundle("assets");

Expand Down
Binary file modified SCHIZO/Resources/AssetBundles/assets
Binary file not shown.
Binary file modified SCHIZO/Resources/FMODBanks/SCHIZO.bank
Binary file not shown.

0 comments on commit 6122fc8

Please sign in to comment.