Rename mod: walls → hades_walls
[minetest_hades/hades_revisited.git] / mods / hades_furniture / nodes.lua
blobd75dc005079f4c013bf54e6f6379c6613e7177bb
1 local S = minetest.get_translator("hades_furniture")
3 --[[
4 Some adjustments and expansions for Hades game added 2015 by Glünggi
6 3D Forniture
8 Copyright 2012 Tonyka
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 MA 02110-1301, USA.
25 Contributors:
27 InfinityProject
29 suggested creating bathroom kit.
31 cosarara97
33 code.
35 ]]--
37 --[[ ----- Basic furniture ----- ]]
39 -- Table and chair
40 local furniture_colors = {
41 {"_uncolored", S("Uncolored Table"), S("Uncolored Chair")},
42 {"_black", S("Black Table"), S("Black Chair")},
43 {"_white", S("White Table"), S("White Chair")},
45 for f=1, #furniture_colors do
46 local append = furniture_colors[f][1]
47 local desc_t = furniture_colors[f][2]
48 local desc_c = furniture_colors[f][3]
50 -- Table
51 minetest.register_node("hades_furniture:table"..append,
52 {description = desc_t,
53 tiles = {
54 "hades_furniture_wood"..append..".png",
56 drawtype = "nodebox",
57 sunlight_propagates = true,
58 paramtype = 'light',
59 paramtype2 = "facedir",
60 is_ground_content = false,
61 node_box = {
62 type = "fixed",
63 fixed = {
64 {-0.4,-0.5,-0.4, -0.3,0.4,-0.3},
65 {0.3,-0.5,-0.4, 0.4,0.4,-0.3},
66 {-0.4,-0.5,0.3, -0.3,0.4,0.4},
67 {0.3,-0.5,0.3, 0.4,0.4,0.4},
68 {-0.5,0.4,-0.5, 0.5,0.5,0.5},
69 {-0.4,-0.2,-0.3, -0.3,-0.1,0.3},
70 {0.3,-0.2,-0.4, 0.4,-0.1,0.3},
71 {-0.3,-0.2,-0.4, 0.4,-0.1,-0.3},
72 {-0.3,-0.2,0.3, 0.3,-0.1,0.4},
75 groups = {table=1, choppy=3,oddly_breakable_by_hand=2},
76 sounds = hades_sounds.node_sound_wood_defaults(),
79 -- Chair
80 minetest.register_node("hades_furniture:chair"..append,
81 { description = desc_c,
82 tiles = {
83 "hades_furniture_wood"..append..".png",
85 drawtype = "nodebox",
86 sunlight_propagates = true,
87 paramtype = 'light',
88 paramtype2 = "facedir",
89 is_ground_content = false,
90 _hades_itemshow_offset = { x=-0.118, y=0, z=-0.118 },
91 node_box = {
92 type = "fixed",
93 fixed = {
94 {-0.3,-0.5,0.2, -0.2,0.5,0.3},
95 {0.2,-0.5,0.2, 0.3,0.5,0.3},
96 {-0.3,-0.5,-0.3, -0.2,-0.1,-0.2},
97 {0.2,-0.5,-0.3, 0.3,-0.1,-0.2},
98 {-0.3,-0.1,-0.3, 0.3,0,0.2},
99 {-0.2,0.1,0.25, 0.2,0.4,0.26}
102 selection_box = {
103 type = "fixed",
104 fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
106 groups = {chair=1, choppy=3,oddly_breakable_by_hand=2},
107 sounds = hades_sounds.node_sound_wood_defaults(),
111 local armchair_colors = {
112 {"", S("Black Armchair")},
113 {"_white", S("White Armchair")},
114 {"_red", S("Red Armchair")},
115 {"_brown", S("Brown Armchair")},
116 {"_blue", S("Blue Armchair")},
117 {"_dark_green", S("Dark Green Armchair")},
120 -- Armchair
121 for a=1, #armchair_colors do
122 local append = armchair_colors[a][1]
123 local desc = armchair_colors[a][2]
124 minetest.register_node("hades_furniture:armchair"..append,
125 { description = desc,
126 tiles = {
127 "hades_furniture_armchair_top"..append..".png",
128 "hades_furniture_armchair_top"..append..".png",
129 "hades_furniture_armchair_lat1"..append..".png",
130 "hades_furniture_armchair_lat1"..append..".png",
131 "hades_furniture_armchair_lat2"..append..".png",
132 "hades_furniture_armchair_lat2"..append..".png",
134 drawtype = "nodebox",
135 sunlight_propagates = true,
136 paramtype = 'light',
137 paramtype2 = "facedir",
138 is_ground_content = false,
139 node_box = {
140 type = "fixed",
141 fixed = {
142 --lat 1
143 {-0.5,-0.5,-0.45, -0.3,0.05,0.3},
144 {-0.45,-0.5,-0.5, -0.35,0.05,-0.45},
145 {-0.45,0.05,-0.45, -0.35,0.1,0.15},
146 --lat 2
147 {0.3,-0.5,-0.45, 0.5,0.05,0.3},{0.35,-0.5,-0.5,0.45,0.05,-0.45},{0.35,0.05,-0.45, 0.45,0.1,0.15},
148 --respaldo
149 {-0.5,-0.5,0.3, 0.5,0.45,0.5},{-0.45,0.45,0.35,0.45,0.5,0.45},
150 --base
151 {-0.3,-0.45,-0.35, 0.3,-0.1,0.3},{-0.3,-0.45,-0.4, 0.3,-0.15,-0.35},
153 --oreja 1
154 {-0.5,0.05,0.15, -0.3,0.45, 0.3},{-0.45,0.1,0.1, -0.35,0.45,0.15},{-0.45,0.45,0.15,-0.35,0.5,0.35},
155 --oreja 2
156 {0.3,0.05,0.15, 0.5,0.45,0.3},{0.35,0.1,0.1, 0.45,0.45,0.15},{0.35,0.45,0.15,0.45,0.5,0.35},
159 selection_box = {
160 type = "fixed",
161 fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
163 groups = {armchair=1, choppy=3,oddly_breakable_by_hand=2},
164 sounds = hades_sounds.node_sound_wood_defaults({
165 footstep = hades_sounds.node_sound_cloth_defaults().footstep,
170 -- Table Lamp
171 local lamps = {
172 { "off", "max", },
173 { "low", "off", 4 },
174 { "med", "low", 8 },
175 { "hi", "med", 12 },
176 { "max", "hi", minetest.LIGHT_MAX },
178 for l=1, #lamps do
179 local drop, not_in_creative_inventory, tt, desc
180 if l ~= 1 then
181 drop = "hades_furniture:table_lamp_off"
182 not_in_creative_inventory = 1
183 desc = S("Table Lamp (level @1)", l)
184 else
185 tt = S("4 different luminance levels")
186 desc = S("Table Lamp")
188 minetest.register_node("hades_furniture:table_lamp_"..lamps[l][1], {
189 description = desc,
190 _tt_help = tt,
191 drawtype = "nodebox",
192 tiles = {
193 "hades_furniture_table_lamp_s.png",
194 "hades_furniture_table_lamp_s.png",
195 "hades_furniture_table_lamp_l.png",
197 use_texture_alpha = "clip",
198 paramtype = 'light',
199 paramtype2 = 'facedir',
200 is_ground_content = false,
201 node_box = {
202 type = "fixed",
203 fixed = {
204 --Lamp Base
205 {-0.15,-0.5,-0.15, 0.15,-0.45,0.15},
206 {-0.05,-0.45,-0.05, 0.05,-0.4,0.05},
207 {-0.025,-0.4,-0.025, 0.025,-0.1,0.025},
208 {-0.0125,-0.125,-0.2, 0.0125,-0.1,0.2},
209 {-0.2,-0.125,-0.0125, 0.2,-0.1,0.0125},
211 --Lamp Shade
212 {-0.2,-0.1,-0.2, -0.175,0.3,0.2},
213 {0.175,-0.1,-0.2, 0.2,0.3,0.2},
214 {-0.175,-0.1,-0.2, 0.175,0.3,-0.175},
215 {-0.175,-0.1,0.175, 0.175,0.3,0.2},
218 sunlight_propagates = true,
219 walkable = false,
220 light_source = lamps[l][3],
221 selection_box = {
222 type = "fixed",
223 fixed = {-0.2, -0.5, -0.2, 0.2, 0.3, 0.2},
225 groups = {cracky=2,oddly_breakable_by_hand=1,not_in_creative_inventory=not_in_creative_inventory},
226 drop = drop,
227 sounds = hades_sounds.node_sound_wood_defaults(),
228 on_rightclick = function(pos, node, clicker)
229 minetest.sound_play({name="hades_furniture_table_lamp_switch"}, {pos=pos, gain=0.35, max_hear_distance=6})
230 minetest.set_node(pos, {name="hades_furniture:table_lamp_"..lamps[l][2]})
231 end,
232 on_rotate = "simple",
237 --[[ ----- Medieval theme -----]]
239 -- Steel Bars (only straight section)
241 local bars = {
242 { "bars", "L_binding_bars", S("Straight Steel Bars"), S("Binding Steel Bars"), { "hades_furniture_black_metal_s1.png" } },
243 { "rusty_bars", "binding_rusty_bars", S("Straight Rusty Bars"), S("Binding Rusty Bars"), { "columnia_rusty.png" } },
246 for b=1, #bars do
247 local bar = bars[b]
248 local id = bar[1]
249 local id2 = bar[2]
250 local desc1 = bar[3]
251 local desc2 = bar[4]
252 local tiles = bar[5]
254 minetest.register_node("hades_furniture:"..id, {
255 description = desc1,
256 tiles = tiles,
257 drawtype = "nodebox",
258 sunlight_propagates = true,
259 paramtype = 'light',
260 paramtype2 = 'facedir',
261 is_ground_content = false,
262 node_box = {
263 type = "fixed",
264 fixed = {
265 {-0.1,-0.5,-0.1, 0.1,0.5,0.1}, -- center bar
266 {0.4,-0.5,-0.1, 0.5,0.5,0.1}, -- right bar
267 {0.1,-0.5,-0.05, 0.4,-0.45,0.05}, -- right low rail
268 {0.1,0.45,-0.05, 0.4,0.5,0.05}, -- right high rail
269 {-0.5,-0.5,-0.1, -0.4,0.5,0.1}, -- left bar
270 {-0.4,-0.5,-0.05, -0.1,-0.45,0.05}, -- left low rail
271 {-0.4,0.45,-0.05, -0.1,0.5,0.05}, -- left high rail
274 collision_box = {
275 type = "fixed",
276 fixed = {-0.5,-0.5,-0.15, 0.5,0.5,0.15},
278 groups = {metal_bars=1, cracky=1},
279 sounds = hades_sounds.node_sound_metal_defaults(),
280 on_rotate = "simple",
281 _hades_shaper_next = "hades_furniture:"..id2,
284 -- Binding bars (for corners and junctions).
285 -- Also, center bar is slightly thicker
286 minetest.register_node("hades_furniture:"..id2,
288 description = desc2,
289 tiles = tiles,
290 drawtype = "nodebox",
291 sunlight_propagates = true,
292 paramtype = 'light',
293 is_ground_content = false,
294 connects_to = {"group:metal_bars", "hades_core:steelblock", "columnia:rusty_block"},
295 connect_sides = { "left", "right", "front", "back" },
296 node_box = {
297 type = "connected",
298 fixed = {
299 {-0.15,-0.5,-0.15, 0.15,0.5,0.15}, -- center bar
301 connect_right = {
302 {0.4,-0.5,-0.1, 0.5,0.5,0.1}, -- bar
303 {0.15,-0.5,-0.05, 0.4,-0.45,0.05}, -- low rail
304 {0.15,0.45,-0.05, 0.4,0.5,0.05}, -- high rail
306 connect_left = {
307 {-0.5,-0.5,-0.1, -0.4,0.5,0.1}, -- bar
308 {-0.4,-0.5,-0.05, -0.15,-0.45,0.05}, -- low rail
309 {-0.4,0.45,-0.05, -0.15,0.5,0.05}, -- high rail
311 connect_front = {
312 {-0.1,-0.5,-0.5,0.1,0.5,-0.4}, -- bar
313 {-0.05,-0.5,-0.4, 0.05,-0.45,-0.15}, -- low rail
314 {-0.05,0.45,-0.4, 0.05,0.5,-0.15}, -- high rail
316 connect_back = {
317 {-0.1,-0.5,0.4,0.1,0.5,0.5}, -- bar
318 {-0.05,-0.5,0.15, 0.05,-0.45,0.4}, -- low rail
319 {-0.05,0.45,0.15, 0.05,0.5,0.4}, -- high rail
322 collision_box = {
323 type = "connected",
324 fixed = {
325 {-0.15,-0.5,-0.15, 0.15,0.5,0.15}, -- center bar
327 connect_right = {
328 {0.15,-0.5,-0.15, 0.5,0.5,0.15},
330 connect_left = {
331 {-0.5,-0.5,-0.15, -0.15,0.5,0.15},
333 connect_back = {
334 {-0.15,-0.5,-0.15, 0.15,0.5,0.5},
336 connect_front = {
337 {-0.15,-0.5,-0.5, 0.15,0.5,-0.15},
341 groups = {metal_bars=1, cracky=1,},
342 sounds = hades_sounds.node_sound_metal_defaults(),
343 _hades_shaper_next = "hades_furniture:"..id,
347 minetest.register_node("hades_furniture:plant_pot", {
348 description = S("Plant Pot"),
349 paramtype = "light",
350 tiles = {"hades_furniture_plant_pot_top.png", "hades_furniture_plant_pot_bottom.png", "hades_furniture_plant_pot_sides.png"},
351 is_ground_content = false,
352 drawtype = "nodebox",
353 is_ground_content = false,
354 node_box = {
355 type = "fixed",
356 fixed = {
357 {-0.5,-0.5,-3/16, 0.5,0.5,3/16},
358 {-7/16,-0.5,-5/16, 7/16,0.5,5/16},
359 {-6/16,-0.5,-6/16, 6/16,0.5,6/16},
360 {-5/16,-0.5,-7/16, 5/16,0.5,7/16},
361 {-3/16,-0.5,-0.5, 3/16,0.5,0.5},
364 collision_box = {
365 type = "fixed",
366 fixed = {{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }},
368 groups = {cracky=3},
369 sounds = hades_sounds.node_sound_stone_defaults({
370 footstep = hades_sounds.node_sound_dirt_defaults().footstep,