feat: add initial People Playground mod development kit
This commit is contained in:
25
SledgeHammer/README.txt
Normal file
25
SledgeHammer/README.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
SledgeHammer Mod
|
||||
================
|
||||
|
||||
A basic example mod that introduces a classic sledgehammer weapon to People Playground.
|
||||
|
||||
Features
|
||||
--------
|
||||
• Simple, functional sledgehammer item
|
||||
• Basic physics and collision detection
|
||||
• Demonstrates core modding concepts
|
||||
• Clean, minimal code structure
|
||||
|
||||
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!
|
||||
|
||||
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
|
||||
17
SledgeHammer/mod.json
Normal file
17
SledgeHammer/mod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"Name": "SledgeHammer",
|
||||
"Author": "Nuclear.Lab",
|
||||
"Description": "A heavy demolition sledgehammer with devastating impact force and realistic physics.",
|
||||
"ModVersion": "1.0",
|
||||
"GameVersion": "1.27.5",
|
||||
"ThumbnailPath": "thumb.png",
|
||||
"EntryPoint": "Mod.Mod",
|
||||
"Tags": [
|
||||
"Fun",
|
||||
"Weapons",
|
||||
"Melee"
|
||||
],
|
||||
"Scripts": [
|
||||
"script.cs"
|
||||
]
|
||||
}
|
||||
45
SledgeHammer/script.cs
Normal file
45
SledgeHammer/script.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using UnityEngine; //You'll probably need this...
|
||||
|
||||
namespace Mod
|
||||
{
|
||||
public class Mod
|
||||
{
|
||||
public static void OnLoad()
|
||||
{
|
||||
// Optional initialization method - runs when mod is first loaded
|
||||
}
|
||||
|
||||
public static void OnUnload()
|
||||
{
|
||||
// Optional cleanup method - runs when mod is unloaded/game closes
|
||||
}
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
// register item to the mod api
|
||||
ModAPI.Register(
|
||||
new Modification()
|
||||
{
|
||||
OriginalItem = ModAPI.FindSpawnable("Power Hammer"), //item to derive from (better physics than Brick)
|
||||
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)
|
||||
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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Instance.FixColliders(); //fix colliders to match new sprite
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
SledgeHammer/sledgeHammer.png
Normal file
BIN
SledgeHammer/sledgeHammer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
SledgeHammer/sledgeHammerView.png
Normal file
BIN
SledgeHammer/sledgeHammerView.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
SledgeHammer/thumb.png
Normal file
BIN
SledgeHammer/thumb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 240 KiB |
Reference in New Issue
Block a user