]> git.lizzy.rs Git - dragonfireclient.git/blob - games/devtest/mods/soundstuff/init.lua
Add Custom version string
[dragonfireclient.git] / games / devtest / mods / soundstuff / init.lua
1 local simple_nodes = {
2         footstep = { "Footstep Sound Node", "soundstuff_node_footstep.png" },
3         dig = { "Dig Sound Node", "soundstuff_node_dig.png" },
4         dug = { "Dug Sound Node", "soundstuff_node_dug.png" },
5         place = { "Place Sound Node", "soundstuff_node_place.png" },
6         place_failed = { "Place Failed Sound Node", "soundstuff_node_place_failed.png" },
7 }
8
9 for k,v in pairs(simple_nodes) do
10         minetest.register_node("soundstuff:"..k, {
11                 description = v[1],
12                 tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]},
13                 groups = {dig_immediate=2},
14                 sounds = {
15                         [k] = { name = "soundstuff_mono", gain = 1.0 },
16                 }
17         })
18 end
19
20 minetest.register_node("soundstuff:place_failed_attached", {
21         description = "Attached Place Failed Sound Node",
22         tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"},
23         groups = {dig_immediate=2, attached_node=1},
24         drawtype = "nodebox",
25         paramtype = "light",
26         node_box = { type = "fixed", fixed = {
27                 { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 },
28                 { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 },
29         }},
30         sounds = {
31                 place_failed = { name = "soundstuff_mono", gain = 1.0 },
32         },
33 })
34
35 minetest.register_node("soundstuff:fall", {
36         description = "Fall Sound Node",
37         tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
38         groups = {dig_immediate=2, falling_node=1},
39         sounds = {
40                 fall = { name = "soundstuff_mono", gain = 1.0 },
41         }
42 })
43
44 minetest.register_node("soundstuff:fall_attached", {
45         description = "Attached Fall Sound Node",
46         tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
47         groups = {dig_immediate=2, attached_node=1},
48         drawtype = "nodebox",
49         paramtype = "light",
50         node_box = { type = "fixed", fixed = {
51                 { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 },
52                 { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 },
53         }},
54         sounds = {
55                 fall = { name = "soundstuff_mono", gain = 1.0 },
56         }
57 })
58
59 minetest.register_node("soundstuff:footstep_liquid", {
60         description = "Liquid Footstep Sound Node",
61         drawtype = "liquid",
62         tiles = {
63                 "soundstuff_node_sound.png^[colorize:#0000FF:127",
64         },
65         special_tiles = {
66                 {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = false},
67                 {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = true},
68         },
69         liquids_pointable = true,
70         liquidtype = "source",
71         liquid_alternative_flowing = "soundstuff:footstep_liquid",
72         liquid_alternative_source = "soundstuff:footstep_liquid",
73         liquid_renewable = false,
74         liquid_range = 0,
75         liquid_viscosity = 0,
76         alpha = 190,
77         paramtype = "light",
78         walkable = false,
79         pointable = false,
80         diggable = false,
81         buildable_to = true,
82         is_ground_content = false,
83         post_effect_color = {a = 64, r = 0, g = 0, b = 200},
84         sounds = {
85                 footstep = { name = "soundstuff_mono", gain = 1.0 },
86         }
87 })
88
89 minetest.register_node("soundstuff:footstep_climbable", {
90         description = "Climbable Footstep Sound Node",
91         drawtype = "allfaces",
92         tiles = {
93                 "soundstuff_node_climbable.png",
94         },
95         alpha = 120,
96         paramtype = "light",
97         sunlight_propagates = true,
98         walkable = false,
99         climbable = true,
100         is_ground_content = false,
101         groups = { dig_immediate = 2 },
102         sounds = {
103                 footstep = { name = "soundstuff_mono", gain = 1.0 },
104         }
105 })
106
107
108
109 minetest.register_craftitem("soundstuff:eat", {
110         description = "Eat Sound Item".."\n"..
111                 "Makes a sound when 'eaten' (with punch key)",
112         inventory_image = "soundstuff_eat.png",
113         on_use = minetest.item_eat(0),
114         sound = {
115                 eat = { name = "soundstuff_mono", gain = 1.0 },
116         }
117 })
118
119 minetest.register_tool("soundstuff:breaks", {
120         description = "Break Sound Tool".."\n"..
121                 "Digs cracky=3 and more".."\n"..
122                 "Makes a sound when it breaks",
123         inventory_image = "soundstuff_node_dug.png",
124         sound = {
125                 breaks = { name = "soundstuff_mono", gain = 1.0 },
126         },
127         tool_capabilities = {
128                 max_drop_level=0,
129                 groupcaps={
130                         cracky={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
131                         choppy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
132                         snappy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
133                         crumbly={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
134                 },
135         },
136 })
137
138 -- Plays sound repeatedly
139 minetest.register_node("soundstuff:positional", {
140         description = "Positional Sound Node",
141         on_construct = function(pos)
142                 local timer = minetest.get_node_timer(pos)
143                 timer:start(0)
144         end,
145         on_timer = function(pos, elapsed)
146                 local node = minetest.get_node(pos)
147                 local dist = node.param2
148                 if dist == 0 then
149                         dist = nil
150                 end
151                 minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist })
152                 local timer = minetest.get_node_timer(pos)
153                 timer:start(0.7)
154         end,
155         on_rightclick = function(pos, node, clicker)
156                 node.param2 = (node.param2 + 1) % 64
157                 minetest.set_node(pos, node)
158                 if clicker and clicker:is_player() then
159                         local dist = node.param2
160                         local diststr
161                         if dist == 0 then
162                                 diststr = "<default>"
163                         else
164                                 diststr = tostring(dist)
165                         end
166                         minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr)
167                 end
168         end,
169
170         groups = { dig_immediate = 2 },
171         tiles = { "soundstuff_node_sound.png" },
172 })
173