Decompiled source of abandonedcompanyassetsfork v0.17.1
BepInEx/plugins/AbandonedCompanyAssets.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AbandonedCompanyAssets.NetcodePatcher; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("AbandonedCompanyAssets")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Find abandoned company assets.")] [assembly: AssemblyFileVersion("0.17.1.0")] [assembly: AssemblyInformationalVersion("0.17.1")] [assembly: AssemblyProduct("AbandonedCompanyAssets")] [assembly: AssemblyTitle("AbandonedCompanyAssets")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.17.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AbandonedCompanyAssets { [BepInPlugin("AbandonedCompanyAssets", "AbandonedCompanyAssets", "0.17.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource ACALog; internal static Plugin instance; private void Awake() { instance = this; ACALog = ((BaseUnityPlugin)this).Logger; TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; val.displayText = "The Candle. A cheap but extremely unreliable method of lighting your way. The Company is not responsible for any fires.\n\n"; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AbandonedCompanyAssets is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "AbandonedCompanyAssets"; public const string PLUGIN_NAME = "AbandonedCompanyAssets"; public const string PLUGIN_VERSION = "0.17.1"; } } namespace AbandonedCompanyAssets.itemStuff { internal sealed class AbandonedFlashlightStuff : FlashlightItem { private enum FaultyTrait { None, Flicker, DrainWhenOff, FastDrainWhenOn, DropWhenHeld, BulbFail } [SerializeField] private AudioClip bulbFlickerClip; [SerializeField] private AudioClip bulbExplodeClip; [SerializeField] private float minIntensity = 50f; [SerializeField] private float maxIntensity = 120f; [SerializeField] [Min(1f)] private int smoothingSamples = 12; [SerializeField] [Min(0.001f)] private float flickerTickIntervalSeconds = 0.03f; private readonly NetworkVariable<int> syncedTraitId = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private int savedTraitId; private bool hasSavedTrait; private FaultyTrait trait; private int lastAppliedTraitId; private bool serverTraitPushed; private bool loggedOnce; private float revealDelaySeconds; private float revealTimerSeconds; private bool traitRevealed; private AudioSource audioSource; private float flickerTickTimer; private float targetIntensity; private float currentIntensity; private Light activeFlickerLight; private float activeFlickerBaselineIntensity; private bool activeFlickerBaselineCaptured; private PlayerControllerB cachedHelmetOwner; private float helmetOwnerRescanSeconds; private float dropTimerSeconds; private float nextDropDelaySeconds; private float bulbFailTimerSeconds; private float nextBulbFailDelaySeconds; private int bulbFailures; public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); int num = syncedTraitId.Value; if (num < 1 || num > 5) { num = ((savedTraitId < 1 || savedTraitId > 5) ? 1 : savedTraitId); } return num; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (saveData >= 1 && saveData <= 5) { savedTraitId = saveData; hasSavedTrait = true; } else { savedTraitId = 0; hasSavedTrait = false; } serverTraitPushed = false; } public override void Start() { ((FlashlightItem)this).Start(); audioSource = base.flashlightAudio ?? ((Component)this).GetComponent<AudioSource>(); revealDelaySeconds = Random.Range(10f, 30f); nextDropDelaySeconds = Random.Range(120f, 240f); nextBulbFailDelaySeconds = Random.Range(45f, 120f); float num = Mathf.Min(minIntensity, maxIntensity); float num2 = Mathf.Max(minIntensity, maxIntensity); currentIntensity = Random.Range(num, num2); targetIntensity = currentIntensity; if (((NetworkBehaviour)this).IsServer) { PushTraitToClientsIfNeeded(); } ApplyTraitFromNetvar(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { PushTraitToClientsIfNeeded(); } } public override void Update() { //IL_023c: Unknown result type (might be due to invalid IL or missing references) ((FlashlightItem)this).Update(); if (((NetworkBehaviour)this).IsServer) { PushTraitToClientsIfNeeded(); } ApplyTraitFromNetvar(); if (!traitRevealed && (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isBeingUsed)) { revealTimerSeconds += Time.deltaTime; if (revealTimerSeconds >= revealDelaySeconds) { traitRevealed = true; } } if (!traitRevealed || trait == FaultyTrait.None) { RestoreFlickerBaseline(); return; } if (trait == FaultyTrait.Flicker) { UpdateFlicker(); return; } RestoreFlickerBaseline(); if (((GrabbableObject)this).insertedBattery != null && ((GrabbableObject)this).insertedBattery.charge > 0f) { if (trait == FaultyTrait.DrainWhenOff && !((GrabbableObject)this).isBeingUsed) { ((GrabbableObject)this).insertedBattery.charge = Mathf.Max(0f, ((GrabbableObject)this).insertedBattery.charge - Time.deltaTime / 350f); ((GrabbableObject)this).insertedBattery.empty = ((GrabbableObject)this).insertedBattery.charge <= 0f; } else if (trait == FaultyTrait.FastDrainWhenOn && ((GrabbableObject)this).isBeingUsed) { ((GrabbableObject)this).insertedBattery.charge = Mathf.Max(0f, ((GrabbableObject)this).insertedBattery.charge - Time.deltaTime / 200f); ((GrabbableObject)this).insertedBattery.empty = ((GrabbableObject)this).insertedBattery.charge <= 0f; } } if (trait == FaultyTrait.DropWhenHeld) { if (((GrabbableObject)this).isHeld && ((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { dropTimerSeconds += Time.deltaTime; if (dropTimerSeconds >= nextDropDelaySeconds) { if (Random.Range(0, 100) > 60) { ((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, true); } dropTimerSeconds = 0f; nextDropDelaySeconds = Random.Range(120f, 240f); } } else { dropTimerSeconds = 0f; } } if (trait != FaultyTrait.BulbFail) { return; } if (((GrabbableObject)this).isBeingUsed) { bulbFailTimerSeconds += Time.deltaTime; if (bulbFailTimerSeconds >= nextBulbFailDelaySeconds && Random.Range(0, 100) > 40) { bulbFailures++; bulbFailTimerSeconds = 0f; nextBulbFailDelaySeconds = Random.Range(45f, 120f); audioSource.pitch = Random.Range(0.8f, 1.1f); audioSource.PlayOneShot(bulbFlickerClip); if (((NetworkBehaviour)this).IsOwner) { ((FlashlightItem)this).SwitchFlashlight(false); } } } else { bulbFailTimerSeconds = 0f; } } public override void ChargeBatteries() { ((GrabbableObject)this).ChargeBatteries(); bulbFailures = 0; bulbFailTimerSeconds = 0f; nextBulbFailDelaySeconds = Random.Range(45f, 120f); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) ((FlashlightItem)this).ItemActivate(used, buttonDown); if (trait == FaultyTrait.BulbFail && used && bulbFailures >= 2 && Random.Range(0, 100) > 60) { audioSource.pitch = 1f; audioSource.PlayOneShot(bulbExplodeClip); if (((GrabbableObject)this).insertedBattery != null) { ((GrabbableObject)this).insertedBattery.charge = 0f; ((GrabbableObject)this).insertedBattery.empty = true; } if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, true); } if (((NetworkBehaviour)this).IsOwner) { ((FlashlightItem)this).SwitchFlashlight(false); } } } private void PushTraitToClientsIfNeeded() { if (!serverTraitPushed || syncedTraitId.Value < 1 || syncedTraitId.Value > 5) { int num = 0; if (hasSavedTrait && savedTraitId >= 1 && savedTraitId <= 5) { num = savedTraitId; } if (num == 0) { num = Random.Range(1, 6); } syncedTraitId.Value = num; serverTraitPushed = true; if (!loggedOnce) { loggedOnce = true; Plugin.ACALog.LogDebug((object)$"AbandonedFlashlight trait={(FaultyTrait)num}"); } } } private void ApplyTraitFromNetvar() { int num = syncedTraitId.Value; if (num != lastAppliedTraitId) { lastAppliedTraitId = num; if (num < 0 || num > 5) { num = 0; } trait = (FaultyTrait)num; revealTimerSeconds = 0f; traitRevealed = false; dropTimerSeconds = 0f; bulbFailTimerSeconds = 0f; float num2 = Mathf.Min(minIntensity, maxIntensity); float num3 = Mathf.Max(minIntensity, maxIntensity); currentIntensity = Random.Range(num2, num3); targetIntensity = currentIntensity; flickerTickTimer = 0f; RestoreFlickerBaseline(); } } private void UpdateFlicker() { Light flickerLightTarget = GetFlickerLightTarget(); bool flag = ((GrabbableObject)this).isBeingUsed && ((Behaviour)flickerLightTarget).enabled; if (flag && (Object)(object)flickerLightTarget == (Object)(object)base.flashlightBulb && ((base.flashlightInterferenceLevel <= FlashlightItem.globalFlashlightInterferenceLevel) ? FlashlightItem.globalFlashlightInterferenceLevel : base.flashlightInterferenceLevel) != 0) { flag = false; } if (!flag) { RestoreFlickerBaseline(); return; } if ((Object)(object)activeFlickerLight != (Object)(object)flickerLightTarget) { RestoreFlickerBaseline(); activeFlickerLight = flickerLightTarget; activeFlickerBaselineIntensity = flickerLightTarget.intensity; activeFlickerBaselineCaptured = true; float num = Mathf.Min(minIntensity, maxIntensity); float num2 = Mathf.Max(minIntensity, maxIntensity); currentIntensity = Random.Range(num, num2); targetIntensity = currentIntensity; flickerTickTimer = 0f; } flickerTickTimer -= Time.deltaTime; if (flickerTickTimer <= 0f) { float num3 = Mathf.Min(minIntensity, maxIntensity); float num4 = Mathf.Max(minIntensity, maxIntensity); targetIntensity = Random.Range(num3, num4); flickerTickTimer = Mathf.Max(0.001f, flickerTickIntervalSeconds); } float num5 = 1f / (float)Mathf.Max(1, smoothingSamples); currentIntensity = Mathf.Lerp(currentIntensity, targetIntensity, num5); activeFlickerLight.intensity = currentIntensity; } private Light GetFlickerLightTarget() { if (!base.usingPlayerHelmetLight) { return base.flashlightBulb; } if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { cachedHelmetOwner = ((GrabbableObject)this).playerHeldBy; } if ((Object)(object)cachedHelmetOwner == (Object)null || (Object)(object)cachedHelmetOwner.helmetLight == (Object)null) { helmetOwnerRescanSeconds -= Time.deltaTime; if (helmetOwnerRescanSeconds <= 0f) { helmetOwnerRescanSeconds = 0.5f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val.pocketedFlashlight == (Object)(object)this) { cachedHelmetOwner = val; break; } } } } Light val2 = cachedHelmetOwner?.helmetLight; return val2 ?? base.flashlightBulb; } private void RestoreFlickerBaseline() { if (activeFlickerBaselineCaptured) { if ((Object)(object)activeFlickerLight != (Object)null) { activeFlickerLight.intensity = activeFlickerBaselineIntensity; } activeFlickerBaselineCaptured = false; activeFlickerLight = null; } } protected override void __initializeVariables() { if (syncedTraitId == null) { throw new Exception("AbandonedFlashlightStuff.syncedTraitId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedTraitId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedTraitId, "syncedTraitId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedTraitId); ((FlashlightItem)this).__initializeVariables(); } protected override void __initializeRpcs() { ((FlashlightItem)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "AbandonedFlashlightStuff"; } } internal sealed class AbandonedWalkieStuff : WalkieTalkie { private enum FaultyTrait { None, Distortion, FastDrainWhenOn, HalfChargeOnRecharge, RandomPowerOff, RandomGarbled, DrainWhenOff } private readonly NetworkVariable<int> syncedTraitId = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private int savedTraitId; private bool hasSavedTrait; private bool serverTraitPushed; private int randomtrait; private bool traitGenerated; private float powertimer; private float randompowerofftime; private float randomgarbletime; private float stoprandomgarble; private float maintimer; private float revealtime; private float garbletimer; private int lastAppliedTraitId = int.MinValue; private AudioDistortionFilter cachedDistortion; private bool distortionSearched; public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); int num = syncedTraitId.Value; if (num < 0 || num > 6) { num = ((savedTraitId >= 0 && savedTraitId <= 6) ? savedTraitId : 0); } return num; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (saveData >= 0 && saveData <= 6) { savedTraitId = saveData; hasSavedTrait = true; } else { savedTraitId = 0; hasSavedTrait = false; } serverTraitPushed = false; } public override void Start() { ((WalkieTalkie)this).Start(); revealtime = Random.Range(60, 90); randompowerofftime = Random.Range(180f, 360f); randomgarbletime = Random.Range(60f, 180f); stoprandomgarble = Random.Range(10f, 30f); if (((GrabbableObject)this).insertedBattery != null) { ((GrabbableObject)this).insertedBattery.charge = Random.Range(0.3f, 0.8f); } if (((NetworkBehaviour)this).IsServer) { PushTraitToClientsIfNeeded(); } ApplyTraitFromNetvar(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { PushTraitToClientsIfNeeded(); } } public override void Update() { ((WalkieTalkie)this).Update(); ApplyTraitFromNetvar(); if (!traitGenerated || randomtrait == 0) { return; } if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isBeingUsed) { maintimer += Time.deltaTime; if (randomtrait == 3 || randomtrait == 5) { powertimer += Time.deltaTime; } } if (maintimer < revealtime) { return; } if (randomtrait == 1) { AudioDistortionFilter distortionFilter = GetDistortionFilter(); if ((Object)(object)distortionFilter != (Object)null) { distortionFilter.distortionLevel = 0.7f; } else if (((NetworkBehaviour)this).IsServer) { ForceNewRandomTrait(); } } if (randomtrait == 2 && ((GrabbableObject)this).isBeingUsed && ((GrabbableObject)this).insertedBattery != null) { Battery insertedBattery = ((GrabbableObject)this).insertedBattery; insertedBattery.charge -= Time.deltaTime / 200f; } if (randomtrait == 4 && powertimer >= randompowerofftime) { ((WalkieTalkie)this).SwitchWalkieTalkieOn(false); powertimer = 0f; } if (randomtrait == 5) { if (powertimer >= randomgarbletime) { base.playingGarbledVoice = true; garbletimer += Time.deltaTime; } if (garbletimer >= stoprandomgarble) { base.playingGarbledVoice = false; powertimer = 0f; garbletimer = 0f; } } if (randomtrait == 6 && !((GrabbableObject)this).isBeingUsed && ((GrabbableObject)this).insertedBattery != null && ((GrabbableObject)this).insertedBattery.charge > 0f) { Battery insertedBattery2 = ((GrabbableObject)this).insertedBattery; insertedBattery2.charge -= Time.deltaTime / 350f; } } public override void ChargeBatteries() { ((GrabbableObject)this).ChargeBatteries(); if (randomtrait == 3 && ((GrabbableObject)this).insertedBattery != null) { ((GrabbableObject)this).insertedBattery.charge = 0.5f; } } private void PushTraitToClientsIfNeeded() { if (!serverTraitPushed || syncedTraitId.Value < 0 || syncedTraitId.Value > 6) { int value = ((!hasSavedTrait || savedTraitId < 0 || savedTraitId > 6) ? Random.Range(0, 7) : savedTraitId); syncedTraitId.Value = value; serverTraitPushed = true; } } private void ApplyTraitFromNetvar() { int num = syncedTraitId.Value; if (num != lastAppliedTraitId) { lastAppliedTraitId = num; if (num < 0 || num > 6) { num = 0; } randomtrait = num; traitGenerated = true; } } private void ForceNewRandomTrait() { int value = Random.Range(0, 7); syncedTraitId.Value = value; serverTraitPushed = true; } private AudioDistortionFilter GetDistortionFilter() { if ((Object)(object)cachedDistortion != (Object)null) { return cachedDistortion; } if (distortionSearched) { return null; } distortionSearched = true; Transform val = FindChildRecursive(((Component)this).transform, "Target"); if ((Object)(object)val == (Object)null) { return null; } cachedDistortion = ((Component)val).GetComponent<AudioDistortionFilter>(); return cachedDistortion; } private static Transform FindChildRecursive(Transform root, string childName) { int childCount = root.childCount; for (int i = 0; i < childCount; i++) { Transform child = root.GetChild(i); if (((Object)child).name == childName) { return child; } Transform val = FindChildRecursive(child, childName); if ((Object)(object)val != (Object)null) { return val; } } return null; } protected override void __initializeVariables() { if (syncedTraitId == null) { throw new Exception("AbandonedWalkieStuff.syncedTraitId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedTraitId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedTraitId, "syncedTraitId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedTraitId); ((WalkieTalkie)this).__initializeVariables(); } protected override void __initializeRpcs() { ((WalkieTalkie)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "AbandonedWalkieStuff"; } } internal sealed class CandleStuff : GrabbableObject { [SerializeField] private Light toggleLight; [SerializeField] private UnityEvent[] onTurnOnEvents; [SerializeField] private UnityEvent[] onTurnOffEvents; [SerializeField] private AudioClip blockedConditionClip; [SerializeField] private ScanNodeProperties scanNode; private const float EnvironmentCheckIntervalSeconds = 0.2f; private ParticleSystem[] cachedParticleSystems; private AudioSource[] cachedAudioSourceChildren; private AudioSource cachedAudioSource; private bool isItemOn; private bool underwaterDead; private string soakedHeaderText = "Soaked Antique Candle"; private string normalHeaderText; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); underwaterDead = (saveData & 1) != 0; ApplyScanNodeHeader(); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return underwaterDead ? 1 : 0; } public override void Start() { ((GrabbableObject)this).Start(); cachedParticleSystems = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); cachedAudioSourceChildren = ((Component)this).GetComponentsInChildren<AudioSource>(); cachedAudioSource = ((Component)this).GetComponent<AudioSource>(); ApplyScanNodeHeader(); isItemOn = false; ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); ApplyVisualState(turnOn: false); } private void SetMute(AudioSource[] sources, bool muted) { for (int i = 0; i < sources.Length; i++) { sources[i].mute = muted; } } public override void PocketItem() { ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); SetMute(cachedAudioSourceChildren, muted: true); cachedAudioSource.mute = true; TurnOffByPlayer(); ((GrabbableObject)this).PocketItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); SetMute(cachedAudioSourceChildren, muted: false); cachedAudioSource.mute = false; if (!buttonDown) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (underwaterDead) { PlayBlockedSound(); } else if (IsUnderwaterNow(localPlayerController)) { if (!isItemOn) { isItemOn = true; } KillByUnderwater(); } else if (IsOutside(localPlayerController) && IsRainOrFlooded()) { PlayBlockedSound(); if (isItemOn) { TurnOffByWeather(); } } else if (isItemOn) { TurnOffByPlayer(); } else { TurnOnByPlayer(); } } private void TurnOnByPlayer() { isItemOn = true; ApplyVisualState(turnOn: true); ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); ((MonoBehaviour)this).InvokeRepeating("EnvironmentTick", 0.2f, 0.2f); } private void TurnOffByPlayer() { isItemOn = false; ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); ApplyVisualState(turnOn: false); } private void TurnOffByWeather() { isItemOn = false; ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); ApplyVisualState(turnOn: false); } private void KillByUnderwater() { if (!underwaterDead && isItemOn) { underwaterDead = true; ApplyScanNodeHeader(); PlayBlockedSound(); isItemOn = false; ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); ApplyVisualState(turnOn: false); } } private void EnvironmentTick() { if (!isItemOn) { ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!IsEquippedByLocalPlayer(localPlayerController)) { ((MonoBehaviour)this).CancelInvoke("EnvironmentTick"); } else if (IsUnderwaterNow(localPlayerController)) { KillByUnderwater(); } else if (IsOutside(localPlayerController) && IsRainOrFlooded()) { TurnOffByWeather(); } } private bool IsUnderwaterNow(PlayerControllerB player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) Collider underwaterCollider = player.underwaterCollider; if ((Object)(object)underwaterCollider == (Object)null) { return false; } Vector3 position = ((Component)player.gameplayCamera).transform.position; Vector3 point = ((Component)player).transform.position + Vector3.up * 0.7f; return IsPointInsideCollider(underwaterCollider, position) || IsPointInsideCollider(underwaterCollider, point); } private bool IsPointInsideCollider(Collider collider, Vector3 point) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Vector3 val = collider.ClosestPoint(point); Vector3 val2 = val - point; return ((Vector3)(ref val2)).sqrMagnitude < 0.0001f; } private bool IsEquippedByLocalPlayer(PlayerControllerB localPlayer) { return base.isHeld && !base.isPocketed && (Object)(object)base.playerHeldBy == (Object)(object)localPlayer; } private bool IsOutside(PlayerControllerB player) { return !player.isInsideFactory && !player.isInHangarShipRoom; } private bool IsRainOrFlooded() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 LevelWeatherType currentWeather = StartOfRound.Instance.currentLevel.currentWeather; return (int)currentWeather == 1 || (int)currentWeather == 4; } private void PlayBlockedSound() { cachedAudioSource.PlayOneShot(blockedConditionClip); } private void ApplyScanNodeHeader() { normalHeaderText = scanNode.headerText; scanNode.headerText = (underwaterDead ? soakedHeaderText : normalHeaderText); } private void ApplyVisualState(bool turnOn) { ((Behaviour)toggleLight).enabled = turnOn; if (turnOn) { InvokeEvents(onTurnOnEvents); return; } StopAndClearParticles(); InvokeEvents(onTurnOffEvents); } private void InvokeEvents(UnityEvent[] eventsToInvoke) { for (int i = 0; i < eventsToInvoke.Length; i++) { eventsToInvoke[i].Invoke(); } } private void StopAndClearParticles() { for (int i = 0; i < cachedParticleSystems.Length; i++) { ParticleSystem val = cachedParticleSystems[i]; val.Pause(true); val.Stop(true, (ParticleSystemStopBehavior)0); val.Clear(true); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "CandleStuff"; } } internal sealed class GlowstickStuff : GrabbableObject { [CompilerGenerated] private sealed class <ApplyInitialMotionNextFixed>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Rigidbody body; public Vector3 velocity; public Vector3 angularVelocity; public GlowstickStuff <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyInitialMotionNextFixed>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; case 1: <>1__state = -1; body.isKinematic = false; body.useGravity = true; body.velocity = velocity; body.angularVelocity = angularVelocity; 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 <DestroyHeldAfterDelay>d__27 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB player; public float delaySeconds; public GlowstickStuff <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DestroyHeldAfterDelay>d__27(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(delaySeconds); <>1__state = 1; return true; case 1: <>1__state = -1; player.DestroyItemInSlotAndSync(player.currentItemSlot); 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 GameObject droppedGlowstickPrefab; [SerializeField] private AudioSource audioSource; [SerializeField] private AudioClip snapClip; [SerializeField] [Min(0f)] private int startingGlowstickCount = 3; [SerializeField] private GameObject glowstickVisualA; [SerializeField] private GameObject glowstickVisualB; [SerializeField] private GameObject glowstickVisualC; [SerializeField] private float spawnForwardOffset = 0.75f; [SerializeField] private float spawnUpOffset = 1.1f; [SerializeField] private float throwForwardSpeed = 8f; [SerializeField] private float throwUpSpeed = 1.5f; [SerializeField] private float randomAngularSpeed = 10f; [SerializeField] private Light[] lightsToToggle; private Light[] cachedLights; private int remainingGlowsticks; private bool destroyScheduled; public override void Start() { ((GrabbableObject)this).Start(); cachedLights = ((lightsToToggle != null && lightsToToggle.Length != 0) ? lightsToToggle : ((Component)this).GetComponentsInChildren<Light>(true)); remainingGlowsticks = startingGlowstickCount; ApplyVisuals(remainingGlowsticks); SetLightsEnabled(enabled: true); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ApplyVisuals(remainingGlowsticks); SetLightsEnabled(enabled: true); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); SetLightsEnabled(enabled: false); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); base.isPocketed = false; ((GrabbableObject)this).EnableItemMeshes(true); ApplyVisuals(remainingGlowsticks); SetLightsEnabled(enabled: true); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && ((NetworkBehaviour)this).IsOwner && !((Object)(object)base.playerHeldBy == (Object)null) && remainingGlowsticks > 0) { if (((NetworkBehaviour)this).IsServer) { ConsumeAndSpawnServer(base.playerHeldBy, replicateState: true); } else { ConsumeAndSpawnServerRpc(); } } } [ServerRpc] private void ConsumeAndSpawnServerRpc(ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(482332507u, rpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 482332507u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB playerByClientId = GetPlayerByClientId(rpcParams.Receive.SenderClientId); if (!((Object)(object)playerByClientId == (Object)null)) { ConsumeAndSpawnServer(playerByClientId, replicateState: true); } } } private void ConsumeAndSpawnServer(PlayerControllerB player, bool replicateState) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (remainingGlowsticks > 0) { BuildSpawnData(player, out var spawnPosition, out var spawnRotation, out var velocity, out var angularVelocity); SpawnDroppedClientRpc(spawnPosition, spawnRotation, velocity, angularVelocity); remainingGlowsticks--; if (remainingGlowsticks < 0) { remainingGlowsticks = 0; } if (replicateState) { ApplyConsumedClientRpc(remainingGlowsticks); } } } private void BuildSpawnData(PlayerControllerB player, out Vector3 spawnPosition, out Quaternion spawnRotation, out Vector3 velocity, out Vector3 angularVelocity) { //IL_0027: 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_002c: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_007e: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a1: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)player.gameplayCamera != (Object)null) ? ((Component)player.gameplayCamera).transform.forward : ((Component)player).transform.forward); spawnPosition = ((Component)player).transform.position + val * spawnForwardOffset + Vector3.up * spawnUpOffset; spawnRotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); velocity = val * throwForwardSpeed + Vector3.up * throwUpSpeed; angularVelocity = Random.insideUnitSphere * randomAngularSpeed; } [ClientRpc] private void SpawnDroppedClientRpc(Vector3 spawnPosition, Quaternion spawnRotation, Vector3 velocity, Vector3 angularVelocity) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(313037180u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref velocity); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref angularVelocity); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 313037180u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Transform propsContainer = StartOfRound.Instance.propsContainer; GameObject val3 = Object.Instantiate<GameObject>(droppedGlowstickPrefab, spawnPosition, spawnRotation, propsContainer); Rigidbody component = val3.GetComponent<Rigidbody>(); ((MonoBehaviour)this).StartCoroutine(ApplyInitialMotionNextFixed(component, velocity, angularVelocity)); } } } [IteratorStateMachine(typeof(<ApplyInitialMotionNextFixed>d__25))] private IEnumerator ApplyInitialMotionNextFixed(Rigidbody body, Vector3 velocity, Vector3 angularVelocity) { //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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyInitialMotionNextFixed>d__25(0) { <>4__this = this, body = body, velocity = velocity, angularVelocity = angularVelocity }; } [ClientRpc] private void ApplyConsumedClientRpc(int newRemaining) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(957138190u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, newRemaining); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 957138190u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; remainingGlowsticks = newRemaining; audioSource.PlayOneShot(snapClip); ApplyVisuals(remainingGlowsticks); if (remainingGlowsticks == 0 && ((NetworkBehaviour)this).IsOwner && !destroyScheduled && (Object)(object)base.playerHeldBy != (Object)null) { destroyScheduled = true; ((MonoBehaviour)this).StartCoroutine(DestroyHeldAfterDelay(base.playerHeldBy, 0.3f)); } } } [IteratorStateMachine(typeof(<DestroyHeldAfterDelay>d__27))] private IEnumerator DestroyHeldAfterDelay(PlayerControllerB player, float delaySeconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DestroyHeldAfterDelay>d__27(0) { <>4__this = this, player = player, delaySeconds = delaySeconds }; } private void ApplyVisuals(int countRemaining) { int num = ((countRemaining >= 3) ? 3 : Mathf.Max(0, countRemaining)); glowstickVisualA.SetActive(num >= 1); glowstickVisualB.SetActive(num >= 2); glowstickVisualC.SetActive(num >= 3); } private void SetLightsEnabled(bool enabled) { for (int i = 0; i < cachedLights.Length; i++) { ((Behaviour)cachedLights[i]).enabled = enabled; } } private static PlayerControllerB GetPlayerByClientId(ulong clientId) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.actualClientId == clientId) { return val; } } return null; } protected override void __initializeVariables() { ((GrabbableObject)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 ((NetworkBehaviour)this).__registerRpc(482332507u, new RpcReceiveHandler(__rpc_handler_482332507), "ConsumeAndSpawnServerRpc"); ((NetworkBehaviour)this).__registerRpc(313037180u, new RpcReceiveHandler(__rpc_handler_313037180), "SpawnDroppedClientRpc"); ((NetworkBehaviour)this).__registerRpc(957138190u, new RpcReceiveHandler(__rpc_handler_957138190), "ApplyConsumedClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_482332507(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((GlowstickStuff)(object)target).ConsumeAndSpawnServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_313037180(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_005d: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 spawnPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPosition); Quaternion spawnRotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnRotation); Vector3 velocity = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref velocity); Vector3 angularVelocity = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref angularVelocity); target.__rpc_exec_stage = (__RpcExecStage)1; ((GlowstickStuff)(object)target).SpawnDroppedClientRpc(spawnPosition, spawnRotation, velocity, angularVelocity); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_957138190(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newRemaining = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newRemaining); target.__rpc_exec_stage = (__RpcExecStage)1; ((GlowstickStuff)(object)target).ApplyConsumedClientRpc(newRemaining); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "GlowstickStuff"; } } internal sealed class IndustrialFlashlightStuff : FlashlightItem { [SerializeField] private AudioClip chargingOnFloorClip; [SerializeField] private AudioClip batteryFullClip; private float lastChargeTime; private bool tickScheduled; private AudioSource flashlightAudioSource; private AudioClip previousClip; private bool previousLoop; private bool chargingLoopActive; private bool fullyChargedSoundPlayed; private void OnEnable() { flashlightAudioSource = ((Component)this).GetComponent<AudioSource>(); StartTick(); } private void OnDisable() { StopTick(); StopChargingLoop(); } private void StartTick() { if (!tickScheduled) { tickScheduled = true; lastChargeTime = Time.time; ((MonoBehaviour)this).InvokeRepeating("ChargeTick", 0.2f, 0.2f); } } private void StopTick() { if (tickScheduled) { tickScheduled = false; ((MonoBehaviour)this).CancelInvoke("ChargeTick"); } } private void ChargeTick() { float time = Time.time; float num = time - lastChargeTime; lastChargeTime = time; if (((GrabbableObject)this).insertedBattery.charge < 1f) { fullyChargedSoundPlayed = false; } bool flag = ((GrabbableObject)this).isInShipRoom && ((GrabbableObject)this).insertedBattery.charge < 1f && (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null; if (flag) { StartChargingLoop(); } else { StopChargingLoop(); } if (flag) { float charge = ((GrabbableObject)this).insertedBattery.charge; float num2 = Mathf.Min(1f, charge + num / 375f); ((GrabbableObject)this).insertedBattery.charge = num2; if (!fullyChargedSoundPlayed && charge < 1f && num2 >= 1f) { fullyChargedSoundPlayed = true; StopChargingLoop(); PlayBatteryFullSound(); } } } private void StartChargingLoop() { if (!chargingLoopActive) { previousClip = flashlightAudioSource.clip; previousLoop = flashlightAudioSource.loop; flashlightAudioSource.clip = chargingOnFloorClip; flashlightAudioSource.loop = true; flashlightAudioSource.Play(); chargingLoopActive = true; } } private void StopChargingLoop() { if (chargingLoopActive) { if ((Object)(object)flashlightAudioSource.clip == (Object)(object)chargingOnFloorClip) { flashlightAudioSource.Stop(); } flashlightAudioSource.loop = previousLoop; flashlightAudioSource.clip = previousClip; chargingLoopActive = false; } } private void PlayBatteryFullSound() { flashlightAudioSource.PlayOneShot(batteryFullClip); } protected override void __initializeVariables() { ((FlashlightItem)this).__initializeVariables(); } protected override void __initializeRpcs() { ((FlashlightItem)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "IndustrialFlashlightStuff"; } } internal sealed class lighterStuff : GrabbableObject { private struct PendingWebRelease { public SandSpiderWebTrap WebTrap; public float ReadyTime; } [SerializeField] private Light toggleLight; [SerializeField] private UnityEvent[] onTurnOnImmediateEvents; [SerializeField] private UnityEvent[] onTurnOnDelayedEvents; [SerializeField] private UnityEvent[] onTurnOffEvents; [SerializeField] [Min(0f)] private float turnOnDelayedSeconds = 0.3f; [SerializeField] [Min(0f)] private float fuel; private bool getsExtraFuel; [SerializeField] private Collider webBurnTrigger; [SerializeField] private GameObject webBurnSpawnPrefab; [SerializeField] private bool usesFuelToWebBurn; [SerializeField] [Min(0f)] private float webBurnFuelMin = 30f; [SerializeField] [Min(0f)] private float webBurnFuelMax = 60f; [SerializeField] [Min(0f)] private float webBurnCooldownSeconds = 0.5f; [SerializeField] [Min(0f)] private float webBurnRadius = 2f; [SerializeField] private LayerMask webBurnLayerMask = LayerMask.op_Implicit(2097152); [SerializeField] [Min(0f)] private float webBurnScanIntervalSeconds = 0.1f; [SerializeField] [Min(0f)] private float webLeaveAfterBurnDelaySeconds = 0.2f; private const float FuelTickIntervalSeconds = 0.25f; private ParticleSystem[] cachedParticleSystems; private AudioSource[] cachedAudioSourceChildren; private AudioSource cachedAudioSource; private static readonly Dictionary<int, SandSpiderWebTrap> webTrapByColliderId = new Dictionary<int, SandSpiderWebTrap>(64); private static readonly Dictionary<int, float> nextBurnTimeByWebId = new Dictionary<int, float>(32); private static readonly Dictionary<int, PendingWebRelease> pendingWebReleasesByWebId = new Dictionary<int, PendingWebRelease>(16); private static readonly List<int> pendingWebReleaseKeysToRemove = new List<int>(16); private static readonly FieldInfo hinderingLocalPlayerField = typeof(SandSpiderWebTrap).GetField("hinderingLocalPlayer", BindingFlags.Instance | BindingFlags.NonPublic); private readonly Collider[] webBurnOverlapResults = (Collider[])(object)new Collider[32]; private float nextWebBurnScanTime; private bool isOn; private bool isTurnOnPending; private bool hasLoadedFuelFromSave; private bool isFuelEmpty; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); fuel = Mathf.Max(0f, (float)saveData); hasLoadedFuelFromSave = true; isFuelEmpty = fuel <= 0f; } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return Mathf.RoundToInt(fuel); } public override void Start() { ((GrabbableObject)this).Start(); cachedParticleSystems = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); cachedAudioSourceChildren = ((Component)this).GetComponentsInChildren<AudioSource>(); cachedAudioSource = ((Component)this).GetComponent<AudioSource>(); isOn = false; isTurnOnPending = false; nextWebBurnScanTime = 0f; if (!hasLoadedFuelFromSave) { fuel = (getsExtraFuel ? Random.Range(500f, 2000f) : Random.Range(300f, 1500f)); } isFuelEmpty = fuel <= 0f; ApplyLightState(enabledState: false); SetWebBurnTriggerState(enabledState: false); StopAndClearParticles(); ((MonoBehaviour)this).CancelInvoke("ConsumeFuelTick"); UpdateFuelTooltip(); } public override void SetControlTipsForItem() { ((GrabbableObject)this).SetControlTipsForItem(); UpdateFuelTooltip(); } private void SetMute(AudioSource[] sources, bool muted) { for (int i = 0; i < sources.Length; i++) { sources[i].mute = muted; } } public override void PocketItem() { if (base.isHeld && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.ChangeControlTip(2, "", false); } SetMute(cachedAudioSourceChildren, muted: true); cachedAudioSource.mute = true; ForceOffInternal(); ((GrabbableObject)this).PocketItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); SetMute(cachedAudioSourceChildren, muted: false); cachedAudioSource.mute = false; if (!buttonDown) { return; } if (isOn) { if (!isTurnOnPending) { SetOffInternal(); RefreshTipsIfLocalHeld(); } } else if (isFuelEmpty) { RefreshTipsIfLocalHeld(); } else { SetOnInternal(); RefreshTipsIfLocalHeld(); } } private void SetOnInternal() { ((MonoBehaviour)this).CancelInvoke("ApplyDelayedTurnOn"); ((MonoBehaviour)this).CancelInvoke("ConsumeFuelTick"); isOn = true; isTurnOnPending = true; ApplyLightState(enabledState: false); SetWebBurnTriggerState(enabledState: false); InvokeEvents(onTurnOnImmediateEvents); ((MonoBehaviour)this).InvokeRepeating("ConsumeFuelTick", 0.3f, 0.25f); float num = Mathf.Max(0f, turnOnDelayedSeconds); if (num <= 0f) { ApplyDelayedTurnOn(); } else { ((MonoBehaviour)this).Invoke("ApplyDelayedTurnOn", num); } } private void ConsumeFuelTick() { if (isOn && !isFuelEmpty) { fuel = Mathf.Max(0f, fuel - 0.25f); if (fuel <= 0f) { isFuelEmpty = true; ForceOffInternal(); ((MonoBehaviour)this).CancelInvoke("ConsumeFuelTick"); RefreshTipsIfLocalHeld(); } else { RefreshTipsIfLocalHeld(); } } } private void ApplyDelayedTurnOn() { if (isOn) { isTurnOnPending = false; ApplyLightState(enabledState: true); SetWebBurnTriggerState(enabledState: true); InvokeEvents(onTurnOnDelayedEvents); } } private void SetOffInternal() { ((MonoBehaviour)this).CancelInvoke("ApplyDelayedTurnOn"); ((MonoBehaviour)this).CancelInvoke("ConsumeFuelTick"); isOn = false; isTurnOnPending = false; ApplyLightState(enabledState: false); SetWebBurnTriggerState(enabledState: false); StopAndClearParticles(); InvokeEvents(onTurnOffEvents); } private void ForceOffInternal() { ((MonoBehaviour)this).CancelInvoke("ApplyDelayedTurnOn"); ((MonoBehaviour)this).CancelInvoke("ConsumeFuelTick"); isOn = false; isTurnOnPending = false; ApplyLightState(enabledState: false); SetWebBurnTriggerState(enabledState: false); StopAndClearParticles(); InvokeEvents(onTurnOffEvents); } private void ApplyLightState(bool enabledState) { ((Behaviour)toggleLight).enabled = enabledState; } private void SetWebBurnTriggerState(bool enabledState) { webBurnTrigger.enabled = enabledState; } private void InvokeEvents(UnityEvent[] eventsToInvoke) { for (int i = 0; i < eventsToInvoke.Length; i++) { eventsToInvoke[i].Invoke(); } } private void StopAndClearParticles() { for (int i = 0; i < cachedParticleSystems.Length; i++) { ParticleSystem val = cachedParticleSystems[i]; val.Pause(true); val.Stop(true, (ParticleSystemStopBehavior)0); val.Clear(true); } } private void UpdateFuelTooltip() { if (base.isHeld && !((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { HUDManager.Instance.ChangeControlTip(2, $"[Fuel = {Mathf.RoundToInt(fuel)}]", false); } } private void RefreshTipsIfLocalHeld() { if (base.isHeld && !((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { ((GrabbableObject)this).SetControlTipsForItem(); UpdateFuelTooltip(); } } public override void Update() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); ProcessPendingWebReleases(); if (!isOn || isTurnOnPending || isFuelEmpty) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!base.isHeld || (Object)(object)base.playerHeldBy != (Object)(object)localPlayerController) { return; } float time = Time.time; if (!(time < nextWebBurnScanTime)) { nextWebBurnScanTime = time + webBurnScanIntervalSeconds; int num = Physics.OverlapSphereNonAlloc(((Component)localPlayerController).transform.position, webBurnRadius, webBurnOverlapResults, LayerMask.op_Implicit(webBurnLayerMask), (QueryTriggerInteraction)2); for (int i = 0; i < num; i++) { TryBurnWeb(webBurnOverlapResults[i]); } } } private void ProcessPendingWebReleases() { if (pendingWebReleasesByWebId.Count == 0) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; float time = Time.time; pendingWebReleaseKeysToRemove.Clear(); foreach (KeyValuePair<int, PendingWebRelease> item in pendingWebReleasesByWebId) { PendingWebRelease value = item.Value; if ((Object)(object)value.WebTrap == (Object)null) { pendingWebReleaseKeysToRemove.Add(item.Key); } else if (!(time < value.ReadyTime)) { ReleaseLocalPlayerFromWebIfNeeded(value.WebTrap, localPlayerController); pendingWebReleaseKeysToRemove.Add(item.Key); } } for (int i = 0; i < pendingWebReleaseKeysToRemove.Count; i++) { pendingWebReleasesByWebId.Remove(pendingWebReleaseKeysToRemove[i]); } } private void OnTriggerStay(Collider other) { if (isOn && !isTurnOnPending && !isFuelEmpty && !base.isHeld && NetworkManager.Singleton.IsHost) { TryBurnWeb(other); } } private void TryBurnWeb(Collider other) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)other).GetInstanceID(); if (!webTrapByColliderId.TryGetValue(instanceID, out var value) || (Object)(object)value == (Object)null) { value = ((Component)other).GetComponentInParent<SandSpiderWebTrap>(); webTrapByColliderId[instanceID] = value; } if ((Object)(object)value == (Object)null) { return; } int instanceID2 = ((Object)value).GetInstanceID(); if (nextBurnTimeByWebId.TryGetValue(instanceID2, out var value2) && Time.time < value2) { return; } nextBurnTimeByWebId[instanceID2] = Time.time + webBurnCooldownSeconds; QueueReleaseFromWebAfterBurnIfNeeded(value); if (NetworkManager.Singleton.IsHost) { value.mainScript.BreakWebClientRpc(((Component)value).transform.position, value.trapID); } else { value.mainScript.BreakWebServerRpc(value.trapID, (int)GameNetworkManager.Instance.localPlayerController.playerClientId); } SpawnWebBurnFxServerRpc(value.centerOfWeb.position); if (usesFuelToWebBurn) { float num = Random.Range(webBurnFuelMin, webBurnFuelMax); fuel = Mathf.Max(0f, fuel - num); if (fuel <= 0f) { isFuelEmpty = true; ForceOffInternal(); } } RefreshTipsIfLocalHeld(); } private void QueueReleaseFromWebAfterBurnIfNeeded(SandSpiderWebTrap webTrap) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)webTrap.currentTrappedPlayer != (Object)(object)localPlayerController)) { float num = (NetworkManager.Singleton.IsHost ? 0f : webLeaveAfterBurnDelaySeconds); pendingWebReleasesByWebId[((Object)webTrap).GetInstanceID()] = new PendingWebRelease { WebTrap = webTrap, ReadyTime = Time.time + num }; } } private void ReleaseLocalPlayerFromWebIfNeeded(SandSpiderWebTrap webTrap, PlayerControllerB localPlayer) { if (hinderingLocalPlayerField != null) { if (!(bool)hinderingLocalPlayerField.GetValue(webTrap)) { return; } hinderingLocalPlayerField.SetValue(webTrap, false); } if (localPlayer.isMovementHindered > 0) { localPlayer.isMovementHindered--; } localPlayer.hinderedMultiplier = Mathf.Clamp(localPlayer.hinderedMultiplier * 0.4f, 1f, 100f); if ((Object)(object)webTrap.currentTrappedPlayer == (Object)(object)localPlayer) { webTrap.currentTrappedPlayer = null; } AudioSource webAudio = webTrap.webAudio; if (webAudio != null) { webAudio.Stop(); } SandSpiderAI mainScript = webTrap.mainScript; if (mainScript != null) { mainScript.PlayerLeaveWebServerRpc(webTrap.trapID, (int)localPlayer.playerClientId); } } [ServerRpc(RequireOwnership = false)] private void SpawnWebBurnFxServerRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(145500242u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 145500242u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SpawnWebBurnFxClientRpc(position); } } } [ClientRpc] private void SpawnWebBurnFxClientRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(736457865u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 736457865u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Object.Instantiate<GameObject>(webBurnSpawnPrefab, position, Quaternion.identity, StartOfRound.Instance.propsContainer); } } } protected override void __initializeVariables() { ((GrabbableObject)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 ((NetworkBehaviour)this).__registerRpc(145500242u, new RpcReceiveHandler(__rpc_handler_145500242), "SpawnWebBurnFxServerRpc"); ((NetworkBehaviour)this).__registerRpc(736457865u, new RpcReceiveHandler(__rpc_handler_736457865), "SpawnWebBurnFxClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_145500242(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((lighterStuff)(object)target).SpawnWebBurnFxServerRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_736457865(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((lighterStuff)(object)target).SpawnWebBurnFxClientRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "lighterStuff"; } } internal sealed class SignalFlare : GrabbableObject { [CompilerGenerated] private sealed class <ConsumeAfterDelayRoutine>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SignalFlare <>4__this; private float <delay>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ConsumeAfterDelayRoutine>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <delay>5__1 = Mathf.Max(0f, <>4__this.consumeDelaySeconds); if (<delay>5__1 > 0f) { <>2__current = (object)new WaitForSeconds(<delay>5__1); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } if (!((NetworkBehaviour)<>4__this).IsOwner) { return false; } if ((Object)(object)((GrabbableObject)<>4__this).playerHeldBy == (Object)null) { return false; } ((GrabbableObject)<>4__this).playerHeldBy.DestroyItemInSlotAndSync(((GrabbableObject)<>4__this).playerHeldBy.currentItemSlot); 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 GameObject flarePrefab; [SerializeField] [Min(0f)] private float consumeDelaySeconds = 0.3f; [SerializeField] private UnityEvent[] onActivateEvents; private bool hasActivated; private bool consumeScheduled; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || hasActivated) { return; } PlayerControllerB playerHeldBy = base.playerHeldBy; if (playerHeldBy.isInsideFactory || playerHeldBy.isInHangarShipRoom) { return; } hasActivated = true; int num = Random.Range(0, 10); if (num == 8) { ShowUrgentWarningTipForLocalPlayer(); if (((NetworkBehaviour)this).IsServer) { ApplyMultiplier(5); } } else if (num == 3 || num == 4) { ShowWarningTipForLocalPlayer(); if (((NetworkBehaviour)this).IsServer) { ApplyMultiplier(2); } } SpawnFlareLocal(playerHeldBy); InvokeEvents(onActivateEvents); ScheduleConsumeAfterDelay(); } private void SpawnFlareLocal(PlayerControllerB activatingPlayer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)activatingPlayer).transform.position; position.y += Random.Range(80f, 180f); Transform propsContainer = StartOfRound.Instance.propsContainer; Object.Instantiate<GameObject>(flarePrefab, position, Quaternion.identity, propsContainer); } private void ScheduleConsumeAfterDelay() { if (!consumeScheduled) { consumeScheduled = true; ((MonoBehaviour)this).StartCoroutine(ConsumeAfterDelayRoutine()); } } [IteratorStateMachine(typeof(<ConsumeAfterDelayRoutine>d__8))] private IEnumerator ConsumeAfterDelayRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ConsumeAfterDelayRoutine>d__8(0) { <>4__this = this }; } private static void ShowWarningTipForLocalPlayer() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!localPlayerController.isInsideFactory) { HUDManager.Instance.DisplayTip("WARNING!", "Increase in moon activity detected.", true, false, "LC_Tip1"); } } private static void ShowUrgentWarningTipForLocalPlayer() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!localPlayerController.isInsideFactory) { HUDManager.Instance.DisplayTip("URGENT WARNING!", "MASSIVE INCREASE IN MOON ACTIVITY DETECTED, EVACTUATION ADVISED.", true, false, "LC_Tip1"); } } private static void ApplyMultiplier(int multiplier) { RoundManager instance = RoundManager.Instance; SelectableLevel currentLevel = instance.currentLevel; currentLevel.maxEnemyPowerCount *= multiplier; SelectableLevel currentLevel2 = instance.currentLevel; currentLevel2.maxDaytimeEnemyPowerCount *= multiplier; SelectableLevel currentLevel3 = instance.currentLevel; currentLevel3.maxOutsideEnemyPowerCount *= multiplier; instance.currentMaxOutsidePower *= multiplier; } private static void InvokeEvents(UnityEvent[] eventsToInvoke) { for (int i = 0; i < eventsToInvoke.Length; i++) { eventsToInvoke[i].Invoke(); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "SignalFlare"; } } internal class TZPAbandonedStuff : TetraChemicalItem { [CompilerGenerated] private sealed class <DamageTimerWhileEmittingGas>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TZPAbandonedStuff <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DamageTimerWhileEmittingGas>d__8(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; break; case 1: <>1__state = -1; break; } if (((TetraChemicalItem)<>4__this).emittingGas) { if (((GrabbableObject)<>4__this).isBeingUsed && ((TetraChemicalItem)<>4__this).emittingGas) { <>4__this.damagetimer += Time.deltaTime; } <>2__current = null; <>1__state = 1; return true; } <>4__this.damageTimerRoutine = null; 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 <DrunknessWhileEmittingGas>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TZPAbandonedStuff <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DrunknessWhileEmittingGas>d__9(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; break; case 1: <>1__state = -1; break; } if (((TetraChemicalItem)<>4__this).emittingGas) { ((TetraChemicalItem)<>4__this).previousPlayerHeldBy.drunknessInertia = Mathf.Clamp(((TetraChemicalItem)<>4__this).previousPlayerHeldBy.drunknessInertia + Time.deltaTime / 1f * ((TetraChemicalItem)<>4__this).previousPlayerHeldBy.drunknessSpeed, 0.1f, 10f); <>2__current = null; <>1__state = 1; return true; } <>4__this.drunknessRoutine = null; 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(); } } private float damagetimer; private float damagetime = 1f; private int damageAmount; private int playerhealth; private Coroutine damageTimerRoutine; private Coroutine drunknessRoutine; public override void Start() { ((GrabbableObject)this).Start(); for (int i = 0; i < GameNetworkManager.Instance.connectedPlayers; i++) { playerhealth = StartOfRound.Instance.allPlayerScripts[i].health; } } public override void Update() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) ((TetraChemicalItem)this).Update(); if (base.emittingGas) { if (damageTimerRoutine == null) { damageTimerRoutine = ((MonoBehaviour)this).StartCoroutine(DamageTimerWhileEmittingGas()); } if (drunknessRoutine == null) { drunknessRoutine = ((MonoBehaviour)this).StartCoroutine(DrunknessWhileEmittingGas()); } } if (damagetimer >= damagetime && ((NetworkBehaviour)this).IsOwner) { GameNetworkManager.Instance.localPlayerController.DamagePlayer(damageAmount, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); damageAmount = Random.Range(0, playerhealth); damagetimer = 0f; } } [IteratorStateMachine(typeof(<DamageTimerWhileEmittingGas>d__8))] private IEnumerator DamageTimerWhileEmittingGas() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DamageTimerWhileEmittingGas>d__8(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<DrunknessWhileEmittingGas>d__9))] private IEnumerator DrunknessWhileEmittingGas() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DrunknessWhileEmittingGas>d__9(0) { <>4__this = this }; } public override void EquipItem() { ((TetraChemicalItem)this).EquipItem(); damagetime = Random.Range(2, 10); damageAmount = Random.Range(0, playerhealth); } protected override void __initializeVariables() { ((TetraChemicalItem)this).__initializeVariables(); } protected override void __initializeRpcs() { ((TetraChemicalItem)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "TZPAbandonedStuff"; } } } namespace AbandonedCompanyAssets.Behaviours { internal sealed class DimThenKill : MonoBehaviour { [CompilerGenerated] private sealed class <BeginAudioRoutine>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DimThenKill <>4__this; private float <delaySeconds>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BeginAudioRoutine>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this.flareAudioSource == (Object)null) { return false; } <delaySeconds>5__1 = Mathf.Max(0f, <>4__this.beginAudioSeconds); if (<delaySeconds>5__1 > 0f) { <>2__current = (object)new WaitForSeconds(<delaySeconds>5__1); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } if ((Object)(object)<>4__this.explosionClip != (Object)null) { <>4__this.flareAudioSource.PlayOneShot(<>4__this.explosionClip); } if ((Object)(object)<>4__this.flareLoopClip != (Object)null) { <>4__this.flareAudioSource.clip = <>4__this.flareLoopClip; <>4__this.flareAudioSource.loop = true; <>4__this.flareAudioSource.Play(); } 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 <BuildLightIntensityRoutine>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DimThenKill <>4__this; private float <durationSeconds>5__1; private float <elapsedSeconds>5__2; private float <t>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildLightIntensityRoutine>d__15(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; if ((Object)(object)<>4__this.flareLight == (Object)null) { return false; } <durationSeconds>5__1 = Mathf.Max(0f, <>4__this.intensityBuildSeconds); if (<durationSeconds>5__1 <= 0f) { <>4__this.flareLight.intensity = <>4__this.targetIntensity; return false; } <elapsedSeconds>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsedSeconds>5__2 < <durationSeconds>5__1) { <elapsedSeconds>5__2 += Time.deltaTime; <t>5__3 = Mathf.Clamp01(<elapsedSeconds>5__2 / <durationSeconds>5__1); <>4__this.flareLight.intensity = Mathf.Lerp(0f, <>4__this.targetIntensity, <t>5__3); <>2__current = null; <>1__state = 1; return true; } <>4__this.flareLight.intensity = <>4__this.targetIntensity; 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 <RunDimCycle>d__16 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DimThenKill <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RunDimCycle>d__16(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; break; case 1: <>1__state = -1; break; } <>4__this.time += Time.deltaTime; if ((Object)(object)<>4__this.flareLight != (Object)null) { if (<>4__this.time > <>4__this.dimindelay && <>4__this.time < <>4__this.killafterseconds && <>4__this.flareLight.range < <>4__this.defaultrange) { Light flareLight = <>4__this.flareLight; flareLight.range += <>4__this.dimrate; } if (<>4__this.time > <>4__this.killafterseconds) { if (!(<>4__this.flareLight.range > 0f)) { <>4__this.DespawnOrDestroy(); return false; } Light flareLight2 = <>4__this.flareLight; flareLight2.range -= <>4__this.dimrate; } } <>2__current = null; <>1__state = 1; 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(); } } [SerializeField] private AudioSource flareAudioSource; [SerializeField] private AudioClip explosionClip; [SerializeField] [Min(0f)] private float beginAudioSeconds; [SerializeField] private AudioClip flareLoopClip; [SerializeField] private Light flareLight; [SerializeField] [Min(0f)] private float intensityBuildSeconds = 0.5f; [SerializeField] private float targetIntensity = 20000f; [SerializeField] private bool dimin; [SerializeField] private float killafterseconds; [SerializeField] private float dimrate; [SerializeField] private float defaultrange; [SerializeField] private float dimindelay; private float time; private void Start() { if ((Object)(object)flareLight != (Object)null) { flareLight.intensity = 0f; } if (dimrate == 0f) { dimrate = 0.005f; } if ((Object)(object)flareLight != (Object)null) { ((MonoBehaviour)this).StartCoroutine(BuildLightIntensityRoutine()); } ((MonoBehaviour)this).StartCoroutine(BeginAudioRoutine()); ((MonoBehaviour)this).StartCoroutine(RunDimCycle()); } [IteratorStateMachine(typeof(<BeginAudioRoutine>d__14))] private IEnumerator BeginAudioRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BeginAudioRoutine>d__14(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<BuildLightIntensityRoutine>d__15))] private IEnumerator BuildLightIntensityRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BuildLightIntensityRoutine>d__15(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<RunDimCycle>d__16))] private IEnumerator RunDimCycle() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RunDimCycle>d__16(0) { <>4__this = this }; } private void DespawnOrDestroy() { Object.Destroy((Object)(object)((Component)this).gameObject); } } internal sealed class DroppedGlowstick : MonoBehaviour { [CompilerGenerated] private sealed class <DestroyAfterLifetime>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DroppedGlowstick <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DestroyAfterLifetime>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.lifetimeSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; Object.Destroy((Object)(object)((Component)<>4__this).gameObject); 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 <DimRoutine>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DroppedGlowstick <>4__this; private float <dimStart>5__1; private float <elapsed>5__2; private float <t>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DimRoutine>d__7(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; <dimStart>5__1 = Mathf.Max(0f, <>4__this.lifetimeSeconds - <>4__this.dimDurationSeconds); <elapsed>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsed>5__2 < <>4__this.lifetimeSeconds) { <elapsed>5__2 += Time.deltaTime; if (<>4__this.dimDurationSeconds > 0f && <elapsed>5__2 >= <dimStart>5__1) { <t>5__3 = Mathf.Clamp01((<elapsed>5__2 - <dimStart>5__1) / <>4__this.dimDurationSeconds); <>4__this.glowLight.intensity = Mathf.Lerp(<>4__this.startIntensity, 0f, <t>5__3); <>4__this.glowLight.range = Mathf.Lerp(<>4__this.startRange, 0f, <t>5__3); } <>2__current = null; <>1__state = 1; return true; } <>4__this.glowLight.intensity = 0f; <>4__this.glowLight.range = 0f; ((Behaviour)<>4__this.glowLight).enabled = 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(); } } [SerializeField] private Light glowLight; [SerializeField] [Min(0f)] private float lifetimeSeconds = 560f; [SerializeField] [Min(0f)] private float dimDurationSeconds = 30f; private float startIntensity; private float startRange; private void Start() { if ((Object)(object)glowLight == (Object)null) { glowLight = ((Component)this).GetComponentInChildren<Light>(); } startIntensity = glowLight.intensity; startRange = glowLight.range; ((MonoBehaviour)this).StartCoroutine(DimRoutine()); ((MonoBehaviour)this).StartCoroutine(DestroyAfterLifetime()); } [IteratorStateMachine(typeof(<DestroyAfterLifetime>d__6))] private IEnumerator DestroyAfterLifetime() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DestroyAfterLifetime>d__6(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<DimRoutine>d__7))] private IEnumerator DimRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DimRoutine>d__7(0) { <>4__this = this }; } } internal sealed class FlickeringLight : MonoBehaviour { [SerializeField] private Light lightSource; [SerializeField] private float minIntensity = 100f; [SerializeField] private float maxIntensity = 200f; [SerializeField] [Min(1f)] private int smoothingSamples = 35; [SerializeField] [Min(0.001f)] private float tickIntervalSeconds = 0.03f; [SerializeField] private bool playOnStart; private float[] intensitySamples = new float[1]; private int intensitySampleIndex; private int intensitySampleCount; private float intensitySum; private bool isFlickering; private void Awake() { AllocateSmoothingBuffer(); } private void Start() { if (playOnStart) { BeginFlicker(); } } public void BeginFlicker() { if (!isFlickering) { isFlickering = true; AllocateSmoothingBuffer(); ((MonoBehaviour)this).CancelInvoke("FlickerTick"); ((MonoBehaviour)this).InvokeRepeating("FlickerTick", 0f, tickIntervalSeconds); } } public void EndFlicker() { if (isFlickering) { isFlickering = false; ((MonoBehaviour)this).CancelInvoke("FlickerTick"); } } public void ToggleFlicker(bool shouldFlicker) { if (shouldFlicker) { BeginFlicker(); } else { EndFlicker(); } } public void SetIntensityRange(float newMinIntensity, float newMaxIntensity) { minIntensity = newMinIntensity; maxIntensity = newMaxIntensity; } private void FlickerTick() { float sampledIntensity = Random.Range(minIntensity, maxIntensity); ApplySampledIntensity(sampledIntensity); } private void ApplySampledIntensity(float sampledIntensity) { if (smoothingSamples <= 1) { lightSource.intensity = sampledIntensity; return; } if (intensitySampleCount < smoothingSamples) { intensitySamples[intensitySampleIndex] = sampledIntensity; intensitySum += sampledIntensity; intensitySampleCount++; } else { float num = intensitySamples[intensitySampleIndex]; intensitySamples[intensitySampleIndex] = sampledIntensity; intensitySum += sampledIntensity - num; } intensitySampleIndex++; if (intensitySampleIndex >= smoothingSamples) { intensitySampleIndex = 0; } lightSource.intensity = intensitySum / (float)intensitySampleCount; } private void AllocateSmoothingBuffer() { int num = Mathf.Max(1, smoothingSamples); if (intensitySamples.Length != num) { smoothingSamples = num; intensitySamples = new float[smoothingSamples]; intensitySampleIndex = 0; intensitySampleCount = 0; intensitySum = 0f; } } } internal class PlayAudioAnimationEventExtended : MonoBehaviour { [Header("Audio Sources")] [SerializeField] private AudioSource audioToPlay; [SerializeField] private AudioSource audioToPlayB; [Header("Audio Clips")] [SerializeField] private AudioClip audioClip1; [SerializeField] private bool audioClip1Loop; [SerializeField] private AudioClip audioClip2; [SerializeField] private AudioClip audioClip3; [SerializeField] private AudioClip audioClip4; [SerializeField] private AudioClip audioClip5; [SerializeField] private AudioClip audioClip6; public void PlayAudio1() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip1 == (Object)null)) { if (audioClip1Loop) { audioToPlay.clip = audioClip1; audioToPlay.Play(); } else { audioToPlay.PlayOneShot(audioClip1); } } } public void PlayAudio2() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip2 == (Object)null)) { audioToPlay.PlayOneShot(audioClip2); } } public void PlayAudio3() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip3 == (Object)null)) { audioToPlay.PlayOneShot(audioClip3); } } public void PlayAudio4() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip4 == (Object)null)) { audioToPlay.PlayOneShot(audioClip4); } } public void PlayAudio5() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip5 == (Object)null)) { audioToPlay.PlayOneShot(audioClip5); } } public void PlayAudio6() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip6 == (Object)null)) { audioToPlay.PlayOneShot(audioClip6); } } public void PlayAudioB1() { if (!((Objec