diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..128c0d6 --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = brewing +description = Brewing and 3d Armor +depends = playerphysics, default, flowers, 3d_armor diff --git a/mushroom.lua b/mushroom.lua new file mode 100644 index 0000000..57cbe77 --- /dev/null +++ b/mushroom.lua @@ -0,0 +1,217 @@ +local S = ... + +local mg_name = minetest.get_mapgen_setting("mg_name") + +-- Orange Mycena + +if mg_name ~= "v6" and mg_name ~= "singlenode" then + minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_coniferous_litter", + sidelen = 16, + fill_ratio = 0.0005, + biomes = {"coniferous_forest"}, + decoration = "brewing:orange_mycena", + height = 1, + }) +end + +minetest.register_node("brewing:orange_mycena", { + description = S("Orange Mycena"), + tiles = {"brewing_orange_mycena.png"}, + inventory_image = "brewing_orange_mycena.png", + wield_image = "brewing_orange_mycena.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + stack_max = 99, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(3), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +-- Cortinarius Violaceus + +if mg_name ~= "v6" and mg_name ~= "singlenode" then + minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_coniferous_litter", + sidelen = 16, + fill_ratio = 0.0005, + biomes = {"coniferous_forest"}, + decoration = "brewing:cortinarius_violaceus", + height = 1, + }) +end + +minetest.register_node("brewing:cortinarius_violaceus", { + description = S("Cortinarius Violaceus"), + tiles = {"brewing_cortinarius_violaceus.png"}, + inventory_image = "brewing_cortinarius_violaceus.png", + wield_image = "brewing_cortinarius_violaceus.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + stack_max = 99, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(-5), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +-- Gliophorus viridis + +if mg_name ~= "v6" and mg_name ~= "singlenode" then + minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_rainforest_litter", + sidelen = 16, + fill_ratio = 0.0005, + biomes = {"rainforest"}, + decoration = "brewing:gliophorus_viridis", + height = 1, + }) +end + +minetest.register_node("brewing:gliophorus_viridis", { + description = S("Gliophorus Viridis"), + tiles = {"brewing_gliophorus_viridis.png"}, + inventory_image = "brewing_gliophorus_viridis.png", + wield_image = "brewing_gliophorus_viridis.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + stack_max = 99, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(-3), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +--Pluteus Chrysophaeus + +if mg_name ~= "v6" and mg_name ~= "singlenode" then + minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_coniferous_litter", + sidelen = 16, + fill_ratio = 0.0005, + biomes = {"coniferous_forest"}, + decoration = "brewing:pluteus_chrysophaeus", + height = 1, + }) +end + +minetest.register_node("brewing:pluteus_chrysophaeus", { + description = S("Pluteus Chrysophaeus"), + tiles = {"brewing_pluteus_chrysophaeus.png"}, + inventory_image = "brewing_pluteus_chrysophaeus.png", + wield_image = "brewing_pluteus_chrysophaeus.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + stack_max = 99, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(4), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +--Leaiana Mycena + +if mg_name ~= "v6" and mg_name ~= "singlenode" then + minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_rainforest_litter", + sidelen = 16, + fill_ratio = 0.0005, + biomes = {"rainforest"}, + decoration = "brewing:leaiana_mycena", + height = 1, + }) +end + +minetest.register_node("brewing:leaiana_mycena", { + description = S("Leaiana Mycena"), + tiles = {"brewing_leaiana_mycena.png"}, + inventory_image = "brewing_leaiana_mycena.png", + wield_image = "brewing_leaiana_mycena.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + stack_max = 99, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(4), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +-- Green Hygrocybe + +if mg_name ~= "v6" and mg_name ~= "singlenode" then + minetest.register_decoration({ + deco_type = "simple", + place_on = "default:dirt_with_rainforest_litter", + sidelen = 16, + fill_ratio = 0.0005, + biomes = {"rainforest"}, + decoration = "brewing:green_hygrocybe", + height = 1, + }) +end + +minetest.register_node("brewing:green_hygrocybe", { + description = S("Green Hygrocybe"), + tiles = {"brewing_green_hygrocybe.png"}, + inventory_image = "brewing_green_hygrocybe.png", + wield_image = "brewing_green_hygrocybe.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + stack_max = 99, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(3), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +minetest.register_abm({ + label = "Brewing Mushroom spread", + nodenames = {"brewing:orange_mycena", "brewing:cortinarius_violaceus", "brewing:gliophorus_viridis", "brewing:pluteus_chrysophaeus", "brewing:leaiana_mycena", "brewing:green_hygrocybe"}, + interval = 11, + chance = 150, + action = function(...) + flowers.mushroom_spread(...) + end, +}) diff --git a/ore.lua b/ore.lua new file mode 100644 index 0000000..5fb522f --- /dev/null +++ b/ore.lua @@ -0,0 +1,27 @@ +minetest.register_node("brewing:magic_ore", { + description = ("Magic Ore"), + tiles = {"default_stone.png^brewing_magic_gem.png"}, + groups = {cracky=3, stone=1}, + drop = { + max_items = 99, + items = { + { + items = {"brewing:magic_gem"}, + rarity = 0, + inherit_color = true, + }, + }, + }, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "brewing:magic_ore", + wherein = "default:stone", + clust_scarcity = 10*10*10, + clust_num_ores = 5, + clust_size = 5, + y_max = -1024, + y_min = -12288, +}) \ No newline at end of file diff --git a/player.lua b/player.lua new file mode 100644 index 0000000..4cdf518 --- /dev/null +++ b/player.lua @@ -0,0 +1,24 @@ +minetest.register_on_player_hpchange(function(player, hp_change, reason) + if reason.type == "node_damage" then + local player_name = player:get_player_name() + local player_pos = player:get_pos() + local node = minetest.get_node_or_nil(player_pos) + if node.name == "fire:permanent_flame" or node.name == "default:lava_source" + or node.name == "default:lava_flowing" then + if brewing.players[player_name] and brewing.players[player_name]["resist_fire"] then + return 0 --no damage + end + end + end + return hp_change +end, true) + +minetest.register_on_joinplayer(function(player) + local player_name = player:get_player_name() + brewing.players[player_name] = {} +end) + +minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + brewing.players[player_name] = nil +end) diff --git a/potion_crafts.lua b/potion_crafts.lua new file mode 100644 index 0000000..e80ff74 --- /dev/null +++ b/potion_crafts.lua @@ -0,0 +1,92 @@ +--Air + +brewing.register_potion_craft({ + effect= "ouair", + type= "add", + level= 2, + recipe = {'brewing:cortinarius_violaceus', 'flowers:mushroom_red', 'brewing:gliophorus_viridis'} +}) + +--Jump + +brewing.register_potion_craft({ + effect= "jump", + type= "add", + level= 1, + recipe = {'flowers:mushroom_brown', 'flowers:mushroom_red', 'brewing:gliophorus_viridis'} +}) + +brewing.register_potion_craft({ + effect= "jump", + type= "add", + level= 2, + recipe = {'brewing:orange_mycena', 'brewing:cortinarius_violaceus', 'brewing:gliophorus_viridis'} +}) + +--Health + +brewing.register_potion_craft({ + effect= "health", + type= "add", + level= 1, + recipe = {'flowers:mushroom_brown', 'flowers:mushroom_brown', 'flowers:mushroom_brown'} +}) + +brewing.register_potion_craft({ + effect= "health", + type= "add", + level= 2, + recipe = {'brewing:pluteus_chrysophaeus', 'brewing:leaiana_mycena', 'brewing:green_hygrocybe'} +}) + +brewing.register_potion_craft({ + effect= "health", + type= "sub", + level= -3, + recipe = {'flowers:mushroom_red', 'flowers:mushroom_red', 'flowers:mushroom_red'} +}) + +--Speed + +brewing.register_potion_craft({ + effect= "speed", + type= "add", + level= 2, + recipe = {'brewing:pluteus_chrysophaeus', 'brewing:green_hygrocybe', 'brewing:green_hygrocybe'} +}) + +--Invisibility + +brewing.register_potion_craft({ + effect= "invisibility", + type= "add", + level= 2, + recipe = {'brewing:leaiana_mycena', 'brewing:green_hygrocybe', 'brewing:green_hygrocybe'} +}) + +brewing.register_potion_craft({ + effect= "resist_fire", + description= "Resist Fire", + type= "add", + level= 2, + recipe = {'brewing:leaiana_mycena', 'brewing:cortinarius_violaceus', 'brewing:green_hygrocybe'} +}) + +--Teleport + +brewing.register_potion_craft({ + effect= "teleport", + description= "Teleport", + type= "add", + level= 2, + recipe = {'flowers:mushroom_red', 'brewing:pluteus_chrysophaeus', 'brewing:green_hygrocybe'} +}) + +brewing.register_potion_craft({ + effect= "teleport", + description= "Teleport", + type= "add", + level= 3, + recipe = {'brewing:leaiana_mycena', 'brewing:pluteus_chrysophaeus', 'flowers:mushroom_red'} +}) +