From eb6b544926527e5dc254fb67733e61cd80145f04 Mon Sep 17 00:00:00 2001 From: Duane Date: Mon, 11 Jul 2016 11:54:31 -0500 Subject: [PATCH] Add initial random elixir ingredients. --- abms.lua | 4 + elixir.lua | 157 ++++++++++++++++++++++++++++++++++ init.lua | 2 +- nodes.lua | 1 + textures/fun_caves_elixir.png | Bin 0 -> 1232 bytes 5 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 textures/fun_caves_elixir.png diff --git a/abms.lua b/abms.lua index a5a3344..a93208f 100644 --- a/abms.lua +++ b/abms.lua @@ -221,6 +221,10 @@ minetest.register_globalstep(function(dtime) end end + if fun_caves.db.status[player_name]['breathe'] then + player:set_breath(11) + end + -- ... from standing on or near hot objects. local counts = minetest_find_nodes_in_area(minp, maxp, hot_stuff) if #counts > 1 then diff --git a/elixir.lua b/elixir.lua index 0fa5fa2..920e963 100644 --- a/elixir.lua +++ b/elixir.lua @@ -1,6 +1,163 @@ local elixir_duration = 3600 +local elixir_ingredients = { + 'default:acacia_leaves', + 'default:acacia_sapling', + 'default:acacia_tree', + 'default:acacia_wood', + 'default:apple', + 'default:aspen_leaves', + 'default:aspen_sapling', + 'default:aspen_tree', + 'default:aspen_wood', + 'default:bronze_lump', + 'default:cactus', + 'default:clay_lump', + 'default:cloud', + 'default:coal_lump', + 'default:copper_lump', + 'default:desert_sand', + 'default:desert_stone', + 'default:diamond', + 'default:dirt', + 'default:dry_shrub', + 'default:gold_lump', + 'default:gravel', + 'default:ice', + 'default:iron_lump', + 'default:junglegrass', + 'default:jungleleaves', + 'default:junglesapling', + 'default:jungletree', + 'default:junglewood', + 'default:leaves', + 'default:mese_crystal', + 'default:obsidian', + 'default:pine_needles', + 'default:pine_sapling', + 'default:pine_tree', + 'default:pine_wood', + 'default:sand', + 'default:sandstone', + 'default:sapling', + 'default:snow', + 'default:stone', + 'default:tree', + 'default:wood', + 'farming:seed_cotton', + 'farming:seed_wheat', + 'flowers:dandelion_white', + 'flowers:dandelion_yellow', + 'flowers:geranium', + 'flowers:mushroom_brown', + 'flowers:mushroom_red', + 'flowers:rose', + 'flowers:tulip', + 'flowers:viola', + 'flowers:waterlily', + 'fun_caves:amber', + 'fun_caves:bark', + 'fun_caves:bird_of_paradise', + 'fun_caves:black_sand', + 'fun_caves:brain_coral', + 'fun_caves:cloud', + 'fun_caves:diamondwood', + 'fun_caves:dragon_eye', + 'fun_caves:dry_fiber', + 'fun_caves:gerbera', + 'fun_caves:giant_mushroom_cap', + 'fun_caves:giant_mushroom_stem', + 'fun_caves:hibiscus', + 'fun_caves:hot_brass', + 'fun_caves:hot_cobble', + 'fun_caves:hot_iron', + 'fun_caves:huge_mushroom_cap', + 'fun_caves:icicle_down', + 'fun_caves:icicle_up', + 'fun_caves:ironwood', + 'fun_caves:leaves', + 'fun_caves:leaves_black', + 'fun_caves:leaves_lumin', + 'fun_caves:lumin_tree', + 'fun_caves:moon_weed', + 'fun_caves:onion', + 'fun_caves:orchid', + 'fun_caves:petrified_wood', + 'fun_caves:pillar_coral', + 'fun_caves:polluted_dirt', + 'fun_caves:precious_coral', + 'fun_caves:radioactive_ore', + 'fun_caves:small_rocks', + 'fun_caves:staghorn_coral', + 'fun_caves:stalactite', + 'fun_caves:stalactite_mossy', + 'fun_caves:stalactite_slimy', + 'fun_caves:stalagmite', + 'fun_caves:stalagmite_mossy', + 'fun_caves:stalagmite_slimy', + 'fun_caves:storm_cloud', + 'fun_caves:thin_ice', + 'fun_caves:tree', + 'wool:white', + 'wool:black', +} + +for _, name in pairs(elixir_ingredients) do + local item = minetest.registered_items[name] + if not item then + item = minetest.registered_nodes[name] + end + if item then + if item.groups then + groups = table.copy(item.groups) + else + groups = {} + end + groups.elixir_ingredient = 1 + minetest.override_item(name, {groups = groups}) + else + --print(name) + end +end +--for _, list in pairs({'registered_items', 'registered_nodes', 'registered_craftitems'}) do +-- for _, item in pairs(minetest[list]) do +-- if item and item.groups.elixir_ingredient then +-- print(item.name) +-- end +-- end +--end + +minetest.register_craftitem("fun_caves:elixir", { + description = "Unknown Elixir", + inventory_image = "fun_caves_elixir.png", + on_use = minetest.item_eat(-2), +}) + +minetest.register_craft({ + type = "shapeless", + output = 'fun_caves:elixir', + recipe = { + 'mobs_slimes:green_slimeball', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + "vessels:glass_bottle", + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = 'fun_caves:elixir', + recipe = { + 'fun_caves:syrup', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + }, +}) + + fun_caves.register_status({ name = 'armor_elixir', terminate = function(player) diff --git a/init.lua b/init.lua index e5fdfd6..9bc2ea3 100644 --- a/init.lua +++ b/init.lua @@ -155,10 +155,10 @@ dofile(fun_caves.path .. "/abms.lua") dofile(fun_caves.path .. "/nodes.lua") dofile(fun_caves.path .. "/deco.lua") dofile(fun_caves.path .. "/fungal_tree.lua") -dofile(fun_caves.path .. "/elixir.lua") dofile(fun_caves.path .. "/wallhammer.lua") dofile(fun_caves.path .. "/mapgen.lua") dofile(fun_caves.path .. "/spec_bomb.lua") +dofile(fun_caves.path .. "/elixir.lua") -- must go after all items are registered dofile(fun_caves.path .. "/chat.lua") if mobs and mobs.mod == "redo" then diff --git a/nodes.lua b/nodes.lua index 9685602..641e339 100644 --- a/nodes.lua +++ b/nodes.lua @@ -14,6 +14,7 @@ function minetest.is_protected(pos, name) return old_is_protected(pos, name) end + -- dirt, cave local newnode = fun_caves.clone_node("default:dirt") newnode.drop = "default:dirt" diff --git a/textures/fun_caves_elixir.png b/textures/fun_caves_elixir.png new file mode 100644 index 0000000000000000000000000000000000000000..beb7b57b8ccb87d6dcb0c33d215f4ceee4bd1b08 GIT binary patch literal 1232 zcmV;>1TXuEP)%*^M@Ho?S=yJXu*PI7W) z=9}O5|GsZ#4p3nuqFdh?5!ok?yuN7W`>p-6(uip0;hsCWYu~-| zf3=O@220AaqxYT~IKS+jSNCbo<$5CQ0FazjC1yM{WbPuOy{SjjqmOOPs146A?p!yq+x>5_;@x7K$IZnN&&(Az~h1B{&;b; zzGNqIYq{1G;9uJ?$WAzQR{vmMqpuY;I`z(!3gSwu#pUMIM1fLl1qkf`tiIlho!%5| zFErlKZ$4Qrh1>vO6#%=MJm6LAgd9MtA9@|ny}4`8l32@1tsvK}*;-Fp8UYyj|{t#EMYOnipzCf+t{Ix-+1=r{V#3@u#t#X z)>;7zz~cA6+@I;aaPDa*z9RDNxih{y5!i0Qv)dapi3jf6E4=rcSpCaZ|%0@^E>$c-5ZnfSe&iyST1AHC}J_&?mhPd9Xoxbb9eXdp8?na z{8|Ap02Hflj2%4u8C$bzvxMZK8+cTgOe)8*Ol#Mj{+~nF6AkGm4!~4;E>sFY0HE?W zlp8W0QBh$rOUO`w=LwTz9)2CX5>KZWnC6D&V(GxrwFCeFVv+?`1p4u{{(q>eal993 znAhNzI(03R&;Za@ELpgtIa;>97B!{07PE69F#y!OhQ)*0ii@(P5{W}{VJh{$YJjee z?rS;UF2BQ=DbyuWUNuQrF@Q0~f8xQXhS<$)**VJiCNPRhi`Nc-F$S%*zaY`zStSm4FDs+%)6(~hJqB2 z&yOl%fRqf37@MB<+3J?nIjwa;N?AJvgb=W;h&gch!;ZkQSaAxx;MpvDlUca}li3`T z*Rx<`Ma`j4KWZbQ(V8E};}gZ{%YDD3;&rKE#bFE>d7&|`NAP?@iZp9%S~_^;>hIG7 zSAQF+)NVx~DBW%*UU=rE&zqYTO`ZAa`-exyM%r~4COKztoP^uDq