From ba2dbaf4665a88d4c58b73a79bd774ed423fe318 Mon Sep 17 00:00:00 2001
From: Rubenwardy <anjayward@gmail.com>
Date: Fri, 31 Aug 2012 14:09:41 +0100
Subject: [PATCH] Did support.lua - dynamic external mod support

---
 rubenfood/baking.lua => baking.lua            |   0
 rubenfood/cakes.lua => cakes.lua              |   0
 rubenfood/dairy.lua => dairy.lua              |   6 +-
 rubenfood/depends.txt => depends.txt          |   0
 rubenfood/drinks.lua => drinks.lua            |   0
 rubenfood/fruits.lua => fruits.lua            |   0
 rubenfood/init.lua => init.lua                |   7 +-
 modpack.txt                                   |   0
 rubenfood_animals/init.lua                    |   2 -
 rubenfood_farming/init.lua                    |   1 -
 support.lua                                   |  81 ++++++++++++++++++
 .../animalmaterials_egg.png                   | Bin
 .../animalmaterials_milk.png                  | Bin
 textures/farming_cake_mix.png                 | Bin 0 -> 343 bytes
 textures/farming_flour.png                    | Bin 0 -> 344 bytes
 textures/farming_strawberry.png               | Bin 0 -> 250 bytes
 .../textures => textures}/ruben_bread.png     | Bin
 .../textures => textures}/ruben_cake.png      | Bin
 .../ruben_cake_choco.png                      | Bin
 .../textures => textures}/ruben_cigar.png     | Bin
 .../textures => textures}/ruben_coffee.png    | Bin
 .../ruben_coffee_cooked.png                   | Bin
 .../ruben_coffee_cup.png                      | Bin
 .../textures => textures}/ruben_cup.png       | Bin
 .../ruben_juice_apple.png                     | Bin
 .../textures => textures}/ruben_mug.png       | Bin
 .../textures => textures}/ruben_pastry.png    | Bin
 .../ruben_pastry_choco.png                    | Bin
 28 files changed, 83 insertions(+), 14 deletions(-)
 rename rubenfood/baking.lua => baking.lua (100%)
 rename rubenfood/cakes.lua => cakes.lua (100%)
 rename rubenfood/dairy.lua => dairy.lua (67%)
 rename rubenfood/depends.txt => depends.txt (100%)
 rename rubenfood/drinks.lua => drinks.lua (100%)
 rename rubenfood/fruits.lua => fruits.lua (100%)
 rename rubenfood/init.lua => init.lua (83%)
 delete mode 100644 modpack.txt
 delete mode 100644 rubenfood_animals/init.lua
 delete mode 100644 rubenfood_farming/init.lua
 create mode 100644 support.lua
 rename {rubenfood/textures => textures}/animalmaterials_egg.png (100%)
 rename {rubenfood/textures => textures}/animalmaterials_milk.png (100%)
 create mode 100644 textures/farming_cake_mix.png
 create mode 100644 textures/farming_flour.png
 create mode 100644 textures/farming_strawberry.png
 rename {rubenfood/textures => textures}/ruben_bread.png (100%)
 rename {rubenfood/textures => textures}/ruben_cake.png (100%)
 rename {rubenfood/textures => textures}/ruben_cake_choco.png (100%)
 rename {rubenfood/textures => textures}/ruben_cigar.png (100%)
 rename {rubenfood/textures => textures}/ruben_coffee.png (100%)
 rename {rubenfood/textures => textures}/ruben_coffee_cooked.png (100%)
 rename {rubenfood/textures => textures}/ruben_coffee_cup.png (100%)
 rename {rubenfood/textures => textures}/ruben_cup.png (100%)
 rename {rubenfood/textures => textures}/ruben_juice_apple.png (100%)
 rename {rubenfood/textures => textures}/ruben_mug.png (100%)
 rename {rubenfood/textures => textures}/ruben_pastry.png (100%)
 rename {rubenfood/textures => textures}/ruben_pastry_choco.png (100%)

