Jaidyn Ann authored on 2018-09-02 14:53:31
Showing 197 changed files
... ...
@@ -23,8 +23,8 @@ minetest.register_alias("mapgen_sandstone", "default:sandstone")
23 23
 minetest.register_alias("mapgen_tree", "default:tree")
24 24
 minetest.register_alias("mapgen_leaves", "default:leaves")
25 25
 minetest.register_alias("mapgen_apple", "default:apple")
26
-minetest.register_alias("mapgen_jungletree", "default:jungletree")
27
-minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
26
+minetest.register_alias("mapgen_jungletree", "default:jungle_tree")
27
+minetest.register_alias("mapgen_jungleleaves", "default:jungle_leaves")
28 28
 minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
29 29
 minetest.register_alias("mapgen_pine_tree", "default:pine_tree")
30 30
 minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
31 31
Binary files a/mods/default/textures/default_torch_on_ceiling_animated.png and b/mods/default/textures/default_torch_on_ceiling_animated.png differ
32 32
Binary files a/mods/default/textures/default_torch_on_floor.png and b/mods/default/textures/default_torch_on_floor.png differ
33 33
Binary files a/mods/default/textures/default_torch_on_floor_animated.png and b/mods/default/textures/default_torch_on_floor_animated.png differ
... ...
@@ -542,16 +542,18 @@ minetest.register_alias("trees:wood_conifer", "default:pine_wood")
542 542
 minetest.register_alias("trees:sapling_conifer", "default:pine_sapling")
543 543
 minetest.register_alias("trees:leaves_conifer", "default:pine_needles")
544 544
 
545
-minetest.register_alias("trees:tree_palm", "default:jungletree")
546
-minetest.register_alias("trees:leaves_palm", "default:jungleleaves")
547
-minetest.register_alias("trees:sapling_palm", "default:junglesapling")
548
-minetest.register_alias("trees:wood_palm", "default:junglewood")
545
+minetest.register_alias("trees:tree_palm", "default:jungle_tree")
546
+minetest.register_alias("default:jungleleaves", "default:jungle_leaves")
547
+minetest.register_alias("default:junglewood", "default:jungle_wood")
548
+minetest.register_alias("trees:leaves_palm", "default:jungle_leaves")
549
+minetest.register_alias("trees:sapling_palm", "default:jungle_sapling")
550
+minetest.register_alias("trees:wood_palm", "default:jungle_wood")
549 551
 
550 552
 minetest.register_alias("trees:tree_mangrove", "default:aspen_tree")
551 553
 minetest.register_alias("trees:leaves_mangrove", "default:aspen_leaves")
552 554
 minetest.register_alias("trees:sapling_mangrove", "default:aspen_sapling")
553 555
 minetest.register_alias("trees:wood_mangrove", "default:aspen_wood")
554 556
 
555
-minetest.register_alias("trees:leaves_red", "default:jungleleaves")
556
-minetest.register_alias("trees:leaves_yellow", "default:jungleleaves")
557
-minetest.register_alias("trees:leaves_green", "default:jungleleaves")
557
+minetest.register_alias("trees:leaves_red", "default:jungle_leaves")
558
+minetest.register_alias("trees:leaves_yellow", "default:jungle_leaves")
559
+minetest.register_alias("trees:leaves_green", "default:jungle_leaves")
558 560
new file mode 100644
... ...
@@ -0,0 +1,299 @@
1
+-----------------------------------------------------------------------------------------------
2
+-- Fishing - Mossmanikin's version - Bobber 0.1.0
3
+-- License (code & textures): 	WTFPL
4
+-- Contains code from: 		fishing (original), mobs, throwing
5
+-- Supports:				animal_clownfish, animal_fish_blue_white, animal_rat, mobs
6
+-----------------------------------------------------------------------------------------------
7
+-- 0.0625 	(= 1 pixel on 16x16 texture)
8
+-- 0.125 
9
+-- 0.1875
10
+-- 0.25
11
+-- 0.3125
12
+-- 0.375 
13
+-- 0.4375
14
+-- 0.5		(= 8 pixels on 16x16 texture)
15
+-- 0.5625 	(= 9 pixels on 16x16 texture)
16
+-- 0.625 
17
+-- 0.6875
18
+-- 0.75  
19
+-- 0.8125
20
+-- 0.875 
21
+-- 0.9375
22
+-- 1.0		(= 16 pixels on 16x16 texture)
23
+
24
+minetest.register_node("fishing:bobber_box", {
25
+	drawtype = "nodebox",
26
+	node_box = {
27
+		type = "fixed",
28
+		fixed = {
29
+--			{ left	, bottom , front  ,  right ,  top   ,  back  }
30
+			{-0.0625, -0.6875, -0.0625,  0.0625, -0.5625,  0.0625},	
31
+		}
32
+	},
33
+	tiles = {"fishing_bobber.png"},
34
+	groups = {not_in_creative_inventory=1},
35
+})
36
+
37
+minetest.register_node("fishing:bobber_box_ready", {
38
+	drawtype = "nodebox",
39
+	node_box = {
40
+		type = "fixed",
41
+		fixed = {
42
+--			{ left	, bottom , front  ,  right ,  top   ,  back  }
43
+			{-0.0625, -0.6875, -0.0625,  0.0625, -0.5625,  0.0625},	
44
+		}
45
+	},
46
+	tiles = {"fishing_bobber_ready.png"},
47
+	groups = {not_in_creative_inventory=1},
48
+})
49
+
50
+local FISHING_BOBBER_ENTITY={
51
+	hp_max = 605,
52
+	water_damage = 1,
53
+	physical = true,
54
+	timer = 0,
55
+	env_damage_timer = 0,
56
+	visual = "wielditem",
57
+	visual_size = {x=0.5, y=0.5, z=0.5},
58
+	textures = {"fishing:bobber_box"},
59
+	--			   { left  , bottom , front  ,  right ,  top   ,  back  }
60
+	collisionbox = {-0.125 , -0.5625, -0.125 ,  0.125 , -0.3125,  0.125 },
61
+	view_range = 7,
62
+--	DESTROY BOBBER WHEN PUNCHING IT
63
+	on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
64
+		local player = puncher:get_player_name()
65
+		if MESSAGES == true then
66
+			--minetest.chat_send_all("Your fish escaped.")
67
+			minetest.chat_send_player(player, "Your fish escaped.", false)
68
+		end
69
+		minetest.sound_play("fishing_bobber1", {
70
+			pos = self.object:getpos(),
71
+			gain = 0.5,
72
+		})
73
+		self.object:remove()
74
+	end,
75
+--	WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS	(CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)	
76
+	on_rightclick = function (self, clicker)
77
+		local item = clicker:get_wielded_item()
78
+		local player = clicker:get_player_name()
79
+		if item:get_name() == "fishing:pole" then
80
+			local inv = clicker:get_inventory()
81
+			local room_fish = inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
82
+			if self.object:get_hp() <= 300 then
83
+			if math.random(1, 100) < FISH_CHANCE then
84
+				local chance = math.random(1, 84)
85
+				if chance <= 60 then
86
+					if room_fish then
87
+						inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
88
+						if MESSAGES == true then
89
+							--minetest.chat_send_all("You caught a Fish.")
90
+							minetest.chat_send_player(player, "You caught a Fish.", false)
91
+						end
92
+					end
93
+				elseif chance <= 70 then
94
+					if minetest.get_modpath("animal_clownfish") ~= nil then
95
+						if inv:room_for_item("main", {name="animal_clownfish:clownfish", count=1, wear=0, metadata=""}) then
96
+							inv:add_item("main", {name="animal_clownfish:clownfish", count=1, wear=0, metadata=""})
97
+							if MESSAGES == true then
98
+								--minetest.chat_send_all("You caught a Clownfish.")
99
+								minetest.chat_send_player(player, "You caught a Clownfish.", false)
100
+							end
101
+						end
102
+					else
103
+						if room_fish then
104
+							inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
105
+							if MESSAGES == true then
106
+								--minetest.chat_send_all("You caught a Fish.")
107
+								minetest.chat_send_player(player, "You caught a Fish.", false)
108
+							end
109
+						end
110
+					end
111
+				elseif chance <= 80 then
112
+					if minetest.get_modpath("animal_fish_blue_white") ~= nil then
113
+						if inv:room_for_item("main", {name="animal_fish_blue_white:fish_blue_white", count=1, wear=0, metadata=""}) then
114
+							inv:add_item("main", {name="animal_fish_blue_white:fish_blue_white", count=1, wear=0, metadata=""})
115
+							if MESSAGES == true then
116
+								--minetest.chat_send_all("You caught a Blue white fish.")
117
+								minetest.chat_send_player(player, "You caught a Blue white fish.", false)
118
+							end
119
+						end
120
+					else
121
+						if room_fish then
122
+							inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
123
+							if MESSAGES == true then
124
+								--minetest.chat_send_all("You caught a Fish.")
125
+								minetest.chat_send_player(player, "You caught a Fish.", false)
126
+							end
127
+						end
128
+					end	
129
+				elseif chance == 81 then
130
+					if inv:room_for_item("main", {name="default:stick", count=1, wear=0, metadata=""}) then
131
+						inv:add_item("main", {name="default:stick", count=1, wear=0, metadata=""})
132
+						if MESSAGES == true then
133
+							--minetest.chat_send_all("You caught a Stick.")
134
+							minetest.chat_send_player(player, "You caught a Stick.", false)
135
+						end
136
+					end
137
+				elseif chance == 82 then
138
+					if minetest.get_modpath("mobs") ~= nil then
139
+						if inv:room_for_item("main", {name="mobs:rat", count=1, wear=0, metadata=""}) then
140
+							inv:add_item("main", {name="mobs:rat", count=1, wear=0, metadata=""})
141
+							if MESSAGES == true then
142
+								--minetest.chat_send_all("You caught a Rat.")
143
+								minetest.chat_send_player(player, "You caught a Rat.", false)
144
+							end
145
+						end
146
+					elseif minetest.get_modpath("animal_rat") ~= nil then
147
+						if inv:room_for_item("main", {name="animal_rat:rat", count=1, wear=0, metadata=""}) then
148
+							inv:add_item("main", {name="animal_rat:rat", count=1, wear=0, metadata=""})
149
+							if MESSAGES == true then
150
+								--minetest.chat_send_all("You caught a Rat.")
151
+								minetest.chat_send_player(player, "You caught a Rat.", false)
152
+							end
153
+						end
154
+					else
155
+						if inv:room_for_item("main", {name="rat", count=1, wear=0, metadata=""}) then
156
+							inv:add_item("main", {name="rat", count=1, wear=0, metadata=""})
157
+							if MESSAGES == true then
158
+								--minetest.chat_send_all("You caught a Rat.")
159
+								minetest.chat_send_player(player, "You caught a Rat.", false)
160
+							end
161
+						end
162
+					end
163
+				end
164
+				elseif chance == 83 then
165
+					if minetest.get_modpath("flowers_plus") ~= nil then
166
+						if inv:room_for_item("main", {name="flowers:seaweed", count=1, wear=0, metadata=""}) then
167
+							inv:add_item("main", {name="flowers:seaweed", count=1, wear=0, metadata=""})
168
+							if MESSAGES == true then
169
+								--minetest.chat_send_all("You caught a Clownfish.")
170
+								minetest.chat_send_player(player, "You caught some Seaweed.", false)
171
+							end
172
+						end
173
+					else
174
+					if room_fish then
175
+						inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
176
+						if MESSAGES == true then
177
+							--minetest.chat_send_all("You caught a Fish.")
178
+							minetest.chat_send_player(player, "You caught a Fish.", false)
179
+						end
180
+					end
181
+				end
182
+				elseif chance == 84 then
183
+					if minetest.get_modpath("seaplants") ~= nil then
184
+						if inv:room_for_item("main", {name="seaplants:leavysnackgreen", count=1, wear=0, metadata=""}) then
185
+							inv:add_item("main", {name="seaplants:leavysnackgreen", count=1, wear=0, metadata=""})
186
+							if MESSAGES == true then
187
+								--minetest.chat_send_all("You caught a Clownfish.")
188
+								minetest.chat_send_player(player, "You caught a Leavy Snack.", false)
189
+							end
190
+						end
191
+					else
192
+					if room_fish then
193
+						inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
194
+						if MESSAGES == true then
195
+							--minetest.chat_send_all("You caught a Fish.")
196
+							minetest.chat_send_player(player, "You caught a Fish.", false)
197
+						end
198
+					end
199
+				end
200
+			else 
201
+				if MESSAGES == true then
202
+					--minetest.chat_send_all("Your fish escaped.")
203
+					minetest.chat_send_player(player, "Your fish escaped.", false)
204
+				end			
205
+			end
206
+			else 
207
+			if MESSAGES == true then
208
+				--minetest.chat_send_all("Your fish escaped.")
209
+				minetest.chat_send_player(player, "Your fish escaped.", false)
210
+			end
211
+			end
212
+		else 
213
+			if MESSAGES == true then
214
+				--minetest.chat_send_all("Your fish escaped.")
215
+				minetest.chat_send_player(player, "Your fish escaped.", false)
216
+			end			
217
+		end
218
+		minetest.sound_play("fishing_bobber1", {
219
+			pos = self.object:getpos(),
220
+			gain = 0.5,
221
+		})
222
+		self.object:remove()
223
+	end,
224
+-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
225
+	on_step = function(self, dtime)
226
+		local pos = self.object:getpos()
227
+		if BOBBER_CHECK_RADIUS > 0 then
228
+			local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, BOBBER_CHECK_RADIUS)
229
+			for k, obj in pairs(objs) do
230
+				if obj:get_luaentity() ~= nil then
231
+					if obj:get_luaentity().name == "fishing:bobber_entity" then
232
+						if obj:get_luaentity() ~= self then
233
+							self.object:remove()
234
+						end
235
+					end
236
+				end
237
+			end
238
+		end
239
+		if math.random(1, 4) == 1 then
240
+			self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
241
+		end
242
+		for _,player in pairs(minetest.get_connected_players()) do
243
+			local s = self.object:getpos()
244
+			local p = player:getpos()
245
+			local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
246
+			if dist > self.view_range then
247
+				minetest.sound_play("fishing_bobber1", {
248
+					pos = self.object:getpos(),
249
+					gain = 0.5,
250
+				})
251
+				self.object:remove()
252
+			end
253
+		end	
254
+		local do_env_damage = function(self)
255
+			self.object:set_hp(self.object:get_hp()-self.water_damage)
256
+			--local pos = self.object:getpos()
257
+			if self.object:get_hp() == 600 then
258
+				self.object:moveto({x=pos.x,y=pos.y-0.03125,z=pos.z})
259
+			elseif self.object:get_hp() == 595 then
260
+				self.object:moveto({x=pos.x,y=pos.y+0.03125,z=pos.z})
261
+			elseif self.object:get_hp() == 590 then
262
+				self.object:moveto({x=pos.x,y=pos.y+0.03125,z=pos.z})
263
+			elseif self.object:get_hp() == 585 then
264
+				self.object:moveto({x=pos.x,y=pos.y-0.03125,z=pos.z})
265
+				self.object:set_hp(self.object:get_hp()-(math.random(1, 200)))
266
+			elseif self.object:get_hp() == 300 then
267
+				minetest.sound_play("fishing_bobber1", {
268
+					pos = self.object:getpos(),
269
+					gain = 0.5,
270
+				})
271
+				if BOBBER_COLOR_CHANGE == true then
272
+					self.object:set_properties({
273
+						textures = {"fishing:bobber_box_ready"},
274
+					})
275
+				end
276
+				self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
277
+			elseif self.object:get_hp() == 295 then
278
+				self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
279
+			elseif self.object:get_hp() == 290 then
280
+				self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
281
+			elseif self.object:get_hp() == 285 then
282
+				self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
283
+			elseif self.object:get_hp() < 284 then	
284
+				self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
285
+			elseif self.object:get_hp() == 0 then
286
+				minetest.sound_play("fishing_bobber1", {
287
+					pos = self.object:getpos(),
288
+					gain = 0.5,
289
+				})
290
+				self.object:remove()
291
+			end
292
+		end
293
+		do_env_damage(self)
294
+	end,
295
+}
296
+
297
+minetest.register_entity("fishing:bobber_entity", FISHING_BOBBER_ENTITY)
298
+
299
+
0 300
new file mode 100644
... ...
@@ -0,0 +1,69 @@
1
+-----------------------------------------------------------------------------------------------
2
+-- Fishing - Mossmanikin's version - Recipes 0.0.5
3
+-----------------------------------------------------------------------------------------------
4
+-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
5
+-- this version by Mossmanikin
6
+-- License (code & textures): 	WTFPL
7
+-- Contains code from: 		animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
8
+-- Looked at code from:
9
+-- Dependencies: 			default, farming
10
+-- Supports:				animal_clownfish, animal_fish_blue_white, animal_rat, mobs
11
+-----------------------------------------------------------------------------------------------
12
+
13
+-----------------------------------------------------------------------------------------------
14
+-- Fishing Pole
15
+-----------------------------------------------------------------------------------------------
16
+-- mc style
17
+minetest.register_craft({
18
+	output = "fishing:pole",
19
+	recipe = { 
20
+		{"", 				"",					"default:stick"	},
21
+		{"", 				"default:stick",	"farming:string"},
22
+		{"default:stick",	"",					"farming:string"},
23
+	}
24
+})
25
+
26
+minetest.register_craft({
27
+	output = "fishing:pole",
28
+	recipe = { 
29
+		{"", 				"",					"default:stick"  },
30
+		{"", 				"default:stick",	"moreblocks:rope"},
31
+		{"default:stick",	"",					"moreblocks:rope"},
32
+	}
33
+})
34
+
35
+minetest.register_craft({
36
+	output = "fishing:pole",
37
+	recipe = { 
38
+		{"", 				"",					"default:stick"	},
39
+		{"", 				"default:stick",	"ropes:rope"   	},
40
+		{"default:stick",	"",					"ropes:rope"   	},
41
+	}
42
+})
43
+
44
+
45
+-----------------------------------------------------------------------------------------------
46
+-- Fish
47
+-----------------------------------------------------------------------------------------------
48
+minetest.register_craft({
49
+	type = "cooking",
50
+	output = "fishing:fish",
51
+	recipe = "fishing:fish_raw",
52
+	cooktime = 2,
53
+})
54
+
55
+-----------------------------------------------------------------------------------------------
56
+-- Sushi
57
+-----------------------------------------------------------------------------------------------
58
+minetest.register_craft({
59
+	type = "shapeless",
60
+	output = "fishing:sushi",
61
+	recipe = {"fishing:fish_raw","flowers:seaweed"},
62
+})
63
+
64
+minetest.register_craft({
65
+	type = "shapeless",
66
+	output = "fishing:sushi",
67
+	recipe = {"fishing:fish_raw","seaplants:leavysnackgreen"},
68
+})
69
+
0 70
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+default
2
+farming
0 3
new file mode 100644
... ...
@@ -0,0 +1,30 @@
1
+-----------------------------------------------------------------------------------------------
2
+-- Fish
3
+-----------------------------------------------------------------------------------------------
4
+minetest.register_craftitem("fishing:fish_raw", {
5
+	description = "Fish",
6
+    groups = {},
7
+    inventory_image = "fishing_fish.png",
8
+	 on_use = minetest.item_eat(2),
9
+})
10
+
11
+-----------------------------------------------------------------------------------------------
12
+-- Roasted Fish
13
+-----------------------------------------------------------------------------------------------
14
+minetest.register_craftitem("fishing:fish", {
15
+	description = "Roasted Fish",
16
+    groups = {},
17
+    inventory_image = "fishing_fish_cooked.png",
18
+	 on_use = minetest.item_eat(4),
19
+})
20
+
21
+-----------------------------------------------------------------------------------------------
22
+-- Sushi
23
+-----------------------------------------------------------------------------------------------
24
+minetest.register_craftitem("fishing:sushi", {
25
+	description = "Sushi (Hoso Maki)",
26
+    groups = {},
27
+    inventory_image = "fishing_sushi.png",
28
+	 on_use = minetest.item_eat(8),
29
+})
30
+
0 31
new file mode 100644
... ...
@@ -0,0 +1,309 @@
1
+-----------------------------------------------------------------------------------------------
2
+local title		= "Fishing - Mossmanikin's version"
3
+local version 	= "0.1.2-LGN"
4
+local mname		= "fishing"
5
+-----------------------------------------------------------------------------------------------
6
+-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
7
+-- this version by Mossmanikin
8
+-- License (code & textures): 			WTFPL (exception below)
9
+--   except for: "fishing_fish_cooked.png" contributed by Tirifto,
10
+--   released into public domain under CC0.
11
+-- Contains code from: 		animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
12
+-- Looked at code from:		default, farming
13
+-- Dependencies: 			default
14
+-- Supports:				animal_clownfish, animal_fish_blue_white, animal_rat, mobs
15
+-----------------------------------------------------------------------------------------------
16
+
17
+-- todo: 	item wear 											done
18
+--			automatic re-baiting option 						done
19
+--			different types of fish, 							sort of
20
+--			add sound											done
21
+--			bobber												done
22
+--			change rainworms filling inv & make 'em disappear 	done
23
+
24
+--			placable fishing rod for decoration					done
25
+--			make bobber move slowly while fish on hook			done
26
+-- 			catch bigger fish with smaller
27
+--			change color of bobber when fish on hook			done
28
+
29
+-----------------------------------------------------------------------------------------------
30
+
31
+dofile(minetest.get_modpath("fishing").."/settings.txt")
32
+dofile(minetest.get_modpath("fishing").."/bobber.lua")
33
+dofile(minetest.get_modpath("fishing").."/crafting.lua")
34
+dofile(minetest.get_modpath("fishing").."/fishes.lua")
35
+dofile(minetest.get_modpath("fishing").."/worm.lua")
36
+
37
+-----------------------------------------------------------------------------------------------
38
+-- Fishing Pole
39
+-----------------------------------------------------------------------------------------------
40
+
41
+local function rod_wear(itemstack, user, pointed_thing, uses)
42
+	itemstack:add_wear(65535/(uses-1))
43
+	return itemstack
44
+end
45
+
46
+minetest.register_tool("fishing:pole", {
47
+
48
+	description = "Fishing Pole",
49
+	groups = {},
50
+	inventory_image = "fishing_pole.png",
51
+	wield_image = "fishing_pole.png^[transformFXR270",
52
+	stack_max = 1,
53
+	liquids_pointable = true,
54
+	on_use = function (itemstack, user, pointed_thing)
55
+		if pointed_thing and pointed_thing.under then
56
+			local pt = pointed_thing
57
+			local node = minetest.env:get_node(pt.under)
58
+			if string.find(node.name, "default:water") then
59
+				local player = user:get_player_name()
60
+				local inv = user:get_inventory()
61
+				if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:bait_worm" then
62
+					inv:remove_item("main", "fishing:bait_worm")
63
+					minetest.sound_play("fishing_bobber2", {
64
+						pos = pt.under,
65
+						gain = 0.5,
66
+					})
67
+					minetest.env:add_entity({interval = 1,x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, "fishing:bobber_entity")
68
+					
69
+					if WEAR_OUT == true then
70
+						return rod_wear(itemstack, user, pointed_thing, 30)	
71
+					else
72
+						return {name="fishing:pole", count=1, wear=0, metadata=""}
73
+					end
74
+				end
75
+			end
76
+		end
77
+		return nil
78
+	end,
79
+	on_place = function(itemstack, placer, pointed_thing)
80
+		local pt = pointed_thing
81
+		if minetest.get_node(pt.under).name~="default:water_source" and minetest.get_node(pt.under).name~="default:water_flowing" then
82
+			local wear = itemstack:get_wear()
83
+			local direction = minetest.dir_to_facedir(placer:get_look_dir())
84
+			local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y  , z=pt.under.z})
85
+			local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
86
+			minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="fishing:pole_deco", param2=direction})
87
+			meta1:set_int("wear", wear)
88
+			meta2:set_int("wear", wear)
89
+			itemstack:take_item()
90
+		end
91
+		return itemstack
92
+	end,
93
+})
94
+
95
+if SIMPLE_DECO_FISHING_POLE == true then
96
+minetest.register_node("fishing:pole_deco", {
97
+	description = "Fishing Pole",
98
+	drawtype = "nodebox",
99
+	paramtype = "light",
100
+	paramtype2 = "facedir",
101
+	tiles = {
102
+		"fishing_pole_top.png", "fishing_pole_bottom.png", "fishing_pole.png", "fishing_pole.png^[transformFX", "fishing_pole_front.png", "fishing_pole_back.png",
103
+	},
104
+	groups = {
105
+		snappy=3,
106
+		flammable=2,
107
+		not_in_creative_inventory=1
108
+	},
109
+	node_box = {
110
+		type = "fixed",
111
+		fixed = {
112
+			{-0.5/3, -1.5/3, -1.5/3, 0.5/3, -0.5/3, -0.5/3},{-0.5/3, -0.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3},{-0.5/3, 0.5/3, 0.5/3, 0.5/3, 1.5/3, 1.5/3},{-0.5/3, -1.5/3, 0.5/3, 0.5/3, 0.5/3, 1.5/3},
113
+		}
114
+	},
115
+	selection_box = {
116
+		type = "fixed",
117
+		fixed = {
118
+			{-0.5/3, -1.5/3, -1.5/3, 0.5/3, -0.5/3, -0.5/3},{-0.5/3, -0.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3},{-0.5/3, 0.5/3, 0.5/3, 0.5/3, 1.5/3, 1.5/3},{-0.5/3, -1.5/3, 0.5/3, 0.5/3, 0.5/3, 1.5/3},
119
+		}
120
+	},
121
+	sounds = default.node_sound_wood_defaults(),
122
+	on_dig = function(pos, node, digger)
123
+		if digger:is_player() and digger:get_inventory() then
124
+			local meta = minetest.env:get_meta(pos)
125
+			local wear_out = meta:get_int("wear")
126
+			digger:get_inventory():add_item("main", {name="fishing:pole", count=1, wear=wear_out, metadata=""})
127
+		end
128
+		minetest.remove_node(pos)
129
+	end,
130
+})
131
+
132
+else
133
+minetest.register_node("fishing:pole_deco", {
134
+	description = "Fishing Pole",
135
+	inventory_image = "fishing_pole.png",
136
+	wield_image = "fishing_pole.png^[transformFXR270",
137
+	drawtype = "nodebox",
138
+	paramtype = "light",
139
+	paramtype2 = "facedir",
140
+	tiles = {
141
+		"fishing_pole_top.png",
142
+		"fishing_pole_bottom.png",
143
+		"fishing_pole_deco.png", -- right
144
+		"fishing_pole_deco.png^[transformFX", -- left
145
+		"fishing_pole_back.png",
146
+		"fishing_pole_front.png"
147
+	},
148
+	node_box = {
149
+		type = "fixed",
150
+--			{ left	, bottom , front  ,  right ,  top   ,  back  }
151
+		fixed = {
152
+			{-1/32  , -1/16  , 14/16  , 1/32   ,  6/16  , 15/16},
153
+			{-1/32  , -3/16  , 13/16  , 1/32   , -1/16  , 14/16},
154
+			{-1/32  , -4/16  , 12/16  , 1/32   , -3/16  , 13/16},
155
+			{-1/32  , -5/16  , 11/16  , 1/32   , -4/16  , 12/16},
156
+			{-1/32  , -6/16  ,  9/16  , 1/32   , -5/16  , 11/16},
157
+			{-1/32  , -5/16  ,  9/16  , 1/32   , -4/16  , 10/16},
158
+			-- stick
159
+			{-1/32  ,  6/16  , 12/16  , 1/32   ,  7/16  , 15/16}, -- top
160
+			{-1/32  ,  5/16  , 11/16  , 1/32   ,  7/16  , 12/16},
161
+			{-1/32  ,  5/16  , 10/16  , 1/32   ,  6/16  , 11/16},
162
+			{-1/32  ,  4/16  ,  9/16  , 1/32   ,  6/16  , 10/16},
163
+			{-1/32  ,  3/16  ,  8/16  , 1/32   ,  5/16  ,  9/16},
164
+			{-1/32  ,  2/16  ,  7/16  , 1/32   ,  4/16  ,  8/16},
165
+			{-1/32  ,  1/16  ,  6/16  , 1/32   ,  3/16  ,  7/16},
166
+			{-1/32  ,  0     ,  5/16  , 1/32   ,  2/16  ,  6/16},
167
+			{-1/32  , -2/16  ,  4/16  , 1/32   ,  1/16  ,  5/16},
168
+			{-1/32  , -3/16  ,  3/16  , 1/32   ,  0     ,  4/16},
169
+			{-1/32  , -5/16  ,  2/16  , 1/32   , -1/16  ,  3/16},
170
+			{-1/32  , -7/16  ,  1/16  , 1/32   , -3/16  ,  2/16},
171
+			{-1/32  , -1/2   ,  0     , 1/32   , -5/16  ,  1/16}, -- bottom
172
+		}
173
+	},
174
+	selection_box = {
175
+		type = "fixed",
176
+		fixed = {
177
+			{-1/16  , -1/2   ,  0     , 1/16   ,  1/2   ,  1   },
178
+		}
179
+	},
180
+	groups = {
181
+		snappy=3,
182
+		flammable=2,
183
+		not_in_creative_inventory=1
184
+	},
185
+	sounds = default.node_sound_wood_defaults(),
186
+	on_dig = function(pos, node, digger)
187
+		if digger:is_player() and digger:get_inventory() then
188
+			local meta = minetest.env:get_meta(pos)
189
+			local wear_out = meta:get_int("wear")
190
+			digger:get_inventory():add_item("main", {name="fishing:pole", count=1, wear=wear_out, metadata=""})
191
+		end
192
+		minetest.remove_node(pos)
193
+	end,
194
+})
195
+
196
+end
197
+-----------------------------------------------------------------------------------------------
198
+-- GETTING WORMS
199
+-----------------------------------------------------------------------------------------------
200
+-- get worms from digging in dirt:
201
+if NEW_WORM_SOURCE == false then
202
+
203
+minetest.register_node(":default:dirt", {
204
+	description = "Dirt",
205
+	tiles = {"default_dirt.png"},
206
+	is_ground_content = true,
207
+	groups = {crumbly=3},
208
+	sounds = default.node_sound_dirt_defaults(),
209
+ 	after_dig_node = function (pos, oldnode, oldmetadata, digger)
210
+ 		if math.random(1, 100) < WORM_CHANCE then
211
+			local tool_in_use = digger:get_wielded_item():get_name()
212
+			if tool_in_use == "" or tool_in_use == "default:dirt" then
213
+				minetest.env:add_entity({x = pos.x, y = pos.y+0.4, z = pos.z}, "fishing:bait_worm_entity")
214
+				--local inv = digger:get_inventory()
215
+ 				--if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
216
+ 					--inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
217
+ 				--end
218
+ 			end
219
+ 		end
220
+ 	end,
221
+})
222
+
223
+else
224
+-- get worms from digging with hoes:
225
+
226
+-- turns nodes with group soil=1 into soil
227
+local function hoe_on_use(itemstack, user, pointed_thing, uses)
228
+	local pt = pointed_thing
229
+	-- check if pointing at a node
230
+	if not pt then
231
+		return
232
+	end
233
+	if pt.type ~= "node" then
234
+		return
235
+	end
236
+	
237
+	local under = minetest.get_node(pt.under)
238
+	local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
239
+	local above = minetest.get_node(p)
240
+	
241
+	-- return if any of the nodes is not registered
242
+	if not minetest.registered_nodes[under.name] then
243
+		return
244
+	end
245
+	if not minetest.registered_nodes[above.name] then
246
+		return
247
+	end
248
+	
249
+	-- check if the node above the pointed thing is air
250
+	if above.name ~= "air" then
251
+		return
252
+	end
253
+	
254
+	-- check if pointing at dirt
255
+	if minetest.get_item_group(under.name, "soil") ~= 1 then
256
+		return
257
+	end
258
+	
259
+	-- turn the node into soil, play sound, get worm and wear out item
260
+	minetest.set_node(pt.under, {name="farming:soil"})
261
+	minetest.sound_play("default_dig_crumbly", {
262
+		pos = pt.under,
263
+		gain = 0.5,
264
+	})
265
+	--local inv = user:get_inventory()
266
+	if math.random(1, 100) < WORM_CHANCE then
267
+		minetest.env:add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")
268
+		--if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
269
+			--inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
270
+		--end
271
+	end
272
+	itemstack:add_wear(65535/(uses-1))
273
+	return itemstack
274
+end
275
+
276
+-- didn't change the hoes, just here because hoe_on_use is local
277
+minetest.register_tool(":farming:hoe_wood", {
278
+	description = "Wooden Hoe",
279
+	inventory_image = "farming_tool_woodhoe.png",
280
+	on_use = function(itemstack, user, pointed_thing)
281
+		return hoe_on_use(itemstack, user, pointed_thing, 30)
282
+	end,
283
+})
284
+minetest.register_tool(":farming:hoe_stone", {
285
+	description = "Stone Hoe",
286
+	inventory_image = "farming_tool_stonehoe.png",
287
+	on_use = function(itemstack, user, pointed_thing)
288
+		return hoe_on_use(itemstack, user, pointed_thing, 90)
289
+	end,
290
+})
291
+minetest.register_tool(":farming:hoe_steel", {
292
+	description = "Steel Hoe",
293
+	inventory_image = "farming_tool_steelhoe.png",
294
+	on_use = function(itemstack, user, pointed_thing)
295
+		return hoe_on_use(itemstack, user, pointed_thing, 200)
296
+	end,
297
+})
298
+minetest.register_tool(":farming:hoe_bronze", {
299
+	description = "Bronze Hoe",
300
+	inventory_image = "farming_tool_bronzehoe.png",
301
+	on_use = function(itemstack, user, pointed_thing)
302
+		return hoe_on_use(itemstack, user, pointed_thing, 220)
303
+	end,
304
+})
305
+
306
+end
307
+-----------------------------------------------------------------------------------------------
308
+print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
309
+-----------------------------------------------------------------------------------------------
0 310
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+MESSAGES = true
2
+FISH_CHANCE = 70
3
+NEW_WORM_SOURCE = false
4
+WORM_CHANCE = 60
5
+WEAR_OUT = true
6
+BOBBER_CHECK_RADIUS = 5
7
+BOBBER_COLOR_CHANGE = true
8
+SIMPLE_DECO_FISHING_POLE = true
0 9
new file mode 100644
... ...
@@ -0,0 +1,4 @@
1
+These sounds are used for the Mod for Minetest; Fishing - Mossmanikin's version.
2
+The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/ 
3
+
4
+--"fishing_bobber1" & "fishing_bobber2" sampled from "01260 water swimming splashing 1.wav", Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/
0 5
\ No newline at end of file
1 6
new file mode 100644
2 7
Binary files /dev/null and b/mods/fishing/sounds/fishing_bobber1.ogg differ
3 8
new file mode 100644
4 9
Binary files /dev/null and b/mods/fishing/sounds/fishing_bobber2.ogg differ
5 10
new file mode 100644
6 11
Binary files /dev/null and b/mods/fishing/textures/alternates/fishing_bobber.png differ
7 12
new file mode 100644
8 13
Binary files /dev/null and b/mods/fishing/textures/alternates/fishing_pole.png differ
9 14
new file mode 100644
10 15
Binary files /dev/null and b/mods/fishing/textures/fishing_bobber.png differ
11 16
new file mode 100644
12 17
Binary files /dev/null and b/mods/fishing/textures/fishing_bobber_ready.png differ
13 18
new file mode 100644
14 19
Binary files /dev/null and b/mods/fishing/textures/fishing_fish.png differ
15 20
new file mode 100644
16 21
Binary files /dev/null and b/mods/fishing/textures/fishing_fish_cooked.png differ
17 22
new file mode 100644
18 23
Binary files /dev/null and b/mods/fishing/textures/fishing_pole.png differ
19 24
new file mode 100644
20 25
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_back.png differ
21 26
new file mode 100644
22 27
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_bottom.png differ
23 28
new file mode 100644
24 29
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_deco.png differ
25 30
new file mode 100644
26 31
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_front.png differ
27 32
new file mode 100644
28 33
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_on_use.png differ
29 34
new file mode 100644
30 35
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_simple.png differ
31 36
new file mode 100644
32 37
Binary files /dev/null and b/mods/fishing/textures/fishing_pole_top.png differ
33 38
new file mode 100644
34 39
Binary files /dev/null and b/mods/fishing/textures/fishing_sushi.png differ
35 40
new file mode 100644
36 41
Binary files /dev/null and b/mods/fishing/textures/fishing_worm.png differ
37 42
new file mode 100644
38 43
Binary files /dev/null and b/mods/fishing/textures/old/fishing_pole_wield.png differ
39 44
new file mode 100644
... ...
@@ -0,0 +1,118 @@
1
+-----------------------------------------------------------------------------------------------
2
+-- Fishing - Mossmanikin's version - Worm 0.0.2
3
+-----------------------------------------------------------------------------------------------
4
+-- License (code & textures): 	WTFPL
5
+-- Contains code from: 		fishing (original), mobs
6
+-- Looked at code from:		my_mobs
7
+-- Dependencies: 			default
8
+-----------------------------------------------------------------------------------------------
9
+-----------------------------------------------------------------------------------------------
10
+-- WORM ITEM
11
+-----------------------------------------------------------------------------------------------
12
+minetest.register_craftitem("fishing:bait_worm", {
13
+	description = "Worm",
14
+    groups = { fishing_bait=1 },
15
+    inventory_image = "fishing_worm.png",
16
+	on_use = minetest.item_eat(1),
17
+	on_place = function(itemstack, placer, pointed_thing)
18
+		local pt = pointed_thing
19
+		minetest.env:add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity")
20
+		itemstack:take_item()
21
+		return itemstack
22
+	end,
23
+	on_drop = function(itemstack, dropper, pos)
24
+		minetest.env:add_entity({x = pos.x, y = pos.y, z = pos.z}, "fishing:bait_worm_entity")
25
+		itemstack:take_item()
26
+		return itemstack
27
+	end,
28
+})
29
+
30
+-----------------------------------------------------------------------------------------------
31
+-- WORM MOB
32
+-----------------------------------------------------------------------------------------------
33
+minetest.register_entity("fishing:bait_worm_entity", {
34
+	hp_max = 300,
35
+	damage_over_time = 1,
36
+	collisionbox = {-3/16, -3/16, -3/16, 3/16, 3/16, 3/16},
37
+	visual = "sprite",
38
+	visual_size = {x=1/2, y=1/2},
39
+	textures = { "fishing_worm.png", "fishing_worm.png"},
40
+	view_range = 32,
41
+	-- Don't punch this poor creature...
42
+	on_punch = function(self, puncher)
43
+		self.object:remove()
44
+	end,
45
+	-- ...softly take it into your hand.
46
+	on_rightclick = function(self, clicker)
47
+		if clicker:is_player() and clicker:get_inventory() then
48
+			clicker:get_inventory():add_item("main", "fishing:bait_worm")
49
+			self.object:remove()
50
+		end
51
+	end,
52
+	-- AI :D
53
+	on_step = function(self, dtime)
54
+		local pos = self.object:getpos()
55
+		local n = minetest.env:get_node({x=pos.x,y=pos.y-0.3,z=pos.z})
56
+		-- despawn when no player in range
57
+		for _,player in pairs(minetest.get_connected_players()) do
58
+			local s = self.object:getpos()
59
+			local p = player:getpos()
60
+			local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
61
+			if dist > self.view_range then
62
+				self.object:remove()
63
+			end
64
+		end	
65
+		-- move in world
66
+		local look_whats_up = function(self)
67
+			self.object:set_hp(self.object:get_hp()-self.damage_over_time) -- creature is getting older
68
+			if n.name == "air" then -- fall when in air
69
+				self.object:moveto({x=pos.x,y=pos.y-0.5,z=pos.z})
70
+				self.object:set_hp(self.object:get_hp()-75)
71
+				
72
+			--if n.name == "snappy" then -- fall when leaves or similar
73
+			elseif minetest.get_item_group(n.name, "snappy") ~= 0 then
74
+				self.object:moveto({x=pos.x+(0.001*(math.random(-32, 32))),y=pos.y-(0.001*(math.random(0, 64))),z=pos.z+(0.001*(math.random(-32, 32)))})
75
+				
76
+				
77
+			elseif string.find(n.name, "default:water") then -- sink when in water
78
+				self.object:moveto({x=pos.x,y=pos.y-0.25,z=pos.z})
79
+				self.object:set_hp(self.object:get_hp()-37)
80
+			
81
+			elseif minetest.get_item_group(n.name, "soil") ~= 0 then
82
+				if minetest.get_item_group(minetest.env:get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then
83
+					self.object:set_hp(199)
84
+				elseif self.object:get_hp() > 200 then -- leave dirt to see whats going on
85
+					self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y+0.003,z=pos.z+(0.001*(math.random(-2, 2)))})
86
+				elseif self.object:get_hp() < 199 then -- no rain here, let's get outa here
87
+					self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y-0.001,z=pos.z+(0.001*(math.random(-2, 2)))})
88
+				elseif self.object:get_hp() == 0 then
89
+					self.object:remove()
90
+				end
91
+			else -- check if there's dirt anywhere (not finished)
92
+				local check_group = minetest.get_item_group
93
+				local goal_01 = check_group(minetest.env:get_node({x = pos.x + 1, y = pos.y-0.4, z = pos.z	  }).name, "soil")
94
+				local goal_02 = check_group(minetest.env:get_node({x = pos.x, 	  y = pos.y-0.4, z = pos.z + 1}).name, "soil")
95
+				local goal_03 = check_group(minetest.env:get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z	  }).name, "soil")
96
+				local goal_04 = check_group(minetest.env:get_node({x = pos.x, 	  y = pos.y-0.4, z = pos.z - 1}).name, "soil")
97
+				
98
+				local goal_1a = check_group(minetest.env:get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z	  }).name, "soil")
99
+				local goal_2a = check_group(minetest.env:get_node({x = pos.x, 	  y = pos.y+0.6, z = pos.z + 1}).name, "soil")
100
+				local goal_3a = check_group(minetest.env:get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z	  }).name, "soil")
101
+				local goal_4a = check_group(minetest.env:get_node({x = pos.x, 	  y = pos.y+0.6, z = pos.z - 1}).name, "soil")
102
+				-- if there's dirt nearby, go there
103
+				if     goal_01 ~= 0 or goal_1a ~= 0 then
104
+					self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})	
105
+				elseif goal_02 ~= 0 or goal_2a ~= 0 then
106
+					self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z+0.002})	
107
+				elseif goal_03 ~= 0 or goal_3a ~= 0 then
108
+					self.object:moveto({x=pos.x-0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})	
109
+				elseif goal_04 ~= 0 or goal_4a ~= 0 then
110
+					self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z-0.002})	
111
+				else -- I'm lost, no dirt
112
+					self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})	
113
+				end
114
+			end	
115
+		end
116
+		look_whats_up(self)
117
+	end,
118
+})
0 119
\ No newline at end of file
1 120
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+*~
2
+
0 3
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+[submodule "src/LuaIRC"]
2
+	path = irc
3
+	url = https://github.com/ShadowNinja/LuaIRC.git
0 4
new file mode 100644
... ...
@@ -0,0 +1,14 @@
1
+
2
+allow_defined_top = true
3
+
4
+read_globals = {
5
+	"minetest",
6
+}
7
+
8
+exclude_files = {
9
+	"irc/*",
10
+}
11
+
12
+globals = {
13
+	"irc",
14
+}
0 15
new file mode 100644
... ...
@@ -0,0 +1,90 @@
1
+IRC Mod API
2
+===========
3
+
4
+This file documents the Minetest IRC mod API.
5
+
6
+Basics
7
+------
8
+
9
+In order to allow your mod to interface with this mod, you must add `irc`
10
+to your mod's `depends.txt` file.
11
+
12
+
13
+Reference
14
+---------
15
+
16
+irc.say([name,] message)
17
+Sends <message> to either the channel (if <name> is nil or not specified),
18
+or to the given user (if <name> is specified).
19
+Example:
20
+	irc.say("Hello, Channel!")
21
+	irc.say("john1234", "How are you?")
22
+
23
+irc.register_bot_command(name, cmdDef)
24
+	Registers a new bot command named <name>.
25
+	When an user sends a private message to the bot with the command name, the
26
+	command's function is called.
27
+	Here's the format of a command definition (<cmdDef>):
28
+		cmdDef = {
29
+			params = "<param1> ...",      -- A description of the command's parameters
30
+			description = "My command",   -- A description of what the command does. (one-liner)
31
+			func = function(user, args)
32
+				-- This function gets called when the command is invoked.
33
+				-- <user> is a user table for the user that ran the command.
34
+				--   (See the LuaIRC documentation for details.)
35
+				--   It contains fields such as 'nick' and 'ident'
36
+				-- <args> is a string of arguments to the command (may be "")
37
+				-- This function should return boolean success and a message.
38
+			end,
39
+		};
40
+	Example:
41
+		irc.register_bot_command("hello", {
42
+			params = "",
43
+			description = "Greet user",
44
+			func = function(user, param)
45
+				return true, "Hello!"
46
+			end,
47
+		});
48
+
49
+irc.joined_players[name]
50
+	This table holds the players who are currently on the channel (may be less
51
+	than the players in the game). It is modified by the /part and /join chat
52
+	commands.
53
+	Example:
54
+	if irc.joined_players["joe"] then
55
+		-- Joe is talking on IRC
56
+	end
57
+
58
+irc.register_hook(name, func)
59
+	Registers a function to be called when an event happens. <name> is the name
60
+	of the event, and <func> is the function to be called. See HOOKS below
61
+	for more information
62
+	Example:
63
+	irc.register_hook("OnSend", function(line)
64
+		print("SEND: "..line)
65
+	end)
66
+
67
+This mod also supplies some utility functions:
68
+
69
+string.expandvars(string, vars)
70
+	Expands all occurrences of the pattern "$(varname)" with the value of
71
+	'varname' in the <vars> table. Variable names not found on the table
72
+	are left verbatim in the string.
73
+	Example:
74
+	local tpl = "$(foo) $(bar) $(baz)"
75
+	local s = tpl:expandvars({foo=1, bar="Hello"})
76
+	assert(s == "1 Hello $(baz)") 
77
+
78
+In addition, all the configuration options decribed in `README.txt` are
79
+available to other mods, though they should be considered read-only. Do
80
+not modify these settings at runtime or you might crash the server!
81
+
82
+
83
+Hooks
84
+-----
85
+
86
+The `irc.register_hook` function can register functions to be called
87
+when some events happen. The events supported are the same as the LuaIRC
88
+ones with a few added (mostly for internal use).
89
+See src/LuaIRC/doc/irc.luadoc for more information.
90
+
0 91
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+Copyright (c) 2013, Diego Martinez (kaeza)
2
+All rights reserved.
3
+
4
+Redistribution and use in source and binary forms, with or without
5
+modification, are permitted provided that the following conditions are met:
6
+ - Redistributions of source code must retain the above copyright notice,
7
+   this list of conditions and the following disclaimer.
8
+ - Redistributions in binary form must reproduce the above copyright notice,
9
+   this list of conditions and the following disclaimer in the documentation
10
+   and/or other materials provided with the distribution.
11
+
12
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
16
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+
0 23
new file mode 100644
... ...
@@ -0,0 +1,181 @@
1
+
2
+IRC Mod for Minetest
3
+====================
4
+
5
+Introduction
6
+------------
7
+
8
+This mod is just a glue between IRC and Minetest. It provides two-way
9
+ communication between the in-game chat, and an arbitrary IRC channel.
10
+
11
+The forum topic is [here][forum].
12
+
13
+[forum]: https://forum.minetest.net/viewtopic.php?f=11&t=3905
14
+
15
+
16
+Installing
17
+----------
18
+
19
+Quick one line install for Linux:
20
+
21
+	cd <Mods directory> && git clone --recursive https://github.com/minetest-mods/irc.git
22
+
23
+Please change `<Mods directory>` to fit your installation of Minetest.
24
+For more information, see [the wiki][wiki].
25
+
26
+The IRC mod's git repository uses submodules, therefore you will have to run
27
+`git submodule init` when first installing the mod (unless you used
28
+`--recursive` as above), and `git submodule update` every time that a submodule
29
+is updated. These steps can be combined into `git submodule update --init`.
30
+
31
+You'll need to install LuaSocket. You can do so with your package manager on
32
+many distributions, for example:
33
+
34
+	# # On Arch Linux:
35
+	# pacman -S lua51-socket
36
+	# # On Debian/Ubuntu:
37
+	# # Debian/Ubuntu's LuaSocket packages are broken, so use LuaRocks.
38
+	# apt-get install luarocks
39
+	# luarocks install luasocket
40
+
41
+You will also need to add IRC to your trusted mods if you haven't disabled mod
42
+security. Here's an example configuration line:
43
+
44
+	secure.trusted_mods = irc
45
+
46
+[wiki]: https://wiki.minetest.net/Installing_mods
47
+
48
+
49
+Settings
50
+--------
51
+
52
+All settings are changed in `minetest.conf`. If any of these settings
53
+are not set, the default value is used.
54
+
55
+* `irc.server` (string):
56
+  The address of the IRC server to connect to.
57
+
58
+* `irc.channel` (string):
59
+  The IRC channel to join.
60
+
61
+* `irc.interval` (number, default 2.0):
62
+  This prevents the server from flooding. It should be at
63
+  least 2.0 but can be higher. After four messages this much
64
+  time must pass between folowing messages.
65
+
66
+* `irc.nick` (string):
67
+  Nickname the server uses when it connects to IRC.
68
+
69
+* `irc.password` (string, default nil):
70
+  Password to use when connecting to the server.
71
+
72
+* `irc.NSPass` (string, default nil):
73
+  NickServ password. Don't set this if you use SASL authentication.
74
+
75
+* `irc.sasl.pass` (string, default nil):
76
+  SASL password, same as nickserv password.
77
+  You should use this instead of NickServ authentication
78
+  if the server supports it.
79
+
80
+* `irc.sasl.user` (string, default `irc.nick`):
81
+  The SASL username. This should normaly be set to your
82
+  NickServ account name.
83
+
84
+* `irc.debug` (boolean, default false):
85
+  Whether to output debug information.
86
+
87
+* `irc.disable_auto_connect` (boolean, default false):
88
+  If false, the bot is connected by default. If true, a player with
89
+  the 'irc_admin' privilege has to use the `/irc_connect` command to
90
+  connect to the server.
91
+
92
+* `irc.disable_auto_join` (boolean, default false):
93
+  If false, players join the channel automatically upon entering the
94
+  game. If true, each user must manually use the `/join` command to
95
+  join the channel. In any case, the players may use the `/part`
96
+  command to opt-out of being in the channel.
97
+
98
+* `irc.send_join_part` (boolean, default true):
99
+  Determines whether to send player join and part messages to the channel.
100
+
101
+
102
+Usage
103
+-----
104
+
105
+Once the game is connected to the IRC channel, chatting in-game will send
106
+messages to the channel, and will be visible by anyone. Also, messages sent
107
+to the channel will be visible in-game.
108
+
109
+Messages that begin with `[off]` from in-game or IRC are not sent to the
110
+other side.
111
+
112
+This mod also adds a few chat commands:
113
+
114
+* `/irc_msg <nick> <message>`:
115
+  Send a private message to a IRC user.
116
+
117
+* `/join`:
118
+  Join the IRC chat.
119
+
120
+* `/part`:
121
+  Part the IRC chat.
122
+
123
+* `/irc_connect`:
124
+  Connect the bot manually to the IRC network.
125
+
126
+* `/irc_disconnect`:
127
+  Disconnect the bot manually from the IRC network (this does not
128
+  shutdown the game).
129
+
130
+* `/irc_reconnect`:
131
+  Equivalent to `/irc_disconnect` followed by `/irc_connect`.
132
+
133
+You can also send private messages from IRC to in-game players
134
+by sending a private message to the bot (set with the `irc.nick`
135
+option above), in the following format:
136
+
137
+	@playername message
138
+
139
+For example, if there's a player named `mtuser`, you can send him/her
140
+a private message from IRC with:
141
+
142
+	/msg server_nick @mtuser Hello!
143
+
144
+The bot also supports some basic commands, which are invoked by saying
145
+the bot name followed by either a colon or a comma and the command, or
146
+sending a private message to it. For example: `ServerBot: help whereis`.
147
+
148
+* `help [<command>]`:
149
+  Prints help about a command, or a list of supported commands if no
150
+  command is given.
151
+
152
+* `uptime`:
153
+  Prints the server's running time.
154
+
155
+* `whereis <player>`:
156
+  Prints the coordinates of the given player.
157
+
158
+* `players`:
159
+  Lists players currently in the server.
160
+
161
+
162
+Thanks
163
+------
164
+
165
+I'd like to thank the users who supported this mod both on the Minetest
166
+Forums and on the `#minetest` channel. In no particular order:
167
+
168
+0gb.us, ShadowNinja, Shaun/kizeren, RAPHAEL, DARGON, Calinou, Exio,
169
+vortexlabs/mrtux, marveidemanis, marktraceur, jmf/john\_minetest,
170
+sdzen/Muadtralk, VanessaE, PilzAdam, sfan5, celeron55, KikaRz,
171
+OldCoder, RealBadAngel, and all the people who commented in the
172
+forum topic. Thanks to you all!
173
+
174
+
175
+License
176
+-------
177
+
178
+See `LICENSE.txt` for details.
179
+
180
+The files in the `irc` directory are part of the LuaIRC project.
181
+See `irc/LICENSE.txt` for details.
0 182
new file mode 100644
... ...
@@ -0,0 +1,175 @@
1
+
2
+irc.bot_commands = {}
3
+
4
+-- From RFC1459:
5
+-- "Because of IRC’s scandanavian origin, the characters {}| are
6
+--  considered to be the lower case equivalents of the characters
7
+--  []\, respectively."
8
+local irctolower = { ["["]="{", ["\\"]="|", ["]"]="}" }
9
+
10
+local function irclower(s)
11
+	return (s:lower():gsub("[%[%]\\]", irctolower))
12
+end
13
+
14
+local function nickequals(nick1, nick2)
15
+	return irclower(nick1) == irclower(nick2)
16
+end
17
+
18
+function irc.check_botcmd(msg)
19
+	local prefix = irc.config.command_prefix
20
+	local nick = irc.conn.nick
21
+	local text = msg.args[2]
22
+	local nickpart = text:sub(1, #nick)
23
+	local suffix = text:sub(#nick+1, #nick+2)
24
+
25
+	-- First check for a nick prefix
26
+	if nickequals(nickpart, nick)
27
+			and (suffix == ": " or suffix == ", ") then
28
+		irc.bot_command(msg, text:sub(#nick + 3))
29
+		return true
30
+	-- Then check for the configured prefix
31
+	elseif prefix and text:sub(1, #prefix):lower() == prefix:lower() then
32
+		irc.bot_command(msg, text:sub(#prefix + 1))
33
+		return true
34
+	end
35
+	return false
36
+end
37
+
38
+
39
+function irc.bot_command(msg, text)
40
+	-- Remove leading whitespace
41
+	text = text:match("^%s*(.*)")
42
+	if text:sub(1, 1) == "@" then
43
+		local _, _, player_to, message = text:find("^.([^%s]+)%s(.+)$")
44
+		if not player_to then
45
+			return
46
+		elseif not minetest.get_player_by_name(player_to) then
47
+			irc.reply("User '"..player_to.."' is not in the game.")
48
+			return
49
+		elseif not irc.joined_players[player_to] then
50
+			irc.reply("User '"..player_to.."' is not using IRC.")
51
+			return
52
+		end
53
+		minetest.chat_send_player(player_to,
54
+				"PM from "..msg.user.nick.."@IRC: "..message, false)
55
+		irc.reply("Message sent!")
56
+		return
57
+	end
58
+	local pos = text:find(" ", 1, true)
59
+	local cmd, args
60
+	if pos then
61
+		cmd = text:sub(1, pos - 1)
62
+		args = text:sub(pos + 1)
63
+	else
64
+		cmd = text
65
+		args = ""
66