From 203ae5d42065ef6fbc050cde7a8b22d262d6c843 Mon Sep 17 00:00:00 2001 From: Rubenwardy Date: Fri, 4 Jan 2013 16:51:09 +0000 Subject: [PATCH] mymobs, aerophonics support --- drinks/hot.lua | 27 ++-- support.lua | 49 ++++++- textures/food_hotchoco.png | Bin 772 -> 0 bytes textures/my_mobs_cooked_rabbit.png | Bin 0 -> 271 bytes tools/oven.lua | 197 ----------------------------- 5 files changed, 58 insertions(+), 215 deletions(-) delete mode 100644 textures/food_hotchoco.png create mode 100644 textures/my_mobs_cooked_rabbit.png delete mode 100644 tools/oven.lua diff --git a/drinks/hot.lua b/drinks/hot.lua index 4b2dd4b..cfdd34f 100644 --- a/drinks/hot.lua +++ b/drinks/hot.lua @@ -15,14 +15,8 @@ print ("Food [Master] - Loading Hot") -----------------------------Coffee----------------------------- -minetest.register_craftitem("food:coffeebean",{ - description = "Raw Coffee Bean", - tiles = {"food_coffee.png"}, - inventory_image = "food_coffee.png", -}) - minetest.register_craftitem("food:coffeebean_cooked",{ - description = "Cooked Coffee Bean", + description = "Roasted Coffee Beans", tiles = {"food_coffee_cooked.png"}, inventory_image = "food_coffee_cooked.png", }) @@ -34,15 +28,6 @@ minetest.register_craftitem("food:coffee", { groups={food=1}, }) -minetest.register_craft({ - output = '"food:coffeebean" 1', - recipe = { - {'""','"default:dry_shrub"','""'}, - {'""','"default:dry_shrub"','""'}, - {'""','"default:dry_shrub"','""'}, - } -}) - minetest.register_craft({ output = '"food:coffee" 1', recipe = { @@ -52,8 +37,18 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = '"food:coffee" 1', + recipe = { + {'""','"food:coffeebean_cooked"','""'}, + {'""','"food:coffeebean_cooked"','""'}, + {'""','"food:mug"','""'}, + } +}) + minetest.register_craft({ type = "cooking", output = "food:coffeebean_cooked", recipe = "food:coffeebean", + cooktime = 5, }) diff --git a/support.lua b/support.lua index e6ca811..a4bdb50 100644 --- a/support.lua +++ b/support.lua @@ -27,12 +27,20 @@ end print "Food [Support] - Vegetables and Fruit" print "Food [Support] - > Bread and Flour" - node_implement("farming","farming:flour","food:flour",function() - minetest.register_craftitem("food:flour", { +node_implement("plantlib","plantlib:wheat","food:wheat",function() + +end) +minetest.register_craftitem("food:flour", { description = "Flour", inventory_image = "farming_flour.png", }) +minetest.register_craft({ + output = '"food:flour" 1', + recipe = { + {"food:wheat"}, + } +}) end) node_implement("farming","farming:bread","food:bread",function() @@ -77,17 +85,20 @@ end) print "Food [Support] - > Strawberry" node_implement("farming_plus","farming_plus:strawberry_item","food:strawberry",function() +node_implement("plantlib","plantlib:strawberry","food:strawberry",function() minetest.register_craftitem("food:strawberry", { description = "Strawberry", inventory_image = "farming_strawberry.png", on_use = minetest.item_eat(2), }) end) +end) print "Food [Support] - > Carrot" node_implement("farming_plus","farming_plus:carrot_item","food:carrot",function() node_implement("docfarming","docfarming:carrot","food:carrot",function() +node_implement("plantlib","plantlib:carrot","food:carrot",function() minetest.register_craftitem("food:carrot", { description = "Carrot", inventory_image = "farming_carrot.png", @@ -95,6 +106,7 @@ minetest.register_craftitem("food:carrot", { }) end) end) +end) print "Food [Support] - > Rhubarb" @@ -133,12 +145,14 @@ end) print "Food [Support] - > Tomato" node_implement("farming_plus","farming_plus:tomato_item","food:tomato",function() +node_implement("plantlib","plantlib:tomato","food:tomato",function() minetest.register_craftitem("food:tomato", { description = "Tomato", inventory_image = "farming_strawberry.png", on_use = minetest.item_eat(2), }) end) +end) print "Food [Support] - > Potato" node_implement("docfarming","docfarming:potato","food:potato",function() @@ -156,6 +170,24 @@ minetest.register_craftitem("food:potato_baked", { }) end) +print "Food [Support] - > Coffee" +node_implement("plantlib","plantlib:coffee","food:coffeebean",function() +minetest.register_craftitem("food:coffeebean",{ + description = "Raw Coffee Bean", + tiles = {"food_coffee.png"}, + inventory_image = "food_coffee.png", +}) + +minetest.register_craft({ + output = '"food:coffeebean" 1', + recipe = { + {'""','"default:dry_shrub"','""'}, + {'""','"default:dry_shrub"','""'}, + {'""','"default:dry_shrub"','""'}, + } +}) +end) + print "Food [Support] - Meats and Animal Produce" print "Food [Support] - > Raw Meat" @@ -186,6 +218,17 @@ minetest.register_craft({ }) end) +node_implement("my_mobs","my_mobs:rabbit_cooked","food:rabbit",function() +node_implement("mobs","mobs:meat","food:rabbit",function() +minetest.register_craftitem("food:rabbit", { + description = "Cooked Rabbit", + inventory_image = "my_mobs_cooked_rabbit.png", + + on_use = minetest.item_eat(5), +}) +end) +end) + print "Food [Support] - > Egg" node_implement("animalmaterials","animalmaterials:egg","food:egg",function() @@ -198,6 +241,7 @@ end) print "Food [Support] - > Milk" node_implement("animalmaterials","animalmaterials:milk","food:milk",function() +node_implement("my_mobs","my_mobs:milk_glass_cup","food:milk",function() minetest.register_craftitem("food:milk", { description = "Milk", image = "animalmaterials_milk.png", @@ -206,6 +250,7 @@ node_implement("animalmaterials","animalmaterials:milk","food:milk",function() stack_max=10 }) end) +end) print "Food [Support] - Vessels and Cutlery" diff --git a/textures/food_hotchoco.png b/textures/food_hotchoco.png deleted file mode 100644 index 6edbab726a2f242c0dfdec5a6e86a36159c780da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 772 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`K2;$RB|(Yh3I#>^X_+~x3MG{V zsS2qTnQ06R6}KLHtv%uMIEaBcSy@jwxR~46+t`>{!C<4wMiVaw5_$Qs7kmC(Bm$SelvY3H^?+6GpPSxg<1`4v5c>21s-{IsE(z1NwdHgQ0!XYD{Sc8LDcqU2PDum780!<0Ga=jNv7l`woeGi^Umj18nLB(o$Zm0`uZOX>^^ zjQyT2jv*Gky_5ImJ#r9f-9OW?d#}O=t-!9SO#KdV41tr{tbXg|MwcYUAuMI$#YT2 zua$Y*wH+Gn&71$_+n*`>tM|@(_b$&=f@e$A+K{zjs+^v;rGC^+d|KqW|Gqj0)2;q~ z2A4pWS<8BkCo@E?6=RruvL$Wv%7+CRHVrC~K`TQHjwP&3HIaJw+b(m~roRW$_r^UB zoPIiWk;bo8jn8-1RB*L2F+@&FJhLtPYt`JNN|qjbL$qo+C6YTIOJwU_n`frR!8E7X zXZdB_lTn8ZSjvhw+{`(#NvHf>u6d*S_o%hUYV6F}nKs|l;ji_-asRNv5eetT7Y}^i zGiMHWP0b(UbC#u6vX3l)hNw(b;XG$4Cnu#NcJgQIt?$7?Q@tXuMZMh?aL!V++y0Ae cag7~g+0|?F-hLN74vZ`YPgg&ebxsLQ0RJK|@Bjb+ diff --git a/textures/my_mobs_cooked_rabbit.png b/textures/my_mobs_cooked_rabbit.png new file mode 100644 index 0000000000000000000000000000000000000000..339ab2024f2afe90cc7c5278acb1b03d5270df92 GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85sDEfH31!Z9ZwBAbW|YuPgf<9$pT8mevdJo&bgVJzX3_EKZ*d zy3Kh&foD&f-$RDj1FSI%tak>BzhKh4z!-D5&LhL4w<#cFpWcJLO$YMR?gyk*XfwZO zcpnh7&LZ`}jtxC5Vlxly?h3ARVN{s6O~5e0+%rw4Ikx}FqLW4wRX=rIE6%>U@LsZ? zN_noswB~gR-xHgzU5$Q{$NH09=hFu^qt1QDuN-MG`u%kOZ0WQnld3867On$2jlt8^ K&t;ucLK6Uf2xVXZ literal 0 HcmV?d00001 diff --git a/tools/oven.lua b/tools/oven.lua deleted file mode 100644 index 8c9f805..0000000 --- a/tools/oven.lua +++ /dev/null @@ -1,197 +0,0 @@ --- RUBENFOOD MOD --- A mod written by rubenwardy that adds --- food to the minetest game --- ====================================== --- >> rubenfood/tools/oven.lua --- adds diary products --- ====================================== --- todo [regis-furnace] Rings --- [regis-furnace] Oven --- ====================================== - -local oven_inactive_formspec = - "invsize[8,9;]".. - "image[2,2;1,1;default_furnace_fire_bg.png]".. - "list[current_name;fuel;2,3;1,1;]".. - "list[current_name;src;2,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]" - -minetest.register_node("food:oven", { - description = "Oven", - tiles = {"food_oven_top.png", "food_oven_bottom.png", "food_oven_side.png", - "food_oven_side.png", "food_oven_side.png", "food_oven_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", oven_inactive_formspec) - meta:set_string("infotext", "Oven") - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("fuel") then - return false - elseif not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_node("food:oven_active", { - description = "Oven", - tiles = {"food_oven_top.png", "food_oven_bottom.png", "food_oven_side.png", - "food_oven_side.png", "food_oven_side.png", "food_oven_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "food:furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", oven_inactive_formspec) - meta:set_string("infotext", "Oven"); - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("fuel") then - return false - elseif not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -function hacky_swap_node(pos,name) - local node = minetest.env:get_node(pos) - local meta = minetest.env:get_meta(pos) - local meta0 = meta:to_table() - if node.name == name then - return - end - node.name = name - local meta0 = meta:to_table() - minetest.env:set_node(pos,node) - meta = minetest.env:get_meta(pos) - meta:from_table(meta0) -end - -minetest.register_abm({ - nodenames = {"food:oven","food:oven_active"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) - for i, name in ipairs({ - "fuel_totaltime", - "fuel_time", - "src_totaltime", - "src_time" - }) do - if meta:get_string(name) == "" then - meta:set_float(name, 0.0) - end - end - - local inv = meta:get_inventory() - - local srclist = inv:get_list("src") - local cooked = nil - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - - local was_active = false - - if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then - was_active = true - meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) - meta:set_float("src_time", meta:get_float("src_time") + 1) - if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then - -- check if there's room for output in "dst" list - if inv:room_for_item("dst",cooked.item) then - -- Put result in "dst" list - inv:add_item("dst", cooked.item) - -- take stuff from "src" list - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - else - --print("Could not insert '"..cooked.item.."'") - end - meta:set_string("src_time", 0) - end - end - - if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then - local percent = math.floor(meta:get_float("fuel_time") / - meta:get_float("fuel_totaltime") * 100) - meta:set_string("infotext","Oven active: "..percent.."%") - hacky_swap_node(pos,"food:oven_active") - meta:set_string("formspec", - "invsize[8,9;]".. - "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. - (100-percent)..":default_furnace_fire_fg.png]".. - "list[current_name;fuel;2,3;1,1;]".. - "list[current_name;src;2,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]") - return - end - - local fuel = nil - local cooked = nil - local fuellist = inv:get_list("fuel") - local srclist = inv:get_list("src") - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - if fuellist then - fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - end - - if fuel.time <= 0 then - meta:set_string("infotext","Oven is out of fuel") - hacky_swap_node(pos,"food:oven") - meta:set_string("formspec", oven_inactive_formspec) - return - end - - if cooked.item:is_empty() then - if was_active then - meta:set_string("infotext","Oven is empty") - hacky_swap_node(pos,"food:oven") - meta:set_string("formspec", oven_inactive_formspec) - end - return - end - - meta:set_string("fuel_totaltime", fuel.time) - meta:set_string("fuel_time", 0) - - local stack = inv:get_stack("fuel", 1) - stack:take_item() - inv:set_stack("fuel", 1, stack) - end, -}) \ No newline at end of file