diff --git a/rubenfood/baking.lua b/baking.lua
similarity index 100%
rename from rubenfood/baking.lua
rename to baking.lua
diff --git a/rubenfood/cakes.lua b/cakes.lua
similarity index 100%
rename from rubenfood/cakes.lua
rename to cakes.lua
diff --git a/rubenfood/dairy.lua b/dairy.lua
similarity index 67%
rename from rubenfood/dairy.lua
rename to dairy.lua
index c0388a4..c2ca2dd 100644
--- a/rubenfood/dairy.lua
+++ b/dairy.lua
@@ -3,12 +3,8 @@
 -- food to the minetest game
 -- ======================================
 -- >> rubenfood/support.lua
--- adds support for other mods
--- adds items and aliases that are needed
+-- adds diary products
 -- ======================================
--- [regis-item] Flour
--- [regis-item] Milk
--- [regis-item] Egg
 -- [regis-food] Cheese
 -- [craft] Cheese
 -- [regis-item] Butter
diff --git a/rubenfood/depends.txt b/depends.txt
similarity index 100%
rename from rubenfood/depends.txt
rename to depends.txt
diff --git a/rubenfood/drinks.lua b/drinks.lua
similarity index 100%
rename from rubenfood/drinks.lua
rename to drinks.lua
diff --git a/rubenfood/fruits.lua b/fruits.lua
similarity index 100%
rename from rubenfood/fruits.lua
rename to fruits.lua
diff --git a/rubenfood/init.lua b/init.lua
similarity index 83%
rename from rubenfood/init.lua
rename to init.lua
index ce0a043..a0f3b02 100644
--- a/rubenfood/init.lua
+++ b/init.lua
@@ -13,6 +13,7 @@
 print ("RubenFood: Loading mainframe: [Master]")
 
 ----------------------Load Files-----------------------------
+dofile(minetest.get_modpath("rubenfood").."/support.lua")
 dofile(minetest.get_modpath("rubenfood").."/dairy.lua")
 
 dofile(minetest.get_modpath("rubenfood").."/baking.lua")
@@ -24,12 +25,6 @@ dofile(minetest.get_modpath("rubenfood").."/fruits.lua")
 
 
 ----------------------------Cup------------------------------
