diff --git a/SCHIZO/Creatures/Components/CarryCreature.cs b/SCHIZO/Creatures/Components/CarryCreature.cs index d1866580..453d22c7 100644 --- a/SCHIZO/Creatures/Components/CarryCreature.cs +++ b/SCHIZO/Creatures/Components/CarryCreature.cs @@ -1,19 +1,36 @@ using System.Collections; +using SCHIZO.Helpers; using UnityEngine; namespace SCHIZO.Creatures.Components; -/// Adapted from partial class CarryCreature : IOnTakeDamage, IOnMeleeAttack { - private GetCarried target; - private bool targetPickedUp; + public Carryable target; + public Creature creature; + public bool targetPickedUp; + + private float pickupRadiusSquared; private float timeNextFindTarget; private float timeNextUpdate; - private static readonly EcoRegion.TargetFilter _isTargetValidFilter = target => target.GetGameObject().GetComponent(); + private static readonly EcoRegion.TargetFilter _isTargetValidFilter = target => target.GetGameObject().GetComponent(); public EcoTargetType EcoTargetType => (EcoTargetType) _ecoTargetType; + public void Awake() + { + creature = GetComponent(); + pickupRadiusSquared = Mathf.Pow(attachRadius, 2f); + Pickupable pickupable = GetComponent(); + if (pickupable) pickupable.pickedUpEvent.AddHandler(gameObject, (_) => Drop()); + } + + public void OnDestroy() + { + Pickupable pickupable = GetComponent(); + if (pickupable) pickupable.pickedUpEvent.RemoveHandlers(gameObject); + } + void IOnTakeDamage.OnTakeDamage(DamageInfo damageInfo) { if (damageInfo.damage > 0) Drop(); @@ -22,7 +39,7 @@ void IOnTakeDamage.OnTakeDamage(DamageInfo damageInfo) bool IOnMeleeAttack.HandleMeleeAttack(GameObject targetObject) { // prevent bite after releasing - if (targetObject.GetComponent()) return true; + if (targetObject.GetComponent()) return true; // pick up held creature instead of eating it Player player = targetObject.GetComponent(); @@ -31,15 +48,18 @@ bool IOnMeleeAttack.HandleMeleeAttack(GameObject targetObject) GameObject heldObject = Inventory.main.GetHeldObject(); if (!heldObject) return false; - GetCarried heldCarryable = heldObject.GetComponent(); + Carryable heldCarryable = heldObject.GetComponent(); if (!heldCarryable) return false; - if (EcoTargetType != heldObject.GetComponent()?.GetTargetType()) return false; + EcoTargetType filterType = EcoTargetType; + EcoTargetType targetType = heldObject.GetComponent()?.GetTargetType() + ?? EcoTargetType.None; + if (filterType != targetType) return false; Inventory.main.DropHeldItem(false); heldObject.SetActive(true); // really makes you think StartCoroutine(DelayedPickupHack()); - creature.SetFriend(player.gameObject, 120f); + if (creature) creature.SetFriend(player.gameObject, 120f); return true; IEnumerator DelayedPickupHack() // not sure how or why but WM sometimes doesn't get scaled correctly unless we wait a frame @@ -49,24 +69,91 @@ IEnumerator DelayedPickupHack() // not sure how or why but WM sometimes doesn't } } - public override float Evaluate(float time) + public void FixedUpdate() { - if (timeNextFindTarget < time) + float time = Time.fixedTime; + float deltaTime = Time.fixedDeltaTime; + if (time > timeNextFindTarget) { UpdateTarget(); - if (target) + timeNextFindTarget = time + updateTargetInterval * (1f + 0.2f * Random.value); + } + + if (!target) return; + + if (time < timeNextUpdate) return; + timeNextUpdate = time + updateInterval; + + if (!targetPickedUp) + { + swimToTarget.target = target.transform; + Vector3 toTarget = target.transform.position - attachSocket.transform.position; + if (toTarget.sqrMagnitude < pickupRadiusSquared) { - creature.Aggression.Value = 0; - creature.Curiosity.Value = 10; + bool pickedUp = targetPickedUp = TryPickup(target); + if (!pickedUp) + { + ClearTarget(); + timeNextFindTarget = time + updateTargetInterval * 2; + } + } + } + else + { + RepositionTarget(); + if (ADHD > 0) + { + float roll = Random.value; + if (roll < ADHD) + { + //LOGGER.LogWarning($"dropping because {roll}<{ADHD}"); + Drop(); + return; + } + } + if (creature) + { + creature.Happy.Add(deltaTime); + creature.Friendliness.Add(deltaTime); } - timeNextFindTarget = time + updateTargetInterval * (1f + 0.2f * Random.value); } - return target && target.gameObject.activeInHierarchy ? GetEvaluatePriority() : 0f; } - public bool TryPickup(GetCarried getCarried) + private void UpdateTarget() + { + if (targetPickedUp || EcoTargetType == EcoTargetType.None) return; + + IEcoTarget ecoTarget = EcoRegionManager.main!?.FindNearestTarget(EcoTargetType, transform.position, _isTargetValidFilter, 1); + Carryable newTarget = ecoTarget?.GetGameObject()!?.GetComponent(); + if (!newTarget || newTarget == target || !newTarget.GetComponent()) return; + if (newTarget.gameObject == gameObject) return; // holy hell + + Vector3 toNewTarget = newTarget.transform.position - transform.position; + if (Physics.Raycast(transform.position, toNewTarget, toNewTarget.magnitude, Voxeland.GetTerrainLayerMask())) + return; + SetTarget(newTarget); + } + + public void SetTarget(Carryable newTarget) + { + if (!newTarget) return; + if (newTarget.gameObject == gameObject) return; + + target = newTarget; + Transform targetTransform = newTarget.attachPlug !?? newTarget.transform; + swimToTarget.target = targetTransform; + } + + public void ClearTarget() + { + target = null; + swimToTarget.target = null; + } + + public bool TryPickup(Carryable getCarried) { - if (!getCarried) return false; + if (!getCarried || getCarried.gameObject == gameObject) return false; + if (target) Drop(); target = getCarried; return TryPickupTarget(); } @@ -74,13 +161,12 @@ public bool TryPickup(GetCarried getCarried) private bool TryPickupTarget() { if (!target || !target.gameObject || !target.gameObject.activeInHierarchy) return false; - if (!target.CanBePickedUp()) return false; + if (!target.CanBePickedUp(this)) return false; if (target.GetComponentInParent()) { // in player's inventory Drop(); - timeNextFindTarget = Time.time + 6f; return false; } UWE.Utils.SetCollidersEnabled(target.gameObject, false); @@ -88,15 +174,14 @@ private bool TryPickupTarget() UWE.Utils.SetEnabled(target.GetComponent(), false); Transform targetTransform = target.transform; - targetTransform.SetParent(attachPoint, true); // false sets scale incorrectly - target.OnPickedUp(); - targetPickedUp = true; + targetTransform.SetParent(attachSocket, true); // false sets scale incorrectly - RepositionTarget(target); + RepositionTarget(); StartCoroutine(DelayedReposition()); // some component just really likes running updates for a few frames after it gets disabled - swimBehaviour.SwimTo(transform.position + Vector3.up + 5f * Random.onUnitSphere, Vector3.up, swimVelocity); - timeNextUpdate = Time.time + 1f; + target.OnPickedUp(this); + targetPickedUp = true; + swimToTarget.target = null; return true; @@ -105,32 +190,36 @@ IEnumerator DelayedReposition() for (int i = 0; i < 5; i++) { yield return new WaitForSeconds(0.05f); - RepositionTarget(target); + RepositionTarget(); } } } - private void RepositionTarget(GetCarried getCarried) + private void RepositionTarget() { - Transform targetTransform = getCarried.transform; + Transform targetTransform = target.transform; if (resetRotation) targetTransform.localRotation = Quaternion.identity; - // place the transform so the pickup point is on the attach point - Vector3 offset = getCarried.pickupPoint - ? -getCarried.pickupPoint.localPosition - : Vector3.zero; - offset.Scale(new Vector3(1f / targetTransform.localScale.x, 1f / targetTransform.localScale.y, 1f / targetTransform.localScale.z)); - targetTransform.localPosition = offset; + targetTransform.localPosition = Vector3.zero; + // place the transform so the plug is exactly on the socket + Vector3 offset = Vector3.zero; + + if (target.attachPlug) + { + offset = attachSocket.InverseTransformPoint(target.attachPlug.position); + } + + targetTransform.localPosition = -offset; } - private void Drop() + public void Drop() { if (target && targetPickedUp) { DropTarget(target.gameObject); - target.OnDropped(); + target.OnDropped(this); } - target = null; + SetTarget(null); targetPickedUp = false; } @@ -146,78 +235,5 @@ private void DropTarget(GameObject targetObject) LargeWorldStreamer.main!?.cellManager.RegisterEntity(lwe); } - private void UpdateTarget() - { - IEcoTarget ecoTarget = EcoRegionManager.main!?.FindNearestTarget(EcoTargetType, transform.position, _isTargetValidFilter, 1); - GetCarried newTarget = ecoTarget?.GetGameObject()!?.GetComponent(); - if (!newTarget) return; - - Vector3 toNewTarget = newTarget.transform.position - transform.position; - float dist = toNewTarget.magnitude - 0.5f; - if (dist > 0 && Physics.Raycast(transform.position, toNewTarget, dist, Voxeland.GetTerrainLayerMask())) - return; - if (target == newTarget || !newTarget.GetComponent()) - return; - if (target) - { - float sqrDistToNew = toNewTarget.sqrMagnitude; - float sqrDistToCurr = (target.transform.position - transform.position).sqrMagnitude; - - if (sqrDistToNew > sqrDistToCurr) - Drop(); - } - target = newTarget; - } - - public override void Perform(float time, float deltaTime) - { - if (!target) return; - if (!targetPickedUp) - { - if (time > timeNextUpdate) - { - timeNextUpdate = time + updateInterval; - swimBehaviour.SwimTo(target.transform.position, -Vector3.up, swimVelocity); - } - if ((attachPoint.transform.position - target.transform.position).sqrMagnitude < Mathf.Pow(attachRadius, 2f)) - { - TryPickupTarget(); - return; - } - } - else - { - if (target.transform.parent != attachPoint) - { - if (target.transform.parent && target.transform.parent.GetComponentInParent()) - { - // picked up by someone else - Drop(); - } - else - { - TryPickupTarget(); - } - return; - } - if (time > timeNextUpdate) - { - timeNextUpdate = time + updateInterval; - RepositionTarget(target); // sometimes the target moves (for absolutely no reason) after it gets attached - swimBehaviour.SwimTo(transform.position + 2f * swimVelocity * Random.insideUnitSphere, swimVelocity); - float roll = Random.value; - if (roll < ADHD) - { - //LOGGER.LogWarning($"dropping because {roll}<{ADHD}"); - Drop(); - } - } - creature.Happy.Add(deltaTime); - creature.Friendliness.Add(deltaTime); - } - } - - public override void StopPerform(float time) => Drop(); - - private void OnDisable() => Drop(); + public void OnDisable() => Drop(); } diff --git a/SCHIZO/Creatures/Components/Carryable.cs b/SCHIZO/Creatures/Components/Carryable.cs new file mode 100644 index 00000000..2f4af2d2 --- /dev/null +++ b/SCHIZO/Creatures/Components/Carryable.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SCHIZO.Helpers; +using SCHIZO.Resources; +using SCHIZO.Sounds.Collections; +using SCHIZO.Sounds.Players; +using UnityEngine; +using Random = UnityEngine.Random; + +namespace SCHIZO.Creatures.Components; + +partial class Carryable +{ + public bool isCarried; + public Func CanAttach; + public Action Attached; + public Action Detached; + + private Creature creature; + + private float _nextCarryNoiseTime; + private float _lastPickedUpTime; + private List _disabledComponents; + private static readonly List toDisable = new() + { + typeof(WorldAmbientSoundPlayer), + typeof(SwimBehaviour), + typeof(Rigidbody), + typeof(Creature), + }; + + public void Awake() + { + _disabledComponents = new List(); + creature = GetComponent(); + } + + public bool CanBePickedUp(CarryCreature pickuper) => !isCarried && Time.time - _lastPickedUpTime > 5f + && (CanAttach?.Multicast().All(f => f(this, pickuper)) ?? true); + + private void DisableComponents() + { + _disabledComponents.Clear(); + foreach (Type type in toDisable) + { + Behaviour comp = GetComponent(type) as Behaviour; + if (!comp || !comp.enabled) continue; + + _disabledComponents.Add(comp); + comp.enabled = false; + } + } + + private void RestoreComponents() + { + foreach (Behaviour component in _disabledComponents) + { + if (component) component.enabled = true; + } + _disabledComponents.Clear(); + } + + public void OnPickedUp(CarryCreature parent) + { + if (isCarried) RestoreComponents(); + DisableComponents(); + PlaySound(attachSounds); + isCarried = true; + _lastPickedUpTime = Time.time; + _nextCarryNoiseTime = Time.time + carryNoiseInterval * (1 + Random.value); + + Attached?.Invoke(this, parent); + } + + public void OnDropped(CarryCreature parent) + { + PlaySound(detachSounds); + isCarried = false; + RestoreComponents(); + + Detached?.Invoke(this, parent); + } + + public void FixedUpdate() + { + if (!isCarried) return; + + float time = Time.fixedTime; + float deltaTime = Time.fixedDeltaTime; + + if (creature) + { + if (likesBeingCarried) + { + creature.Happy.Add(deltaTime); + creature.Friendliness.Add(deltaTime / 2f); + } + else + { + creature.Scared.Add(deltaTime); + creature.Tired.Add(deltaTime / 2f); + } + } + + if (time > _nextCarryNoiseTime) + { + _nextCarryNoiseTime = time + carryNoiseInterval * (1 + Random.value); + PlaySound(carrySounds); + } + } + + private void PlaySound(SoundCollectionInstance coll) + { + if (Assets.Mod_Options_DisableAllSounds.Value) return; + coll!?.PlayRandom3D(emitter); + } +} diff --git a/SCHIZO/Creatures/Components/GetCarried.cs b/SCHIZO/Creatures/Components/GetCarried.cs deleted file mode 100644 index 2f8c2abe..00000000 --- a/SCHIZO/Creatures/Components/GetCarried.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Collections.Generic; -using SCHIZO.Sounds.Players; -using UnityEngine; -using Random = UnityEngine.Random; - -namespace SCHIZO.Creatures.Components; - -partial class GetCarried -{ - public bool isCarried; - - private float _nextCarryNoiseTime; - private float _lastPickedUpTime; - private List<(MonoBehaviour component, bool wasEnabled)> _disabledComponents; - private static readonly List toDisable = new() - { - typeof(WorldAmbientSoundPlayer), - typeof(SwimBehaviour), - typeof(Rigidbody), - }; - - public override void Awake() - { - base.Awake(); - // contrary to the name, this is actually the max possible priority - // full explanation here - evaluatePriority = 99f; - _disabledComponents = new List<(MonoBehaviour component, bool wasEnabled)>(); - } - - public override float Evaluate(float time) => isCarried ? 99f : -99f; // manual start/end - - public bool CanBePickedUp() => Time.time - _lastPickedUpTime > 5f; - - private void DisableComponents() - { - _disabledComponents.Clear(); - foreach (Type type in toDisable) - { - MonoBehaviour comp = GetComponent(type) as MonoBehaviour; - if (!comp) continue; - - _disabledComponents.Add((comp, comp.enabled)); - comp.enabled = false; - } - } - - private void RestoreComponents() - { - foreach ((MonoBehaviour component, bool wasEnabled) in _disabledComponents) - { - if (!component) continue; - component.enabled = wasEnabled; - } - } - - public void OnPickedUp() - { - pickupSounds!?.PlayRandom3D(emitter); - isCarried = true; - _lastPickedUpTime = Time.time; - StartPerform(Time.time); - } - - public void OnDropped() - { - releaseSounds!?.PlayRandom3D(emitter); - isCarried = false; - StopPerform(Time.time); - } - - public override void StartPerform(float time) - { - DisableComponents(); - _nextCarryNoiseTime = time + carryNoiseInterval * (1 + Random.value); - if (!isCarried) OnPickedUp(); - } - - public override void Perform(float time, float deltaTime) - { - if (!isCarried) - { - StopPerform(time); - return; - } - if (likesBeingCarried) - { - creature.Happy.Add(deltaTime); - creature.Friendliness.Add(deltaTime / 2f); - } - else - { - creature.Scared.Add(deltaTime); - creature.Tired.Add(deltaTime / 2f); - } - - if (time > _nextCarryNoiseTime) - { - _nextCarryNoiseTime = time + carryNoiseInterval * (1 + Random.value); - carrySounds!?.PlayRandom3D(emitter); - } - } - - public override void StopPerform(float time) - { - if (isCarried) OnDropped(); - RestoreComponents(); - } -} diff --git a/SCHIZO/Creatures/Ermfish/ErmStack.cs b/SCHIZO/Creatures/Ermfish/ErmStack.cs new file mode 100644 index 00000000..00258f05 --- /dev/null +++ b/SCHIZO/Creatures/Ermfish/ErmStack.cs @@ -0,0 +1,205 @@ +using System.Collections.Generic; +using System.Linq; +using SCHIZO.Creatures.Components; +using SCHIZO.Helpers; +using UnityEngine; + +namespace SCHIZO.Creatures.Ermfish; + +/// +/// erm (tail)
+/// ...
+/// erm ^-socket side-^ v-plug side-v
+/// ...
+/// erm (head) <-- has swim control
+///
+public sealed partial class ErmStack +{ + // TODO: actual stack behaviour (push/pop) just to be funny + + public ErmStack head; + public ErmStack tail; + + public ErmStack nextPlug; + public ErmStack nextSocket; + + private float _nextUpdate; + + public void Start() + { + head = this; + tail = this; + plug.Attached += OnConnected; + plug.Detached += OnDisconnected; + plug.CanAttach += ShouldAttach; + + socket.ADHD = 0f; // we will detach manually + } + + public void FixedUpdate() + { + if (Time.fixedTime > _nextUpdate) + { + _nextUpdate = Time.fixedTime + updateInterval; + + float roll = Random.Range(0f, 1f); + // LOGGER.LogWarning($"rolled {roll}"); + + if (!nextSocket && !nextPlug) + { + if (socket.target) return; + if (roll < growStackChance) StartStacking(); + } + else + { + float detachChance = nextSocket && nextPlug ? middleDetachChance : endsDetachChance; + if (roll < detachChance) + { + Disconnect(Random.Range(0f, 1f) < 0.5f); + } + } + } + } + + public void StartStacking() + { + ErmStack target = FindTarget(); + if (!target || target == this) return; + + socket.SetTarget(target.plug); + } + + public ErmStack FindTarget() + { + TechType selfTechType = CraftData.GetTechType(gameObject); + bool EcoTargetFilter(IEcoTarget et) => CraftData.GetTechType(et.GetGameObject()) == selfTechType && et.GetGameObject() != gameObject; + + ErmStack target = FindNearest_EcoTarget() !?? FindNearest_TechType(); + return target; + + ErmStack FindNearest_EcoTarget() + { + EcoTarget selfEcoTarget = GetComponent(); + if (!selfEcoTarget || selfEcoTarget.type == EcoTargetType.None) return null; + + return EcoRegionManager.main!? + .FindNearestTarget(selfEcoTarget.type, transform.position, EcoTargetFilter)? + .GetGameObject()!? + .GetComponent(); + } + + ErmStack FindNearest_TechType() + { + return PhysicsHelpers.ObjectsInRange(gameObject.transform.position, 20f) + .OfTechType(selfTechType) + .OrderByDistanceTo(gameObject.transform.position) + .SelectComponentInParent() + .Where(s => !s.nextSocket && s != this) + .FirstOrDefault(); + } + } + + public static bool Connect(ErmStack plug, ErmStack socket) + { + if (plug.nextSocket) + { + LOGGER.LogError($"Tried to connect plug '{plug}' to socket '{socket}' but plug is already attached to {plug.nextSocket}!\nDisconnecting!"); + plug.Disconnect(false); + } + if (socket.nextPlug) + { + LOGGER.LogError($"Tried to connect plug '{plug}' to socket '{socket}' but socket is already attached to {socket.nextPlug}!\nDisconnecting!"); + socket.Disconnect(true); + } + + return socket.socket.TryPickup(plug.plug); + } + + /// + /// Disconnect a from the stack. + /// + /// Node to disconnect. + /// Which side to disconnect from. Only has an effect on middle nodes. + public static void Disconnect(ErmStack node, bool plugSide = true) + { + if (!node.nextSocket && !node.nextPlug) return; + + // Disconnect only actually does anything on the socket side + CarryCreature socket; + if (node.nextSocket && node.nextPlug) + { + // both connected - respect plugSide + socket = plugSide ? node.nextSocket.socket : node.socket; + } + else + { + socket = node.nextSocket?.socket ?? node.socket; + } + socket.Drop(); + } + + public bool Connect(ErmStack node, bool nodeIsPlug) => nodeIsPlug ? Connect(node, this) : Connect(this, node); + public void Disconnect(bool plugSide = true) => Disconnect(this, plugSide); + + public bool ShouldAttach(Carryable plug, CarryCreature socket) + { + ErmStack socketStack = socket.GetComponent(); + if (!socketStack) return true; + + return socketStack.head != head && socketStack.tail != tail + && !socketStack.nextPlug; + } + public void OnConnected(Carryable plug, CarryCreature socket) + { + // only called on the plug side - so we update the socket from the plug + ErmStack socketStack = socket.GetComponent(); + if (!socketStack) return; + + socketStack.nextPlug = this; + nextSocket = socketStack; + + WalkToTail().ForEach(s => s.head = socketStack.head); + socketStack.WalkToHead().ForEach(s => s.tail = tail); + } + + public void OnDisconnected(Carryable plug, CarryCreature socket) + { + // only called on the plug side - so we update the socket from the plug + ErmStack socketStack = socket.GetComponent(); + if (!socketStack) return; + + socketStack.nextPlug = null; + nextSocket = null; + + WalkToTail().ForEach(s => s.head = this); + socketStack.WalkToHead().ForEach(s => s.tail = socketStack); + } + + private IEnumerable WalkToHead() + { + yield return this; + for (ErmStack curr = nextSocket; curr; curr = curr.nextSocket) + { + if (curr == this) + { + LOGGER.LogError($"Cycle in {nameof(WalkToHead)} - {nameof(nextSocket)} is self\n{StackTraceUtility.ExtractStackTrace()}"); + yield break; + } + yield return curr; + } + } + + private IEnumerable WalkToTail() + { + yield return this; + for (ErmStack curr = nextPlug; curr; curr = curr.nextPlug) + { + if (curr == this) + { + LOGGER.LogError($"Cycle in {nameof(WalkToTail)} - {nameof(nextPlug)} is self\n{StackTraceUtility.ExtractStackTrace()}"); + yield break; + } + yield return curr; + } + } +} diff --git a/SCHIZO/Helpers/CastingHelpers.cs b/SCHIZO/Helpers/CastingHelpers.cs deleted file mode 100644 index 2eed3f15..00000000 --- a/SCHIZO/Helpers/CastingHelpers.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Runtime.CompilerServices; -using UnityEngine; - -namespace SCHIZO.Helpers; - -public static class CastingHelpers -{ - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static FMOD_CustomEmitter ToFMODEmitter(this MonoBehaviour monoBehaviour) - { - return (FMOD_CustomEmitter) monoBehaviour; - } -} diff --git a/SCHIZO/Helpers/DelegateHelpers.cs b/SCHIZO/Helpers/DelegateHelpers.cs new file mode 100644 index 00000000..cfdba08e --- /dev/null +++ b/SCHIZO/Helpers/DelegateHelpers.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace SCHIZO.Helpers; + +public static class DelegateHelpers +{ + public static IEnumerable Multicast(this TFunc multicast) + where TFunc : MulticastDelegate + { + return multicast.GetInvocationList().Cast(); + } +} diff --git a/SCHIZO/Helpers/VectorExtensions.cs b/SCHIZO/Helpers/VectorExtensions.cs new file mode 100644 index 00000000..70ea51db --- /dev/null +++ b/SCHIZO/Helpers/VectorExtensions.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace SCHIZO.Helpers; + +public static class VectorExtensions +{ + public static Vector3 Reciprocal(this Vector3 vec3) + => new(1f / vec3.x, 1f / vec3.y, 1f / vec3.z); +} diff --git a/SCHIZO/Interop/Subnautica/_SwimToTarget.cs b/SCHIZO/Interop/Subnautica/_SwimToTarget.cs new file mode 100644 index 00000000..10d387ca --- /dev/null +++ b/SCHIZO/Interop/Subnautica/_SwimToTarget.cs @@ -0,0 +1,5 @@ +namespace SCHIZO.Interop.Subnautica; + +partial class _SwimToTarget : SwimToTarget +{ +} diff --git a/SCHIZO/Resources/AssetBundles/Assets.cs b/SCHIZO/Resources/AssetBundles/Assets.cs index adb4f9ad..24b32fed 100644 --- a/SCHIZO/Resources/AssetBundles/Assets.cs +++ b/SCHIZO/Resources/AssetBundles/Assets.cs @@ -12,7 +12,7 @@ namespace SCHIZO.Resources; public static class Assets { - private const int _rnd = 1099564147; + private const int _rnd = 1215340893; private static readonly UnityEngine.AssetBundle _a = ResourceManager.GetAssetBundle("assets"); diff --git a/SCHIZO/Resources/AssetBundles/assets b/SCHIZO/Resources/AssetBundles/assets index 6f8be8d1..cb21ca7f 100644 Binary files a/SCHIZO/Resources/AssetBundles/assets and b/SCHIZO/Resources/AssetBundles/assets differ diff --git a/Unity/Assets/Mod/Ermfish/Ermfish.prefab b/Unity/Assets/Mod/Ermfish/Ermfish.prefab index eb79453c..953c60f3 100644 --- a/Unity/Assets/Mod/Ermfish/Ermfish.prefab +++ b/Unity/Assets/Mod/Ermfish/Ermfish.prefab @@ -218,6 +218,26 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &-3723841728758596834 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8756873621844092796} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc42e514932a01944b425963c56250c8, type: 3} + m_Name: + m_EditorClassIdentifier: + swimToTarget: {fileID: 8265457806104071489} + _ecoTargetType: 2010 + attachRadius: 2 + updateInterval: 2 + updateTargetInterval: 1 + attachSocket: {fileID: 3425085474201060618} + resetRotation: 1 + ADHD: 0 --- !u!114 &-2321474093542275019 MonoBehaviour: m_ObjectHideFlags: 0 @@ -256,9 +276,47 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9ae8bc41ee49d684f95eb8955c7071d9, type: 3} m_Name: m_EditorClassIdentifier: - creature: {fileID: 0} - swimBehaviour: {fileID: 0} - evaluatePriority: 0.4 + likesBeingCarried: 1 + attachPlug: {fileID: 5839032077065552717} + emitter: {fileID: 5648931341203019549} + carryNoiseInterval: 5 + attachSounds: {fileID: 0} + carrySounds: {fileID: 0} + detachSounds: {fileID: 0} +--- !u!114 &1349106207919405109 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8756873621844092796} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d7f09158e470e841abeeb53b7af894c, type: 3} + m_Name: + m_EditorClassIdentifier: + maxStack: 5 + socket: {fileID: -3723841728758596834} + plug: {fileID: -906797858269330932} + updateInterval: 2 + growStackChance: 0.1 + endsDetachChance: 0.05 + middleDetachChance: 0.02 +--- !u!114 &8265457806104071489 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8756873621844092796} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 804aa32b92fdc9a4d966f17405ac50c1, type: 3} + m_Name: + m_EditorClassIdentifier: + creature: {fileID: 7500958825842708008} + swimBehaviour: {fileID: 3767109891289925411} + evaluatePriority: 0.8 priorityMultiplier: serializedVersion: 2 m_Curve: [] @@ -266,13 +324,8 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 minActionCheckInterval: -1 - likesBeingCarried: 1 - pickupPoint: {fileID: 5839032077065552717} - emitter: {fileID: 5648931341203019549} - carryNoiseInterval: 5 - pickupSounds: {fileID: 0} - carrySounds: {fileID: 0} - releaseSounds: {fileID: 0} + swimVelocity: 6 + swimInterval: 1 --- !u!1 &5952168343408095337 GameObject: m_ObjectHideFlags: 0 @@ -297,8 +350,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5952168343408095337} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0.82, z: 0.28} - m_LocalScale: {x: 0.9, y: 0.9, z: 0.9} + m_LocalPosition: {x: 0, y: 1.22, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 8335868717171090933} m_Father: {fileID: 8883497526312519149} @@ -909,18 +962,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 4581379911448225930} m_PrefabAsset: {fileID: 0} ---- !u!114 &5648931341203019549 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 8210446819742810007, guid: 5ff80f47f2822bb438251c8a7a1370ca, - type: 3} - m_PrefabInstance: {fileID: 4581379911448225930} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8756873621844092796} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f419283b15274b87be363a33ff631238, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!4 &8883497526312519149 stripped Transform: m_CorrespondingSourceObject: {fileID: 4962070890995002727, guid: 5ff80f47f2822bb438251c8a7a1370ca, @@ -957,6 +998,18 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b14011210f954223ae768ae50e1b9e2d, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &5648931341203019549 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8210446819742810007, guid: 5ff80f47f2822bb438251c8a7a1370ca, + type: 3} + m_PrefabInstance: {fileID: 4581379911448225930} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8756873621844092796} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f419283b15274b87be363a33ff631238, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &5935777102349017973 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Unity/Assets/Mod/Ermshark/Ermshark prefab.prefab b/Unity/Assets/Mod/Ermshark/Ermshark prefab.prefab index 724006b8..640a7a56 100644 --- a/Unity/Assets/Mod/Ermshark/Ermshark prefab.prefab +++ b/Unity/Assets/Mod/Ermshark/Ermshark prefab.prefab @@ -1,19 +1,36 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!135 &1755055861034866995 -SphereCollider: +--- !u!1 &2213092574367901767 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1417550359813203792} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.01 - m_Center: {x: 0, y: 0, z: 0.005} ---- !u!114 &-1740228102285344066 + serializedVersion: 6 + m_Component: + - component: {fileID: 627083515678291955} + m_Layer: 0 + m_Name: mouth_attach_point + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &627083515678291955 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2213092574367901767} + m_LocalRotation: {x: 1.776357e-15, y: -1, z: 0.00000014901163, w: 0.000000043711395} + m_LocalPosition: {x: 0, y: -0.00537144, z: 0.0072284834} + m_LocalScale: {x: 0.01, y: 0.010000001, z: 0.010000001} + m_Children: [] + m_Father: {fileID: 207277331249403832} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &-3391872547238616758 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -22,10 +39,10 @@ MonoBehaviour: m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cc42e514932a01944b425963c56250c8, type: 3} + m_Script: {fileID: 11500000, guid: 804aa32b92fdc9a4d966f17405ac50c1, type: 3} m_Name: m_EditorClassIdentifier: - creature: {fileID: 0} + creature: {fileID: 752434511793161575} swimBehaviour: {fileID: 5862139192057144009} evaluatePriority: 0.4 priorityMultiplier: @@ -35,13 +52,27 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 minActionCheckInterval: -1 + swimVelocity: 4 + swimInterval: 1 +--- !u!114 &-1740228102285344066 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2061343355341963926} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc42e514932a01944b425963c56250c8, type: 3} + m_Name: + m_EditorClassIdentifier: + swimToTarget: {fileID: -3391872547238616758} _ecoTargetType: 2010 - attachPoint: {fileID: 86987238986158663} - resetRotation: 1 attachRadius: 3 updateInterval: 2 updateTargetInterval: 1 - swimVelocity: 10 + attachSocket: {fileID: 86987238986158663} + resetRotation: 1 ADHD: 0.1 --- !u!114 &752434511793161575 MonoBehaviour: @@ -148,23 +179,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cc42e514932a01944b425963c56250c8, type: 3} m_Name: m_EditorClassIdentifier: - creature: {fileID: 752434511793161575} - swimBehaviour: {fileID: 5862139192057144009} - evaluatePriority: 0.4 - priorityMultiplier: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - minActionCheckInterval: -1 + swimToTarget: {fileID: -3391872547238616758} _ecoTargetType: 3 - attachPoint: {fileID: 627083515678291955} - resetRotation: 0 attachRadius: 2 updateInterval: 2 updateTargetInterval: 1 - swimVelocity: 10 + attachSocket: {fileID: 627083515678291955} + resetRotation: 0 ADHD: 0.15 --- !u!114 &1908199920528423029 MonoBehaviour: @@ -180,89 +201,91 @@ MonoBehaviour: m_EditorClassIdentifier: entertainmentFactor: 1.5 personalSpaceRadius: 4 ---- !u!1 &2213092574367901767 -GameObject: +--- !u!95 &6997803495513647470 +Animator: + serializedVersion: 3 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 627083515678291955} - m_Layer: 0 - m_Name: mouth_attach_point - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &627083515678291955 -Transform: + m_GameObject: {fileID: 8051100617892635820} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: da4af60216926ee43b859ca8f01379b2, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!136 &8781505804551395359 +CapsuleCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2213092574367901767} - m_LocalRotation: {x: 1.776357e-15, y: -1, z: 0.00000014901163, w: 0.000000043711395} - m_LocalPosition: {x: 0, y: -0.00537144, z: 0.0072284834} - m_LocalScale: {x: 0.01, y: 0.010000001, z: 0.010000001} - m_Children: [] - m_Father: {fileID: 207277331249403832} - m_RootOrder: 10 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!135 &436430237975948031 + m_GameObject: {fileID: 5029726151320809213} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.02236977 + m_Height: 0.06667455 + m_Direction: 2 + m_Center: {x: 0, y: 0.005, z: -0.005} +--- !u!135 &6310270463152235551 SphereCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3704318305922117568} + m_GameObject: {fileID: 7603139637545736590} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 m_Radius: 0.01 m_Center: {x: 0, y: 0, z: 0} ---- !u!135 &5497805302455990769 +--- !u!135 &1755055861034866995 SphereCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3740680688041185813} + m_GameObject: {fileID: 1417550359813203792} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 m_Radius: 0.01 - m_Center: {x: 0, y: 0, z: 0} ---- !u!135 &8530232455624690695 + m_Center: {x: 0, y: 0, z: 0.005} +--- !u!135 &436430237975948031 SphereCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4782822019780793779} + m_GameObject: {fileID: 3704318305922117568} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 m_Radius: 0.01 - m_Center: {x: 0, y: 0, z: 0.005} ---- !u!136 &8781505804551395359 -CapsuleCollider: + m_Center: {x: 0, y: 0, z: 0} +--- !u!135 &8530232455624690695 +SphereCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5029726151320809213} + m_GameObject: {fileID: 4782822019780793779} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 - m_Radius: 0.02236977 - m_Height: 0.06667455 - m_Direction: 2 - m_Center: {x: 0, y: 0.005, z: -0.005} + serializedVersion: 2 + m_Radius: 0.01 + m_Center: {x: 0, y: 0, z: 0.005} --- !u!135 &6588760414519639920 SphereCollider: m_ObjectHideFlags: 0 @@ -276,27 +299,13 @@ SphereCollider: serializedVersion: 2 m_Radius: 0.015 m_Center: {x: 0, y: 0, z: 0} ---- !u!136 &3478680452708060408 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7461509967390352406} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - m_Radius: 0.008347123 - m_Height: 0.03486734 - m_Direction: 0 - m_Center: {x: -0.00036260026, y: -0.0025221452, z: 0.0045559914} ---- !u!135 &6310270463152235551 +--- !u!135 &5497805302455990769 SphereCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7603139637545736590} + m_GameObject: {fileID: 3740680688041185813} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 @@ -316,25 +325,20 @@ SphereCollider: serializedVersion: 2 m_Radius: 0.007 m_Center: {x: 0, y: 0, z: 0} ---- !u!95 &6997803495513647470 -Animator: - serializedVersion: 3 +--- !u!136 &3478680452708060408 +CapsuleCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8051100617892635820} + m_GameObject: {fileID: 7461509967390352406} + m_Material: {fileID: 0} + m_IsTrigger: 0 m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: da4af60216926ee43b859ca8f01379b2, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 + m_Radius: 0.008347123 + m_Height: 0.03486734 + m_Direction: 0 + m_Center: {x: -0.00036260026, y: -0.0025221452, z: 0.0045559914} --- !u!1 &8627506038822203719 GameObject: m_ObjectHideFlags: 0 @@ -451,8 +455,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 190bdfebab1b470c944f28f12c7d781b, type: 3} m_Name: m_EditorClassIdentifier: - mouth: {fileID: 8869172563747261278} + lastTarget: {fileID: 4735139364640553446} + creature: {fileID: 752434511793161575} + liveMixin: {fileID: 722758244617200422} animator: {fileID: 6997803495513647470} + mouth: {fileID: 8869172563747261278} biteInterval: 1 biteDamage: 20 canBitePlayer: 1 @@ -461,15 +468,11 @@ MonoBehaviour: canBiteCreature: 0 ignoreSameKind: 1 canBeFed: 1 - lastTarget: {fileID: 4735139364640553446} - creature: {fileID: 752434511793161575} - liveMixin: {fileID: 722758244617200422} biteAggressionThreshold: 0.3 eatHungerDecrement: 0.5 eatHappyIncrement: 0.5 biteAggressionDecrement: 0.4 damageFX: {fileID: 0} - _attackSound: {fileID: 0} attackSounds: {fileID: -651457221615391217, guid: 0d3bacd789afd8c488a63f3f4769c807, type: 2} emitter: {fileID: 3132534834664993527} @@ -715,6 +718,12 @@ PrefabInstance: propertyPath: evaluatePriority value: 0.2 objectReference: {fileID: 0} + - target: {fileID: 2722342412455638247, guid: 5ff80f47f2822bb438251c8a7a1370ca, + type: 3} + propertyPath: sounds + value: + objectReference: {fileID: -2232285011790399243, guid: 9ee9dfa7770ab144dad626ab9273ce05, + type: 2} - target: {fileID: 2722342412455638247, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} propertyPath: soundCollection @@ -952,6 +961,12 @@ PrefabInstance: propertyPath: animationMoveMaxSpeed value: 10 objectReference: {fileID: 0} + - target: {fileID: 7784437994874313104, guid: 5ff80f47f2822bb438251c8a7a1370ca, + type: 3} + propertyPath: sounds + value: + objectReference: {fileID: 2647928344090774995, guid: 0d1e2f32135ed8640b34d5605f7cc7f2, + type: 2} - target: {fileID: 7784437994874313104, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} propertyPath: pickupable @@ -1004,30 +1019,18 @@ PrefabInstance: - {fileID: -3849722203967673367, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} - {fileID: 3365459996886375183, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} ---- !u!1 &2061343355341963926 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 5049378406231838710, guid: 5ff80f47f2822bb438251c8a7a1370ca, - type: 3} - m_PrefabInstance: {fileID: 6523923881202224480} - m_PrefabAsset: {fileID: 0} ---- !u!114 &5862139192057144009 stripped +--- !u!114 &7848775496123532971 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: -8371309086422519895, guid: 5ff80f47f2822bb438251c8a7a1370ca, + m_CorrespondingSourceObject: {fileID: 3919769461741374411, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_PrefabInstance: {fileID: 6523923881202224480} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2260eca3617340a59dfb84ebfeade9bb, type: 3} + m_Script: {fileID: 11500000, guid: 49a33a91de98493e82c6af9b1a6f232c, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!4 &2185779753971032071 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4962070890995002727, guid: 5ff80f47f2822bb438251c8a7a1370ca, - type: 3} - m_PrefabInstance: {fileID: 6523923881202224480} - m_PrefabAsset: {fileID: 0} --- !u!114 &3132534834664993527 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8210446819742810007, guid: 5ff80f47f2822bb438251c8a7a1370ca, @@ -1040,64 +1043,76 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f419283b15274b87be363a33ff631238, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &7848775496123532971 stripped +--- !u!114 &3931153366976468208 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3919769461741374411, guid: 5ff80f47f2822bb438251c8a7a1370ca, + m_CorrespondingSourceObject: {fileID: 7784437994874313104, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_PrefabInstance: {fileID: 6523923881202224480} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 49a33a91de98493e82c6af9b1a6f232c, type: 3} + m_Script: {fileID: 11500000, guid: e4f19711010743bfa5da92c65afc5b86, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &9173293904867031431 stripped +--- !u!4 &2185779753971032071 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4962070890995002727, guid: 5ff80f47f2822bb438251c8a7a1370ca, + type: 3} + m_PrefabInstance: {fileID: 6523923881202224480} + m_PrefabAsset: {fileID: 0} +--- !u!1 &2061343355341963926 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5049378406231838710, guid: 5ff80f47f2822bb438251c8a7a1370ca, + type: 3} + m_PrefabInstance: {fileID: 6523923881202224480} + m_PrefabAsset: {fileID: 0} +--- !u!114 &5862139192057144009 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 2722342412455638247, guid: 5ff80f47f2822bb438251c8a7a1370ca, + m_CorrespondingSourceObject: {fileID: -8371309086422519895, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_PrefabInstance: {fileID: 6523923881202224480} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b8fe7cd25fedc56428574c91124f6530, type: 3} + m_Script: {fileID: 11500000, guid: 2260eca3617340a59dfb84ebfeade9bb, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &4735139364640553446 stripped +--- !u!114 &722758244617200422 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1963351864823084166, guid: 5ff80f47f2822bb438251c8a7a1370ca, + m_CorrespondingSourceObject: {fileID: -3418686219161457082, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_PrefabInstance: {fileID: 6523923881202224480} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d933c0320ec24d7eb9f809c5a90edabb, type: 3} + m_Script: {fileID: 11500000, guid: 03934c6b274d4245b6e0fba9ec5f7a6c, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &722758244617200422 stripped +--- !u!114 &4735139364640553446 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: -3418686219161457082, guid: 5ff80f47f2822bb438251c8a7a1370ca, + m_CorrespondingSourceObject: {fileID: 1963351864823084166, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_PrefabInstance: {fileID: 6523923881202224480} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 03934c6b274d4245b6e0fba9ec5f7a6c, type: 3} + m_Script: {fileID: 11500000, guid: d933c0320ec24d7eb9f809c5a90edabb, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &3931153366976468208 stripped +--- !u!114 &9173293904867031431 stripped MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7784437994874313104, guid: 5ff80f47f2822bb438251c8a7a1370ca, + m_CorrespondingSourceObject: {fileID: 2722342412455638247, guid: 5ff80f47f2822bb438251c8a7a1370ca, type: 3} m_PrefabInstance: {fileID: 6523923881202224480} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061343355341963926} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e4f19711010743bfa5da92c65afc5b86, type: 3} + m_Script: {fileID: 11500000, guid: b8fe7cd25fedc56428574c91124f6530, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1001 &7168086334788475389 @@ -1654,27 +1669,15 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8e83d4420483cee479966674f207b75b, type: 3} ---- !u!1 &7400526840670531787 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: -8806266285075781322, guid: 8e83d4420483cee479966674f207b75b, - type: 3} - m_PrefabInstance: {fileID: 7168086334788475389} - m_PrefabAsset: {fileID: 0} ---- !u!1 &4782822019780793779 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 2388552406697069646, guid: 8e83d4420483cee479966674f207b75b, - type: 3} - m_PrefabInstance: {fileID: 7168086334788475389} - m_PrefabAsset: {fileID: 0} --- !u!1 &3740680688041185813 stripped GameObject: m_CorrespondingSourceObject: {fileID: 5806188644741794792, guid: 8e83d4420483cee479966674f207b75b, type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} ---- !u!1 &3704318305922117568 stripped +--- !u!1 &7603139637545736590 stripped GameObject: - m_CorrespondingSourceObject: {fileID: 5769754699604489789, guid: 8e83d4420483cee479966674f207b75b, + m_CorrespondingSourceObject: {fileID: 790926802493964403, guid: 8e83d4420483cee479966674f207b75b, type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} @@ -1684,9 +1687,9 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} ---- !u!1 &1417550359813203792 stripped +--- !u!1 &5029726151320809213 stripped GameObject: - m_CorrespondingSourceObject: {fileID: -1092670459054211411, guid: 8e83d4420483cee479966674f207b75b, + m_CorrespondingSourceObject: {fileID: -6433667211111549184, guid: 8e83d4420483cee479966674f207b75b, type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} @@ -1696,15 +1699,9 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} ---- !u!1 &7603139637545736590 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 790926802493964403, guid: 8e83d4420483cee479966674f207b75b, - type: 3} - m_PrefabInstance: {fileID: 7168086334788475389} - m_PrefabAsset: {fileID: 0} ---- !u!1 &5029726151320809213 stripped +--- !u!1 &4782822019780793779 stripped GameObject: - m_CorrespondingSourceObject: {fileID: -6433667211111549184, guid: 8e83d4420483cee479966674f207b75b, + m_CorrespondingSourceObject: {fileID: 2388552406697069646, guid: 8e83d4420483cee479966674f207b75b, type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} @@ -1720,3 +1717,21 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 7168086334788475389} m_PrefabAsset: {fileID: 0} +--- !u!1 &3704318305922117568 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5769754699604489789, guid: 8e83d4420483cee479966674f207b75b, + type: 3} + m_PrefabInstance: {fileID: 7168086334788475389} + m_PrefabAsset: {fileID: 0} +--- !u!1 &7400526840670531787 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: -8806266285075781322, guid: 8e83d4420483cee479966674f207b75b, + type: 3} + m_PrefabInstance: {fileID: 7168086334788475389} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1417550359813203792 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: -1092670459054211411, guid: 8e83d4420483cee479966674f207b75b, + type: 3} + m_PrefabInstance: {fileID: 7168086334788475389} + m_PrefabAsset: {fileID: 0} diff --git a/Unity/Assets/Mod/Ermshark/Sounds/Ambient/Ambient.asset b/Unity/Assets/Mod/Ermshark/Sounds/Ambient/Ambient.asset index 52706cdf..7ffb153b 100644 --- a/Unity/Assets/Mod/Ermshark/Sounds/Ambient/Ambient.asset +++ b/Unity/Assets/Mod/Ermshark/Sounds/Ambient/Ambient.asset @@ -11,7 +11,7 @@ MonoBehaviour: m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1c07b4304e30a144f81553498090382c, type: 3} m_Name: Ambient - m_EditorClassIdentifier: + m_EditorClassIdentifier: sounds: - {fileID: 8300000, guid: bfa7c73b87edcd7468474a2f41374051, type: 3} - {fileID: 8300000, guid: 5d717dbdd82d8ae4d9a638561fd67e9c, type: 3} @@ -20,3 +20,19 @@ MonoBehaviour: - {fileID: 8300000, guid: 28f06cf4f800f904b93af495b6ecdaca, type: 3} - {fileID: 8300000, guid: e5ee989d7a9d1e9479b2ab0a2c0656f9, type: 3} - {fileID: 8300000, guid: 2267bed41d49e7c4cac29cf36c514edd, type: 3} +--- !u!114 &2647928344090774995 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7e5191dfd75c432c9713c5321302eadd, type: 3} + m_Name: Ambient (UnderwaterCreatures) + m_EditorClassIdentifier: + path: + id: + collection: {fileID: 11400000} + bus: 1 diff --git a/Unity/Assets/Mod/Tutel/Tutel.prefab b/Unity/Assets/Mod/Tutel/Tutel.prefab index 982333dd..afd2a34b 100644 --- a/Unity/Assets/Mod/Tutel/Tutel.prefab +++ b/Unity/Assets/Mod/Tutel/Tutel.prefab @@ -226,7 +226,7 @@ MonoBehaviour: m_RotationOrder: 4 minActionCheckInterval: -1 likesBeingCarried: 0 - pickupPoint: {fileID: 0} + attachPlug: {fileID: 0} emitter: {fileID: 6151193553991328253} carryNoiseInterval: 5 pickupSounds: {fileID: -4909919376518584713, guid: 1117ab6ef838da74b8d402a14c1296da, diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/Components/CarryCreature.cs b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/CarryCreature.cs index 28ea6fc9..6d4fcef8 100644 --- a/Unity/Assets/Scripts/SCHIZO/Creatures/Components/CarryCreature.cs +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/CarryCreature.cs @@ -1,22 +1,29 @@ -using JetBrains.Annotations; using UnityEngine; -using SCHIZO.Interop.Subnautica.Enums; using TriInspector; +using JetBrains.Annotations; +using SCHIZO.Interop.Subnautica.Enums; +using SCHIZO.Interop.Subnautica; +using SCHIZO.TriInspector.Attributes; namespace SCHIZO.Creatures.Components { - public sealed partial class CarryCreature : CustomCreatureAction + [DeclareComponentReferencesGroup] + public sealed partial class CarryCreature : MonoBehaviour { + [ComponentReferencesGroup] + public _SwimToTarget swimToTarget; [SerializeField, UsedImplicitly] + [Tooltip("None means this won't seek out carryables at all - then, it can only pick anything up from the player's hands" + + "\n(or if directed by another component)")] private EcoTargetType_All _ecoTargetType; - [Required] - public Transform attachPoint; - [Tooltip("Rotate the carried creature to match the attach point's forward/up vectors.")] - public bool resetRotation; public float attachRadius = 2f; public float updateInterval = 2f; public float updateTargetInterval = 1f; - public float swimVelocity = 10f; + + [Required] + public Transform attachSocket; + [Tooltip("Rotate the carried creature to match the attach point's forward/up vectors.")] + public bool resetRotation; [Tooltip("Chance to drop the carried target, rolled every action update (every Update Interval)")] [Range(0f, 1f)] public float ADHD = 0.15f; diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/Components/GetCarried.cs b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/Carryable.cs similarity index 66% rename from Unity/Assets/Scripts/SCHIZO/Creatures/Components/GetCarried.cs rename to Unity/Assets/Scripts/SCHIZO/Creatures/Components/Carryable.cs index 04a92aa8..e6871cfc 100644 --- a/Unity/Assets/Scripts/SCHIZO/Creatures/Components/GetCarried.cs +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/Carryable.cs @@ -6,16 +6,16 @@ namespace SCHIZO.Creatures.Components { [DeclareBoxGroup("Sounds")] - public partial class GetCarried : CustomCreatureAction + public partial class Carryable : MonoBehaviour { public bool likesBeingCarried; - public Transform pickupPoint; + public Transform attachPlug; [GroupNext("Sounds")] public _FMOD_CustomEmitter emitter; public float carryNoiseInterval = 5f; - public SoundCollectionInstance pickupSounds; + public SoundCollectionInstance attachSounds; public SoundCollectionInstance carrySounds; - public SoundCollectionInstance releaseSounds; + public SoundCollectionInstance detachSounds; } } diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/Components/GetCarried.cs.meta b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/Carryable.cs.meta similarity index 100% rename from Unity/Assets/Scripts/SCHIZO/Creatures/Components/GetCarried.cs.meta rename to Unity/Assets/Scripts/SCHIZO/Creatures/Components/Carryable.cs.meta diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish.meta b/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish.meta new file mode 100644 index 00000000..0f79df0f --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 871f6102cd12b51429a2d5c6a9ea484b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish/ErmStack.cs b/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish/ErmStack.cs new file mode 100644 index 00000000..7939b470 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish/ErmStack.cs @@ -0,0 +1,25 @@ +using SCHIZO.Creatures.Components; +using SCHIZO.Interop.Subnautica; +using UnityEngine; + +namespace SCHIZO.Creatures.Ermfish +{ + [RequireComponent(typeof(CarryCreature), typeof(Carryable), typeof(_SwimToTarget))] + public sealed partial class ErmStack : MonoBehaviour + { + public int maxStack = 7; + public CarryCreature socket; + public Carryable plug; + + [Tooltip("Seconds between each update. Updating rolls the chances to start a stack/detach from a stack.")] + public float updateInterval = 2f; + + [Tooltip("Chance (rolled each update) to target and approach the nearest of its kin.")] + public float growStackChance = 0.10f; + + [Tooltip("Chance that this creature will detach if it's at the head (bottom) or tail (top) of the stack.")] + public float endsDetachChance = 0.05f; + [Tooltip("Chance that this creature will detach if it's in the middle of the stack.")] + public float middleDetachChance = 0.02f; + } +} diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish/ErmStack.cs.meta b/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish/ErmStack.cs.meta new file mode 100644 index 00000000..3bbc7623 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/Ermfish/ErmStack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d7f09158e470e841abeeb53b7af894c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_ModelPlug.Unity.cs b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_ModelPlug.Unity.cs index e41dcbfd..af42bc44 100644 --- a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_ModelPlug.Unity.cs +++ b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_ModelPlug.Unity.cs @@ -5,11 +5,10 @@ namespace SCHIZO.Interop.Subnautica { [DeclareComponentReferencesGroup] [DeclareUnexploredGroup] - [DeclareUnexploredGroup(MODEL_PLUG_GROUP)] partial class _ModelPlug : MonoBehaviour { protected const string MODEL_PLUG_GROUP = "Model Plug"; - [UnexploredGroup(MODEL_PLUG_GROUP)] public Transform plugOrigin; + public Transform plugOrigin; } } diff --git a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.Unity.cs b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.Unity.cs new file mode 100644 index 00000000..acf4d1f0 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.Unity.cs @@ -0,0 +1,8 @@ +namespace SCHIZO.Interop.Subnautica +{ + partial class _SwimToTarget : _CreatureAction + { + public float swimVelocity = 4f; + public float swimInterval = 1f; + } +} \ No newline at end of file diff --git a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.Unity.cs.meta b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.Unity.cs.meta new file mode 100644 index 00000000..4a3c23b3 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.Unity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3feaff8980a9e604286587255332467e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.cs b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.cs new file mode 100644 index 00000000..6ea06789 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.cs @@ -0,0 +1,6 @@ +namespace SCHIZO.Interop.Subnautica +{ + public abstract partial class _SwimToTarget + { + } +} \ No newline at end of file diff --git a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.cs.meta b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.cs.meta new file mode 100644 index 00000000..c8543ea4 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/_SwimToTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15f0ed82485f35a4287f66b14f5f563f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Scripts/Subnautica/SwimToTarget.cs b/Unity/Assets/Scripts/Subnautica/SwimToTarget.cs new file mode 100644 index 00000000..a161d7bf --- /dev/null +++ b/Unity/Assets/Scripts/Subnautica/SwimToTarget.cs @@ -0,0 +1,5 @@ +using SCHIZO.Interop.Subnautica; + +public class SwimToTarget : _SwimToTarget +{ +} \ No newline at end of file diff --git a/Unity/Assets/Scripts/Subnautica/SwimToTarget.cs.meta b/Unity/Assets/Scripts/Subnautica/SwimToTarget.cs.meta new file mode 100644 index 00000000..15c91abe --- /dev/null +++ b/Unity/Assets/Scripts/Subnautica/SwimToTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 804aa32b92fdc9a4d966f17405ac50c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: