diff --git a/elepower_dynamics/craftitems.lua b/elepower_dynamics/craftitems.lua index 0de8ffe..48bb853 100644 --- a/elepower_dynamics/craftitems.lua +++ b/elepower_dynamics/craftitems.lua @@ -127,7 +127,44 @@ minetest.register_craftitem("elepower_dynamics:pcb_blank", { description = "Printed Circuit Board (PCB) Blank\nUse Etching Acid to etch", inventory_image = "elepower_blank_pcb.png", liquids_pointable = true, - groups = {blank_board = 1, static_component = 1} + groups = {blank_board = 1, static_component = 1}, + on_place = function (itemstack, placer, pointed_thing) + local pos = pointed_thing.under + if not pos or pointed_thing.type ~= "node" then return itemstack end + + local node = minetest.get_node_or_nil(pos) + if not node or node.name ~= "elepower_dynamics:etching_acid_source" then + return itemstack + end + + local istack = itemstack:get_name() + if not placer or placer:get_player_name() == "" then + return itemstack + end + + local out = ItemStack("elepower_dynamics:pcb") + local inv = placer:get_inventory() + local meta = minetest.get_meta(pos) + local uses = meta:get_int("uses") + + uses = uses + 1 + itemstack:take_item(1) + + if inv:room_for_item("main", out) then + inv:add_item("main", out) + else + minetest.item_drop(out, placer, pos) + end + + -- Limited etchings + if uses == 10 then + minetest.set_node(pos, {name = "default:water_source"}) + else + meta:set_int("uses", uses) + end + + return itemstack + end }) minetest.register_craftitem("elepower_dynamics:pcb", { diff --git a/elepower_dynamics/fluids.lua b/elepower_dynamics/fluids.lua index 752d70c..0e5d89e 100644 --- a/elepower_dynamics/fluids.lua +++ b/elepower_dynamics/fluids.lua @@ -1,140 +1,29 @@ -local etching = { - ["elepower_dynamics:pcb_blank"] = { - time = 5, - result = "elepower_dynamics:pcb" - } -} - -- Etching Acid -minetest.register_node("elepower_dynamics:etching_acid_source", { - description = "Etching Acid Source", - drawtype = "liquid", - tiles = {"elepower_etching_acid.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_dynamics:etching_acid_source", - liquid_alternative_flowing = "elepower_dynamics:etching_acid_flowing", - liquid_viscosity = 4, +ele.helpers.register_liquid("etching_acid", { + description = "Etching Acid", + tiles = {"elepower_etching_acid.png"}, + special_tiles = {"elepower_etching_acid.png", "elepower_etching_acid.png"}, + alpha = 200, + liquid_viscosity = 4, damage_per_second = 4, post_effect_color = {a = 103, r = 65, g = 8, b = 0}, - groups = {acid = 1, etching_acid = 1, liquid = 3, tree_fluid = 1}, - sounds = default.node_sound_water_defaults(), - on_rightclick = function (pos, node, clicker, itemstack, pointed_thing) - local istack = itemstack:get_name() - if not clicker or clicker:get_player_name() == "" then - return itemstack - end - - if not etching[istack] then - return itemstack - end - - local recipe = etching[istack] - local out = ItemStack(recipe.result) - local inv = clicker:get_inventory() - local meta = minetest.get_meta(pos) - local uses = meta:get_int("uses") - - if inv:room_for_item("main", out) then - inv:add_item("main", out) - itemstack:take_item(1) - uses = uses + 1 - end - - -- Limited etchings - if uses == 10 then - minetest.set_node(pos, {name = "default:water_source"}) - else - meta:set_int("uses", uses) - end - - return itemstack - end -}) - -minetest.register_node("elepower_dynamics:etching_acid_flowing", { - description = "Flowing Etching Acid", - drawtype = "flowingliquid", - tiles = {"elepower_etching_acid.png"}, - special_tiles = {"elepower_etching_acid.png", "elepower_etching_acid.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_dynamics:etching_acid_flowing", - liquid_alternative_source = "elepower_dynamics:etching_acid_source", - liquid_viscosity = 4, - damage_per_second = 4, - post_effect_color = {a = 103, r = 65, g = 8, b = 0}, - groups = {acid = 1, etching_acid = 1, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {acid = 1, etching_acid = 1, liquid = 3, tree_fluid = 1}, }) -- Liquid Lithium -minetest.register_node("elepower_dynamics:lithium_source", { - description = "Liquid Lithium Source", - drawtype = "liquid", - tiles = {"elepower_lithium.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_dynamics:lithium_source", - liquid_alternative_flowing = "elepower_dynamics:lithium_flowing", - liquid_viscosity = 4, - damage_per_second = 4, +ele.helpers.register_liquid("lithium", { + description = "Liquid Lithium", + drawtype = "liquid", + tiles = {"elepower_lithium.png"}, + special_tiles = {"elepower_lithium.png", "elepower_lithium.png"}, + liquid_viscosity = 4, + damage_per_second = 1, + alpha = 200, post_effect_color = {a = 103, r = 229, g = 227, b = 196}, - groups = {lithium = 1, liquid = 3}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_dynamics:lithium_flowing", { - description = "Flowing Liquid Lithium", - drawtype = "flowingliquid", - tiles = {"elepower_lithium.png"}, - special_tiles = {"elepower_lithium.png", "elepower_lithium.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_dynamics:lithium_flowing", - liquid_alternative_source = "elepower_dynamics:lithium_source", - liquid_viscosity = 4, - damage_per_second = 4, - post_effect_color = {a = 103, r = 229, g = 227, b = 196}, - groups = {lithium = 1, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {lithium = 1, liquid = 3}, }) bucket.register_liquid("elepower_dynamics:etching_acid_source", "elepower_dynamics:etching_acid_flowing", diff --git a/elepower_farming/fluids.lua b/elepower_farming/fluids.lua index 893e73f..9270097 100644 --- a/elepower_farming/fluids.lua +++ b/elepower_farming/fluids.lua @@ -1,240 +1,61 @@ -- Tree Sap -minetest.register_node("elepower_farming:tree_sap_source", { - description = "Tree Sap Source", - drawtype = "liquid", - tiles = {"elefarming_tree_sap.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_farming:tree_sap_source", - liquid_alternative_flowing = "elepower_farming:tree_sap_flowing", - liquid_viscosity = 7, +ele.helpers.register_liquid("tree_sap", { + description = "Tree Sap", + tiles = {"elefarming_tree_sap.png"}, + special_tiles = {"elefarming_tree_sap.png", "elefarming_tree_sap.png"}, + alpha = 200, + liquid_viscosity = 7, post_effect_color = {a = 103, r = 84, g = 34, b = 0}, - groups = {tree_sap = 3, liquid = 3, raw_bio = 1, tree_fluid = 1}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_farming:tree_sap_flowing", { - description = "Flowing Tree Sap", - drawtype = "flowingliquid", - tiles = {"elefarming_tree_sap.png"}, - special_tiles = {"elefarming_tree_sap.png", "elefarming_tree_sap.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_farming:tree_sap_flowing", - liquid_alternative_source = "elepower_farming:tree_sap_source", - liquid_viscosity = 7, - post_effect_color = {a = 103, r = 84, g = 34, b = 0}, - groups = {tree_sap = 3, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {tree_sap = 3, liquid = 3, raw_bio = 1, tree_fluid = 1}, }) -- Tree Resin -minetest.register_node("elepower_farming:resin_source", { - description = "Resin Source", - drawtype = "liquid", - tiles = {"elefarming_tree_sap.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_farming:resin_source", - liquid_alternative_flowing = "elepower_farming:resin_flowing", - liquid_viscosity = 8, +ele.helpers.register_liquid("resin", { + description = "Resin", + tiles = {"elefarming_tree_sap.png"}, + special_tiles = {"elefarming_tree_sap.png", "elefarming_tree_sap.png"}, + alpha = 200, + liquid_viscosity = 8, post_effect_color = {a = 103, r = 84, g = 34, b = 0}, - groups = {resin = 3, liquid = 3, raw_bio = 1, tree_fluid = 1}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_farming:resin_flowing", { - description = "Flowing Resin", - drawtype = "flowingliquid", - tiles = {"elefarming_tree_sap.png"}, - special_tiles = {"elefarming_tree_sap.png", "elefarming_tree_sap.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_source = "elepower_farming:resin_source", - liquid_alternative_flowing = "elepower_farming:resin_flowing", - liquid_viscosity = 8, - post_effect_color = {a = 103, r = 84, g = 34, b = 0}, - groups = {resin = 3, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {resin = 3, liquid = 3, raw_bio = 1, tree_fluid = 1}, }) -- Biomass -minetest.register_node("elepower_farming:biomass_source", { - description = "Biomass Source", - drawtype = "liquid", - tiles = {"elefarming_biomass.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_farming:biomass_source", - liquid_alternative_flowing = "elepower_farming:biomass_flowing", - liquid_viscosity = 7, +ele.helpers.register_liquid("biomass", { + description = "Biomass", + tiles = {"elefarming_biomass.png"}, + special_tiles = {"elefarming_biomass.png", "elefarming_biomass.png"}, + alpha = 200, + liquid_viscosity = 7, post_effect_color = {a = 103, r = 0, g = 42, b = 0}, - groups = {biomass = 3, liquid = 3}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_farming:biomass_flowing", { - description = "Flowing Biomass", - drawtype = "flowingliquid", - tiles = {"elefarming_biomass.png"}, - special_tiles = {"elefarming_biomass.png", "elefarming_biomass.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_farming:biomass_flowing", - liquid_alternative_source = "elepower_farming:biomass_source", - liquid_viscosity = 7, - post_effect_color = {a = 103, r = 0, g = 42, b = 0}, - groups = {biomass = 3, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {biomass = 3, liquid = 3}, }) -- Biofuel -minetest.register_node("elepower_farming:biofuel_source", { - description = "Biofuel Source", - drawtype = "liquid", - tiles = {"elefarming_biofuel.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_farming:biofuel_source", - liquid_alternative_flowing = "elepower_farming:biofuel_flowing", - liquid_viscosity = 7, +ele.helpers.register_liquid("biofuel", { + description = "Biofuel", + tiles = {"elefarming_biofuel.png"}, + special_tiles = {"elefarming_biofuel.png", "elefarming_biofuel.png"}, + alpha = 200, + liquid_viscosity = 7, post_effect_color = {a = 103, r = 255, g = 163, b = 0}, - groups = {biofuel = 3, liquid = 3}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_farming:biofuel_flowing", { - description = "Flowing Biofuel", - drawtype = "flowingliquid", - tiles = {"elefarming_biofuel.png"}, - special_tiles = {"elefarming_biofuel.png", "elefarming_biofuel.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_farming:biofuel_flowing", - liquid_alternative_source = "elepower_farming:biofuel_source", - liquid_viscosity = 7, - post_effect_color = {a = 103, r = 255, g = 163, b = 0}, - groups = {biofuel = 3, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {biofuel = 3, liquid = 3}, }) -- Sludge -minetest.register_node("elepower_farming:sludge_source", { - description = "Sludge Source", - drawtype = "liquid", - tiles = {"elefarming_tar.png"}, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_farming:sludge_source", - liquid_alternative_flowing = "elepower_farming:sludge_flowing", - liquid_viscosity = 8, +ele.helpers.register_liquid("sludge", { + description = "Sludge", + tiles = {"elefarming_tar.png"}, + special_tiles = {"elefarming_tar.png", "elefarming_tar.png"}, + liquid_viscosity = 8, post_effect_color = {a = 50, r = 0, g = 0, b = 0}, - groups = {sludge = 3, liquid = 3}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_farming:sludge_flowing", { - description = "Flowing Sludge", - drawtype = "flowingliquid", - tiles = {"elefarming_tar.png"}, - special_tiles = {"elefarming_tar.png", "elefarming_tar.png"}, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_farming:sludge_flowing", - liquid_alternative_source = "elepower_farming:sludge_source", - liquid_viscosity = 8, - post_effect_color = {a = 50, r = 0, g = 0, b = 0}, - groups = {sludge = 3, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {sludge = 3, liquid = 3}, }) if minetest.get_modpath("bucket") ~= nil then diff --git a/elepower_nuclear/fluids.lua b/elepower_nuclear/fluids.lua index d5d9b7e..54bf606 100644 --- a/elepower_nuclear/fluids.lua +++ b/elepower_nuclear/fluids.lua @@ -41,10 +41,9 @@ ele.register_gas(nil, "Helium Plasma", "elepower_nuclear:helium_plasma") ------------- -- Heavy Water -minetest.register_node("elepower_nuclear:heavy_water_source", { - description = "Heavy Water Source", - drawtype = "liquid", - tiles = { +ele.helpers.register_liquid("heavy_water", { + description = "Heavy Water", + tiles_source = { { name = "elenuclear_heavy_water_source_animated.png", animation = { @@ -55,40 +54,7 @@ minetest.register_node("elepower_nuclear:heavy_water_source", { }, }, }, - special_tiles = { - { - name = "elenuclear_heavy_water_source_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 2.0, - }, - backface_culling = false, - }, - }, - alpha = 160, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "elepower_nuclear:heavy_water_flowing", - liquid_alternative_source = "elepower_nuclear:heavy_water_source", - liquid_viscosity = 4, - post_effect_color = {a = 103, r = 13, g = 69, b = 121}, - groups = {heavy_water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_nuclear:heavy_water_flowing", { - description = "Flowing Heavy Water", - drawtype = "flowingliquid", - tiles = {"elenuclear_heavy_water.png"}, + tiles_flowing = {"elenuclear_heavy_water.png"}, special_tiles = { { name = "elenuclear_heavy_water_flowing_animated.png", @@ -112,171 +78,91 @@ minetest.register_node("elepower_nuclear:heavy_water_flowing", { }, }, alpha = 160, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_nuclear:heavy_water_flowing", - liquid_alternative_source = "elepower_nuclear:heavy_water_source", liquid_viscosity = 4, post_effect_color = {a = 103, r = 13, g = 69, b = 121}, - groups = {heavy_water = 3, liquid = 3, puts_out_fire = 1, - not_in_creative_inventory = 1, cools_lava = 1}, - sounds = default.node_sound_water_defaults(), + groups = {heavy_water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, }) -- Cold coolant -minetest.register_node("elepower_nuclear:coolant_source", { - description = "Cold Coolant Source", - drawtype = "liquid", - tiles = {"elenuclear_cold_coolant.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_nuclear:coolant_source", - liquid_alternative_flowing = "elepower_nuclear:coolant_flowing", - liquid_viscosity = 2, +ele.helpers.register_liquid("coolant", { + description = "Cold Coolant", + tiles = {"elenuclear_cold_coolant.png"}, + special_tiles = {"elenuclear_cold_coolant.png", "elenuclear_cold_coolant.png"}, + alpha = 200, + liquid_viscosity = 2, post_effect_color = {a = 128, r = 36, g = 150, b = 255}, - groups = {liquid = 3, coolant = 1}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_nuclear:coolant_flowing", { - description = "Cold Coolant Flowing", - drawtype = "flowingliquid", - tiles = {"elenuclear_cold_coolant.png"}, - special_tiles = {"elenuclear_cold_coolant.png", "elenuclear_cold_coolant.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_nuclear:coolant_flowing", - liquid_alternative_source = "elepower_nuclear:coolant_source", - liquid_viscosity = 2, - post_effect_color = {a = 128, r = 36, g = 150, b = 255}, - groups = {coolant = 3, liquid = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_water_defaults(), + groups = {liquid = 3, coolant = 1}, }) -- Hot coolant -minetest.register_node("elepower_nuclear:hot_coolant_source", { - description = "Hot Coolant Source", - drawtype = "liquid", - tiles = {"elenuclear_hot_coolant.png"}, - alpha = 200, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - damage_per_second = 4 * 2, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_source = "elepower_nuclear:hot_coolant_source", - liquid_alternative_flowing = "elepower_nuclear:hot_coolant_flowing", - liquid_viscosity = 2, +ele.helpers.register_liquid("hot_coolant", { + description = "Hot Coolant", + tiles = {"elenuclear_hot_coolant.png"}, + special_tiles = {"elenuclear_hot_coolant.png", "elenuclear_hot_coolant.png"}, + alpha = 200, + liquid_viscosity = 2, post_effect_color = {a = 128, r = 136, g = 100, b = 158}, - groups = {liquid = 3, coolant = 1, hot = 1}, - sounds = default.node_sound_water_defaults(), -}) - -minetest.register_node("elepower_nuclear:hot_coolant_flowing", { - description = "Hot Coolant Flowing", - drawtype = "flowingliquid", - tiles = {"elenuclear_hot_coolant.png"}, - special_tiles = {"elenuclear_hot_coolant.png", "elenuclear_hot_coolant.png"}, - alpha = 200, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - damage_per_second = 4 * 2, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_nuclear:hot_coolant_flowing", - liquid_alternative_source = "elepower_nuclear:hot_coolant_source", - liquid_viscosity = 2, - post_effect_color = {a = 128, r = 136, g = 100, b = 158}, - groups = {coolant = 3, liquid = 3, not_in_creative_inventory = 1, hot = 1}, - sounds = default.node_sound_water_defaults(), + groups = {liquid = 3, coolant = 1, hot = 1}, }) -- Brine -minetest.register_node("elepower_nuclear:brine_source", { - description = "Brine Source", - drawtype = "liquid", - tiles = {"elenuclear_brine.png"}, - special_tiles = {"elenuclear_brine.png"}, - alpha = 240, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "elepower_nuclear:brine_flowing", - liquid_alternative_source = "elepower_nuclear:brine_source", - liquid_viscosity = 7, +ele.helpers.register_liquid("brine", { + description = "Brine", + drawtype = "liquid", + tiles = {"elenuclear_brine.png"}, + special_tiles = {"elenuclear_brine.png", "elenuclear_brine.png"}, + alpha = 240, + liquid_viscosity = 7, post_effect_color = {a = 200, r = 215, g = 221, b = 187}, - groups = {brine = 3, saline = 1, liquid = 3, puts_out_fire = 1, cools_lava = 1}, - sounds = default.node_sound_water_defaults(), + groups = {brine = 3, saline = 1, liquid = 3, puts_out_fire = 1, cools_lava = 1}, }) -minetest.register_node("elepower_nuclear:brine_flowing", { - description = "Flowing Brine", - drawtype = "flowingliquid", - tiles = {"elenuclear_brine.png"}, - special_tiles = {"elenuclear_brine.png", "elenuclear_brine.png"}, - alpha = 240, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drop = "", - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "elepower_nuclear:brine_flowing", - liquid_alternative_source = "elepower_nuclear:brine_source", - liquid_viscosity = 7, - post_effect_color = {a = 200, r = 215, g = 221, b = 187}, - groups = {brine = 3, saline = 1, liquid = 3, puts_out_fire = 1, - not_in_creative_inventory = 1, cools_lava = 1}, - sounds = default.node_sound_water_defaults(), +-- Corium + +ele.helpers.register_liquid("corium", { + description = "Corium", + drawtype = "liquid", + tiles_source = { + { + name = "elenuclear_corium_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + tiles_flowing = {"elenuclear_corium.png"}, + special_tiles_flowing = { + { + name = "elenuclear_corium_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "elenuclear_corium_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + liquid_viscosity = 7, + damage_per_second = 10, + post_effect_color = {a = 50, r = 155, g = 255, b = 12}, + groups = {corium = 3, radioactive = 1, liquid = 3, igniter = 1}, }) if minetest.get_modpath("bucket") ~= nil then @@ -301,3 +187,16 @@ if minetest.get_modpath("bucket") ~= nil then } }) end + +-- Corium effects + +minetest.register_abm({ + label = "Corium: boil water", + nodenames = {"group:water"}, + neighbors = {"elepower_nuclear:corium_flowing", "elepower_nuclear:corium_source"}, + interval = 1, + chance = 1, + action = function(pos, node) + minetest.remove_node(pos) + end, +}) diff --git a/elepower_nuclear/machines/fission_reactor.lua b/elepower_nuclear/machines/fission_reactor.lua index 178d4bc..841ab4f 100644 --- a/elepower_nuclear/machines/fission_reactor.lua +++ b/elepower_nuclear/machines/fission_reactor.lua @@ -307,8 +307,7 @@ local function reactor_core_timer(pos) end if heat >= 100 then - -- TODO: Melt - minetest.set_node(pos, {name = "air"}) + minetest.set_node(pos, {name = "elepower_nuclear:corium_source"}) return false end diff --git a/elepower_nuclear/textures/elenuclear_corium.png b/elepower_nuclear/textures/elenuclear_corium.png new file mode 100644 index 0000000..aa2ae14 Binary files /dev/null and b/elepower_nuclear/textures/elenuclear_corium.png differ diff --git a/elepower_nuclear/textures/elenuclear_corium_flowing_animated.png b/elepower_nuclear/textures/elenuclear_corium_flowing_animated.png new file mode 100644 index 0000000..9386d71 Binary files /dev/null and b/elepower_nuclear/textures/elenuclear_corium_flowing_animated.png differ diff --git a/elepower_nuclear/textures/elenuclear_corium_source_animated.png b/elepower_nuclear/textures/elenuclear_corium_source_animated.png new file mode 100644 index 0000000..a329668 Binary files /dev/null and b/elepower_nuclear/textures/elenuclear_corium_source_animated.png differ diff --git a/elepower_papi/helpers.lua b/elepower_papi/helpers.lua index 98dd06d..5b1ed3c 100644 --- a/elepower_papi/helpers.lua +++ b/elepower_papi/helpers.lua @@ -111,3 +111,57 @@ function ele.helpers.state_enabled(meta, pos, state) return false end + +function ele.helpers.register_liquid(liquid, def) + local mod = minetest.get_current_modname() + for _,state in pairs({"source", "flowing"}) do + local def_base = { + drawtype = "liquid", + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = state, + liquid_alternative_source = mod..":"..liquid.."_source", + liquid_alternative_flowing = mod..":"..liquid.."_flowing", + sounds = default.node_sound_water_defaults(), + } + + for key,val in pairs(def) do + if type(val) == "table" then + def_base[key] = table.copy(val) + else + def_base[key] = val + end + end + + if not def_base.groups then + def_base.groups = {liquid = 3} + end + + if state == "flowing" then + def_base.description = "Flowing " .. def_base.description + def_base.paramtype2 = "flowingliquid" + def_base.drawtype = "flowingliquid" + def_base.groups.not_in_creative_inventory = 1 + else + def_base.description = def_base.description .. " Source" + end + + if def["tiles_"..state] then + def_base.tiles = table.copy(def["tiles_"..state]) + def_base["tiles_"..state] = nil + end + + if def["special_tiles_"..state] then + def_base.special_tiles = table.copy(def["special_tiles_"..state]) + def_base["special_tiles_"..state] = nil + end + + minetest.register_node(mod..":"..liquid.."_"..state, def_base) + end +end