Skip to content

Commit

Permalink
apply underwater gravity to fumos
Browse files Browse the repository at this point in the history
update drop pod spawn code to better correspond to latest nautilus
(oops forgor to commit)
  • Loading branch information
Govorunb committed Apr 12, 2024
1 parent 0c81c2d commit d8547b3
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 54 deletions.
21 changes: 7 additions & 14 deletions SCHIZO/Items/FumoItem/FumoItemPatches.BelowZero.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,24 @@ private static IEnumerator SpawnFumoCoro(LifepodDrop pod)
KnownTech.Add(fumoItem, false, false);
}

// sometimes things just spawn twice. shrug
// shouldn't spawn twice anymore w/ new code but shrug
if (Object.FindObjectOfType<FumoItemTool>())
{
LOGGER.LogWarning("Attempted to spawn fumo in lifepod twice");
yield break;
}

LOGGER.LogMessage("Spawning fumo in lifepod drop");
GameObject obj = UWE.Utils.InstantiateDeactivated(prefab, pod.transform, spawnLoc.position, Quaternion.Euler(spawnLoc.rotation));

LargeWorldEntity lwe = obj.GetComponent<LargeWorldEntity>();

yield return new WaitUntil(() => LargeWorldStreamer.main && LargeWorldStreamer.main.IsReady());
LargeWorldStreamer lws = LargeWorldStreamer.main;

if (lwe is { cellLevel: not LargeWorldEntity.CellLevel.Batch and not LargeWorldEntity.CellLevel.Global })
{
Int3 batch = lws.GetContainingBatch(obj.transform.position);
yield return new WaitUntil(() => lws.IsBatchReadyToCompile(batch));
}
Int3 batch = lws.GetContainingBatch(pod.transform.localToWorldMatrix.MultiplyPoint(spawnLoc.position));
yield return new WaitUntil(() => lws.IsBatchReadyToCompile(batch));

yield return new WaitUntil(() => LargeWorld.main && LargeWorld.main.streamer.globalRoot != null);
LargeWorld lw = LargeWorld.main;
lw.streamer.cellManager.RegisterEntity(obj);

LOGGER.LogMessage("Spawning fumo in lifepod drop");
GameObject obj = UWE.Utils.InstantiateDeactivated(prefab, pod.transform, spawnLoc.position, Quaternion.Euler(spawnLoc.rotation));
obj.SetActive(true);

LargeWorldEntity.Register(obj);
}
}
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 = 332438850;
private const int _rnd = 488613676;

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

Expand Down
Binary file modified SCHIZO/Resources/AssetBundles/assets
Binary file not shown.
54 changes: 38 additions & 16 deletions Unity/Assets/Mod/Evil Fumo/Evil Fumo item.prefab
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!65 &4332142020512149085
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3050323588128677620}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 4.0000005, y: 4.3434496, z: 3.2994847}
m_Center: {x: -0, y: 2.1420708, z: -0.17539322}
--- !u!1 &4427810026626581335
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -38,14 +51,36 @@ Rigidbody:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5958827312421353464}
serializedVersion: 2
m_Mass: 5
m_Drag: 0.1
m_Mass: 0.5
m_Drag: 0.5
m_AngularDrag: 0.05
m_UseGravity: 1
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 3
--- !u!114 &-2743290300116954017
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5958827312421353464}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3af24dbe2e70427cb93275ef00f34823, type: 3}
m_Name:
m_EditorClassIdentifier:
useRigidbody: {fileID: 3813723675008832454}
moveWithPlatform: 1
handleGravity: 1
aboveWaterGravity: 9.81
underwaterGravity: 2
handleDrag: 1
aboveWaterDrag: 0
underwaterDrag: 0.5
handleWind: 0
windScalar: 1
--- !u!114 &986444971531117965
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -162,19 +197,6 @@ MonoBehaviour:
_fabricatorMesh: {fileID: 4300000, guid: f02dbf41adbb6c14c8b2eb4704e4fd18, type: 2}
_fabricatorPrefab: {fileID: 4931248133309480, guid: 18b270460e531e34ca5ebc989dccd026,
type: 3}
--- !u!65 &4332142020512149085
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3050323588128677620}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 4.0000005, y: 4.3434496, z: 3.2994847}
m_Center: {x: -0, y: 2.1420708, z: -0.17539322}
--- !u!1001 &8219148621552729296
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
68 changes: 45 additions & 23 deletions Unity/Assets/Mod/Neurofumo/Neurofumo item.prefab
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &334745811986472101
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5052461778956576287}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1b9fb29e8f4c4ae99c44aaf8bf20015f, type: 3}
m_Name:
m_EditorClassIdentifier:
localMinY: -0.01
localMaxY: 0.44
posOffset: {x: 0, y: -0.01, z: 0}
eulerOffset: {x: 0, y: 0, z: 0}
scaleFactor: 1
_fabricatorMesh: {fileID: 4300000, guid: f02dbf41adbb6c14c8b2eb4704e4fd18, type: 2}
_fabricatorPrefab: {fileID: 4931248133309480, guid: 18b270460e531e34ca5ebc989dccd026,
type: 3}
--- !u!54 &-3198660705918623929
Rigidbody:
m_ObjectHideFlags: 0
Expand All @@ -8,14 +28,36 @@ Rigidbody:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5527787040625736568}
serializedVersion: 2
m_Mass: 5
m_Drag: 0.1
m_Mass: 0.5
m_Drag: 0.5
m_AngularDrag: 0.05
m_UseGravity: 1
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 3
--- !u!114 &-4845083955997906334
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5527787040625736568}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3af24dbe2e70427cb93275ef00f34823, type: 3}
m_Name:
m_EditorClassIdentifier:
useRigidbody: {fileID: -3198660705918623929}
moveWithPlatform: 1
handleGravity: 1
aboveWaterGravity: 9.81
underwaterGravity: 2
handleDrag: 1
aboveWaterDrag: 0
underwaterDrag: 0.5
handleWind: 0
windScalar: 1
--- !u!114 &5550508841886641735
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -109,26 +151,6 @@ MonoBehaviour:
hugColdResistBuff: 20
fumoModelSN: {fileID: 5699160057072596943}
fumoModelBZ: {fileID: 7859187418265201921}
--- !u!114 &334745811986472101
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5052461778956576287}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1b9fb29e8f4c4ae99c44aaf8bf20015f, type: 3}
m_Name:
m_EditorClassIdentifier:
localMinY: -0.01
localMaxY: 0.44
posOffset: {x: 0, y: -0.01, z: 0}
eulerOffset: {x: 0, y: 0, z: 0}
scaleFactor: 1
_fabricatorMesh: {fileID: 4300000, guid: f02dbf41adbb6c14c8b2eb4704e4fd18, type: 2}
_fabricatorPrefab: {fileID: 4931248133309480, guid: 18b270460e531e34ca5ebc989dccd026,
type: 3}
--- !u!65 &2518586707761524305
BoxCollider:
m_ObjectHideFlags: 0
Expand Down

0 comments on commit d8547b3

Please sign in to comment.