Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Wheelbarrow v1.0.3
BepInEx/plugins/Wheelbarrow/Wheelbarrow.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using CustomItemBehaviourLibrary.AbstractItems; using CustomItemBehaviourLibrary.Misc; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using Wheelbarrow.Behaviour; using Wheelbarrow.Compat; using Wheelbarrow.Input; using Wheelbarrow.Misc; using Wheelbarrow.NetcodePatcher; using Wheelbarrow.Util; [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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Wheelbarrow { [BepInPlugin("com.github.WhiteSpike.Wheelbarrow", "Wheelbarrow", "1.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static readonly Harmony harmony = new Harmony("com.github.WhiteSpike.Wheelbarrow"); internal static readonly ManualLogSource mls = Logger.CreateLogSource("Wheelbarrow"); internal static readonly List<AudioClip> wheelsNoise = new List<AudioClip>(); public static PluginConfig Config; private void Awake() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Expected O, but got Unknown Config = new PluginConfig(((BaseUnityPlugin)this).Config); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "wheelbarrow"); AssetBundle val = AssetBundle.LoadFromFile(text); string text2 = "Assets/Wheelbarrow/"; Item val2 = ScriptableObject.CreateInstance<Item>(); ((Object)val2).name = "WheelbarrowItemProperties"; val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.DROP_AHEAD_PLAYER); val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.GRABBED_BEFORE_START); val2.canBeInspected = false; val2.creditsWorth = SyncedEntry<int>.op_Implicit(Config.PRICE); val2.floorYOffset = -90; val2.restingRotation = new Vector3(0f, 0f, 0f); val2.rotationOffset = new Vector3(0f, 0f, 0f); val2.positionOffset = new Vector3(0f, -0.7f, 1.4f); val2.verticalOffset = 0.3f; val2.weight = 0.99f + (float)SyncedEntry<int>.op_Implicit(Config.WEIGHT) / 100f; val2.minValue = SyncedEntry<int>.op_Implicit(Config.MINIMUM_VALUE); val2.maxValue = SyncedEntry<int>.op_Implicit(Config.MAXIMUM_VALUE); val2.isScrap = SyncedEntry<bool>.op_Implicit(Config.SCRAP); val2.twoHanded = true; val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png"); val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "Wheelbarrow.prefab"); val2.dropSFX = val.LoadAsset<AudioClip>(text2 + "Drop.ogg"); val2.grabSFX = val.LoadAsset<AudioClip>(text2 + "Grab.ogg"); val2.pocketSFX = val.LoadAsset<AudioClip>(text2 + "Pocket.ogg"); val2.throwSFX = val.LoadAsset<AudioClip>(text2 + "Throw.ogg"); wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Wheelbarrow_Move_1.mp3")); wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Wheelbarrow_Move_2.ogg")); wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Wheelbarrow_Move_3.ogg")); wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Wheelbarrow_Move_4.ogg")); val2.highestSalePercentage = SyncedEntry<int>.op_Implicit(Config.HIGHEST_SALE_PERCENTAGE); val2.itemName = "Wheelbarrow"; val2.itemSpawnsOnGround = true; val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE); val2.requiresBattery = false; val2.batteryUsage = 0f; val2.twoHandedAnimation = true; val2.grabAnim = "HoldJetpack"; WheelbarrowBehaviour wheelbarrowBehaviour = val2.spawnPrefab.AddComponent<WheelbarrowBehaviour>(); ((GrabbableObject)wheelbarrowBehaviour).itemProperties = val2; ((GrabbableObject)wheelbarrowBehaviour).grabbable = true; ((GrabbableObject)wheelbarrowBehaviour).grabbableToEnemies = true; Utilities.FixMixerGroups(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); if (val2.isScrap) { Items.RegisterItem(val2); AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0f), new Keyframe(1f - Config.RARITY.Value, 1f), new Keyframe(1f, 1f) }); SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val3.spawnableMapObject = new SpawnableMapObject { prefabToSpawn = val2.spawnPrefab }; MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => curve)); } else { TerminalNode val4 = SetupInfoNode(); Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val4, val2.creditsWorth); } InputUtilsCompat.Init(); harmony.PatchAll(typeof(Keybinds)); mls.LogInfo((object)"Wheelbarrow 1.0.3 has been loaded successfully."); } internal static TerminalNode SetupInfoNode() { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = val.displayText + GetDisplayInfo() + "\n"; val.clearPreviousText = true; return val; } public static string GetDisplayInfo() { return $"A portable container which has a maximum capacity of {Config.MAXIMUM_AMOUNT_ITEMS.Value}" + $" and reduces the effective weight of the inserted items by {Config.WEIGHT_REDUCTION_MULTIPLIER.Value * 100f} %.\n" + $"It weighs {Config.WEIGHT.Value} lbs"; } } public static class PluginInfo { public const string PLUGIN_GUID = "Wheelbarrow"; public const string PLUGIN_NAME = "Wheelbarrow"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Wheelbarrow.Util { internal static class Constants { internal const string ITEM_SCAN_NODE_KEY_FORMAT = "Enable scan node of {0}"; internal const bool ITEM_SCAN_NODE_DEFAULT = true; internal const string ITEM_SCAN_NODE_DESCRIPTION = "Shows a scan node on the item when scanning"; internal const string WHEELBARROW_PRICE_KEY = "Wheelbarrow price"; internal const int WHEELBARROW_PRICE_DEFAULT = 500; internal const string WHEELBARROW_PRICE_DESCRIPTION = "Price for Wheelbarrow."; internal const string WHEELBARROW_WEIGHT_KEY = "Item weight"; internal const int WHEELBARROW_WEIGHT_DEFAULT = 15; internal const string WHEELBARROW_WEIGHT_DESCRIPTION = "Weight (in lbs)"; internal const string WHEELBARROW_CONDUCTIVE_KEY = "Conductive"; internal const bool WHEELBARROW_CONDUCTIVE_DEFAULT = true; internal const string WHEELBARROW_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)"; internal const string WHEELBARROW_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping"; internal const bool WHEELBARROW_DROP_AHEAD_PLAYER_DEFAULT = true; internal const string WHEELBARROW_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront."; internal const string WHEELBARROW_GRABBED_BEFORE_START_KEY = "Grabbable before game start"; internal const bool WHEELBARROW_GRABBED_BEFORE_START_DEFAULT = true; internal const string WHEELBARROW_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not"; internal const string WHEELBARROW_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage"; internal const int WHEELBARROW_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50; internal const string WHEELBARROW_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale."; internal const string WHEELBARROW_RESTRICTION_MODE_KEY = "Restrictions on the Wheelbarrow Item"; internal const Restrictions WHEELBARROW_RESTRICTION_MODE_DEFAULT = 2; internal const string WHEELBARROW_RESTRICTION_MODE_DESCRIPTION = "Restriction applied when trying to insert an item on the Wheelbarrow.\nSupported values: None, ItemCount, TotalWeight, All"; internal const string WHEELBARROW_MAXIMUM_WEIGHT_ALLOWED_KEY = "Maximum amount of weight for Wheelbarrow"; internal const float WHEELBARROW_MAXIMUM_WEIGHT_ALLOWED_DEFAULT = 100f; internal const string WHEELBARROW_MAXIMUM_WEIGHT_ALLOWED_DESCRIPTION = "How much weight (in lbs and after weight reduction multiplier is applied on the stored items) a Wheelbarrow can carry in items before it is considered full."; internal const string WHEELBARROW_MAXIMUM_AMOUNT_ITEMS_KEY = "Maximum amount of items for Wheelbarrow"; internal const int WHEELBARROW_MAXIMUM_AMOUNT_ITEMS_DEFAULT = 4; internal const string WHEELBARROW_MAXIMUM_AMOUNT_ITEMS_DESCRIPTION = "Amount of items allowed before the Wheelbarrow is considered full"; internal const string WHEELBARROW_MINIMUM_VALUE_KEY = "Minimum scrap value of Wheelbarrow"; internal const int WHEELBARROW_MINIMUM_VALUE_DEFAULT = 50; internal const string WHEELBARROW_MINIMUM_VALUE_DESCRIPTION = "Lower boundary of the scrap's possible value"; internal const string WHEELBARROW_RARITY_KEY = "Spawn Chance of the Wheelbarrow Item"; internal const float WHEELBARROW_RARITY_DEFAULT = 0.1f; internal const string WHEELBARROW_RARITY_DESCRIPTION = "How likely it is for a Wheelbarrow item to spawn when landing on a moon. (0.1 = 10%)"; internal const string WHEELBARROW_MAXIMUM_VALUE_KEY = "Maximum scrap value of Wheelbarrow"; internal const int WHEELBARROW_MAXIMUM_VALUE_DEFAULT = 100; internal const string WHEELBARROW_MAXIMUM_VALUE_DESCRIPTION = "Higher boundary of the scrap's possible value"; internal const string WHEELBARROW_WEIGHT_REDUCTION_MULTIPLIER_KEY = "Weight reduction multiplier for Wheelbarrow"; internal const float WHEELBARROW_WEIGHT_REDUCTION_MULTIPLIER_DEFAULT = 0.7f; internal const string WHEELBARROW_WEIGHT_REDUCTION_MUTLIPLIER_DESCRIPTION = "How much an item's weight will be ignored to the Wheelbarrow's total weight"; internal const string WHEELBARROW_NOISE_RANGE_KEY = "Noise range of the Wheelbarrow Item"; internal const float WHEELBARROW_NOISE_RANGE_DEFAULT = 14f; internal const string WHEELBARROW_NOISE_RANGE_DESCRIPTION = "How far the Wheelbarrow sound propagates to nearby enemies when in movement"; internal const string WHEELBARROW_LOOK_SENSITIVITY_DRAWBACK_KEY = "Look sensitivity drawback of the Wheelbarrow Item"; internal const float WHEELBARROW_LOOK_SENSITIVITY_DRAWBACK_DEFAULT = 0.4f; internal const string WHEELBARROW_LOOK_SENSITIVITY_DRAWBACK_DESCRIPTION = "Value multiplied on the player's look sensitivity when moving with the Wheelbarrow Item"; internal const string WHEELBARROW_MOVEMENT_SLOPPY_KEY = "Sloppiness of the Wheelbarrow Item"; internal const float WHEELBARROW_MOVEMENT_SLOPPY_DEFAULT = 5f; internal const string WHEELBARROW_MOVEMENT_SLOPPY_DESCRIPTION = "Value multiplied on the player's movement to give the feeling of drifting while carrying the Wheelbarrow Item"; internal const string WHEELBARROW_PLAY_NOISE_KEY = "Plays noises for players with Wheelbarrow Item"; internal const bool WHEELBARROW_PLAY_NOISE_DEFAULT = true; internal const string WHEELBARROW_PLAY_NOISE_DESCRIPTION = "If false, it will just not play the sounds, it will still attract monsters to noise"; internal const string WHEELBARROW_SCRAP_KEY = "Scrap Item"; internal const bool WHEELBARROW_SCRAP_DEFAULT = false; internal const string WHEELBARROW_SCRAP_DESCRIPTION = "If true, it will be considered as a scrap item and spawn inside the facility. Otherwise, it will be bought from the store"; internal const string DROP_ALL_ITEMS_WHEELBARROW_KEYBIND_NAME = "Drop all items from wheelbarrow"; internal const string DROP_ALL_ITEMS_WHEELBARROW_DEFAULT_KEYBIND = "<Mouse>/middleButton"; internal static readonly string WHEELBARROW_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Wheelbarrow"); } } namespace Wheelbarrow.Misc { [DataContract] public class PluginConfig : SyncedConfig2<PluginConfig> { [field: SyncedEntryField] public SyncedEntry<bool> SCAN_NODE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> PRICE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> WEIGHT { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> DROP_AHEAD_PLAYER { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> GRABBED_BEFORE_START { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> CONDUCTIVE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> HIGHEST_SALE_PERCENTAGE { get; set; } [field: SyncedEntryField] public SyncedEntry<Restrictions> RESTRICTION_MODE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> MAXIMUM_AMOUNT_ITEMS { get; set; } [field: SyncedEntryField] public SyncedEntry<float> MAXIMUM_WEIGHT_ALLOWED { get; set; } [field: SyncedEntryField] public SyncedEntry<float> WEIGHT_REDUCTION_MULTIPLIER { get; set; } [field: SyncedEntryField] public SyncedEntry<float> LOOK_SENSITIVITY_DRAWBACK { get; set; } [field: SyncedEntryField] public SyncedEntry<float> MOVEMENT_SLOPPY { get; set; } [field: SyncedEntryField] public SyncedEntry<float> NOISE_RANGE { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> PLAY_NOISE { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> SCRAP { get; set; } [field: SyncedEntryField] public SyncedEntry<int> MINIMUM_VALUE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> MAXIMUM_VALUE { get; set; } [field: SyncedEntryField] public SyncedEntry<float> RARITY { get; set; } public PluginConfig(ConfigFile cfg) : base("com.github.WhiteSpike.Wheelbarrow") { string text = "Wheelbarrow"; PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Wheelbarrow price", 500, "Price for Wheelbarrow."); WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 15, "Weight (in lbs)"); SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.WHEELBARROW_SCAN_NODE_KEY, true, "Shows a scan node on the item when scanning"); DROP_AHEAD_PLAYER = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Drop ahead of player when dropping", true, "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront."); CONDUCTIVE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Conductive", true, "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)"); GRABBED_BEFORE_START = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Grabbable before game start", true, "Allows wether the item can be grabbed before hand or not"); HIGHEST_SALE_PERCENTAGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Highest Sale Percentage", 50, "Maximum percentage of sale allowed when this item is selected for a sale."); RESTRICTION_MODE = SyncedBindingExtensions.BindSyncedEntry<Restrictions>(cfg, text, "Restrictions on the Wheelbarrow Item", (Restrictions)2, "Restriction applied when trying to insert an item on the Wheelbarrow.\nSupported values: None, ItemCount, TotalWeight, All"); MAXIMUM_WEIGHT_ALLOWED = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Maximum amount of weight for Wheelbarrow", 100f, "How much weight (in lbs and after weight reduction multiplier is applied on the stored items) a Wheelbarrow can carry in items before it is considered full."); MAXIMUM_AMOUNT_ITEMS = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum amount of items for Wheelbarrow", 4, "Amount of items allowed before the Wheelbarrow is considered full"); WEIGHT_REDUCTION_MULTIPLIER = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Weight reduction multiplier for Wheelbarrow", 0.7f, "How much an item's weight will be ignored to the Wheelbarrow's total weight"); NOISE_RANGE = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Noise range of the Wheelbarrow Item", 14f, "How far the Wheelbarrow sound propagates to nearby enemies when in movement"); LOOK_SENSITIVITY_DRAWBACK = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Look sensitivity drawback of the Wheelbarrow Item", 0.4f, "Value multiplied on the player's look sensitivity when moving with the Wheelbarrow Item"); MOVEMENT_SLOPPY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Sloppiness of the Wheelbarrow Item", 5f, "Value multiplied on the player's movement to give the feeling of drifting while carrying the Wheelbarrow Item"); PLAY_NOISE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Plays noises for players with Wheelbarrow Item", true, "If false, it will just not play the sounds, it will still attract monsters to noise"); SCRAP = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Scrap Item", false, "If true, it will be considered as a scrap item and spawn inside the facility. Otherwise, it will be bought from the store"); MINIMUM_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Minimum scrap value of Wheelbarrow", 50, "Lower boundary of the scrap's possible value"); MAXIMUM_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum scrap value of Wheelbarrow", 100, "Higher boundary of the scrap's possible value"); RARITY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Spawn Chance of the Wheelbarrow Item", 0.1f, "How likely it is for a Wheelbarrow item to spawn when landing on a moon. (0.1 = 10%)"); ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this); } } internal static class Metadata { public const string GUID = "com.github.WhiteSpike.Wheelbarrow"; public const string NAME = "Wheelbarrow"; public const string VERSION = "1.0.3"; } internal static class Tools { internal enum NodeType { GENERAL, DANGER, SCRAP } private static GameObject CreateCanvasScanNode(ref GameObject objectToAddScanNode) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3), objectToAddScanNode.transform.position, Quaternion.Euler(Vector3.zero), objectToAddScanNode.transform); ((Object)val).name = "ScanNode"; val.layer = LayerMask.NameToLayer("ScanNode"); Object.Destroy((Object)(object)val.GetComponent<MeshRenderer>()); Object.Destroy((Object)(object)val.GetComponent<MeshFilter>()); return val; } private static void AddScanNode(GameObject objectToAddScanNode, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7) { GameObject val = CreateCanvasScanNode(ref objectToAddScanNode); ScanNodeProperties scanNodeProperties = val.AddComponent<ScanNodeProperties>(); ChangeScanNode(ref scanNodeProperties, nodeType, header, subText, creatureScanID, 0, minRange, maxRange); } public static void AddGeneralScanNode(GameObject objectToAddScanNode, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7) { AddScanNode(objectToAddScanNode, NodeType.GENERAL, header, subText, creatureScanID, minRange, maxRange); } public static void ChangeScanNode(ref ScanNodeProperties scanNodeProperties, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int scrapValue = 0, int minRange = 2, int maxRange = 7) { scanNodeProperties.headerText = header; scanNodeProperties.subText = subText; scanNodeProperties.nodeType = (int)nodeType; scanNodeProperties.creatureScanID = creatureScanID; scanNodeProperties.scrapValue = scrapValue; scanNodeProperties.minRange = minRange; scanNodeProperties.maxRange = maxRange; } } } namespace Wheelbarrow.Input { internal class IngameKeybinds : LcInputActions { public static IngameKeybinds Instance; [InputAction("<Mouse>/middleButton", Name = "Drop all items from wheelbarrow")] public InputAction WheelbarrowKey { get; set; } internal static InputActionAsset GetAsset() { return ((LcInputActions)Instance).Asset; } } [HarmonyPatch] internal static class Keybinds { public static InputActionAsset Asset; public static InputActionMap ActionMap; public static InputAction WheelbarrowAction; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddToKeybindMenu() { //IL_0010: 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) Asset = InputUtilsCompat.Asset; ActionMap = Asset.actionMaps[0]; WheelbarrowAction = InputUtilsCompat.WheelbarrowKey; } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPostfix] public static void OnEnable() { Asset.Enable(); WheelbarrowAction.performed += OnWheelbarrowActionPerformed; } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { Asset.Disable(); WheelbarrowAction.performed -= OnWheelbarrowActionPerformed; } private static void OnWheelbarrowActionPerformed(CallbackContext context) { if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && Object.op_Implicit((Object)(object)localPlayerController.currentlyHeldObjectServer)) { WheelbarrowBehaviour component = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent<WheelbarrowBehaviour>(); if (Object.op_Implicit((Object)(object)component)) { ((ContainerBehaviour)component).UpdateContainerDrop(); } } } } } namespace Wheelbarrow.Compat { public static class InputUtilsCompat { internal static InputActionAsset Asset => IngameKeybinds.GetAsset(); public static InputAction WheelbarrowKey => IngameKeybinds.Instance.WheelbarrowKey; internal static void Init() { IngameKeybinds.Instance = new IngameKeybinds(); } } } namespace Wheelbarrow.Behaviour { internal class WheelbarrowBehaviour : ContainerBehaviour { private GameObject wheel; internal const string ITEM_NAME = "Wheelbarrow"; internal const string ITEM_DESCRIPTION = "Allows carrying multiple items"; protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE); public string GetDisplayInfo() { return $"A portable container which has a maximum capacity of {Plugin.Config.MAXIMUM_AMOUNT_ITEMS.Value}" + $" and reduces the effective weight of the inserted items by {Plugin.Config.WEIGHT_REDUCTION_MULTIPLIER.Value * 100f} %.\n" + $"It weighs {Plugin.Config.WEIGHT.Value} lbs"; } protected override bool ShowDepositPrompts() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; return localPlayerController.isHoldingObject && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)localPlayerController; } public override void Start() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) ((ContainerBehaviour)this).Start(); wheel = GameObject.Find("lgu_wheelbarrow_wheel"); PluginConfig config = Plugin.Config; base.maximumAmountItems = config.MAXIMUM_AMOUNT_ITEMS.Value; base.weightReduceMultiplier = config.WEIGHT_REDUCTION_MULTIPLIER.Value; base.restriction = SyncedEntry<Restrictions>.op_Implicit(config.RESTRICTION_MODE); base.maximumWeightAllowed = config.MAXIMUM_WEIGHT_ALLOWED.Value; base.noiseRange = config.NOISE_RANGE.Value; base.sloppiness = config.MOVEMENT_SLOPPY.Value; base.lookSensitivityDrawback = config.LOOK_SENSITIVITY_DRAWBACK.Value; base.playSounds = config.PLAY_NOISE.Value; base.wheelsClip = Plugin.wheelsNoise.ToArray(); if (((GrabbableObject)this).itemProperties.isScrap && ((GrabbableObject)this).scrapValue <= 0) { Random random = new Random(StartOfRound.Instance.randomMapSeed + 105); ((GrabbableObject)this).SetScrapValue(random.Next(config.MINIMUM_VALUE.Value, config.MAXIMUM_VALUE.Value)); } if (!KeepScanNode) { Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>()); } } public override void Update() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) //IL_00ad: 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) ((ContainerBehaviour)this).Update(); if (((GrabbableObject)this).isHeld) { Vector3 velocity = ((GrabbableObject)this).playerHeldBy.thisController.velocity; if (((Vector3)(ref velocity)).magnitude > 0f) { wheel.transform.Rotate(Time.deltaTime, 0f, 0f, (Space)1); Quaternion rotation = wheel.transform.rotation; ((Quaternion)(ref rotation)).Set(wheel.transform.rotation.x % 360f, wheel.transform.rotation.y, wheel.transform.rotation.z, wheel.transform.rotation.w); } } } protected override void SetupScanNodeProperties() { ScanNodeProperties scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)scanNodeProperties != (Object)null) { Tools.ChangeScanNode(ref scanNodeProperties, (Tools.NodeType)scanNodeProperties.nodeType, "Wheelbarrow", "Allows carrying multiple items"); } else { Tools.AddGeneralScanNode(((Component)this).gameObject, "Wheelbarrow", "Allows carrying multiple items"); } } protected override string[] SetupContainerTooltips() { string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngameKeybinds.Instance.WheelbarrowKey, (DisplayStringOptions)0, (string)null); return new string[1] { "Drop all items: [" + bindingDisplayString + "]" }; } protected override void __initializeVariables() { ((ContainerBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "WheelbarrowBehaviour"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace Wheelbarrow.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }