#1 start integration of technic mod

master
ademant 2018-10-31 14:37:06 +01:00
parent 9384751bdf
commit c44e26c00b
12 changed files with 195 additions and 0 deletions

20
battery_box.lua Normal file
View File

@ -0,0 +1,20 @@
-- VP Flywheel
minetest.register_craft({
output = 'farming_technic:vp_battery_box0',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'farming_technic:flywheel', 'farming_technic:gear', 'farming_technic:flywheel'},
{'farming_technic:flywheel', 'farming_technic:vp_cable', 'farming_technic:flywheel'},
}
})
technic.register_battery_box({
tier = "VP",
max_charge = 20000,
charge_rate = 150,
discharge_rate = 400,
charge_step = 50,
discharge_step = 80,
})

14
cables.lua Normal file
View File

@ -0,0 +1,14 @@
minetest.register_alias("vp_cable", "farming_technic:vp_cable")
minetest.register_craft({
output = 'farming_technic:vp_cable 6',
recipe = {
{'group:wool', 'group:wool', 'group:wool'},
{'group:wood', 'group:wood', 'group:wood'},
{'group:wool', 'group:wool', 'group:wool'},
}
})
technic.register_cable("VP", 2/16)

18
generator.lua Normal file
View File

@ -0,0 +1,18 @@
-- The electric generator.
-- A simple device to get started on the electric machines.
-- Inefficient and expensive in fuel (200EU per tick)
-- Also only allows for LV machinery to run.
minetest.register_alias("vp_generator", "farming_technic:vp_generator")
minetest.register_craft({
output = 'farming_technic:vp_generator',
recipe = {
{'default:stone', 'default:furnace', 'default:stone'},
{'default:stone', 'farming_technic:boiler', 'default:stone'},
{'default:stone', 'farming_technic:vp_cable', 'default:stone'},
}
})
technic.register_generator({tier="VP", supply=150})

13
grinder.lua Normal file
View File

@ -0,0 +1,13 @@
--minetest.register_alias("grinder", "technic:lv_grinder")
minetest.register_craft({
output = 'farming_technic:vp_grinder',
recipe = {
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
{'default:desert_stone', 'farming_technic:gear', 'default:desert_stone'},
{'technic:granite', 'farming_technic:vp_cable', 'technic:granite'},
}
})
technic.register_grinder({tier="VP", demand={150}, speed=0.65})

View File

@ -13,6 +13,7 @@ minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- start loadi
dofile(farming_technic.path .. "/craft.lua")
dofile(farming_technic.path .. "/technic.lua")

20
technic.lua Normal file
View File

@ -0,0 +1,20 @@
if minetest.get_modpath("technic") ~= nil then
technic.register_tier("VP", "Vapor driven")
local path = farming_technic.modpath
-- Wiring stuff
dofile(path.."/cables.lua")
dofile(path.."/battery_box.lua")
-- Generators
dofile(path.."/water_mill.lua")
dofile(path.."/generator.lua")
-- Machines
dofile(path.."/vapor_furnace.lua")
dofile(path.."/grinder.lua")
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

109
water_mill.lua Normal file
View File

@ -0,0 +1,109 @@
-- A water mill produces LV EUs by exploiting flowing water across it
-- It is a LV EU supplyer and fairly low yield (max 180EUs)
-- It is a little over half as good as the thermal generator.
local S = technic.getter
local cable_entry = "^technic_cable_connection_overlay.png"
--minetest.register_alias("water_mill", "technic:water_mill")
minetest.register_craft({
output = 'farming_technic:water_mill',
recipe = {
{'technic:marble', 'default:diamond', 'technic:marble'},
{'group:wood', 'farming_technic:gear', 'group:wood'},
{'technic:marble', 'farming_technic:vp_cable', 'technic:marble'},
}
})
local function check_node_around_mill(pos)
local node = minetest.get_node(pos)
if node.name == "default:water_flowing"
or node.name == "default:river_water_flowing" then
return node.param2 -- returns approx. water flow, if any
end
return false
end
local run = function(pos, node)
local meta = minetest.get_meta(pos)
local water_flow = 0
local production_level = 0
local eu_supply = 0
local max_output = 4 * 40 -- keeping it around 180, little more than previous 150 :)
local positions = {
{x=pos.x+1, y=pos.y, z=pos.z},
{x=pos.x-1, y=pos.y, z=pos.z},
{x=pos.x, y=pos.y, z=pos.z+1},
{x=pos.x, y=pos.y, z=pos.z-1},
}
for _, p in pairs(positions) do
local check = check_node_around_mill(p)
if check then
water_flow = water_flow + check
end
end
eu_supply = math.min(4 * water_flow, max_output)
production_level = math.floor(100 * eu_supply / max_output)
meta:set_int("VP_EU_supply", eu_supply)
meta:set_string("infotext",
S("Hydro %s Generator"):format("VP").." ("..production_level.."%)")
if production_level > 0 and
minetest.get_node(pos).name == "farming_technic:water_mill" then
technic.swap_node (pos, "farming_technic:water_mill_active")
meta:set_int("VP_EU_supply", 0)
return
end
if production_level == 0 then
technic.swap_node(pos, "farming_technic:water_mill")
end
end
minetest.register_node("farming_technic:water_mill", {
description = S("Hydro %s Generator"):format("VP"),
tiles = {
"technic_water_mill_top.png",
"technic_machine_bottom.png"..cable_entry,
"technic_water_mill_side.png",
"technic_water_mill_side.png",
"technic_water_mill_side.png",
"technic_water_mill_side.png"
},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
technic_machine=1, technic_vp=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Hydro %s Generator"):format("VP"))
meta:set_int("VP_EU_supply", 0)
end,
technic_run = run,
})
minetest.register_node("technic:water_mill_active", {
description = S("Hydro %s Generator"):format("VP"),
tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png",
"technic_water_mill_side.png", "technic_water_mill_side.png",
"technic_water_mill_side.png", "technic_water_mill_side.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
technic_machine=1, technic_vp=1, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
drop = "farming_technic:water_mill",
technic_run = run,
technic_disabled_machine_name = "farming_technic:water_mill",
})
technic.register_machine("VP", "farming_technic:water_mill", technic.producer)
technic.register_machine("VP", "farming_technic:water_mill_active", technic.producer)