feat: add zombie cure syringe mod & add audio effects for template mod
This commit is contained in:
@@ -24,16 +24,43 @@ namespace Mod
|
||||
NameOverride = "SledgeHammer", //new item name
|
||||
DescriptionOverride = "A heavy demolition sledgehammer.", //new item description
|
||||
CategoryOverride = ModAPI.FindCategory("Melee"), //new item category
|
||||
ThumbnailOverride = ModAPI.LoadSprite("sledgeHammerView.png"), //new item thumbnail (relative path)
|
||||
ThumbnailOverride = ModAPI.LoadSprite("sprites/sledgeHammerView.png"), //new item thumbnail (relative path)
|
||||
AfterSpawn = (Instance) => //all code in the AfterSpawn delegate will be executed when the item is spawned
|
||||
{
|
||||
Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("sledgeHammer.png"); //get the SpriteRenderer and replace its sprite with a custom one
|
||||
Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("sprites/sledgeHammer.png"); //get the SpriteRenderer and replace its sprite with a custom one
|
||||
|
||||
var physical = Instance.GetComponent<PhysicalBehaviour>();
|
||||
if (physical != null)
|
||||
{
|
||||
physical.InitialMass = 8f; //make it heavier for realistic sledgehammer feel
|
||||
physical.TrueInitialMass = 8f; //ensure the mass is actually applied
|
||||
|
||||
// Add custom impact sounds for different collision types
|
||||
physical.OverrideImpactSounds = new AudioClip[]
|
||||
{
|
||||
ModAPI.LoadSound("sfx/simple-hit.wav"),
|
||||
ModAPI.LoadSound("sfx/hard-hit.wav")
|
||||
};
|
||||
|
||||
// Add custom bullet impact sounds (when shot)
|
||||
physical.OverrideShotSounds = new AudioClip[]
|
||||
{
|
||||
ModAPI.LoadSound("sfx/hard-hit.wav")
|
||||
};
|
||||
}
|
||||
|
||||
// Add a spawn sound when the hammer is created
|
||||
var audioSource = Instance.GetComponent<AudioSource>();
|
||||
if (audioSource == null)
|
||||
{
|
||||
audioSource = Instance.AddComponent<AudioSource>();
|
||||
}
|
||||
|
||||
// Play spawn sound
|
||||
var spawnSound = ModAPI.LoadSound("sfx/spawn.wav");
|
||||
if (spawnSound != null && audioSource != null)
|
||||
{
|
||||
audioSource.PlayOneShot(spawnSound);
|
||||
}
|
||||
|
||||
Instance.FixColliders(); //fix colliders to match new sprite
|
||||
|
||||
Reference in New Issue
Block a user