[Mod] SoundItems [sounditems]

Post Reply
An0n3m0us
Member
Posts: 77
Joined: Thu Dec 01, 2016 19:15
GitHub: An0n3m0us

[Mod] SoundItems [sounditems]

by An0n3m0us » Post

This mod allows one to register items that can play sounds when `on_use` is triggered (i.e when the user clicks the left mouse button while holding the item). It also prevents the player from playing another sound until the first has finished.

Here's an example of how to register a sounditem:

Code: Select all

sounditems.register("partyhorn", {
	description = S("Party Horn"),
	inventory_image = "sounditems_partyhorn.png",
   sound = {name = "sounditems_partyhorn", length = 4.6, gain = 3},
})
The `sound` variable has three dictionary items:
`name`: The name of the sound in the `sounds` directory of the mod
`length`: How long the sound is allowed to play for before being stopped
`gain`: Loudness of the noise

By default, the `max_hear_distance` is set to 100 blocks, but it's possible to make that customizable if required.

Download: https://github.com/An0n3m0us/sounditems ... master.zip
Browse code: https://github.com/An0n3m0us/sounditems
Version: 1.0

Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests