using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DerelictMoonPlugin.NetcodePatcher;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Rendering.HighDefinition;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DerelictMoonPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+5aa41b7ac14b38c1e9830242b73e8eefc27d9c77")]
[assembly: AssemblyProduct("DerelictMoonPlugin")]
[assembly: AssemblyTitle("DerelictMoonPlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace DerelictMoonPlugin
{
[BepInPlugin("DerelictMoonPlugin", "DerelictMoonPlugin", "1.2.1")]
public class DerelictMoonPlugin : BaseUnityPlugin
{
public static DerelictMoonPlugin instance;
private static void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
Type[] array2 = array;
foreach (Type type in array2)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array3 = methods;
MethodInfo[] array4 = array3;
foreach (MethodInfo methodInfo in array4)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
private void Awake()
{
instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin DerelictMoonPlugin is loaded!");
NetcodePatcher();
}
}
internal class InteriorHazardSpawner : MonoBehaviour
{
public GameObject hazardPrefab;
public int minNumberOfHazards = 10;
public int maxNumberOfHazards = 20;
public float spawnRadius = 20f;
public float minDistanceBetweenHazards = 5f;
public float minDistanceFromEntrances = 15f;
private int numberOfHazards;
private List<Vector3> spawnedPositions;
private Vector3[] randomMapObjectsPositions;
private Vector3[] entrancePositions;
private Random random;
private int maxAttempts;
private void Start()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if ((Object)(object)hazardPrefab == (Object)null)
{
Debug.LogError((object)"InteriorHazardSpawner: Hazard prefab is not assigned!");
}
else
{
((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(OnNewRound));
}
}
private void OnNewRound()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
InitializeSpawner();
SpawnHazards();
((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).RemoveListener(new UnityAction(OnNewRound));
((Behaviour)this).enabled = false;
}
private void InitializeSpawner()
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
random = new Random(StartOfRound.Instance.randomMapSeed + 422);
numberOfHazards = random.Next(minNumberOfHazards, maxNumberOfHazards + 1);
spawnedPositions = new List<Vector3>(numberOfHazards);
maxAttempts = numberOfHazards * 3;
EntranceTeleport[] array = (from entrance in Object.FindObjectsOfType<EntranceTeleport>()
where !entrance.isEntranceToBuilding
select entrance).ToArray();
SpawnSyncedObject[] array2 = Object.FindObjectsOfType<SpawnSyncedObject>();
entrancePositions = (Vector3[])(object)new Vector3[array.Length];
for (int i = 0; i < array.Length; i++)
{
entrancePositions[i] = ((Component)array[i]).transform.position;
}
randomMapObjectsPositions = (Vector3[])(object)new Vector3[array2.Length];
for (int j = 0; j < array2.Length; j++)
{
randomMapObjectsPositions[j] = ((Component)array2[j]).transform.position;
}
}
private void SpawnHazards()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
NavMeshHit navHit = default(NavMeshHit);
for (int i = 0; i < maxAttempts; i++)
{
if (spawnedPositions.Count >= numberOfHazards)
{
break;
}
int num = random.Next(randomMapObjectsPositions.Length);
Vector3 objectPosition = randomMapObjectsPositions[num];
Vector3 validSpawnPosition = GetValidSpawnPosition(objectPosition, ref navHit);
if (validSpawnPosition != Vector3.zero)
{
GameObject val = Object.Instantiate<GameObject>(hazardPrefab, validSpawnPosition, Quaternion.identity);
val.transform.SetParent(((Component)this).transform);
spawnedPositions.Add(validSpawnPosition);
}
}
Debug.Log((object)$"InteriorHazardSpawner: Spawned {spawnedPositions.Count} hazards out of {numberOfHazards}");
}
private Vector3 GetValidSpawnPosition(Vector3 objectPosition, ref NavMeshHit navHit)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(objectPosition, spawnRadius, navHit, random, -1, 1f);
if (IsPositionValid(randomNavMeshPositionInBoxPredictable))
{
return randomNavMeshPositionInBoxPredictable;
}
return Vector3.zero;
}
private bool IsPositionValid(Vector3 position)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
float num = minDistanceBetweenHazards * minDistanceBetweenHazards;
float num2 = minDistanceFromEntrances * minDistanceFromEntrances;
Vector3 val;
for (int i = 0; i < spawnedPositions.Count; i++)
{
val = position - spawnedPositions[i];
if (((Vector3)(ref val)).sqrMagnitude < num)
{
return false;
}
}
for (int j = 0; j < entrancePositions.Length; j++)
{
val = position - entrancePositions[j];
if (((Vector3)(ref val)).sqrMagnitude < num2)
{
return false;
}
}
return true;
}
}
public static class ListShuffler
{
public static void ShuffleInSync<T1, T2>(IList<T1> list1, IList<T2> list2, Random random)
{
if (list1.Count != list2.Count)
{
throw new ArgumentException("Lists must have the same length.");
}
int count = list1.Count;
for (int num = count - 1; num > 0; num--)
{
int num2 = random.Next(0, num + 1);
int index = num;
int index2 = num2;
T1 value = list1[num2];
T1 value2 = list1[num];
list1[index] = value;
list1[index2] = value2;
index2 = num;
index = num2;
T2 value3 = list2[num2];
T2 value4 = list2[num];
list2[index2] = value3;
list2[index] = value4;
}
}
}
public class RingPortalStormEvent : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <>c__DisplayClass46_0
{
public int settledObjectCount;
public RingPortalStormEvent <>4__this;
internal void <SpawnAndDropShipmentServer>b__0(GameObject <p0>)
{
settledObjectCount++;
}
internal bool <SpawnAndDropShipmentServer>b__1()
{
return settledObjectCount == <>4__this.shipmentItemNum - 1;
}
}
[CompilerGenerated]
private sealed class <DecreaseRotationSpeed>d__44 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private float <elapsedTime>5__1;
private float <t>5__2;
private float <value>5__3;
private float <value2>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DecreaseRotationSpeed>d__44(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Starting to decrease rotation speed");
<elapsedTime>5__1 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<elapsedTime>5__1 < <>4__this.rotationSpeedChangeDuration * 0.2f)
{
<t>5__2 = <elapsedTime>5__1 / (<>4__this.rotationSpeedChangeDuration * 0.2f);
<value>5__3 = Mathf.Lerp(<>4__this.maxRotationSpeed, 1f, <t>5__2);
<value2>5__4 = Mathf.Lerp(<>4__this.maxRotationSpeed * 0.75f, 0.5f, <t>5__2);
<>4__this.animator.SetFloat("RotSpeedOuter", <value>5__3);
<>4__this.animator.SetFloat("RotSpeedInner", <value2>5__4);
<elapsedTime>5__1 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <FadeOutSound>d__39 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private float <startVolume>5__1;
private float <deltaVolume>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FadeOutSound>d__39(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<startVolume>5__1 = <>4__this.audioSource.volume;
<deltaVolume>5__2 = <startVolume>5__1 * Time.deltaTime / <>4__this.fadeOutDuration;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this.audioSource.volume > 0f)
{
AudioSource audioSource = <>4__this.audioSource;
audioSource.volume -= <deltaVolume>5__2;
<>2__current = null;
<>1__state = 1;
return true;
}
<>4__this.audioSource.Stop();
<>4__this.audioSource.volume = <startVolume>5__1;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <IncreaseRotationSpeed>d__43 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private float <elapsedTime>5__1;
private float <t>5__2;
private float <value>5__3;
private float <value2>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <IncreaseRotationSpeed>d__43(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Starting to increase rotation speed");
<elapsedTime>5__1 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<elapsedTime>5__1 < <>4__this.rotationSpeedChangeDuration)
{
<t>5__2 = <elapsedTime>5__1 / <>4__this.rotationSpeedChangeDuration;
<value>5__3 = Mathf.Lerp(1f, <>4__this.maxRotationSpeed, <t>5__2);
<value2>5__4 = Mathf.Lerp(0.5f, <>4__this.maxRotationSpeed * 0.75f, <t>5__2);
<>4__this.animator.SetFloat("RotSpeedOuter", <value>5__3);
<>4__this.animator.SetFloat("RotSpeedInner", <value2>5__4);
<elapsedTime>5__1 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
Debug.Log((object)"RingPortalStormEvent: Finished increasing rotation speed");
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <MoveToNextPosition>d__42 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private int <index>5__1;
private Vector3 <startPosition>5__2;
private Vector3 <targetPosition>5__3;
private Vector3 <startRotation>5__4;
private Vector3 <levelRotation>5__5;
private float <elapsedTime>5__6;
private float <time>5__7;
private float <t>5__8;
private Vector3 <position>5__9;
private Vector3 <euler>5__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MoveToNextPosition>d__42(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<index>5__1 = <>4__this.currentShipmentIndex.Value % <>4__this.shipmentPositions.Count;
<startPosition>5__2 = ((Component)<>4__this).transform.position;
<targetPosition>5__3 = <>4__this.shipmentPositions[<index>5__1].position;
<targetPosition>5__3.y = <startPosition>5__2.y;
Quaternion rotation = ((Component)<>4__this).transform.rotation;
<startRotation>5__4 = ((Quaternion)(ref rotation)).eulerAngles;
<levelRotation>5__5 = new Vector3(0f, <startRotation>5__4.y, 0f);
<elapsedTime>5__6 = 0f;
break;
}
case 1:
<>1__state = -1;
break;
}
if (<elapsedTime>5__6 < <>4__this.movementDuration)
{
<time>5__7 = <elapsedTime>5__6 / <>4__this.movementDuration;
<t>5__8 = <>4__this.movementCurve.Evaluate(<time>5__7);
<position>5__9 = Vector3.Slerp(<startPosition>5__2, <targetPosition>5__3, <t>5__8);
((Component)<>4__this).transform.position = <position>5__9;
<euler>5__10 = Vector3.Slerp(<startRotation>5__4, <levelRotation>5__5, <t>5__8);
((Component)<>4__this).transform.rotation = Quaternion.Euler(<euler>5__10);
<elapsedTime>5__6 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
((Component)<>4__this).transform.position = <targetPosition>5__3;
((Component)<>4__this).transform.rotation = Quaternion.Euler(<levelRotation>5__5);
Debug.Log((object)"RingPortalStormEvent: Finished moving to next position");
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <MovementSoundSequence>d__37 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private AudioClip <audioClip>5__1;
private AudioClip <audioClip2>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MovementSoundSequence>d__37(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<audioClip>5__1 = null;
<audioClip2>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (<>4__this.startMovingSounds.Length != 0)
{
<audioClip>5__1 = <>4__this.startMovingSounds[<>4__this.seededRandom.Next(<>4__this.startMovingSounds.Length)];
<>4__this.audioSource.PlayOneShot(<audioClip>5__1);
<>2__current = (object)new WaitForSeconds(<audioClip>5__1.length);
<>1__state = 1;
return true;
}
break;
case 1:
<>1__state = -1;
<audioClip>5__1 = null;
break;
case 2:
<>1__state = -1;
<audioClip2>5__2 = null;
break;
case 3:
<>1__state = -1;
break;
}
if (<>4__this.ringMovementSounds.Length != 0)
{
<audioClip2>5__2 = <>4__this.ringMovementSounds[<>4__this.seededRandom.Next(<>4__this.ringMovementSounds.Length)];
<>4__this.audioSource.clip = <audioClip2>5__2;
<>4__this.audioSource.Play();
<>2__current = (object)new WaitForSeconds(<audioClip2>5__2.length);
<>1__state = 2;
return true;
}
<>2__current = null;
<>1__state = 3;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <PerformDeliverySequence>d__41 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PerformDeliverySequence>d__41(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Expected O, but got Unknown
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Expected O, but got Unknown
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Expected O, but got Unknown
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Starting delivery sequence");
<>4__this.isDelivering = true;
<>4__this.shipmentSettledOnServer.Value = false;
<>4__this.animator.SetBool("isPortalActive", false);
<>4__this.animator.SetBool("isPortalOpenFinished", false);
<>4__this.animator.SetBool("isPortalCloseFinished", false);
<>4__this.isPortalOpenAnimationFinished = false;
<>4__this.isPortalCloseAnimationFinished = false;
<>4__this.PlayMovementSoundsClientRpc();
Debug.Log((object)"RingPortalStormEvent: Moving to next position");
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.MoveToNextPosition());
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.StopMovementSoundsClientRpc();
<>2__current = (object)new WaitForSeconds(<>4__this.fadeOutDuration + 0.5f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>4__this.PlayStartSpinningSoundClientRpc();
Debug.Log((object)"RingPortalStormEvent: Increasing rotation speed");
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.IncreaseRotationSpeed());
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Activating portal");
<>4__this.animator.SetBool("isPortalActive", true);
<>4__this.animator.SetBool("isPortalOpenFinished", false);
Debug.Log((object)"RingPortalStormEvent: Waiting for portal open animation to finish");
<>2__current = (object)new WaitUntil((Func<bool>)(() => <>4__this.isPortalOpenAnimationFinished));
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Portal open animation finished");
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DecreaseRotationSpeed());
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(<>4__this.cooldownDuration);
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Spawning and dropping shipment");
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SpawnAndDropShipmentServer());
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(<>4__this.cooldownDuration);
<>1__state = 8;
return true;
case 8:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Closing portal");
<>4__this.animator.SetBool("isPortalActive", false);
<>4__this.animator.SetBool("isPortalCloseFinished", false);
Debug.Log((object)"RingPortalStormEvent: Waiting for portal close animation to finish");
<>2__current = (object)new WaitUntil((Func<bool>)(() => <>4__this.isPortalCloseAnimationFinished));
<>1__state = 9;
return true;
case 9:
{
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Portal close animation finished");
Debug.Log((object)$"RingPortalStormEvent: Preparing for next delivery. Current index: {<>4__this.currentShipmentIndex}");
NetworkVariable<int> currentShipmentIndex = <>4__this.currentShipmentIndex;
int value = currentShipmentIndex.Value;
currentShipmentIndex.Value = value + 1;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SetRandomTilt());
<>1__state = 10;
return true;
}
case 10:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Delivery sequence completed");
<>4__this.isDelivering = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SetRandomTilt>d__45 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private float <x>5__1;
private float <z>5__2;
private float <elapsedTime>5__3;
private Vector3 <startRotation>5__4;
private float <t>5__5;
private Vector3 <euler>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetRandomTilt>d__45(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: tilting the station");
<x>5__1 = (float)<>4__this.seededRandom.NextDouble() * <>4__this.maxTiltAngle;
<z>5__2 = (float)<>4__this.seededRandom.NextDouble() * <>4__this.maxTiltAngle;
RingPortalStormEvent ringPortalStormEvent = <>4__this;
float num = <x>5__1;
Quaternion rotation = ((Component)<>4__this).transform.rotation;
ringPortalStormEvent.targetRotation = new Vector3(num, ((Quaternion)(ref rotation)).eulerAngles.y, <z>5__2);
<elapsedTime>5__3 = 0f;
rotation = ((Component)<>4__this).transform.rotation;
<startRotation>5__4 = ((Quaternion)(ref rotation)).eulerAngles;
break;
}
case 1:
<>1__state = -1;
break;
}
if (<elapsedTime>5__3 < <>4__this.tiltChangeDuration)
{
<t>5__5 = <elapsedTime>5__3 / <>4__this.tiltChangeDuration;
<euler>5__6 = Vector3.Slerp(<startRotation>5__4, <>4__this.targetRotation, <t>5__5);
((Component)<>4__this).transform.rotation = Quaternion.Euler(<euler>5__6);
<elapsedTime>5__3 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpawnAndDropShipmentClient>d__47 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnAndDropShipmentClient>d__47(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitUntil((Func<bool>)(() => <>4__this.shipmentSettledOnServer.Value));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Shipment dropped");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpawnAndDropShipmentServer>d__46 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RingPortalStormEvent <>4__this;
private <>c__DisplayClass46_0 <>8__1;
private Action<GameObject> <onObjectSettled>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnAndDropShipmentServer>d__46(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<onObjectSettled>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass46_0();
<>8__1.<>4__this = <>4__this;
<>8__1.settledObjectCount = 0;
<onObjectSettled>5__2 = delegate
{
<>8__1.settledObjectCount++;
};
<>4__this.PrepareShipmentClientRpc();
ShipmentCollisionHandler.OnObjectSettled += <onObjectSettled>5__2;
<>2__current = (object)new WaitUntil((Func<bool>)(() => <>8__1.settledObjectCount == <>8__1.<>4__this.shipmentItemNum - 1));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Debug.Log((object)"RingPortalStormEvent: Shipment dropped");
ShipmentCollisionHandler.OnObjectSettled -= <onObjectSettled>5__2;
<>4__this.shipmentSettledOnServer.Value = true;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public List<float> deliveryTimes = new List<float>();
[SerializeField]
private float maxStartTimeDelay = 120f;
[SerializeField]
private GameObject shipmentsContainer;
[SerializeField]
private GameObject shipmentPositionsObject;
[SerializeField]
private float maxRotationSpeed = 5f;
[SerializeField]
private float rotationSpeedChangeDuration = 10f;
[SerializeField]
private float cooldownDuration = 5f;
[SerializeField]
private float movementDuration = 30f;
[SerializeField]
private AnimationCurve movementCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
[SerializeField]
private float maxTiltAngle = 25f;
[SerializeField]
private float tiltChangeDuration = 30f;
[SerializeField]
private AudioClip[] startMovingSounds;
[SerializeField]
private AudioClip[] ringMovementSounds;
[SerializeField]
private AudioClip startSpinningSound;
[SerializeField]
private float fadeOutDuration = 1f;
private AudioSource audioSource;
private Coroutine soundCoroutine;
private Animator animator;
private Vector3 targetRotation;
private Random seededRandom;
private List<GameObject> shipments = new List<GameObject>();
private List<Transform> shipmentPositions = new List<Transform>();
private float timer;
private float timeDelay;
private int shipmentItemNum;
private bool isPortalOpenAnimationFinished;
private bool isPortalCloseAnimationFinished;
private bool isDelivering;
private NetworkVariable<int> currentShipmentIndex = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
private NetworkVariable<int> sharedSeed = new NetworkVariable<int>(StartOfRound.Instance.randomMapSeed, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
private NetworkVariable<bool> shipmentSettledOnServer = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public override void OnNetworkSpawn()
{
if (((NetworkBehaviour)this).IsServer)
{
sharedSeed.Value = StartOfRound.Instance.randomMapSeed + 42;
}
}
private void Start()
{
Debug.Log((object)"RingPortalStormEvent: Start method called");
animator = ((Component)this).GetComponent<Animator>();
InitializeShipmentPositions();
InitializeShipments();
if (shipmentPositions.Count != shipments.Count)
{
Debug.LogError((object)"RingPortalStormEvent: Mismatch in number of shipments and delivery locations!");
}
audioSource = ((Component)this).GetComponent<AudioSource>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
}
seededRandom = new Random(sharedSeed.Value);
timeDelay = (float)seededRandom.NextDouble() * maxStartTimeDelay;
for (int i = 0; i < deliveryTimes.Count; i++)
{
deliveryTimes[i] += timeDelay;
}
ListShuffler.ShuffleInSync(shipmentPositions, shipments, seededRandom);
}
private void Update()
{
if (currentShipmentIndex.Value >= deliveryTimes.Count)
{
Debug.Log((object)"RingPortalStormEvent: All shipments delivered, disabling station");
((Behaviour)this).enabled = false;
}
if (((NetworkBehaviour)this).IsServer)
{
timer += Time.deltaTime;
if (currentShipmentIndex.Value < deliveryTimes.Count && timer >= deliveryTimes[currentShipmentIndex.Value] && !isDelivering)
{
Debug.Log((object)$"RingPortalStormEvent: Starting delivery sequence for shipment {currentShipmentIndex.Value}");
((MonoBehaviour)this).StartCoroutine(PerformDeliverySequence());
}
}
}
private void InitializeShipments()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
Debug.Log((object)"RingPortalStormEvent: Initializing shipments");
if ((Object)(object)shipmentsContainer == (Object)null)
{
Debug.LogError((object)"RingPortalStormEvent: Shipments container is not assigned!");
return;
}
foreach (Transform item in shipmentsContainer.transform)
{
Transform val = item;
shipments.Add(((Component)val).gameObject);
Debug.Log((object)("Added shipment: " + ((Object)val).name));
}
Debug.Log((object)$"Total shipments: {shipments.Count}");
}
private void InitializeShipmentPositions()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"RingPortalStormEvent: Initializing shipment positions");
if ((Object)(object)shipmentPositionsObject == (Object)null)
{
Debug.LogError((object)"RingPortalStormEvent: ShipmentPositions object is not assigned!");
return;
}
foreach (Transform item in shipmentPositionsObject.transform)
{
Transform val = item;
shipmentPositions.Add(val);
Debug.Log((object)$"Added shipment position: {((Object)val).name} at {val.position}");
}
Debug.Log((object)$"Total shipment positions: {shipmentPositions.Count}");
}
[ClientRpc]
private void PlayMovementSoundsClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3134008275u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3134008275u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (soundCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(soundCoroutine);
}
soundCoroutine = ((MonoBehaviour)this).StartCoroutine(MovementSoundSequence());
}
}
[IteratorStateMachine(typeof(<MovementSoundSequence>d__37))]
private IEnumerator MovementSoundSequence()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MovementSoundSequence>d__37(0)
{
<>4__this = this
};
}
[ClientRpc]
private void StopMovementSoundsClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1328377033u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1328377033u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (soundCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(soundCoroutine);
soundCoroutine = null;
}
((MonoBehaviour)this).StartCoroutine(FadeOutSound());
}
}
[IteratorStateMachine(typeof(<FadeOutSound>d__39))]
private IEnumerator FadeOutSound()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FadeOutSound>d__39(0)
{
<>4__this = this
};
}
[ClientRpc]
private void PlayStartSpinningSoundClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1280932741u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1280932741u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if ((Object)(object)startSpinningSound != (Object)null)
{
audioSource.clip = startSpinningSound;
audioSource.Play();
}
}
}
[IteratorStateMachine(typeof(<PerformDeliverySequence>d__41))]
private IEnumerator PerformDeliverySequence()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PerformDeliverySequence>d__41(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<MoveToNextPosition>d__42))]
private IEnumerator MoveToNextPosition()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MoveToNextPosition>d__42(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<IncreaseRotationSpeed>d__43))]
private IEnumerator IncreaseRotationSpeed()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <IncreaseRotationSpeed>d__43(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<DecreaseRotationSpeed>d__44))]
private IEnumerator DecreaseRotationSpeed()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DecreaseRotationSpeed>d__44(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<SetRandomTilt>d__45))]
private IEnumerator SetRandomTilt()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetRandomTilt>d__45(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<SpawnAndDropShipmentServer>d__46))]
private IEnumerator SpawnAndDropShipmentServer()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnAndDropShipmentServer>d__46(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<SpawnAndDropShipmentClient>d__47))]
private IEnumerator SpawnAndDropShipmentClient()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnAndDropShipmentClient>d__47(0)
{
<>4__this = this
};
}
[ClientRpc]
private void PrepareShipmentClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1372235156u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1372235156u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
Debug.Log((object)$"RingPortalStormEvent: Spawning shipment {currentShipmentIndex.Value % shipments.Count}");
GameObject val3 = shipments[currentShipmentIndex.Value % shipments.Count];
AudioSource component = val3.GetComponent<AudioSource>();
AlignShipment(val3);
Transform[] componentsInChildren = val3.GetComponentsInChildren<Transform>(true);
Transform[] array = componentsInChildren;
Transform[] array2 = array;
foreach (Transform val4 in array2)
{
ShipmentCollisionHandler component2 = ((Component)val4).gameObject.GetComponent<ShipmentCollisionHandler>();
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = true;
}
}
if (component != null)
{
component.Play();
}
shipmentItemNum = componentsInChildren.Length;
}
private void AlignShipment(GameObject shipment)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
Transform transform = shipment.transform;
Vector3 val = shipmentsContainer.transform.InverseTransformPoint(transform.position);
Quaternion val2 = Quaternion.Inverse(shipmentsContainer.transform.rotation) * transform.rotation;
Vector3 position = ((Component)this).transform.TransformPoint(val);
Quaternion rotation = ((Component)this).transform.rotation * val2;
transform.position = position;
transform.rotation = rotation;
}
public void OnPortalOpenAnimationFinished()
{
Debug.Log((object)"RingPortalStormEvent: Portal open animation finished");
animator.SetBool("isPortalOpenFinished", true);
isPortalOpenAnimationFinished = true;
}
public void OnPortalCloseAnimationFinished()
{
Debug.Log((object)"RingPortalStormEvent: Portal close animation finished");
animator.SetBool("isPortalCloseFinished", true);
isPortalCloseAnimationFinished = true;
}
protected override void __initializeVariables()
{
if (currentShipmentIndex == null)
{
throw new Exception("RingPortalStormEvent.currentShipmentIndex cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)currentShipmentIndex).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentShipmentIndex, "currentShipmentIndex");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)currentShipmentIndex);
if (sharedSeed == null)
{
throw new Exception("RingPortalStormEvent.sharedSeed cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)sharedSeed).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)sharedSeed, "sharedSeed");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)sharedSeed);
if (shipmentSettledOnServer == null)
{
throw new Exception("RingPortalStormEvent.shipmentSettledOnServer cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)shipmentSettledOnServer).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)shipmentSettledOnServer, "shipmentSettledOnServer");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)shipmentSettledOnServer);
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3134008275u, new RpcReceiveHandler(__rpc_handler_3134008275), "PlayMovementSoundsClientRpc");
((NetworkBehaviour)this).__registerRpc(1328377033u, new RpcReceiveHandler(__rpc_handler_1328377033), "StopMovementSoundsClientRpc");
((NetworkBehaviour)this).__registerRpc(1280932741u, new RpcReceiveHandler(__rpc_handler_1280932741), "PlayStartSpinningSoundClientRpc");
((NetworkBehaviour)this).__registerRpc(1372235156u, new RpcReceiveHandler(__rpc_handler_1372235156), "PrepareShipmentClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_3134008275(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RingPortalStormEvent)(object)target).PlayMovementSoundsClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1328377033(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RingPortalStormEvent)(object)target).StopMovementSoundsClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1280932741(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RingPortalStormEvent)(object)target).PlayStartSpinningSoundClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1372235156(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RingPortalStormEvent)(object)target).PrepareShipmentClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "RingPortalStormEvent";
}
}
public class ShipmentCollisionHandler : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <CheckIfSettled>d__23 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ShipmentCollisionHandler <>4__this;
private float <elapsedTime>5__1;
private Vector3 <position>5__2;
private Quaternion <rotation>5__3;
private Vector3 <restingPosition>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CheckIfSettled>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Expected O, but got Unknown
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Expected O, but got Unknown
Vector3 velocity;
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<elapsedTime>5__1 = <>4__this.initialCheckDelay;
<>2__current = (object)new WaitForSeconds(<>4__this.initialCheckDelay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
goto IL_00b6;
case 2:
<>1__state = -1;
<elapsedTime>5__1 += <>4__this.checkInterval;
goto IL_00b6;
case 3:
<>1__state = -1;
<>4__this.SetObjectSettledClientRpc();
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 4;
return true;
case 4:
{
<>1__state = -1;
<position>5__2 = <>4__this.rb.position;
<rotation>5__3 = <>4__this.rb.rotation;
<restingPosition>5__4 = <position>5__2;
<>4__this.SyncSettledObjectClientRpc(<restingPosition>5__4, <rotation>5__3);
return false;
}
IL_00b6:
velocity = <>4__this.rb.velocity;
if (((Vector3)(ref velocity)).magnitude > <>4__this.settlementThreshold && <elapsedTime>5__1 < <>4__this.maxTimeToSettle)
{
<>2__current = (object)new WaitForSeconds(<>4__this.checkInterval);
<>1__state = 2;
return true;
}
ShipmentCollisionHandler.OnObjectSettled?.Invoke(((Component)<>4__this).gameObject);
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 3;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SyncSettledObjectCoroutine>d__26 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Vector3 restingPosition;
public Quaternion restingRotation;
public ShipmentCollisionHandler <>4__this;
private float <interpSyncTime>5__1;
private float <currSyncTime>5__2;
private Vector3 <startPos>5__3;
private Quaternion <startRot>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SyncSettledObjectCoroutine>d__26(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<interpSyncTime>5__1 = 3f;
<currSyncTime>5__2 = 0f;
<startPos>5__3 = <>4__this.rb.position;
<startRot>5__4 = <>4__this.rb.rotation;
break;
case 1:
<>1__state = -1;
break;
}
if (<currSyncTime>5__2 < <interpSyncTime>5__1)
{
<>4__this.rb.position = Vector3.Lerp(<startPos>5__3, restingPosition, <currSyncTime>5__2 / <interpSyncTime>5__1);
<>4__this.rb.rotation = Quaternion.Slerp(<startRot>5__4, restingRotation, <currSyncTime>5__2 / <interpSyncTime>5__1);
<currSyncTime>5__2 += 0.02f;
<>2__current = (object)new WaitForSeconds(0.02f);
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <WaitAndEnablePhysics>d__17 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public ShipmentCollisionHandler <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitAndEnablePhysics>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)<>4__this.rb != (Object)null)
{
if (((NetworkBehaviour)<>4__this).IsServer)
{
<>4__this.rb.useGravity = true;
<>4__this.rb.isKinematic = false;
}
else
{
<>4__this.rb.useGravity = false;
<>4__this.rb.isKinematic = true;
}
}
else
{
Debug.LogError((object)"ShipmentCollisionHandler: Rigidbody is not assigned!");
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
private float settlementThreshold = 0.1f;
[SerializeField]
private float initialCheckDelay = 0.5f;
[SerializeField]
private float checkInterval = 0.1f;
[SerializeField]
private float maxTimeToSettle = 15f;
[SerializeField]
private float killVelocityThreshold = 1f;
private bool hasCollided;
private MeshCollider meshCollider;
private BoxCollider boxCollider;
private Rigidbody rb;
private AudioSource impactSound;
private NavMeshObstacle navMeshObstacle;
private ParticleSystem smokeExplosion;
private NetworkTransform networkTransform;
public static event Action<GameObject> OnObjectSettled;
private void Start()
{
rb = ((Component)this).GetComponent<Rigidbody>();
impactSound = ((Component)this).GetComponent<AudioSource>();
meshCollider = ((Component)this).GetComponent<MeshCollider>();
boxCollider = ((Component)this).GetComponent<BoxCollider>();
navMeshObstacle = ((Component)this).GetComponent<NavMeshObstacle>();
smokeExplosion = ((Component)this).GetComponent<ParticleSystem>();
networkTransform = ((Component)this).GetComponent<NetworkTransform>();
MeshRenderer component = ((Component)this).GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
((Renderer)component).enabled = true;
}
if ((Object)(object)networkTransform != (Object)null)
{
((Behaviour)networkTransform).enabled = true;
}
if ((Object)(object)navMeshObstacle != (Object)null)
{
navMeshObstacle.carving = false;
}
if ((Object)(object)meshCollider != (Object)null)
{
meshCollider.convex = true;
((Collider)meshCollider).enabled = true;
}
if ((Object)(object)boxCollider != (Object)null && ((NetworkBehaviour)this).IsServer)
{
((Collider)boxCollider).enabled = true;
((Collider)boxCollider).isTrigger = true;
}
((MonoBehaviour)this).StartCoroutine(WaitAndEnablePhysics(1f));
}
[IteratorStateMachine(typeof(<WaitAndEnablePhysics>d__17))]
private IEnumerator WaitAndEnablePhysics(float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitAndEnablePhysics>d__17(0)
{
<>4__this = this,
delay = delay
};
}
private void OnCollisionEnter(Collision collision)
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
if (!hasCollided && (collision.gameObject.CompareTag("Grass") || collision.gameObject.CompareTag("Aluminum")))
{
OnCollisionEnterEffect();
}
else
{
if (!collision.gameObject.CompareTag("Player"))
{
return;
}
PlayerControllerB component = collision.gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null)
{
Vector3 velocity = rb.velocity;
if (((Vector3)(ref velocity)).magnitude > killVelocityThreshold)
{
NotifyPlayerKillClientRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)component), rb.velocity);
}
}
}
}
private void OnTriggerEnter(Collider other)
{
if (((Component)other).gameObject.layer == LayerMask.NameToLayer("Enemies") && ((NetworkBehaviour)this).IsServer)
{
EnemyAI component = ((Component)other).gameObject.GetComponent<EnemyAI>();
if ((Object)(object)component != (Object)null)
{
Debug.Log((object)"ShipmentCollisionHandler: Enemy crushed by falling debris");
component.KillEnemyOnOwnerClient(false);
}
}
}
private void OnCollisionEnterEffect()
{
hasCollided = true;
PlayEffectsClientRpc();
((MonoBehaviour)this).StartCoroutine(CheckIfSettled());
}
[ClientRpc]
private void PlayEffectsClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2851645643u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2851645643u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
AudioSource obj = impactSound;
if (obj != null)
{
obj.Play();
}
ParticleSystem obj2 = smokeExplosion;
if (obj2 != null)
{
obj2.Play();
}
}
}
[ClientRpc]
private void NotifyPlayerKillClientRpc(NetworkBehaviourReference playerRef, Vector3 killVelocity)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(972820659u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe(ref killVelocity);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 972820659u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB val3 = default(PlayerControllerB);
if (!StartOfRound.Instance.shipIsLeaving && ((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null))
{
Debug.Log((object)$"ShipmentCollisionHandler: Player {val3.actualClientId} was crushed by falling debris");
if ((Object)(object)val3 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
val3.KillPlayer(killVelocity, true, (CauseOfDeath)8, 0, default(Vector3));
}
}
}
[IteratorStateMachine(typeof(<CheckIfSettled>d__23))]
private IEnumerator CheckIfSettled()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CheckIfSettled>d__23(0)
{
<>4__this = this
};
}
[ClientRpc]
private void SetObjectSettledClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(235186220u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 235186220u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
rb.useGravity = false;
rb.isKinematic = true;
if ((Object)(object)meshCollider != (Object)null)
{
meshCollider.convex = false;
}
if ((Object)(object)boxCollider != (Object)null)
{
((Collider)boxCollider).isTrigger = false;
((Collider)boxCollider).enabled = false;
}
if ((Object)(object)navMeshObstacle != (Object)null)
{
navMeshObstacle.carving = true;
}
}
}
[ClientRpc]
private void SyncSettledObjectClientRpc(Vector3 restingPosition, Quaternion restingRotation)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3622365502u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref restingPosition);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref restingRotation);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3622365502u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (!((NetworkBehaviour)this).IsServer)
{
((MonoBehaviour)this).StartCoroutine(SyncSettledObjectCoroutine(restingPosition, restingRotation));
}
}
}
[IteratorStateMachine(typeof(<SyncSettledObjectCoroutine>d__26))]
private IEnumerator SyncSettledObjectCoroutine(Vector3 restingPosition, Quaternion restingRotation)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SyncSettledObjectCoroutine>d__26(0)
{
<>4__this = this,
restingPosition = restingPosition,
restingRotation = restingRotation
};
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(2851645643u, new RpcReceiveHandler(__rpc_handler_2851645643), "PlayEffectsClientRpc");
((NetworkBehaviour)this).__registerRpc(972820659u, new RpcReceiveHandler(__rpc_handler_972820659), "NotifyPlayerKillClientRpc");
((NetworkBehaviour)this).__registerRpc(235186220u, new RpcReceiveHandler(__rpc_handler_235186220), "SetObjectSettledClientRpc");
((NetworkBehaviour)this).__registerRpc(3622365502u, new RpcReceiveHandler(__rpc_handler_3622365502), "SyncSettledObjectClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_2851645643(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShipmentCollisionHandler)(object)target).PlayEffectsClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_972820659(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkBehaviourReference playerRef = default(NetworkBehaviourReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
Vector3 killVelocity = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref killVelocity);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShipmentCollisionHandler)(object)target).NotifyPlayerKillClientRpc(playerRef, killVelocity);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_235186220(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShipmentCollisionHandler)(object)target).SetObjectSettledClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3622365502(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 restingPosition = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref restingPosition);
Quaternion restingRotation = default(Quaternion);
((FastBufferReader)(ref reader)).ReadValueSafe(ref restingRotation);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShipmentCollisionHandler)(object)target).SyncSettledObjectClientRpc(restingPosition, restingRotation);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ShipmentCollisionHandler";
}
}
internal class ToxicFogWeather : ToxicFumes
{
[SerializeField]
private float damageProb = 0.25f;
private Random seededRandom;
private LocalVolumetricFog toxicVolumetricFog;
private bool isToxified;
private void Start()
{
seededRandom = new Random(StartOfRound.Instance.randomMapSeed + 42);
toxicVolumetricFog = ((Component)this).GetComponent<LocalVolumetricFog>();
}
protected override void ApplyDamage(PlayerControllerB playerController)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (seededRandom.NextDouble() < (double)damageProb)
{
playerController.DamagePlayer(damageAmount, true, true, (CauseOfDeath)5, 0, false, default(Vector3));
}
}
protected override void OnTriggerStay(Collider other)
{
if (isToxified)
{
ApplyToxicEffect(other);
}
}
private void ToxifyFog()
{
((Behaviour)TimeOfDay.Instance.foggyWeather).enabled = false;
toxicVolumetricFog.parameters.meanFreePath = seededRandom.Next((int)TimeOfDay.Instance.currentWeatherVariable, (int)TimeOfDay.Instance.currentWeatherVariable2);
((Behaviour)toxicVolumetricFog).enabled = true;
isToxified = true;
}
private void PurifyFog()
{
((Behaviour)toxicVolumetricFog).enabled = false;
isToxified = false;
}
protected override void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Invalid comparison between Unknown and I4
if ((int)TimeOfDay.Instance.currentLevelWeather == 3 && !isToxified)
{
ToxifyFog();
}
else if ((int)TimeOfDay.Instance.currentLevelWeather != 3 && isToxified)
{
PurifyFog();
}
base.Update();
}
private void OnDestroy()
{
PurifyFog();
}
}
internal class ToxicFumes : MonoBehaviour
{
[SerializeField]
protected float damageTime = 3f;
[SerializeField]
protected float drunknessPower = 1.5f;
[SerializeField]
protected int damageAmount = 5;
protected float damageTimer;
protected bool isPoisoningLocalPlayer;
protected virtual void OnTriggerStay(Collider other)
{
ApplyToxicEffect(other);
}
internal void ApplyToxicEffect(Collider other)
{
if (!((Component)other).CompareTag("Player"))
{
return;
}
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)null) || !((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController) || component.isInHangarShipRoom)
{
return;
}
if (component.beamUpParticle.isPlaying || component.isPlayerDead)
{
isPoisoningLocalPlayer = false;
return;
}
isPoisoningLocalPlayer = true;
damageTimer += Time.deltaTime;
component.drunknessInertia = Mathf.Clamp(component.drunknessInertia + Time.deltaTime / drunknessPower * component.drunknessSpeed, 0.1f, 10f);
component.increasingDrunknessThisFrame = true;
if (damageTimer >= damageTime)
{
ApplyDamage(component);
damageTimer = 0f;
}
}
protected virtual void ApplyDamage(PlayerControllerB playerController)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
playerController.DamagePlayer(damageAmount, true, true, (CauseOfDeath)5, 0, false, default(Vector3));
}
internal void OnTriggerExit(Collider other)
{
if (((Component)other).CompareTag("Player"))
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
isPoisoningLocalPlayer = false;
}
}
}
protected virtual void Update()
{
if (!isPoisoningLocalPlayer && !(damageTimer <= 0f))
{
damageTimer = Mathf.Clamp(damageTimer - Time.deltaTime, 0f, damageTime);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DerelictMoonPlugin";
public const string PLUGIN_NAME = "DerelictMoonPlugin";
public const string PLUGIN_VERSION = "1.2.1";
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
}
}
}
namespace DerelictMoonPlugin.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}