-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
6,416 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using UnityEngine; | ||
|
||
namespace SCHIZO.Items.Components; | ||
|
||
partial class SeaMonkeyHeldItemOverrides | ||
{ | ||
private Vector3 _savedLocalPos; | ||
private Quaternion _savedLocalRot; | ||
public void OnPickedUp() | ||
{ | ||
if (!enabled) return; | ||
|
||
_savedLocalPos = overrideTransform.localPosition; | ||
_savedLocalRot = overrideTransform.localRotation; | ||
|
||
overrideTransform.localPosition = localPosition; | ||
overrideTransform.localEulerAngles = localRotation; | ||
} | ||
|
||
public void OnDropped() | ||
{ | ||
if (!enabled) return; | ||
|
||
overrideTransform.localPosition = _savedLocalPos; | ||
overrideTransform.localRotation = _savedLocalRot; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
SCHIZO/Items/Components/SeaMonkeyHeldItemOverridesPatches.BelowZero.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using HarmonyLib; | ||
|
||
namespace SCHIZO.Items.Components; | ||
[HarmonyPatch] | ||
public static class SeaMonkeyHeldItemOverridesPatches | ||
{ | ||
[HarmonyPatch(typeof(SeaMonkeyHeldItem), nameof(SeaMonkeyHeldItem.Hold), [typeof(Pickupable), typeof(bool)])] | ||
[HarmonyPostfix] | ||
public static void OnHold(Pickupable pickupable) | ||
{ | ||
if (!pickupable) return; | ||
SeaMonkeyHeldItemOverrides overrideComponent = pickupable.GetComponent<SeaMonkeyHeldItemOverrides>(); | ||
if (!overrideComponent) return; | ||
|
||
overrideComponent.OnPickedUp(); | ||
} | ||
|
||
[HarmonyPatch(typeof(SeaMonkeyHeldItem), nameof(SeaMonkeyHeldItem.Drop))] | ||
[HarmonyPrefix] | ||
public static void OnDrop(SeaMonkeyHeldItem __instance) | ||
{ | ||
if (!__instance.item) return; | ||
SeaMonkeyHeldItemOverrides overrideComponent = __instance.item.GetComponent<SeaMonkeyHeldItemOverrides>(); | ||
if (!overrideComponent) return; | ||
|
||
overrideComponent.OnDropped(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
using Nautilus.Assets; | ||
using Nautilus.Utility; | ||
using UnityEngine; | ||
|
||
namespace SCHIZO.Items.FumoItem; | ||
|
||
partial class FumoItemLoader | ||
{ | ||
public override void Load(ModItem modItem) | ||
{ | ||
base.Load(modItem); | ||
FumoItemPatches.Register(modItem, spawn); | ||
CustomPrefab prefab = new(spawnerClassId, null, null); | ||
prefab.SetGameObject(() => | ||
{ | ||
GameObject instance = GameObject.Instantiate(spawnerPrefab); | ||
PrefabUtils.AddBasicComponents(instance, spawnerClassId, TechType.None, LargeWorldEntity.CellLevel.Global); | ||
instance.SetActive(false); // why do we have to do this manually again | ||
return instance; | ||
}); | ||
prefab.Register(); | ||
FumoItemPatches.Register(spawnerClassId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System.Collections; | ||
using SCHIZO.Helpers; | ||
using UnityEngine; | ||
using UWE; | ||
|
||
namespace SCHIZO.Items.FumoItem; | ||
|
||
partial class SneakyFumoSpawner | ||
{ | ||
// prevent dupes or whatever | ||
private const string _storyGoal = "SneakyFumo"; | ||
private GameObject _prefab; | ||
|
||
private IEnumerator Start() | ||
{ | ||
if (StoryGoalHelpers.IsCompleted(_storyGoal)) | ||
yield return TheFumoAppears(); | ||
else | ||
yield return NeuroFumoIs100mFromYourLocationAndRapidlyApproaching(); | ||
} | ||
|
||
private IEnumerator NeuroFumoIs100mFromYourLocationAndRapidlyApproaching() | ||
{ | ||
// Log("starting"); | ||
// player enters drop pod for the first time, no fumo is present | ||
while (!StoryGoalHelpers.IsCompleted("OnEnterLifepod")) | ||
yield return new WaitForSecondsRealtime(5); | ||
// Log("entered"); | ||
|
||
// player leaves for a while | ||
while (!StoryGoalHelpers.IsCompleted("OnExitLifepod")) | ||
yield return new WaitForSecondsRealtime(5); | ||
// Log("exited"); | ||
|
||
yield return new WaitForSeconds(minAwayTime); // probably completely useless | ||
// Log("waited for time, waiting for distance"); | ||
while ((Player.main.transform.position - transform.position).magnitude < minAwayDistance) | ||
yield return new WaitForSecondsRealtime(1); | ||
// Log("spawning"); | ||
|
||
yield return TheFumoAppears(); | ||
} | ||
// private void Log(string msg) => LOGGER.LogDebug($"{name}: {msg}"); | ||
|
||
private IEnumerator GetPrefab() | ||
{ | ||
IPrefabRequest request = PrefabDatabase.GetPrefabAsync(spawnData.classId); | ||
yield return request; | ||
if (!request.TryGetPrefab(out _prefab)) | ||
{ | ||
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); | ||
yield break; | ||
} | ||
} | ||
|
||
private IEnumerator TheFumoAppears() | ||
{ | ||
StoryGoalHelpers.Trigger(_storyGoal); | ||
|
||
yield return GetPrefab(); | ||
if (!_prefab) yield break; | ||
|
||
GameObject fumo = GameObject.Instantiate(_prefab, transform); | ||
fumo.transform.parent = transform.parent; // reparent to drop pod (keeping the spawner's local pos/rot) | ||
LargeWorldEntity.Register(fumo); | ||
|
||
Destroy(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.