Support Farming Redo
This commit is contained in:
parent
a00f1ba85d
commit
0e9ad60635
@ -1,4 +1,5 @@
|
|||||||
# Elepower
|
# Elepower
|
||||||
|
![](screenshot.png)
|
||||||
A new *powerful* modpack for [Minetest](http://minetest.net) 5.0.0+!
|
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.**
|
**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.**
|
||||||
|
6
elepower_farming/craftitems.lua
Normal file
6
elepower_farming/craftitems.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
minetest.register_craftitem("elepower_farming:resin", {
|
||||||
|
description = "Resin",
|
||||||
|
inventory_image = "elefarming_resin.png",
|
||||||
|
groups = {resin = 1}
|
||||||
|
})
|
@ -7,4 +7,5 @@ elefarm = rawget(_G, "elefarm") or {}
|
|||||||
elefarm.modpath = modpath
|
elefarm.modpath = modpath
|
||||||
|
|
||||||
dofile(modpath.."/formspec.lua")
|
dofile(modpath.."/formspec.lua")
|
||||||
|
dofile(modpath.."/craftitems.lua")
|
||||||
dofile(modpath.."/nodes/init.lua")
|
dofile(modpath.."/nodes/init.lua")
|
||||||
|
@ -27,7 +27,7 @@ minetest.register_node("elepower_farming:tree_sap_flowing", {
|
|||||||
description = "Flowing Tree Sap",
|
description = "Flowing Tree Sap",
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {"elefarming_tree_sap.png"},
|
tiles = {"elefarming_tree_sap.png"},
|
||||||
special_tiles = {"elefarming_tree_sap.png"},
|
special_tiles = {"elefarming_tree_sap.png", "elefarming_tree_sap.png"},
|
||||||
alpha = 200,
|
alpha = 200,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
@ -47,6 +47,54 @@ minetest.register_node("elepower_farming:tree_sap_flowing", {
|
|||||||
sounds = default.node_sound_water_defaults(),
|
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
|
-- Biomass
|
||||||
|
|
||||||
minetest.register_node("elepower_farming:biomass_source", {
|
minetest.register_node("elepower_farming:biomass_source", {
|
||||||
@ -75,7 +123,7 @@ minetest.register_node("elepower_farming:biomass_flowing", {
|
|||||||
description = "Flowing Biomass",
|
description = "Flowing Biomass",
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {"elefarming_biomass.png"},
|
tiles = {"elefarming_biomass.png"},
|
||||||
special_tiles = {"elefarming_biomass.png"},
|
special_tiles = {"elefarming_biomass.png", "elefarming_biomass.png"},
|
||||||
alpha = 200,
|
alpha = 200,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
@ -97,54 +145,6 @@ minetest.register_node("elepower_farming:biomass_flowing", {
|
|||||||
|
|
||||||
-- Biofuel
|
-- 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", {
|
minetest.register_node("elepower_farming:biofuel_source", {
|
||||||
description = "Biofuel Source",
|
description = "Biofuel Source",
|
||||||
drawtype = "liquid",
|
drawtype = "liquid",
|
||||||
@ -171,7 +171,7 @@ minetest.register_node("elepower_farming:biofuel_flowing", {
|
|||||||
description = "Flowing Biofuel",
|
description = "Flowing Biofuel",
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {"elefarming_biofuel.png"},
|
tiles = {"elefarming_biofuel.png"},
|
||||||
special_tiles = {"elefarming_biofuel.png"},
|
special_tiles = {"elefarming_biofuel.png", "elefarming_biofuel.png"},
|
||||||
alpha = 200,
|
alpha = 200,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
@ -218,7 +218,7 @@ minetest.register_node("elepower_farming:sludge_flowing", {
|
|||||||
description = "Flowing Sludge",
|
description = "Flowing Sludge",
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {"elefarming_tar.png"},
|
tiles = {"elefarming_tar.png"},
|
||||||
special_tiles = {"elefarming_tar.png"},
|
special_tiles = {"elefarming_tar.png", "elefarming_tar.png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
|
@ -45,7 +45,8 @@ local function harvest(pos, harvested, fdir)
|
|||||||
local check_node = minetest.get_node_or_nil(check_pos)
|
local check_node = minetest.get_node_or_nil(check_pos)
|
||||||
if check_node and ele.helpers.get_item_group(check_node.name, "plant") then
|
if check_node and ele.helpers.get_item_group(check_node.name, "plant") then
|
||||||
local nodedef = minetest.registered_nodes[check_node.name]
|
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
|
-- Can harvest
|
||||||
local drop = minetest.get_node_drops(check_node.name)
|
local drop = minetest.get_node_drops(check_node.name)
|
||||||
if drop then
|
if drop then
|
||||||
|
@ -145,9 +145,10 @@ local function plant(pos, range, stack, inv)
|
|||||||
if node and node.name == "air" then
|
if node and node.name == "air" then
|
||||||
if till then
|
if till then
|
||||||
local regN = minetest.registered_nodes
|
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.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
|
till = false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -157,7 +158,10 @@ local function plant(pos, range, stack, inv)
|
|||||||
gain = 0.5,
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -165,10 +169,10 @@ local function plant(pos, range, stack, inv)
|
|||||||
if to_place then
|
if to_place then
|
||||||
minetest.set_node(place_pos, {name = to_place})
|
minetest.set_node(place_pos, {name = to_place})
|
||||||
else
|
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},
|
farming.place_seed(to_plant, nil, {type = "node", under = base_pos, above = place_pos},
|
||||||
seeddef.next_plant)
|
nodename)
|
||||||
|
|
||||||
take = to_plant
|
take = to_plant
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
|
|
||||||
local CAPACITY = 8000
|
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", {
|
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},
|
groups = {fluid_container = 1, oddly_breakable_by_hand = 1, cracky = 1},
|
||||||
tiles = {
|
tiles = {
|
||||||
"elefarming_machine_base.png", "elefarming_machine_base.png", "elefarming_machine_side.png",
|
"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",
|
"elefarming_machine_tree_extractor.png",
|
||||||
},
|
},
|
||||||
fluid_buffers = {
|
fluid_buffers = {
|
||||||
tree_sap = {
|
tree = {
|
||||||
capacity = CAPACITY
|
capacity = CAPACITY
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_construct = function ( pos )
|
paramtype2 = "facedir"
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("tree_sap_fluid", "elepower_farming:tree_sap_source")
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -27,14 +32,21 @@ minetest.register_abm({
|
|||||||
chance = 1/6,
|
chance = 1/6,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local tree_sap_c = meta:get_int("tree_sap_fluid_storage")
|
local fluid_c = meta:get_int("tree_fluid_storage")
|
||||||
if tree_sap_c == CAPACITY then return end
|
if fluid_c == CAPACITY then return end
|
||||||
|
|
||||||
local fpos = ele.helpers.face_front(pos, node.param2)
|
local fpos = ele.helpers.face_front(pos, node.param2)
|
||||||
local fluid = 0
|
local fluid = 0
|
||||||
|
local ftype = meta:get_string("tree_fluid")
|
||||||
|
local fname = "Tree Sap"
|
||||||
local fnode = minetest.get_node_or_nil(fpos)
|
local fnode = minetest.get_node_or_nil(fpos)
|
||||||
if fnode and ele.helpers.get_item_group(fnode.name, "tree") then
|
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
|
end
|
||||||
|
|
||||||
if fluid == 0 then
|
if fluid == 0 then
|
||||||
@ -43,15 +55,16 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
|
|
||||||
local give = 0
|
local give = 0
|
||||||
if tree_sap_c + fluid > CAPACITY then
|
if fluid_c + fluid > CAPACITY then
|
||||||
give = CAPACITY - tree_sap_c
|
give = CAPACITY - fluid_c
|
||||||
else
|
else
|
||||||
give = fluid
|
give = fluid
|
||||||
end
|
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_int("tree_fluid_storage", fluid_c)
|
||||||
meta:set_string("infotext", ("Tree Sap: %d/%d %s"):format(tree_sap_c, CAPACITY, elefluid.unit))
|
meta:set_string("tree_fluid", ftype)
|
||||||
|
meta:set_string("infotext", ("%s: %d/%d %s"):format(fname, fluid_c, CAPACITY, elefluid.unit))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
BIN
elepower_farming/textures/elefarming_resin.png
Normal file
BIN
elepower_farming/textures/elefarming_resin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 298 B |
@ -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
|
if ele.helpers.get_item_group(node.name, "ele_conductor") then
|
||||||
local nodedef = minetest.registered_nodes[node.name]
|
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)
|
add_conductor_node(all_nodes, pos, pnodeid, queue)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 370 KiB |
Loading…
Reference in New Issue
Block a user