Add base electro

This commit is contained in:
ConfidentOwl 2023-01-27 22:32:33 +03:00
parent 30a1672249
commit 56f4c4a7ae
12 changed files with 258 additions and 2 deletions

View File

@ -0,0 +1,127 @@
local S = minetest.get_translator(minetest.get_current_modname())
local name = minetest.get_current_modname()
local path = minetest.get_modpath(name)
local function set_formspect_base_steam_turbine(meta)
local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1)
local fluid_1_volume = owl_tech.get_pull_volume(meta,1)
local max_charge = owl_tech:get_charge_max(meta)
local curent_charge = owl_tech:get_charge(meta)
local voltage = owl_tech:get_voltage(meta)
local formspec = "size[9,8.75]"..
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
"label[2.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Base steam turbin"))).."]"..
"label[0,2.5;"..minetest.formspec_escape(minetest.colorize("#313131", (max_charge.."--"..curent_charge.."--"..voltage))).."]"..
"list[context;battari_slot;2.5,2.5;1,1;]"..
mcl_formspec.get_itemslot_bg(2.5,2.5,1,1)..
"label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]"..
"listring[current_player;main]"..
"listring[context;battari_slot]"..
"listring[current_player;main]"..
"listring[current_player;main]"
meta:set_string("formspec", formspec)
end
minetest.register_node("owl_tech:base_steam_turbin", {
description = S("Base turbine"),
_doc_items_longdesc = S("First generate electro"),
tiles = {
"(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_steam_output.png",
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
"(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_boiler_face.png",
},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, owl_tech_generator=1 ,fluid_in=1,fuel=1,dst=1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
paramtype2 = "facedir",
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
owl_tech.add_new_pull(meta,16000,1,0) --steam for input
owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam") --whitlist for make input ONLY Water
owl_tech:add_electro(pos,32,16000)
owl_tech.update_fluid_pipe_around(pos)
set_formspect_base_steam_turbine(meta)
local timer =minetest.get_node_timer(pos)
local inv = meta:get_inventory()
inv:set_size("battari_slot", 1) ---Can charge items in slot WIP
timer:start(0.2)
end,
--[[on_timer = function(pos, elapsed)
local timer = minetest.get_node_timer(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local fluid_its = inv:get_stack('fluid_in', 1)
local fuel_its = inv:get_stack('fuel', 1)
local dst_its = inv:get_stack('dst', 1)
if not fluid_its:is_empty() then --Load fluid from buckets
owl_tech.add_fluid_in_pull_from_itemslot(meta,fluid_its,inv,dst_its,'fluid_in','dst')
end
if owl_tech.get_fuel_time(meta)>0 then --burn process
owl_tech.fuel_burning(meta)
end
if owl_tech.get_curent_heat(meta)>0 and owl_tech.get_fuel_time(meta)==0 then --coling boiler if not burn
owl_tech.cooling_boiler(meta)
end
if owl_tech.get_curent_heat(meta)>100
and owl_tech.get_pull_volume(meta,2)+owl_tech.get_water_in_steam(meta)*5<=owl_tech.get_pull_max_volume(meta,2)
and owl_tech.get_pull_volume(meta,1)-owl_tech.get_water_in_steam(meta)>=0 then --make steam
owl_tech.gen_steam_in_node_pull(meta,1,2,owl_tech.get_water_in_steam(meta))
if owl_tech.get_pull_fluid_name(meta,2)~="owl_tech_steam" then
owl_tech.set_pull_fluid_name(meta,2,"owl_tech_steam")
end
end
if not fuel_its:is_empty() and owl_tech.get_fuel_time(meta)==0 then --Load fluid from buckets
local out_fuel= minetest.get_craft_result({method = "fuel", width = 1, items = {fuel_its}})
if out_fuel.time>0 then
owl_tech.load_fuel_in_boiler(meta,inv,'fuel',out_fuel,fuel_its)
end
end
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})).name,"fluid_pipe") then --sand in pipe
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up))
local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up))
if can_do and can_do2 then
owl_tech.add_fluid_in_node_pull(meta_up,"owl_tech_steam",remove_amount,inde_pull)
local pull_curent_volume = owl_tech.get_pull_volume(meta,2)
local difer = pull_curent_volume-remove_amount
owl_tech.set_pull_volume(meta,2,difer)
end
end
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"fluid_pipe")
and owl_tech.get_pull_fluid_name(minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z}),1)=="mcl_core:water_source" then --get from pipe water
local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z})
local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1)
local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta))
local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up))
if can_do and can_do2 then
owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull)
owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull)
end
end
owl_tech.delit_name_fluid_if_0(meta)
set_formspect_base_boiler(meta)
timer:start(0.2)
end]]
})
--Crafte bronze boiler
minetest.register_craft({
type = "shaped",
output = "owl_tech:base_steam_turbin",
recipe = {
{"owl_tech:steel_plate","owl_tech:steel_plate","owl_tech:steel_plate"},
{"owl_tech:steel_plate","owl_tech:steel_frames","owl_tech:steel_plate"},
{"owl_tech:steel_plate","owl_tech:circuit_tire_1","owl_tech:steel_plate"}
}
})

View File

@ -0,0 +1,5 @@
local S = minetest.get_translator(minetest.get_current_modname())
local name = minetest.get_current_modname()
local path = minetest.get_modpath(name)
dofile(path .. "/electro_generator/base_steam_turbins.lua")

View File

@ -0,0 +1,80 @@
local S = minetest.get_translator(minetest.get_current_modname())
--Copper wire
minetest.register_node("owl_tech:copper_electro_wire",{
description = "Copper electro wire tire 1",
_tt_help = S("Transport electro enegry"),
_doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."),
_doc_items_usagehelp = S("Right-click the fence gate to open or close it."),
tiles = {"(owl_tech_base_fluid_pipe.png^[colorize:#ff5e00:128)^owl_tech_base_wire.png"},
paramtype = "light",
is_ground_content = false,
stack_max = 64,
sunlight_propagates = true,
walkable = true,
groups = {owl_tech_electro_wire=1},
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {-0.125,-0.125,-0.125,0.125,0.125,0.125} ,
connect_top = {-0.125,-0.125,-0.125,0.125,0.5,0.125} ,
connect_bottom = {-0.125,-0.5,-0.125,0.125,0.125,0.125} ,
connect_front = {-0.125,-0.125,-0.5,0.125,0.125,0.125} ,
connect_left = {-0.5,-0.125,-0.125,0.125,0.125,0.125} ,
connect_back = {-0.125,-0.125,-0.125,0.125,0.125,0.5} ,
connect_right = {-0.125,-0.125,-0.125,0.5,0.125,0.125} ,
},
connects_to = {"group:owl_tech_electro_wire","owl_tech_electro_mashine","owl_tech_electro_gen"},
sounds = mcl_sounds.node_sound_wool_defaults(),
_mcl_hardness = 0.1,
_mcl_blast_resistance = 0.1,
on_construct = function(pos)
owl_tech:prepear_vire(pos,32)
local timer =minetest.get_node_timer(pos)
owl_tech:look_around_for_wire(pos)
--update wire around
if minetest.get_node_group(minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}),"group:owl_tech_electro_wire") then
owl_tech:look_around_for_wire({x=pos.x,y=pos.y+1,z=pos.z})
end
if minetest.get_node_group(minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}),"group:owl_tech_electro_wire") then
owl_tech:look_around_for_wire({x=pos.x,y=pos.y-1,z=pos.z})
end
if minetest.get_node_group(minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}),"group:owl_tech_electro_wire") then
owl_tech:look_around_for_wire({x=pos.x,y=pos.y,z=pos.z+1})
end
if minetest.get_node_group(minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}),"group:owl_tech_electro_wire") then
owl_tech:look_around_for_wire({x=pos.x,y=pos.y,z=pos.z-1})
end
if minetest.get_node_group(minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}),"group:owl_tech_electro_wire") then
owl_tech:look_around_for_wire({x=pos.x+1,y=pos.y,z=pos.z})
end
if minetest.get_node_group(minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}),"group:owl_tech_electro_wire") then
owl_tech:look_around_for_wire({x=pos.x-1,y=pos.y,z=pos.z})
end
--------------------
timer:start(0.2)
end,
on_timer = function (pos, elapsed)
local meta = minetest.get_meta(pos)
owl_tech:look_around_for_wire(pos)
if meta:get_int("connect_amount")>0 then
owl_tech:send_to_side_electro(pos)
end
local timer =minetest.get_node_timer(pos)
timer:start(0.2)
end
})
--Crafte iron fluid pipe
minetest.register_craft({
type = "shaped",
output = "owl_tech:copper_electro_wire 4",
recipe = {
{"owl_tech:copper_plate","mcl_core:ruber_dust","owl_tech:copper_plate"},
{"","",""},
{"","",""}
}
})

6
electro_wire/init.lua Normal file
View File

@ -0,0 +1,6 @@
local S = minetest.get_translator(minetest.get_current_modname())
local name = minetest.get_current_modname()
local path = minetest.get_modpath(name)
dofile(path.."/electro_wire/electro_api.lua")
dofile(path.."/electro_wire/electro_wire.lua")

View File

@ -20,3 +20,5 @@ if i3_name~=nil then
end
dofile(path .. "/multiblocks/init.lua") --Multi-nodes
dofile(path .. "/farming/init.lua") --Farming
dofile(path .. "/electro_wire/init.lua")--electro_vire electro_generator/init.lua
dofile(path .. "/electro_generator/init.lua")--electro generator

View File

@ -72,7 +72,7 @@ FORGE_HAMMER_RECIPS={
}
--List of all crops
LIST_ALL_CROPS={
"mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct","mcl_farming:carrot"
"mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct","mcl_farming:carrot","mcl_farming:potato_item"
}
--List all crops breed 1)time ,2)name new crop
CROPS_BREED={

View File

@ -181,7 +181,7 @@ for i, value in ipairs(metals_ore_array) do
cooktime = 10,
})
end
--dust
--dust owl_tech_lamp_base.png owl_tech_lamp_part.png
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dust", {
description = S(metals_ore_array[i][2].. " dust"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " dust"),
@ -198,6 +198,24 @@ for i, value in ipairs(metals_ore_array) do
{"owl_tech:work_mortar","owl_tech:work_mortar"},
}
})
--lamp
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_lamp", {
description = S(metals_ore_array[i][2].. " lamp"),
_doc_items_longdesc = S("simple and reliable electrical circuit element"),
inventory_image = "owl_tech_lamp_base.png^(owl_tech_lamp_part.png^[colorize:"..metals_ore_array[i][5]..":128)",
stack_max = 64,
groups = { craftitem=1 },
})
--Cafte lamp
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..metals_ore_array[i][1].."_lamp 4",
recipe = {
{"mcl_core:glass","owl_tech:"..metals_ore_array[i][1].."_ingot","mcl_core:glass"},
{"mcl_core:glass","owl_tech:"..metals_ore_array[i][1].."_ingot","mcl_core:glass",},
{"","",""}
},
})
--dirt dust
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dirt_dust", {
description = S(metals_ore_array[i][2].. " dirt dust"),
@ -980,4 +998,22 @@ minetest.register_craft({
{"mcl_core:stick", ""},
{"mcl_core:stick", ""}
}
})
--lamp
minetest.register_craftitem("owl_tech:circuit_tire_1", {
description = S("Circuit tire 1"),
_doc_items_longdesc = S("Simple lamp circuit"),
inventory_image = "owl_tech_circuit_tire1.png",
stack_max = 64,
groups = { craftitem=1 },
})
--Cafte lamp
minetest.register_craft({
type = "shaped",
output = "owl_tech:circuit_tire_1 2",
recipe = {
{"owl_tech:tin_lamp","owl_tech:copper_electro_wire","owl_tech:tin_lamp"},
{"owl_tech:iron_lamp","owl_tech:copper_electro_wire","owl_tech:iron_lamp",},
{"owl_tech:copper_lamp","owl_tech:copper_electro_wire","owl_tech:copper_lamp"}
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB