-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcarpet.lua
More file actions
97 lines (97 loc) · 3.09 KB
/
carpet.lua
File metadata and controls
97 lines (97 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, string, vector
= minetest, nodecore, string, vector
local string_gsub
= string.gsub
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
-- ================================================================== --
-- <><><><> Slice (Menger) Sponges into (Sierpinski) Carpets <><><><> --
-- ================================================================== --
minetest.register_node(modname .. ":carpet", {
description = "Carpet",
use_texture_alpha = "clip",
drawtype = "nodebox",
node_box = nodecore.fixedbox({-0.5, -15/32, -0.5, 0.5, -14/32, 0.5}),
tiles = {"nc_sponge.png"},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
walkable = false,
floodable = false,
groups = {
snappy = 1,
flammable = 3,
fire_fuel = 3,
carpet = 1
},
air_pass = true,
sounds = nodecore.sounds("nc_terrain_swishy"),
on_place = minetest.rotate_node
})
------------------------------------------------------------------------
minetest.register_node(modname .. ":carpet_wet", {
description = "Wet Carpet",
use_texture_alpha = "clip",
drawtype = "nodebox",
node_box = nodecore.fixedbox({-0.5, -15/32, -0.5, 0.5, -14/32, 0.5}),
tiles = {"nc_sponge.png^(nc_terrain_water.png^[opacity:96)"},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
walkable = false,
floodable = false,
groups = {
snappy = 1,
coolant = 1,
moist = 1,
carpet = 1
},
sounds = nodecore.sounds("nc_terrain_swishy"),
on_place = minetest.rotate_node
})
------------------------------------------------------------------------
-- To me it makes the most sense to get 16 carpets per sponge, but that seemed
-- a bit op, so I only made it 8 until testing shows it should be more/less.
-- It could just as well be 6, given that a cube has 6 faces, and a sierpinski carpet
-- is a 2d plane, rather than an actual carpet, but whatever.
------------------------------------------------------------------------
nodecore.register_craft({
label = "slice sponge into carpet",
action = "pummel",
indexkeys = {"nc_sponge:sponge"},
nodes = {
{match = "nc_sponge:sponge", replace = "air"}
},
items = {
{name = modname.. ":carpet", count = 8, scatter = 4},
},
toolgroups = {choppy = 3},
itemscatter = 4
})
nodecore.register_craft({
label = "slice wet sponge into wet carpet",
action = "pummel",
indexkeys = {"nc_sponge:sponge_wet"},
nodes = {
{match = "nc_sponge:sponge_wet", replace = "air"}
},
items = {
{name = modname.. ":carpet_wet", count = 8, scatter = 4},
},
toolgroups = {choppy = 3},
itemscatter = 4
})
------------------------------------------------------------------------
nodecore.register_craft({
label = "compress carpets back to sponges",
action = "pummel",
toolgroups = {thumpy = 1},
indexkeys = {modname .. ":carpet"},
nodes = {
{
match = {name = modname .. ":carpet", count = 8},
replace = "nc_sponge:sponge"
}
}
})