From 162faa7e60e8060c9c091a8304f1cf7fc56ed542 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 20 Jun 2020 21:00:57 -0400 Subject: [PATCH] Add fire resistance groundwork. --- mods/ITEMS/mcl_potions/functions.lua | 9 +++++- mods/ITEMS/mcl_potions/init.lua | 8 +++--- mods/ITEMS/mcl_potions/potions.lua | 43 ++++++++++++++++++++++++++++ mods/ITEMS/mcl_potions/splash.lua | 8 ++++++ 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 80397bdffe..e47aabfc1e 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -149,7 +149,7 @@ minetest.register_globalstep(function(dtime) is_swift[player] = nil end - elseif not player:get_properties() then + elseif not player:get_properties() then is_swift[player] = nil end @@ -415,3 +415,10 @@ function mcl_potions.water_breathing_func(player, duration) end end + + +function mcl_potions.fire_resistance_func(player, duration) + + + +end diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 46d4eb464f..e3d86f9548 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -300,9 +300,9 @@ local awkward_table = { ["mcl_core:sugar"] = "mcl_potions:swiftness", ["mcl_mobitems:magma_cream"] = "mcl_potions:fire_resistance", --add craft ["mcl_mobitems:blaze_powder"] = "mcl_potions:strength", --add craft - ["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing", --add craft - ["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration", --add craft - ["mcl_mobitems:spider_eye"] = "mcl_potions:poison", --add craft + ["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing", + ["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration", + ["mcl_mobitems:spider_eye"] = "mcl_potions:poison", ["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping", } @@ -320,7 +320,7 @@ for i, potion in ipairs({"healing","harming","swiftness","leaping","poison","reg table.insert(potions, potion) - if potion ~= "invisibility" and potion ~= "night_vision" and potion ~= "weakness" and potion ~= "water_breathing" then + if potion ~= "invisibility" and potion ~= "night_vision" and potion ~= "weakness" and potion ~= "water_breathing" and potion ~= "fire_resistance" then enhancement_table["mcl_potions:"..potion] = "mcl_potions:"..potion.."_2" enhancement_table["mcl_potions:"..potion.."_splash"] = "mcl_potions:"..potion.."_2_splash" table.insert(potions, potion.."_2") diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 84324f2135..439cb5b9bc 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -591,3 +591,46 @@ minetest.register_craftitem("mcl_potions:water_breathing_plus", { return itemstack end }) + + +minetest.register_craftitem("mcl_potions:fire_resistance", { + description = S("Fire Resistance Potion"), + _doc_items_longdesc = brewhelp, + wield_image = potion_image("#D0A040"), + inventory_image = potion_image("#D0A040"), + groups = { brewitem = 1, food = 0 }, + stack_max = 1, + + on_place = function(itemstack, user, pointed_thing) + mcl_potions.fire_resistance_func(user, 180) + mcl_potions._use_potion(itemstack, user, "#D0A040") + return itemstack + end, + + on_secondary_use = function(itemstack, user, pointed_thing) + mcl_potions.fire_resistance_func(user, 180) + mcl_potions._use_potion(itemstack, user, "#D0A040") + return itemstack + end +}) + +minetest.register_craftitem("mcl_potions:fire_resistance_plus", { + description = S("Fire Resistance Potion +"), + _doc_items_longdesc = brewhelp, + wield_image = potion_image("#E0B050"), + inventory_image = potion_image("#E0B050"), + groups = { brewitem = 1, food = 0 }, + stack_max = 1, + + on_place = function(itemstack, user, pointed_thing) + mcl_potions.fire_resistance_func(user, 480) + mcl_potions._use_potion(itemstack, user, "#E0B050") + return itemstack + end, + + on_secondary_use = function(itemstack, user, pointed_thing) + mcl_potions.fire_resistance_func(user, 480) + mcl_potions._use_potion(itemstack, user, "#E0B050") + return itemstack + end +}) diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index c38db9f54b..95efa8bde4 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -188,3 +188,11 @@ register_splash("water_breathing", "Splash Water Breathing", "#0000AA", { register_splash("water_breathing_plus", "Splash Water Breathing +", "#0000CC", { potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, 360*redx) end }) + +register_splash("water_breathing_plus", "Splash Fire Resistance", "#D0A040", { + potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, 135*redx) end +}) + +register_splash("water_breathing_plus", "Splash Fire Resistance +", "#E0B050", { + potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, 360*redx) end +})