feat: add zombie cure syringe mod & add audio effects for template mod

This commit is contained in:
2026-01-10 22:09:39 +03:00
parent 10dbfd434c
commit aee067d611
19 changed files with 264 additions and 30 deletions

View File

@@ -1,25 +1,20 @@
SledgeHammer Mod
================
A heavy sledgehammer that makes satisfying impact sounds when hitting things.
A basic example mod that introduces a classic sledgehammer weapon to People Playground.
How to use:
- Spawn it from the Melee category
- Swing it around and hit objects
- Hear the different impact sounds based on how hard you hit
Features
--------
• Simple, functional sledgehammer item
• Basic physics and collision detection
• Demonstrates core modding concepts
• Clean, minimal code structure
Features:
- Heavy weight for realistic physics
- Custom impact sound effects
- Cool sprite design
How to Use
----------
1. Activate the mod in your mod list
2. Find the sledgehammer in the weapons category
3. Spawn it and start smashing!
Includes 3 sound effects:
- Light impacts
- Heavy impacts
- Spawn sound when created
Technical Details
-----------------
This mod serves as an educational example showing:
• Proper mod.json configuration
• Item registration with ModAPI
• Basic sprite loading and assignment
• Simple weapon implementation
Enjoy smashing things with style!

View File

@@ -7,7 +7,6 @@
"ThumbnailPath": "thumb.png",
"EntryPoint": "Mod.Mod",
"Tags": [
"Fun",
"Weapons",
"Melee"
],

View File

@@ -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

Binary file not shown.

Binary file not shown.

BIN
SledgeHammer/sfx/spawn.wav Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB