diff --git a/Behaviours/NerdPhysicsProp.cs b/Behaviours/NerdPhysicsProp.cs new file mode 100644 index 0000000..2aeaf53 --- /dev/null +++ b/Behaviours/NerdPhysicsProp.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace DingusThings.Behaviours +{ + internal class NerdPhysicsProp : PhysicsProp + { + private readonly float cooldown = 1.1f; + + float _lastTriggeredTime; + + public override void ItemActivate(bool used, bool buttonDown = true) + { + // if still under cooldown do not activate + if (Time.time - _lastTriggeredTime < cooldown) return; + + base.ItemActivate(used, buttonDown); + if (buttonDown) + { + _lastTriggeredTime = Time.time; + AssetBundle? bundle = DingusThings.Bundle; + string itemName = "Nerd"; + if (bundle == null) + { + DingusThings.Logger.LogError($"{itemName}: Sound failed to play."); + return; + } + AudioClip audioClip = bundle.LoadAsset("Assets/DingusThings/Sounds/akchually.ogg"); + AudioSource audioSource = GetComponent(); + audioSource.PlayOneShot(audioClip, 1F); + } + } + } +} diff --git a/CustomScriptableObject/NerdItem.cs b/CustomScriptableObject/NerdItem.cs new file mode 100644 index 0000000..6bb879e --- /dev/null +++ b/CustomScriptableObject/NerdItem.cs @@ -0,0 +1,34 @@ +using DingusThings.Behaviours; +using LethalLib.Modules; +using UnityEngine; + +namespace DingusThings.CustomScriptableObject +{ + internal class NerdItem + { + public static void Register() + { + string itemName = "Nerd"; + AssetBundle? bundle = DingusThings.Bundle; + if (bundle == null) + { + DingusThings.Logger.LogError(itemName + " failed to load."); + return; + } + /// Nerd + int rarity = 40; + Item item = bundle.LoadAsset("Assets/DingusThings/Items/Nerd.asset"); + item.toolTips = ["Ackchually: [LMB]"]; + NerdPhysicsProp nerdPhysicsProp = item.spawnPrefab.AddComponent(); + nerdPhysicsProp.grabbable = true; + nerdPhysicsProp.grabbableToEnemies = true; + nerdPhysicsProp.isInFactory = true; + nerdPhysicsProp.itemProperties = item; + + // register prefab + NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); + Utilities.FixMixerGroups(item.spawnPrefab); + Items.RegisterScrap(item, rarity, Levels.LevelTypes.All); + } + } +} diff --git a/DingusThings.cs b/DingusThings.cs index 432dc11..58d535c 100644 --- a/DingusThings.cs +++ b/DingusThings.cs @@ -69,7 +69,7 @@ private void Awake() return; } - // load patch + // load patches Harmony.CreateAndPatchAll(typeof(TerminalPatch)); Harmony.CreateAndPatchAll(typeof(SeedPatch)); @@ -79,6 +79,7 @@ private void Awake() LifebuoyBarSoapItem.Register(); InstantNoodlePackItem.Register(); KeyboardItem.Register(); + NerdItem.Register(); Logger.LogInfo($"{PluginString} has loaded!"); } diff --git a/DingusThings.csproj b/DingusThings.csproj index dafa901..4941c5d 100644 --- a/DingusThings.csproj +++ b/DingusThings.csproj @@ -5,7 +5,7 @@ milodinosaur.DingusThings DingusThings - 1.4.5 + 1.5.0 diff --git a/README.md b/README.md index 25428b5..c7a71a6 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ Yet another Lethal Company custom scrap pack Steam Gift Card - Model made by me, sounds and images by Valve + Model made by me +

+ Sounds and images by Valve @@ -65,6 +67,16 @@ Yet another Lethal Company custom scrap pack Keyboard sounds by Pinguwow, Mikacchi, LunaIc3, Agamgunz, Kayeo, and me + + + Nerd + + + Model made by me +

+ Voice by Richietxy + + Assets: https://github.com/ryantanrk/DingusThings-Assets