-minetest.register_alias("rubenfood:cup","animalmaterials:glass")
-minetest.register_craftitem(":animalmaterials:glass",{
-	description = "Cup",
-	tiles = {"ruben_cup.png"},
-	inventory_image = "ruben_cup.png",
-})
 
 minetest.register_craftitem("rubenfood:mug",{
 	description = "Mug",
diff --git a/modpack.txt b/modpack.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/rubenfood_animals/init.lua b/rubenfood_animals/init.lua
deleted file mode 100644
index aa3cdf2..0000000
--- a/rubenfood_animals/init.lua
+++ /dev/null
@@ -1,2 +0,0 @@
-minetest.register_alias("rubenfood:milk","animalmaterials:milk")
-minetest.register_alias("rubenfood:egg","animalmaterials:egg")
\ No newline at end of file
diff --git a/rubenfood_farming/init.lua b/rubenfood_farming/init.lua
deleted file mode 100644
index ab5e489..0000000
--- a/rubenfood_farming/init.lua
+++ /dev/null
@@ -1 +0,0 @@
-minetest.register_alias("rubenfood:flour","farming:flour")
\ No newline at end of file
diff --git a/support.lua b/support.lua
new file mode 100644
index 0000000..41d23fe
--- /dev/null
+++ b/support.lua
@@ -0,0 +1,81 @@
+-- RUBENFOOD MOD
+-- A mod written by rubenwardy that adds
+-- food to the minetest game
+-- ======================================
+-- >> rubenfood/support.lua
+-- adds support for other mods
+-- adds items and aliases that are needed
+-- ======================================
+-- [support]
+-- ======================================
+
+print "RubenFood [Support] - Initialising"
+function node_implement(modname,n_ext,n_int,resultfunc)
+         if not minetest.get_modpath(modname) then
+            resultfunc()
+         else
+            minetest.register_alias(n_int,n_ext)
+         end
+end
+
+
+
+
+
+
+
+print "RubenFood [Support] - Farming Mod"
+node_implement("farming","farming:flour","rubenfood:flour",function()
+   minetest.register_craftitem("rubenfood:flour", {
+	description = "Flour",
+	inventory_image = "farming_flour.png",
+})
+end)
+
+node_implement("farming","farming:strawberry_item","rubenfood:strawberry",function()
+minetest.register_craftitem("rubenfood:strawberry", {
+	description = "Strawberry",
+	inventory_image = "farming_strawberry.png",
+	on_use = minetest.item_eat(2),
+})
+end)
+
+
+
+
+
+print "RubenFood [Support] - Animal Mod"
+node_implement("animalmaterials","animalmaterials:glass","rubenfood:cup",function()
+   minetest.register_craftitem("rubenfood:cup",{
+	description = "Glass",
+	tiles = {"ruben_cup.png"},
+	inventory_image = "ruben_cup.png",
+})
+end)
+
+node_implement("animalmaterials","animalmaterials:egg","rubenfood:egg",function()
+ minetest.register_craftitem("rubenfood:egg", {
+	description = "Egg",
+	image = "animalmaterials_egg.png",
+	stack_max=10
+})
+end)
+
+node_implement("animalmaterials","animalmaterials:milk","rubenfood:milk",function()
+  minetest.register_craftitem("rubenfood:milk", {
+	description = "Milk",
+	image = "animalmaterials_milk.png",
+	on_use = minetest.item_eat(1),
+	groups = { eatable=1 },
+	stack_max=10
+})
+end)
+
+
+
+
+
+
+
+
+
diff --git a/rubenfood/textures/animalmaterials_egg.png b/textures/animalmaterials_egg.png
similarity index 100%
rename from rubenfood/textures/animalmaterials_egg.png
rename to textures/animalmaterials_egg.png
diff --git a/rubenfood/textures/animalmaterials_milk.png b/textures/animalmaterials_milk.png
similarity index 100%
rename from rubenfood/textures/animalmaterials_milk.png
rename to textures/animalmaterials_milk.png
diff --git a/textures/farming_cake_mix.png b/textures/farming_cake_mix.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c4b19758af8a5804049ebb615aafdd7c758c972
GIT binary patch
literal 343
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@
z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<4qib4wyWi{PXmRnd%8G=Se(8a
zq{w&JfM-w0;^c!<+kQ2C`kSb7sUXvx?OR9Vzl4gQ6LkUsMpxLUux&Y#!+*kInx1Fy
zRKLwBC(CNS-Q@ewUbG`J_LFj=@rHM6=Zb&MxyyXllp}TXl06$<aWSqq&h<6oW<_OW
zg22U)<#QF47#wbMT+3W==56%y#^(>jJsN7~cU&-QI{M%}NB^l+>}pCDY;%g=oWI19
zW51ZiJH*R3fxTxYL&J{!GqUICHYVTJ*XWOaJZ+Ds>hHP1h39^j_=&{_dSzbwH%p*t
isr@A{L-`-ppV-15#66uI@wXZ1MFvk-KbLh*2~7Y>4TyOF

literal 0
HcmV?d00001

diff --git a/textures/farming_flour.png b/textures/farming_flour.png
new file mode 100644
index 0000000000000000000000000000000000000000..7c302bfd61149edfaf706b846b4603d80f6602ba
GIT binary patch
literal 344
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@
z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<4qib%!=2rX(m<gbo-U3d7N_q9
zZR9=Vz_TZvr_1A?8uOCINrD-gp0oKn6(^ivTf?9n5R}?rvTaIJPhyw<gU2e1T<4^m
z{Pz1?-RT4JN!6TY;?g?=cdl%nzvS_&Wo)Z1D{PezRn6QG$Ki1CnZ_-fCz~IiVM+7Z
z`!3Xlf#K=7-K!Wksq6{m{ZMg?N%)C{nBWxa_d1nDjkg+SPMvAm*Dbmsu8ep0dY)-3
zR^2LRVNhzC%fj&Ip<KoGKbu{=x7F#Kc;5TXyUzc>nJn(L9D<H64lV`fc7BwVSZG=C
j{_YpWTEXtl{mtS_y^3b;w{j^2`jNrY)z4*}Q$iB}d7^?*

literal 0
HcmV?d00001

diff --git a/textures/farming_strawberry.png b/textures/farming_strawberry.png
new file mode 100644
index 0000000000000000000000000000000000000000..0a80f45ddf486546c7eb9556b86503843eaa5183
GIT binary patch
literal 250
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^RlY
zSq#SNHJ^bLXMsm#F$061G6*wPEVVBK3bL1Y`ns~;;gILCv<ld8eF9LZ%G1R$#NzbS
z;Ap-B3LM!x|L-hY`|k7$kHj1L!dv)RyqcIj85~06Ilf#_+NG@UF@dd4C(rbGb*h$(
zOh5N!ukSf5sg+ify49TQzkYE1{aI4k%9VGHOEQDZAD12H{62^Ku8A=zR(R?(Pve|S
og^-xiV#^1${C9qtY5!$9ctz{pr!%}Wfv#ZiboFyt=akR{0MbWN8vp<R

literal 0
HcmV?d00001

diff --git a/rubenfood/textures/ruben_bread.png b/textures/ruben_bread.png
similarity index 100%
rename from rubenfood/textures/ruben_bread.png
rename to textures/ruben_bread.png
diff --git a/rubenfood/textures/ruben_cake.png b/textures/ruben_cake.png
similarity index 100%
rename from rubenfood/textures/ruben_cake.png
rename to textures/ruben_cake.png
diff --git a/rubenfood/textures/ruben_cake_choco.png b/textures/ruben_cake_choco.png
similarity index 100%
rename from rubenfood/textures/ruben_cake_choco.png
rename to textures/ruben_cake_choco.png
diff --git a/rubenfood/textures/ruben_cigar.png b/textures/ruben_cigar.png
similarity index 100%
rename from rubenfood/textures/ruben_cigar.png
rename to textures/ruben_cigar.png
diff --git a/rubenfood/textures/ruben_coffee.png b/textures/ruben_coffee.png
similarity index 100%
rename from rubenfood/textures/ruben_coffee.png
rename to textures/ruben_coffee.png
diff --git a/rubenfood/textures/ruben_coffee_cooked.png b/textures/ruben_coffee_cooked.png
similarity index 100%
rename from rubenfood/textures/ruben_coffee_cooked.png
rename to textures/ruben_coffee_cooked.png
diff --git a/rubenfood/textures/ruben_coffee_cup.png b/textures/ruben_coffee_cup.png
similarity index 100%
rename from rubenfood/textures/ruben_coffee_cup.png
rename to textures/ruben_coffee_cup.png
diff --git a/rubenfood/textures/ruben_cup.png b/textures/ruben_cup.png
similarity index 100%
rename from rubenfood/textures/ruben_cup.png
rename to textures/ruben_cup.png
diff --git a/rubenfood/textures/ruben_juice_apple.png b/textures/ruben_juice_apple.png
similarity index 100%
rename from rubenfood/textures/ruben_juice_apple.png
rename to textures/ruben_juice_apple.png
diff --git a/rubenfood/textures/ruben_mug.png b/textures/ruben_mug.png
similarity index 100%
rename from rubenfood/textures/ruben_mug.png
rename to textures/ruben_mug.png
diff --git a/rubenfood/textures/ruben_pastry.png b/textures/ruben_pastry.png
similarity index 100%
rename from rubenfood/textures/ruben_pastry.png
rename to textures/ruben_pastry.png
diff --git a/rubenfood/textures/ruben_pastry_choco.png b/textures/ruben_pastry_choco.png
similarity index 100%
rename from rubenfood/textures/ruben_pastry_choco.png
rename to textures/ruben_pastry_choco.png