forked from Ezhh/rainbow_source
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.lua
More file actions
162 lines (155 loc) · 4.59 KB
/
init.lua
File metadata and controls
162 lines (155 loc) · 4.59 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
--Water definitions
local source_list = {
{"black", "Darkened", "292421", 40, 36, 33},
{"blue", "Blue", "0000FF", 0, 0, 255},
{"cyan", "Cyan", "00FFFF", 0, 255, 255},
{"green", "Green", "00FF00", 0, 255, 0},
{"magenta", "Magenta", "FF00FF", 255, 0, 255},
{"orange", "Orange", "FF6103", 255, 97, 3},
{"purple", "Purple", "800080", 128, 0, 128, "violet"},
{"red", "Red", "FF0000", 255, 0, 0},
{"yellow", "Yellow", "FFFF00", 255, 255, 0},
{"frosted", "Frosted", "FFFFFF", 255, 255, 255, "white"}
}
for i in ipairs(source_list) do
local name = source_list[i][1]
local description = source_list[i][2]
local colour = source_list[i][3]
local red = source_list[i][4]
local green = source_list[i][5]
local blue = source_list[i][6]
local dye = source_list[i][7] or name
--Register water source nodes
core.register_node("rainbow_source:"..name.."_water_source", {
description = description.." Water Source",
drawtype = "liquid",
tiles = {
{
name = "rs_water_source_animated.png^[colorize:#"..colour..":70",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
special_tiles = {
{
name = "rs_water_source_animated.png^[colorize:#"..colour..":70",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
backface_culling = false,
},
},
use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "rainbow_source:"..name.."_water_flowing",
liquid_alternative_source = "rainbow_source:"..name.."_water_source",
liquid_viscosity = 1,
post_effect_color = {a = 50, r = red, g = green, b = blue},
groups = {water = 3, liquid = 3, puts_out_fire = 1,
cools_lava = 1},
sounds = default.node_sound_water_defaults(),
})
--Register flowing water nodes
core.register_node("rainbow_source:"..name.."_water_flowing", {
description = description.." Flowing Water",
drawtype = "flowingliquid",
tiles = {"rs_water.png^[colorize:#"..colour},
special_tiles = {
{
name = "rs_water_flowing_animated.png^[colorize:#"..colour..":70",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
{
name = "rs_water_flowing_animated.png^[colorize:#"..colour..":70",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
},
use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "rainbow_source:"..name.."_water_flowing",
liquid_alternative_source = "rainbow_source:"..name.."_water_source",
liquid_viscosity = 1,
post_effect_color = {a = 50, r = red, g = green, b = blue},
groups = {water = 3, liquid = 3, puts_out_fire = 1,
not_in_creative_inventory = 1, cools_lava = 1},
sounds = default.node_sound_water_defaults(),
})
--[[-------------------------------------
--Buckets (new feature by DustyDave961)--
---------------------------------------]]
--Register buckets with fluid_lib function
if core.get_modpath("bucket_compat") then
fluid_lib.register_liquid(
"rainbow_source:"..name.."_water_source",
"rainbow_source:"..name.."_water_flowing",
"rainbow_source:bucket_"..name.."_water",
"#"..colour,
description.." Water Bucket",
{tool = 1, water_bucket = 1}
)
--Register crafting recipes if dye is present and crafting setting is enabled
if core.get_modpath("dye") and core.settings:get_bool("enable_colored_bucket_crafts") then
core.register_craft({
output = "rainbow_source:bucket_"..name.."_water",
recipe = {
{"dye:"..dye},
{"group:water_bucket"}
}
})
end
--Add buckets even without bucket_compat
elseif core.get_modpath("bucket") then
bucket.register_liquid(
"rainbow_source:blue_water_source",
"rainbow_source:blue_water_flowing",
"rainbow_source:bucket_blue_water",
"bucket_water.png",
"Blue Water Bucket",
{tool = 1, water_bucket = 1}
)
bucket.register_liquid(
"rainbow_source:orange_water_source",
"rainbow_source:orange_water_flowing",
"rainbow_source:bucket_orange_water",
"bucket_lava.png",
"Orange Water Bucket",
{tool = 1, water_bucket = 1}
)
end
end