diff --git a/README.md b/README.md index 68611ee..1a1600f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Elepower +![](screenshot.png) A new *powerful* modpack for [Minetest](http://minetest.net) 5.0.0+! **I do not recommend using this modpack with technic, as this modpack aims to become an all new technology mod. However, compatibility might be added at a later date.** diff --git a/elepower_farming/craftitems.lua b/elepower_farming/craftitems.lua new file mode 100644 index 0000000..d21629f --- /dev/null +++ b/elepower_farming/craftitems.lua @@ -0,0 +1,6 @@ + +minetest.register_craftitem("elepower_farming:resin", { + description = "Resin", + inventory_image = "elefarming_resin.png", + groups = {resin = 1} +}) diff --git a/elepower_farming/init.lua b/elepower_farming/init.lua index 18e3ecb..2b448ab 100644 --- a/elepower_farming/init.lua +++ b/elepower_farming/init.lua @@ -7,4 +7,5 @@ elefarm = rawget(_G, "elefarm") or {} elefarm.modpath = modpath dofile(modpath.."/formspec.lua") +dofile(modpath.."/craftitems.lua") dofile(modpath.."/nodes/init.lua") diff --git a/elepower_farming/nodes/fluids.lua b/elepower_farming/nodes/fluids.lua index fdf8d47..bf28084 100644 --- a/elepower_farming/nodes/fluids.lua +++ b/elepower_farming/nodes/fluids.lua @@ -27,7 +27,7 @@ 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"}, + special_tiles = {"elefarming_tree_sap.png", "elefarming_tree_sap.png"}, alpha = 200, paramtype = "light", paramtype2 = "flowingliquid", @@ -47,6 +47,54 @@ minetest.register_node("elepower_farming:tree_sap_flowing", { sounds = default.node_sound_water_defaults(), }) +-- 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, + post_effect_color = {a = 103, r = 84, g = 34, b = 0}, + groups = {resin = 3, liquid = 3}, + 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(), +}) + -- Biomass minetest.register_node("elepower_farming:biomass_source", { @@ -75,7 +123,7 @@ minetest.register_node("elepower_farming:biomass_flowing", { description = "Flowing Biomass", drawtype = "flowingliquid", tiles = {"elefarming_biomass.png"}, - special_tiles = {"elefarming_biomass.png"}, + special_tiles = {"elefarming_biomass.png", "elefarming_biomass.png"}, alpha = 200, paramtype = "light", paramtype2 = "flowingliquid", @@ -97,54 +145,6 @@ minetest.register_node("elepower_farming:biomass_flowing", { -- Biofuel -minetest.register_node("elepower_farming:biofuel_source", { - description = "Biomass 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, - 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 Biomass", - drawtype = "flowingliquid", - tiles = {"elefarming_biofuel.png"}, - special_tiles = {"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(), -}) - --- Biofuel - minetest.register_node("elepower_farming:biofuel_source", { description = "Biofuel Source", drawtype = "liquid", @@ -171,7 +171,7 @@ minetest.register_node("elepower_farming:biofuel_flowing", { description = "Flowing Biofuel", drawtype = "flowingliquid", tiles = {"elefarming_biofuel.png"}, - special_tiles = {"elefarming_biofuel.png"}, + special_tiles = {"elefarming_biofuel.png", "elefarming_biofuel.png"}, alpha = 200, paramtype = "light", paramtype2 = "flowingliquid", @@ -218,7 +218,7 @@ minetest.register_node("elepower_farming:sludge_flowing", { description = "Flowing Sludge", drawtype = "flowingliquid", tiles = {"elefarming_tar.png"}, - special_tiles = {"elefarming_tar.png"}, + special_tiles = {"elefarming_tar.png", "elefarming_tar.png"}, paramtype = "light", paramtype2 = "flowingliquid", walkable = false, diff --git a/elepower_farming/nodes/harvester.lua b/elepower_farming/nodes/harvester.lua index db0da87..ccb7ba9 100644 --- a/elepower_farming/nodes/harvester.lua +++ b/elepower_farming/nodes/harvester.lua @@ -45,7 +45,8 @@ local function harvest(pos, harvested, fdir) local check_node = minetest.get_node_or_nil(check_pos) if check_node and ele.helpers.get_item_group(check_node.name, "plant") then local nodedef = minetest.registered_nodes[check_node.name] - if not nodedef['next_plant'] or not minetest.registered_nodes[nodedef.next_plant] then + if (not nodedef['next_plant'] or not minetest.registered_nodes[nodedef.next_plant]) + and not ele.helpers.get_item_group(check_node.name, "growing") then -- Can harvest local drop = minetest.get_node_drops(check_node.name) if drop then diff --git a/elepower_farming/nodes/planter.lua b/elepower_farming/nodes/planter.lua index eb40df4..c887c3c 100644 --- a/elepower_farming/nodes/planter.lua +++ b/elepower_farming/nodes/planter.lua @@ -145,9 +145,10 @@ local function plant(pos, range, stack, inv) if node and node.name == "air" then if till then local regN = minetest.registered_nodes - if regN[base_node.name].soil == nil or + if (regN[base_node.name].soil == nil or regN[base_node.name].soil.wet == nil or - regN[base_node.name].soil.dry == nil then + regN[base_node.name].soil.dry == nil) and + regN["farming:soil"] == nil then till = false end @@ -157,7 +158,10 @@ local function plant(pos, range, stack, inv) gain = 0.5, }) - minetest.set_node(base_pos, {name = regN[base_node.name].soil.dry}) + local soil = regN[base_node.name].soil + if soil then soil = soil.dry else soil = "farming:soil" end + + minetest.set_node(base_pos, {name = soil}) end end @@ -165,10 +169,10 @@ local function plant(pos, range, stack, inv) if to_place then minetest.set_node(place_pos, {name = to_place}) else - local seeddef = minetest.registered_items[to_plant] - + local seeddef = minetest.registered_items[to_plant] + local nodename = seeddef.next_plant or (to_plant .. "_1"):gsub("seed_", "") farming.place_seed(to_plant, nil, {type = "node", under = base_pos, above = place_pos}, - seeddef.next_plant) + nodename) take = to_plant end diff --git a/elepower_farming/nodes/tree_extractor.lua b/elepower_farming/nodes/tree_extractor.lua index 4a892bd..5fc628f 100644 --- a/elepower_farming/nodes/tree_extractor.lua +++ b/elepower_farming/nodes/tree_extractor.lua @@ -1,8 +1,16 @@ local CAPACITY = 8000 +local fluid_table = { + ["default:tree"] = { fpc = 100, fluid = "elepower_farming:tree_sap_source" }, + ["default:jungletree"] = { fpc = 50, fluid = "elepower_farming:resin_source" }, + ["default:pine_tree"] = { fpc = 100, fluid = "elepower_farming:resin_source" }, + ["default:acacia_tree"] = { fpc = 50, fluid = "elepower_farming:resin_source" }, + ["default:aspen_tree"] = { fpc = 50, fluid = "elepower_farming:resin_source" }, +} + minetest.register_node("elepower_farming:tree_extractor", { - description = "Tree Sap Extractor", + description = "Tree Fluid Extractor", groups = {fluid_container = 1, oddly_breakable_by_hand = 1, cracky = 1}, tiles = { "elefarming_machine_base.png", "elefarming_machine_base.png", "elefarming_machine_side.png", @@ -10,14 +18,11 @@ minetest.register_node("elepower_farming:tree_extractor", { "elefarming_machine_tree_extractor.png", }, fluid_buffers = { - tree_sap = { + tree = { capacity = CAPACITY } }, - on_construct = function ( pos ) - local meta = minetest.get_meta(pos) - meta:set_string("tree_sap_fluid", "elepower_farming:tree_sap_source") - end + paramtype2 = "facedir" }) minetest.register_abm({ @@ -27,14 +32,21 @@ minetest.register_abm({ chance = 1/6, action = function(pos, node, active_object_count, active_object_count_wider) local meta = minetest.get_meta(pos) - local tree_sap_c = meta:get_int("tree_sap_fluid_storage") - if tree_sap_c == CAPACITY then return end + local fluid_c = meta:get_int("tree_fluid_storage") + if fluid_c == CAPACITY then return end local fpos = ele.helpers.face_front(pos, node.param2) local fluid = 0 + local ftype = meta:get_string("tree_fluid") + local fname = "Tree Sap" local fnode = minetest.get_node_or_nil(fpos) if fnode and ele.helpers.get_item_group(fnode.name, "tree") then - fluid = fluid + 100 + local fdata = fluid_table[fnode.name] + if fdata and (ftype == "" or ftype == fdata.fluid) then + fluid = fdata.fpc + ftype = fdata.fluid + fname = minetest.registered_nodes[ftype].description:gsub(" Source", "") + end end if fluid == 0 then @@ -43,15 +55,16 @@ minetest.register_abm({ end local give = 0 - if tree_sap_c + fluid > CAPACITY then - give = CAPACITY - tree_sap_c + if fluid_c + fluid > CAPACITY then + give = CAPACITY - fluid_c else give = fluid end - tree_sap_c = tree_sap_c + give + fluid_c = fluid_c + give - meta:set_int("tree_sap_fluid_storage", tree_sap_c) - meta:set_string("infotext", ("Tree Sap: %d/%d %s"):format(tree_sap_c, CAPACITY, elefluid.unit)) + meta:set_int("tree_fluid_storage", fluid_c) + meta:set_string("tree_fluid", ftype) + meta:set_string("infotext", ("%s: %d/%d %s"):format(fname, fluid_c, CAPACITY, elefluid.unit)) end }) diff --git a/elepower_farming/textures/elefarming_resin.png b/elepower_farming/textures/elefarming_resin.png new file mode 100644 index 0000000..772d23f Binary files /dev/null and b/elepower_farming/textures/elefarming_resin.png differ diff --git a/elepower_papi/network.lua b/elepower_papi/network.lua index 52223d2..ae463bc 100644 --- a/elepower_papi/network.lua +++ b/elepower_papi/network.lua @@ -43,12 +43,6 @@ local function check_node(users, providers, all_nodes, pos, pr_pos, pnodeid, que if ele.helpers.get_item_group(node.name, "ele_conductor") then local nodedef = minetest.registered_nodes[node.name] - local ptransfer = 0 - - if nodedef.elepower_transfer then - ptransfer = nodedef.elepower_transfer - end - add_conductor_node(all_nodes, pos, pnodeid, queue) return end diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..7abba60 Binary files /dev/null and b/screenshot.png differ