Book/Tome update
Initial upload of Book/Tome of instructions of how to use elepower Book will be given on initial logon
@ -159,7 +159,6 @@ local function electrolyzer_timer(pos)
|
||||
|
||||
meta:set_string("infotext", ("Electrolyzer %s\n%s"):format(status, ele.capacity_text(pow_buffer.capacity, pow_buffer.storage)))
|
||||
meta:set_string("formspec", get_formspec(time_percent, pow_buffer, input, out1, out2, state))
|
||||
minetest.debug(dump(pow_buffer))
|
||||
return refresh
|
||||
end
|
||||
|
||||
|
@ -210,7 +210,7 @@ local function timer(pos, elapsed)
|
||||
end
|
||||
|
||||
ele.register_machine("elepower_machines:pump", {
|
||||
description = "Pump",
|
||||
description = "Pickup Pump Tank",
|
||||
tiles = {
|
||||
"elepower_machine_top.png^elepower_power_port.png", "elepower_machine_base.png^elepower_pump_base.png",
|
||||
"elepower_machine_side.png^elepower_pump_side.png",
|
||||
|
@ -82,6 +82,6 @@ function ele.formspec.fluid_bar(x, y, fluid_buffer)
|
||||
return "image["..x..","..y..";1,2.8;elepower_gui_barbg.png"..
|
||||
"\\^[lowpart\\:"..metric.."\\:"..texture.."\\\\^[resize\\\\:64x128]"..
|
||||
"image["..x..","..y..";1,2.8;elepower_gui_gauge.png]"..
|
||||
"image[0.2,2.45;0.5,0.5;elepower_gui_icon_power_stored.png]"..
|
||||
--"image[.."..(x+0.2)..","..(y+2.45)..";0.5,0.5;elepower_gui_icon_fluid_water.png]"..
|
||||
tooltip
|
||||
end
|
||||
|
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.8 KiB |
BIN
elepower_papi/textures/elepower_gui_icon_power_water.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
296
elepower_tome/i_eletome_additional_info.lua
Normal file
@ -0,0 +1,296 @@
|
||||
---------------------------------------------------
|
||||
-- ___ _ --
|
||||
-- | __| |___ _ __ _____ __ _____ _ _ --
|
||||
-- | _|| / -_) '_ \/ _ \ V V / -_) '_| --
|
||||
-- |___|_\___| .__/\___/\_/\_/\___|_| --
|
||||
-- |_| --
|
||||
-- _____ --
|
||||
-- |_ _|__ _ __ ___ --
|
||||
-- | |/ _ \ ' \/ -_) --
|
||||
-- |_|\___/_|_|_\___| --
|
||||
---------------------------------------------------
|
||||
-- Additional Information --
|
||||
---------------------------------------------------
|
||||
|
||||
-- This is a store of custom text and data metrics used
|
||||
-- by the tome. In some cases some of these could be added
|
||||
-- to the node/craft registrations but this would clutter
|
||||
-- those even more and they are across multiple mods making
|
||||
-- updates more difficult.
|
||||
|
||||
-- Main table for storing additional info
|
||||
eletome.ai = {}
|
||||
|
||||
---------------------------------------------------------
|
||||
-- General Info for Machine Pages (Simple and Complex) --
|
||||
---------------------------------------------------------
|
||||
-- note must be setup as
|
||||
-- eletome.ai.<page_heading_name>
|
||||
-- Values
|
||||
-- eletome.ai.<page_heading_name>.img - <optional> Image sized 800/1000 x 600 sized image
|
||||
--works best, appears at the bottom of the left page if set
|
||||
|
||||
--eletome.ai.<page_heading_name>.part - <optional> Used for Complex Machine pages -
|
||||
-- This is a table list of the machine nodes that is used to
|
||||
-- assemble the complex machine, node names should be entered
|
||||
-- in the order you wish them to output on the right hand page.
|
||||
|
||||
--eletome.ai.<page_heading_name>.over - <optional> text block that appears on the left page
|
||||
-- 500-600 characters works best but can enter more or less
|
||||
|
||||
--eletome.ai.<page_heading_name>.sort_by - <optional> an optional field to sort all the nodes by, has to be
|
||||
-- a field avaliable on the node registrations for all nodes
|
||||
-- using "no_sort" will prevent any sorting from occuring
|
||||
|
||||
-- info for Generators page
|
||||
eletome.ai.generators = {}
|
||||
eletome.ai.generators.img = "power_network_simple_examples.png"
|
||||
eletome.ai.generators.over = "Generators produce EpU/s by taking something from the natural "..
|
||||
"environment and converting it to power that can be used by machines. "..
|
||||
"There are both low and high tech solutions for producing power so choose "..
|
||||
"a power generation method that best fits with what your current needs are "..
|
||||
"and the resources you have avaliable.\n\n"..
|
||||
"Generators produce power (EpU/s) every second, they then distribute this "..
|
||||
"power across their network to all connected machines that require power.\n\n"..
|
||||
"A single power network is a group of machines and conduits which is connected "..
|
||||
"in one single un-broken group two examples of simple valid power networks "..
|
||||
"is pictured below."
|
||||
|
||||
-- info for Powercells page
|
||||
eletome.ai.powercells = {}
|
||||
eletome.ai.powercells.sort_by = "ele_output"
|
||||
eletome.ai.powercells.over = "Powercells will charge from the network when power is avaliable."..
|
||||
"Once power supply on a network is 0 ie generators no longer "..
|
||||
"producing EpUs. The powercell(s) will provide power only to active "..
|
||||
"machines on the network. Powercells will provide the minimum EpUs "..
|
||||
"to the machine ie the usage amount not the max amount the machine "..
|
||||
"can recieve.\nFor example the Sawmill when active(being used) uses "..
|
||||
"32 EpUs, however the Sawmill can accept upto 64 EpUs of power until "..
|
||||
"fully charged. Powercell(s) will only provide the Sawmill with 32 "..
|
||||
"EpUs of power if the Sawmill is active."
|
||||
|
||||
-- info for (Simple/Single node) Machine page
|
||||
eletome.ai.machine = {}
|
||||
|
||||
-- info for Fluid Pump page
|
||||
eletome.ai.fluid_pump = {}
|
||||
eletome.ai.fluid_pump.sort_by = "no_sort"
|
||||
eletome.ai.fluid_pump.img = "elepower_tome_complex_water_pump.png"
|
||||
eletome.ai.fluid_pump.part = {"elepower_machines:pump",
|
||||
"fluid_transfer:fluid_transfer_pump",
|
||||
"elepower_machines:accumulator",
|
||||
"elepower_machines:accumulator_heavy"}
|
||||
eletome.ai.fluid_pump.over = "The simplest fluid Pump is assembled from two components:"..
|
||||
"the 'Pickup Pump Tank' and the 'Fluid Transfer Pump'\n"..
|
||||
"The 'Pickup Pump Tank' must be placed above a body of fluid, "..
|
||||
"and provided with power. The black end of the "..
|
||||
"'Fluid Transfer Pump' must be placed up against the 'Pickup Pump Tank'.\n"..
|
||||
"Once completed fluid ducting can then be used to run fluid to machines "..
|
||||
"that require fluid - For example water to the Electrolyzer."
|
||||
|
||||
-- info for Miner page
|
||||
eletome.ai.miner = {}
|
||||
eletome.ai.miner.sort_by = "no_sort"
|
||||
eletome.ai.miner.instruct = "y"
|
||||
eletome.ai.miner.img = "elepower_tome_complex_miner.png"
|
||||
eletome.ai.miner.part = {"elepower_mining:miner_controller",
|
||||
"elepower_mining:miner_core",
|
||||
"elepower_mining:miner_drill"}
|
||||
eletome.ai.miner.over = "The miner uses significant volumes of power and water to sift metals "..
|
||||
"from the surronding electro-molecular environment. The miner then "..
|
||||
"gathers the molecules together until enough are gathered for a lump "..
|
||||
"of metal to materialise.\n"..
|
||||
"Assembly requires an incoming water supply from a fluid pump, a power "..
|
||||
"source providing at least 128 EpUs of power. 1-9 mining drills, 1 central core, "..
|
||||
"1 miner controller and some lengths of fluid duct. Place the 1-9 mining drills "..
|
||||
"down as 1x1 to 3x3 grid, place the central core ontop of the center drill and place "..
|
||||
"the controller ontop of the central core. Join them all togther with fluid duct "..
|
||||
"ensure one fluid duct is going into the side of the controller. Supply power "..
|
||||
"and water to the miner and it will start functioning."
|
||||
|
||||
-- info for Evaporation Plant page
|
||||
eletome.ai.evaporation_plant = {}
|
||||
eletome.ai.evaporation_plant.sort_by = "no_sort"
|
||||
eletome.ai.evaporation_plant.instruct = "y"
|
||||
eletome.ai.evaporation_plant.img = "elepower_tome_complex_thermal_evap.png"
|
||||
eletome.ai.evaporation_plant.part = {"elepower_thermal:evaporator_controller",
|
||||
"elepower_thermal:evaporator_input",
|
||||
"elepower_thermal:evaporator_output",
|
||||
"elepower_machines:heat_casing",
|
||||
"elepower_solar:solar_generator"}
|
||||
eletome.ai.evaporation_plant.over = "The Thermal Evaporation Plant is a machine which converts Water into Brine "..
|
||||
"and Brine into liquid Lithium. It is powered via solar panels around the top "..
|
||||
"edge.\n"..
|
||||
"The plant consists of a Thermal Evaporation Plant Controller, Heat Casings, "..
|
||||
"Thermal Evaporation Plant Inputs and Thermal Evaporation Plant Outputs. It "..
|
||||
"is a 4x4 structure which can be built between 3 and 18 nodes high. The first "..
|
||||
"layer is a solid 4x4 of Heat Casings. The controller must be placed on top of "..
|
||||
"this floor of heat casings and on an outside edge. The center must be left "..
|
||||
"hollow. On top of the top layer of heat casings you place Solar Generators "..
|
||||
"this is in order to increase the heat inside the plant, More heat increases the "..
|
||||
"production rate per second of the plant. The plant has a maximum temp of 1000 Kelvin.\n"..
|
||||
"Note: If the controller fails to verify your structure (PUNCH the controller) or "..
|
||||
"try placing it on a different side."
|
||||
|
||||
-- info for Transporter page
|
||||
eletome.ai.transporter = {}
|
||||
eletome.ai.transporter.sort_by = "no_sort"
|
||||
eletome.ai.transporter.part = {"elepower_wireless:dialler",
|
||||
"elepower_wireless:matter_transmitter",
|
||||
"elepower_wireless:matter_receiver"}
|
||||
eletome.ai.transporter.over = "Once setup the Teleporter allows for instanaeous travel from the sending pad "..
|
||||
"to the recieveing pad.\n"..
|
||||
"To construct the teleporter simply place the transmission pad down were you would like "..
|
||||
"to travel from and the reciever pad were you would like to travel too. Both ends will "..
|
||||
"need to be provided with power to function. It is suggested "..
|
||||
"you place a sending and recieving pad at both ends so you can teleport back and forth easily."
|
||||
|
||||
-- info for Wind Turbine page
|
||||
eletome.ai.wind_turbine = {}
|
||||
eletome.ai.wind_turbine.sort_by = "no_sort"
|
||||
eletome.ai.wind_turbine.part = {"elepower_machines:wind_turbine",
|
||||
"elepower_machines:wind_turbine_blade"
|
||||
}
|
||||
eletome.ai.wind_turbine.over = ""
|
||||
|
||||
-- info for Fission page
|
||||
eletome.ai.fission_reactor = {}
|
||||
eletome.ai.fission_reactor.sort_by = "no_sort"
|
||||
eletome.ai.fission_reactor.instruct= "y"
|
||||
eletome.ai.fission_reactor.img = "elepower_tome_complex_fission_reactor.png"
|
||||
eletome.ai.fission_reactor.part = {"elepower_nuclear:fission_controller",
|
||||
"elepower_nuclear:fission_core",
|
||||
"elepower_nuclear:reactor_fluid_port",
|
||||
"elepower_nuclear:heat_exchanger",
|
||||
"elepower_nuclear:enrichment_plant",
|
||||
"elepower_nuclear:bucket_coolant",
|
||||
}
|
||||
eletome.ai.fission_reactor.over = "The Nuclear (Fission) Reactor is a type of Nuclear Reactor in Elepower used for power generation. "..
|
||||
"The reactor itself is composed of three nodes:\n"..
|
||||
"Fission Control Module - Used for controlling the power of the reactor (top node)\n"..
|
||||
"Fission Reactor Core - The core of the reactor (middle node)\n"..
|
||||
"Reactor Fluid Port - Used to turn Cold Coolant into Hot Coolant (bottom node)\n"..
|
||||
"The Reactor Core takes Fissile Fuel Rods and turns them into Depleted Fuel Rods after 2 hours (7200 seconds). "..
|
||||
"The reactor assembly needs to have area of Water Source nodes surrounding it in order to keep "..
|
||||
"the reactor cool (9x9x9 block of water). If the reactor heat reaches above 80%, it will start to melt down. The Control Rods "..
|
||||
"can be raised or lowered to control the power output of the reactor core. Lowered control rods mean "..
|
||||
"that the reactor is slowed down and raised mean that the reactor is accelerated.\nTo gather power from the reactor "..
|
||||
"you will need to add a heat exchanger, water pump, steam turbine and at least 1 bucket of cold coolant as well "..
|
||||
"as the fluid ducts and fluid transfer pumps to move the fluids and steam around.\n"..
|
||||
"This reactor is inspired by the real world pressurized water reactor design.\n\n"
|
||||
|
||||
-- info for Fusion page
|
||||
eletome.ai.fusion_reactor = {}
|
||||
eletome.ai.fusion_reactor.sort_by = "no_sort"
|
||||
eletome.ai.fusion_reactor.part = {"elepower_nuclear:fusion_coil",
|
||||
"elepower_nuclear:reactor_controller",
|
||||
"elepower_nuclear:reactor_power",
|
||||
"elepower_nuclear:reactor_fluid",
|
||||
"elepower_nuclear:reactor_output",
|
||||
"elepower_nuclear:solar_neutron_activator",
|
||||
"elepower_machines:advanced_machine_block"}
|
||||
eletome.ai.fusion_reactor.over = ""
|
||||
|
||||
-- will also accept image names (png only), table keys
|
||||
-- equate to craft grid eg [5] equals center node in 3x3 grid
|
||||
--{[4] = "reg_node_name_1",[5] = "image_name_1.png", [6] = "reg_node_name_1"}
|
||||
|
||||
------------------------------------------------
|
||||
-- Node/Image specific additional information --
|
||||
------------------------------------------------
|
||||
-- Used to supply additional information to specific
|
||||
-- nodes or to images being used in recipes or summary block
|
||||
--
|
||||
-- Values (all optional) - use if unknown appears or customising
|
||||
-- lb_top_img = left page, left box, top image (.png) or registered node name
|
||||
-- lb_top_tt = left page, left box, top tooltip
|
||||
-- lb_mid_img = left page, left box, mid image
|
||||
-- lb_mid_tt = left page, left box, mid tooltip
|
||||
-- lb_btm_img = left page, left box, btm image_name or number
|
||||
-- lb_btm_tt = left page, left box, btm tooltip
|
||||
|
||||
-- mb_title_txt = left page, middle box, topline title txt - good for custom craft or action
|
||||
--only use when recipe dosen't have slots [1],[2] or [3].
|
||||
|
||||
-- mb_recipe_items = left page, middle box; table keys
|
||||
-- equate to craft grid eg [5] equals center node in 3x3 grid
|
||||
-- Structure - {[4] = "reg_node_name_1",
|
||||
-- [5] = "image_name_1.png",
|
||||
-- [6] = "reg_node_name_1"}
|
||||
|
||||
eletome.ai.nodes = {}
|
||||
|
||||
-- Generators Page
|
||||
eletome.ai.nodes["elepower_machines:generator"] = {lb_top_img = "default:coal_lump",
|
||||
lb_top_tt = "Burnable Items",
|
||||
lb_btm_tt = " EpU generated\nper second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:lava_generator"] = {lb_top_img = "default:lava_source",
|
||||
lb_btm_tt = " EpU generated\nper 125 lava/second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:fuel_burner"] = {lb_top_img = "elepower_farming:biofuel_source",
|
||||
lb_btm_tt = " EpU generated\nper 12.5 biofuel/second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_solar:solar_generator"] = {lb_top_img = "elepower_tome_sunlight.png",
|
||||
lb_top_tt ="Sunlight",
|
||||
lb_btm_tt = " EpU generated\nper second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:steam_turbine"] = {lb_top_img = "elepower_tome_steam.png",
|
||||
lb_top_tt ="Steam",
|
||||
lb_btm_tt = " EpU generated\nper 500 steam/second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:wind_turbine"] = {lb_top_img = "elepower_tome_wind.png",
|
||||
lb_top_tt ="Wind",
|
||||
lb_btm_tt = " EpU generated\nper second"
|
||||
}
|
||||
|
||||
-- Powercells
|
||||
eletome.ai.nodes["elepower_machines:power_cell_0"] = {lb_top_img = "elepower_gui_icon_power_stored.png",
|
||||
lb_top_tt = "Storage "..minetest.registered_nodes["elepower_machines:power_cell_0"].ele_capacity.." EpUs",
|
||||
lb_btm_tt = " EpU max output\nper second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:hardened_power_cell_0"] = {lb_top_img = "elepower_gui_icon_power_stored.png",
|
||||
lb_top_tt = "Storage "..minetest.registered_nodes["elepower_machines:hardened_power_cell_0"].ele_capacity.." EpUs",
|
||||
lb_btm_tt = " EpU max output\nper second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:reinforced_power_cell_0"] = {lb_top_img = "elepower_gui_icon_power_stored.png",
|
||||
lb_top_tt = "Storage "..minetest.registered_nodes["elepower_machines:reinforced_power_cell_0"].ele_capacity.." EpUs",
|
||||
lb_btm_tt = " EpU max output\nper second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:resonant_power_cell_0"] = {lb_top_img = "elepower_gui_icon_power_stored.png",
|
||||
lb_top_tt = "Storage "..minetest.registered_nodes["elepower_machines:resonant_power_cell_0"].ele_capacity.." EpUs",
|
||||
lb_btm_tt = " EpU max output\nper second"
|
||||
}
|
||||
eletome.ai.nodes["elepower_machines:super_power_cell_0"] = {lb_top_img = "elepower_gui_icon_power_stored.png",
|
||||
lb_top_tt = "Storage "..minetest.registered_nodes["elepower_machines:super_power_cell_0"].ele_capacity.." EpUs",
|
||||
lb_btm_tt = " EpU max output\nper second"
|
||||
}
|
||||
|
||||
-- (Simple) Machines Page
|
||||
eletome.ai.nodes["elepower_machines:alloy_furnace"] = {lb_top_img = "default_tin_ingot.png",
|
||||
lb_top_tt ="2 Materials\nto be Alloyed",
|
||||
lb_btm_tt = " used per second"}
|
||||
|
||||
-- Fluid Pump Page
|
||||
eletome.ai.nodes["elepower_machines:pump"] = {lb_top_img = "elepower_gui_icon_fluid_electrolyzer_in.png", lb_top_tt = "Fluid"}
|
||||
eletome.ai.nodes["fluid_transfer:fluid_transfer_pump"] = {lb_top_img = "elepower_gui_icon_fluid_electrolyzer_in.png", lb_top_tt = "Fluid"}
|
||||
eletome.ai.nodes["elepower_machines:accumulator"] = {lb_top_img = "elepower_gui_icon_fluid_water.png", lb_top_tt = "Water"}
|
||||
eletome.ai.nodes["elepower_machines:accumulator_heavy"] = {lb_top_img = "elepower_gui_icon_fluid_water.png",
|
||||
lb_top_tt = "Heavy Water",
|
||||
mb_title_txt = "Right Click",
|
||||
mb_recipe_items = {[4] = "elepower_machines:heavy_filter",
|
||||
[5] = "elepower_tome_mouse_rght_click.png",
|
||||
[6] = "elepower_machines:accumulator"}
|
||||
}
|
||||
|
||||
-- Evaporation Plant page
|
||||
eletome.ai.nodes["elepower_thermal:evaporator_controller"] = {lb_top_img = "elepower_gui_icon_fluid_water_brine_lithium.png", lb_top_tt = " Water\n Brine\nLithium"}
|
||||
eletome.ai.nodes["elepower_thermal:evaporator_input"] = {lb_top_img = "elepower_gui_icon_fluid_water_brine.png", lb_top_tt = "Water\nBrine"}
|
||||
eletome.ai.nodes["elepower_thermal:evaporator_output"] = {lb_top_img = "elepower_gui_icon_fluid_brine_lithium.png", lb_top_tt = " Brine\nLithium"}
|
||||
eletome.ai.nodes["elepower_machines:heat_casing"] = {lb_top_img = "elepower_machines:heat_casing"}
|
||||
|
||||
|
||||
-- Miner Page
|
||||
eletome.ai.nodes["elepower_mining:miner_controller"] = {lb_top_img ="elepower_gui_icon_fluid_water.png",lb_top_tt ="Requires\nWater"}
|
||||
eletome.ai.nodes["elepower_mining:miner_core"] = {lb_top_img ="elepower_gui_icon_fluid_water.png",lb_top_tt ="Requires\nWater"}
|
||||
eletome.ai.nodes["elepower_mining:miner_drill"] = {lb_top_img ="elepower_tome_icon_metal_lump.png",lb_top_tt ="Produces\n Metal lumps" ,lb_btm_img = "elepower_gui_icon_power_water.png", lb_btm_tt = "128 EpUs & 500 Water\n used per drill"}
|
284
elepower_tome/i_functions.lua
Normal file
@ -0,0 +1,284 @@
|
||||
---------------------------------------------------
|
||||
-- ___ _ --
|
||||
-- | __| |___ _ __ _____ __ _____ _ _ --
|
||||
-- | _|| / -_) '_ \/ _ \ V V / -_) '_| --
|
||||
-- |___|_\___| .__/\___/\_/\_/\___|_| --
|
||||
-- |_| --
|
||||
-- _____ --
|
||||
-- |_ _|__ _ __ ___ --
|
||||
-- | |/ _ \ ' \/ -_) --
|
||||
-- |_|\___/_|_|_\___| --
|
||||
---------------------------------------------------
|
||||
-- Functions --
|
||||
---------------------------------------------------
|
||||
|
||||
----------------------------------
|
||||
-- Determine if a text string --
|
||||
-- is for an image or not --
|
||||
----------------------------------
|
||||
|
||||
function eletome.is_image(text)
|
||||
local value = false
|
||||
if type(text) == "string" then
|
||||
if string.find(text,".png") then
|
||||
value = true
|
||||
end
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- The below gets all the nodes in a group, additionally --
|
||||
-- it filters out any "_active" versions of the node and --
|
||||
-- removes any numerical versions of the node > 0 --
|
||||
-- additionally it removes any node that is not a --
|
||||
-- standalone machine as a single node --
|
||||
-- two returns mach_key and mach_sort --
|
||||
-----------------------------------------------------------
|
||||
function eletome.get_nodes_in_group(group_name)
|
||||
local mach_key = {}
|
||||
local mach_sort = {}
|
||||
|
||||
for name, def in pairs(minetest.registered_nodes) do
|
||||
if def.groups[group_name] then
|
||||
-- have to remove registered nodes with same name but
|
||||
-- different number versions eg powercells, also remove
|
||||
-- "active" versions
|
||||
|
||||
if not string.find(name, "active") and tonumber((string.match(name,"%d+"))or 0) == 0 then
|
||||
local description = def.description
|
||||
|
||||
if string.find(description,"\n") then
|
||||
description = string.match(description,"(.+)\n")
|
||||
end
|
||||
|
||||
if group_name == "ele_user" and not def.groups["ele_storage"] then
|
||||
-- Simple one node machines are found in machine and farming mods, remove pump - complex.
|
||||
if name ~= "elepower_machines:pump" and string.find(name,"machines:") or string.find(name,"farming:") then
|
||||
table.insert(mach_sort,description)
|
||||
mach_key[description] = name
|
||||
end
|
||||
|
||||
else
|
||||
table.insert(mach_sort,description)
|
||||
mach_key[description] = name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return mach_key, mach_sort
|
||||
end
|
||||
|
||||
-----------------------------------------------------
|
||||
-- table sorting function which will sort nodes by --
|
||||
-- any field avaliable on node registration --
|
||||
-- Output is mach_sort and mach_key --
|
||||
-----------------------------------------------------
|
||||
function eletome.sort_by(sort_by,mach_sort,mach_key)
|
||||
local key = {}
|
||||
local sort = {}
|
||||
|
||||
-- create new key table using sort_by with
|
||||
-- field to sort_by and node.description
|
||||
for des,name in pairs(mach_key)do
|
||||
table.insert(sort,minetest.registered_nodes[name][sort_by])
|
||||
key[minetest.registered_nodes[name][sort_by]] = des
|
||||
end
|
||||
|
||||
-- standard table sort
|
||||
table.sort(sort)
|
||||
|
||||
-- rebuild mach_sort
|
||||
mach_sort = {}
|
||||
for k,v in pairs(sort) do
|
||||
mach_sort[k] = key[v]
|
||||
end
|
||||
return mach_sort,mach_key
|
||||
end
|
||||
--------------------------------------------------------------
|
||||
-- Returns content of page, content of page + bwd_fwd nav --
|
||||
-- or content of specific page num with bwd/fwd nav buttons --
|
||||
--------------------------------------------------------------
|
||||
-- Assumed Input Formats
|
||||
---- page_ref = string - name of main page/how main page identified
|
||||
---- itemlist = structured table of values pre-formated in formspec format
|
||||
---- this includes correct x/y positions for pgs 2/3 etc
|
||||
---- itemlist = {"formspec for item_1","formspec for item_2", etc}
|
||||
---- max_items_pp = How many items from itemlist to put on each page
|
||||
---- page_num = Int of the page number user going too
|
||||
---- button_name = This is the buttons "field" name eg "mach_bwd_fwd"
|
||||
---- used in on_recieve to identify what formspec to return
|
||||
|
||||
function eletome.p_nav_bwd_fwd(page_ref,item_list,max_items_pp,page_num,button_name)
|
||||
local recipe_pg = ""
|
||||
local num_recipe = #item_list
|
||||
local i = 1
|
||||
|
||||
if page_num > 1 then
|
||||
-- Check if we need another fwd button
|
||||
if page_num*max_items_pp < num_recipe then
|
||||
recipe_pg = recipe_pg .."button[15,0;2.5,0.5;"..button_name..";Page "..(page_num + 1).." >>]"
|
||||
end
|
||||
-- Always need back button
|
||||
recipe_pg = recipe_pg .."button[12.5,0;2.5,0.5;"..button_name..";<< "..(page_num - 1).." Page]"
|
||||
|
||||
elseif num_recipe > max_items_pp then
|
||||
recipe_pg = recipe_pg .."button[15,0;2.5,0.5;"..button_name..";Page "..(page_num + 1).." >>]"
|
||||
end
|
||||
|
||||
-- Pass page reference value to player recieve fields when fwd/bwd pressed - not visible on formspec
|
||||
recipe_pg = recipe_pg .."field[10,12;1,0.5;description;;"..page_ref.."]"
|
||||
|
||||
-- used to add a num/offset so we get correct recipes on pg 1/2/etc
|
||||
local pg_offset = (page_num-1)*max_items_pp
|
||||
i = i+pg_offset
|
||||
|
||||
-- Create the final output
|
||||
while i <= (max_items_pp + pg_offset) and i <= num_recipe do
|
||||
recipe_pg = recipe_pg ..item_list[i]
|
||||
i=i+1
|
||||
end
|
||||
|
||||
return recipe_pg
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Returns a table of items which make up the craft recipe for the registered --
|
||||
-- node in elepower note max grid recipe is 3x1 output assigned to keys 4/5/6 --
|
||||
-- Structured as: --
|
||||
-- recipe_output = {items = {[4] = "item 1", [5] = "item 2", [6] = "item 3"}, --
|
||||
-- num = {[4 = 2 , [5] = 1 , [6] = 6 }, --
|
||||
-- craft_name = "elepower craft name" eg can, --
|
||||
-- craft_des = "elepower craft description" eg canning } --
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function eletome.get_craft_recipe(reg_node_name)
|
||||
local recipe_output = {}
|
||||
recipe_output.items = {}
|
||||
recipe_output.num = {}
|
||||
local i = 1
|
||||
local all_crafts = table.copy(elepm.craft.types)
|
||||
|
||||
for craft_name,craft_def in pairs(all_crafts) do
|
||||
for k,reg_craft_def in pairs(elepm.craft[craft_name]) do
|
||||
|
||||
local itemstring = reg_craft_def.output
|
||||
local stack = ItemStack(itemstring)
|
||||
stack = stack:to_table()
|
||||
|
||||
if stack then
|
||||
if stack.name == reg_node_name then
|
||||
-- get inputs for craft
|
||||
local craft_in = craft_def.inputs
|
||||
local pos = {4,5,6}
|
||||
|
||||
if craft_in == 1 then
|
||||
pos = {5}
|
||||
|
||||
elseif craft_in == 2 then
|
||||
pos = {5,6}
|
||||
end
|
||||
|
||||
recipe_output.craft_name = craft_name
|
||||
recipe_output.craft_des = craft_def.description
|
||||
|
||||
for k,v in pairs(reg_craft_def.recipe) do
|
||||
recipe_output.items[pos[i]] = k
|
||||
recipe_output.num[pos[i]] = v
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
else
|
||||
-- some not in stack format (saw - catch later)
|
||||
end
|
||||
end
|
||||
end
|
||||
return recipe_output
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
-- Generates the visual craft output grid recipe for the node --
|
||||
-- nominally this is either a 3x3 grid (std MT Recipe or a --
|
||||
-- 1x3,1x2,1x1 grid for elepower craft recipes. --
|
||||
-- Takes into account customisation from additional info --
|
||||
-- Input list of items for node recipe as a numeric key table --
|
||||
-- keys 1-9 - note keys can be missing but can't exceed 9 --
|
||||
-- basically accepts output from "eletome.get_craft_recipe" --
|
||||
-- Outputs: --
|
||||
-- formspec formated grid of ingredients --
|
||||
-- Current y offset - y_off --
|
||||
------------------------------------------------------------------
|
||||
function eletome.gen_craft_grid(recipe,y_off,no_items)
|
||||
local x_cnt = 1
|
||||
local x_off = 0
|
||||
local dis_recipe = ""
|
||||
local sty_h3s = eletome.common_styles.style_h3s
|
||||
local sty_h3e = eletome.common_styles.style_h3e
|
||||
|
||||
while x_cnt <= 9 do
|
||||
-- catch for node with un-handled/non-exsitant recipe
|
||||
if no_items == 1 then
|
||||
-- output nothing as no recipe
|
||||
|
||||
-- recipe item or image output
|
||||
elseif recipe.items[x_cnt] then
|
||||
|
||||
-- handle when recipe includes groups
|
||||
if string.find(recipe.items[x_cnt],"group") then
|
||||
local grp_name = string.gsub(recipe.items[x_cnt],"group:","")
|
||||
local node_name
|
||||
for name,def in pairs(minetest.registered_nodes) do
|
||||
if def.groups[grp_name] and not def.groups["wall"] then
|
||||
node_name = name
|
||||
break
|
||||
end
|
||||
end
|
||||
dis_recipe = dis_recipe.."item_image_button["..(12+x_off)..","..(1+y_off)..";0.75,0.75;"..node_name..";"..node_name..";G]"..
|
||||
"tooltip["..node_name..";"..recipe.items[x_cnt]..";"..eletome.tooltip_color.."]"
|
||||
|
||||
-- handle a custom png image
|
||||
elseif string.find(recipe.items[x_cnt],".png") then
|
||||
dis_recipe = dis_recipe.."image["..(12+x_off)..","..(1+y_off)..";0.75,0.75;"..recipe.items[x_cnt].."]"
|
||||
dis_recipe = dis_recipe.."tooltip["..(12+x_off)..","..(1+y_off)..";0.75,0.75;"..recipe.craft_des..";"..eletome.tooltip_color.."]"
|
||||
else
|
||||
dis_recipe = dis_recipe.."item_image_button["..(12+x_off)..","..(1+y_off)..";0.75,0.75;"..recipe.items[x_cnt]..";"..recipe.items[x_cnt]..";]"
|
||||
end
|
||||
|
||||
-- Special case to insert elepower craft name in grid pos[1] or
|
||||
-- Custom additional info "craft name" eg "Right Click"
|
||||
elseif recipe.craft_name and x_cnt == 1 then
|
||||
-- only provide a link if a elepower craft name
|
||||
if elepm.craft[recipe.craft_name] then
|
||||
dis_recipe = dis_recipe.."hypertext["..(11.5+x_off)..","..(1.2+y_off)..
|
||||
";2.5,1;craft_click;"..sty_h3s.."<action name="..recipe.craft_des..">"..recipe.craft_des.."</action>"..sty_h3e.."]"
|
||||
else
|
||||
dis_recipe = dis_recipe.."hypertext["..(11.5+x_off)..","..(1.2+y_off)..
|
||||
";2.5,1;craft_click;"..sty_h3s..recipe.craft_des..sty_h3e.."]"
|
||||
end
|
||||
|
||||
-- Custom craft but no ingredient/need for craft slot
|
||||
elseif recipe.craft_name then
|
||||
-- output nothing as no slot on custom craft
|
||||
|
||||
-- Normal MT craft output empty craft slot.
|
||||
else
|
||||
dis_recipe = dis_recipe.."image["..(12+x_off)..","..(1+y_off)..";0.75,0.75;elepower_tome_bgimg_2.png]"
|
||||
end
|
||||
|
||||
-- counters and offsets
|
||||
if x_cnt == 3 or x_cnt == 6 then
|
||||
x_off = 0
|
||||
y_off = y_off + 0.8
|
||||
else
|
||||
x_off = x_off + 0.8
|
||||
end
|
||||
x_cnt = x_cnt+1
|
||||
end
|
||||
|
||||
return dis_recipe, y_off
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
99
elepower_tome/i_page_contents.lua
Normal file
@ -0,0 +1,99 @@
|
||||
---------------------------------------------------
|
||||
-- ___ _ --
|
||||
-- | __| |___ _ __ _____ __ _____ _ _ --
|
||||
-- | _|| / -_) '_ \/ _ \ V V / -_) '_| --
|
||||
-- |___|_\___| .__/\___/\_/\_/\___|_| --
|
||||
-- |_| --
|
||||
-- _____ --
|
||||
-- |_ _|__ _ __ ___ --
|
||||
-- | |/ _ \ ' \/ -_) --
|
||||
-- |_|\___/_|_|_\___| --
|
||||
---------------------------------------------------
|
||||
-- Contents Page --
|
||||
---------------------------------------------------
|
||||
|
||||
function eletome.contents_page()
|
||||
-- Contents page structured as 2 pages ie an open book
|
||||
-- a single column on left page and 2 columns on right page
|
||||
|
||||
-- Assign Common styles to local vars
|
||||
local sty_h0s = eletome.common_styles.style_h0s
|
||||
local sty_h0e = eletome.common_styles.style_h0e
|
||||
local sty_h1s = eletome.common_styles.style_h1s
|
||||
local sty_h1e = eletome.common_styles.style_h1e
|
||||
local sty_h2s = eletome.common_styles.style_h2s
|
||||
local sty_h2e = eletome.common_styles.style_h2e
|
||||
local sty_h3s = eletome.common_styles.style_h3s
|
||||
local sty_h3e = eletome.common_styles.style_h3e
|
||||
local sty_h4s = eletome.common_styles.style_h4s
|
||||
local sty_h4e = eletome.common_styles.style_h4e
|
||||
|
||||
-- Contents page left page Content
|
||||
|
||||
local content_lp_txt = "Elepower adds power to a game, "..
|
||||
"Power is referred to in units and these units "..
|
||||
"are called EpU (Elepower Unit).\n"..
|
||||
"New crafts are added to the game as well as new machines "..
|
||||
"to enable these new crafts and make use of EpU/s.\n\n"..
|
||||
"A big thank you to IcyDiamond the orginal creator of this mod."
|
||||
|
||||
local heading_lp = "hypertext[0.50,0.70;8.5,1.2;content_lp_h_tome;"..sty_h0s.."Elepower Tome"..sty_h0e.."]"
|
||||
local content_lp = "hypertext[0.75,1.8;8.0,8.0;content_lp_c_text;"..sty_h3s..content_lp_txt..sty_h3s.."]"
|
||||
|
||||
|
||||
-- Contents page right page Content
|
||||
local heading_rp = "hypertext[9.0,0.7;8.5,1.0;content_rp_h_cont;"..sty_h1s.."Contents"..sty_h1e.."]"
|
||||
local heading_rp_craft = "hypertext[9.0,1.5;8.5,1.0;content_rp_sh_crafts;"..sty_h2s.."Crafts"..sty_h2e.."]"
|
||||
|
||||
local raw_all_crafts = table.copy(elepm.craft.types)
|
||||
local all_crafts = {}
|
||||
-- Gets the Human readable craft name
|
||||
-- and sorts them alphabetically
|
||||
for k,def in pairs(raw_all_crafts) do
|
||||
table.insert(all_crafts,def.description)
|
||||
end
|
||||
table.sort(all_crafts)
|
||||
|
||||
-- Generate the craft_content section
|
||||
-- 2 columns of h2 headings down the page
|
||||
local left_col = ""
|
||||
local rght_col = ""
|
||||
for k,craft_name in pairs(all_crafts) do
|
||||
if (k % 2 == 0) then -- even key - backwards fix this left should be odd....
|
||||
left_col = left_col.."<action name="..craft_name..">"..craft_name.."</action>".."\n"
|
||||
else -- odd key
|
||||
rght_col = rght_col.."<action name="..craft_name..">"..craft_name.."</action>".."\n"
|
||||
end
|
||||
end
|
||||
|
||||
local ac_off = math.ceil((#all_crafts/2)*0.75)
|
||||
|
||||
local craft_rp_txt = "hypertext[09.0,2.0;4.5,"..ac_off..";craft_click;"..sty_h3s..left_col..sty_h3e.."]"..
|
||||
"hypertext[13.5,2.0;4.5,"..ac_off..";craft_click;"..sty_h3s..rght_col..sty_h3e.."]"
|
||||
local heading_rp_mach = "hypertext[09.0,"..(2+ac_off)..";8.5,1.0;content_rp_sh_mach;"..sty_h2s.."Machines"..sty_h2e.."]"
|
||||
|
||||
local subhead_mach_gen = "hypertext[09.0,"..(2.7+ac_off)..";4.5,7.0;machine;"..sty_h3s.. -- left side column
|
||||
"<action name=machine-ele_provider>Simple Generators</action>\n"..
|
||||
"<action name=machine-ele_user>Simple Machines</action>\n"..
|
||||
"<action name=machine-Wind_Turbine>Wind Turbine</action>\n"..
|
||||
"<action name=machine-Fission_Reactor>Fission Reactor</action>\n"..
|
||||
"<action name=machine-Fusion_Reactor>Fusion Reactor</action>"..
|
||||
sty_h3e.."]"..
|
||||
"tooltip[9.0,"..(2.7+ac_off)..";4.5,0.6;Single Node\nPower Generators;"..eletome.tooltip_color.."]"..
|
||||
"tooltip[9.0,"..(3.2+ac_off)..";4.5,0.6;Single Node\nMachines;"..eletome.tooltip_color.."]"..
|
||||
|
||||
"hypertext[13.5,"..(2.7+ac_off)..";4.5,7.0;machine;"..sty_h3s.. -- right side column
|
||||
"<action name=machine-ele_storage>Powercells</action>\n"..
|
||||
"<action name=machine-Fluid_Pump>Fluid Pump</action>\n"..
|
||||
"<action name=machine-Evaporation_Plant>Evaporation Plant</action>\n"..
|
||||
"<action name=machine-Miner>Miner</action>\n"..
|
||||
"<action name=machine-Transporter>Transporter</action>"..
|
||||
sty_h3e.."]"
|
||||
|
||||
-- Assemble contents page
|
||||
local eletome_cont = heading_lp..content_lp..
|
||||
heading_rp..heading_rp_craft..craft_rp_txt..
|
||||
heading_rp_mach..subhead_mach_gen
|
||||
|
||||
return eletome_cont
|
||||
end
|
241
elepower_tome/i_page_crafts.lua
Normal file
@ -0,0 +1,241 @@
|
||||
---------------------------------------------------
|
||||
-- ___ _ --
|
||||
-- | __| |___ _ __ _____ __ _____ _ _ --
|
||||
-- | _|| / -_) '_ \/ _ \ V V / -_) '_| --
|
||||
-- |___|_\___| .__/\___/\_/\_/\___|_| --
|
||||
-- |_| --
|
||||
-- _____ --
|
||||
-- |_ _|__ _ __ ___ --
|
||||
-- | |/ _ \ ' \/ -_) --
|
||||
-- |_|\___/_|_|_\___| --
|
||||
---------------------------------------------------
|
||||
-- Crafts Page --
|
||||
---------------------------------------------------
|
||||
|
||||
function eletome.craft_page(craft_description,page_num)
|
||||
-- remove "action:" from string
|
||||
local craft_description = string.match(craft_description, ":(.*)")
|
||||
|
||||
-- Convert craft_description back to craft
|
||||
local raw_all_crafts = table.copy(elepm.craft.types)
|
||||
local craft_click = {}
|
||||
local craft_type
|
||||
for craft_name,def in pairs(raw_all_crafts) do
|
||||
if def.description == craft_description then
|
||||
craft_click[craft_name] = def
|
||||
craft_type = craft_name
|
||||
end
|
||||
end
|
||||
|
||||
if craft_click == "nil" then
|
||||
minetest.debug("error")
|
||||
end
|
||||
-- Craft page structured as 2 pages ie an open book
|
||||
-- a single column on left page and single column
|
||||
-- on the right page.
|
||||
|
||||
-- Assign Common styles to local vars
|
||||
local sty_h0s = eletome.common_styles.style_h0s
|
||||
local sty_h0e = eletome.common_styles.style_h0e
|
||||
local sty_h1s = eletome.common_styles.style_h1s
|
||||
local sty_h1e = eletome.common_styles.style_h1e
|
||||
local sty_h2s = eletome.common_styles.style_h2s
|
||||
local sty_h2e = eletome.common_styles.style_h2e
|
||||
local sty_h3s = eletome.common_styles.style_h3s
|
||||
local sty_h3e = eletome.common_styles.style_h3e
|
||||
local sty_h4s = eletome.common_styles.style_h4s
|
||||
local sty_h4e = eletome.common_styles.style_h4e
|
||||
|
||||
--------------------------
|
||||
-- Craft page left page --
|
||||
--------------------------
|
||||
local heading_lp = "hypertext[0.5,0.7;8.5,1.1;craft_lp_h;"..sty_h0s..craft_description..sty_h0e.."]"
|
||||
local head_sub_lp_ov = "hypertext[0.5,1.4;8.5,1.0;craft_lp_sh_ov;"..sty_h1s.."Overview"..sty_h1e.."]"
|
||||
local ov_lp_txt = "hypertext[0.75,2.1;8.0,5.5;craft_lp_ov_text;"..sty_h3s..craft_click[craft_type].overview..sty_h3s.."]"
|
||||
|
||||
-- calculate approximatly how many lines "overview" takes
|
||||
local length = string.len(craft_click[craft_type].overview)
|
||||
local cpl = eletome.char_per_line
|
||||
local num_lines = math.ceil(length/cpl)
|
||||
local y_offset = num_lines*eletome.y_space_line
|
||||
|
||||
-- Find machines that do craft
|
||||
local mach_names = {}
|
||||
|
||||
for name,def in pairs(minetest.registered_nodes)do
|
||||
if def.craft_type == craft_type then
|
||||
if def.ele_active_node and string.find(name,"active") then -- only insert active version of machine
|
||||
table.insert(mach_names,{name,def.description})
|
||||
|
||||
elseif not def.ele_active_node then
|
||||
table.insert(mach_names,{name,def.description})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local machines_lp = "style_type[item_image_button;bgimg=elepower_tome_bgimg_2.png]"
|
||||
local y_m_row = 0 --multiple rows of machines
|
||||
for k,def in pairs(mach_names)do
|
||||
if #mach_names == 1 then
|
||||
machines_lp = machines_lp.."item_image_button[4,"..(5.6+y_offset+y_m_row)..";1.25,1.25;"..def[1]..";"..def[2]..";]"..
|
||||
"hypertext[0.5,"..(7+y_offset+y_m_row)..";8.4,1;craft_mach_lab;"..sty_h3s..def[2]..sty_h3s.."]"
|
||||
|
||||
else
|
||||
if (k % 2 == 0) then -- even key
|
||||
machines_lp = machines_lp.."item_image_button[6,"..(5.6+y_offset+y_m_row)..";1.25,1.25;"..def[1]..";"..def[2]..";]"..
|
||||
"hypertext[4.5,"..(7+y_offset+y_m_row)..";4.5,1;craft_mach_lab;"..sty_h3s..def[2]..sty_h3s.."]"
|
||||
y_m_row = y_m_row + 2.5
|
||||
else -- odd key
|
||||
machines_lp = machines_lp.."item_image_button[2,"..(5.6+y_offset+y_m_row)..";1.25,1.25;"..def[1]..";"..def[2]..";]"..
|
||||
"hypertext[0.5,"..(7+y_offset+y_m_row)..";4.5,1;craft_mach_lab;"..sty_h3s..def[2]..sty_h3s.."]"
|
||||
end
|
||||
end
|
||||
end
|
||||
---------------------------
|
||||
-- Craft page right page --
|
||||
---------------------------
|
||||
local head_sub_rp_rec = "hypertext[9.5,0.7;8.5,1.0;craft_lp_h;"..sty_h1s.."Recipes"..sty_h1e.."]"
|
||||
|
||||
local craft_reg_path = elepm.craft[craft_type]
|
||||
local recipe_list = {}
|
||||
local recipe_list_rdy = {}
|
||||
|
||||
|
||||
if craft_type == "cooking" then
|
||||
-- restructure craft recipe inputs/outputs, so easier to output to formspec
|
||||
-- recipe_list = {
|
||||
-- {input={item1,num},{item2,num},output={item,num}},
|
||||
-- {input={item1,num},{item2,num},output={item1,num},{item2,num}}
|
||||
-- }
|
||||
|
||||
for name,def in pairs(minetest.registered_items) do
|
||||
local recipe = minetest.get_all_craft_recipes(name)
|
||||
|
||||
if recipe ~= nil then
|
||||
for k,def in pairs(recipe) do
|
||||
if def.method == "cooking" and def.output ~= "" then
|
||||
if string.find(def.items[1],"group") then
|
||||
def.items[1] = string.gsub(def.items[1],"group","default")
|
||||
end
|
||||
-- This structure matches below, double table nesting a bit redundant
|
||||
|
||||
table.insert(recipe_list,{input = {{def.items[1],1}},output = {{def.output,1}}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
-- restructure craft recipe inputs/outputs, so easier to output to formspec
|
||||
-- recipe_list = {
|
||||
-- {input={item1,num},{item2,num},output={item,num}},
|
||||
-- {input={item1,num},{item2,num},output={item1,num},{item2,num}}
|
||||
-- }
|
||||
|
||||
for k,v in pairs(craft_reg_path) do
|
||||
local input = {}
|
||||
local output = {}
|
||||
|
||||
if type(v.output) == "table" then -- very rarly table eg grinding-fuel_rod_depleted
|
||||
for k,v in pairs(v.output)do
|
||||
local t_out = string.split(v," ")
|
||||
table.insert(output,{t_out[1],tonumber(t_out[2]) or 1})
|
||||
end
|
||||
|
||||
else
|
||||
local t_out = string.gsub(tostring(v.output),"ItemStack%(\"","")
|
||||
local t_out = string.gsub(t_out,"\"%)","")
|
||||
local t_out = string.split(t_out," ")
|
||||
table.insert(output,{t_out[1],tonumber(t_out[2]) or 1})
|
||||
end
|
||||
|
||||
for k2,v2 in pairs(v.recipe)do
|
||||
table.insert(input,{k2,v2})
|
||||
end
|
||||
|
||||
table.insert(recipe_list,{input = input,output = output})
|
||||
end
|
||||
--minetest.debug(dump(recipe_list))
|
||||
end
|
||||
|
||||
-- build recipe list
|
||||
local y_off = 0
|
||||
local x_off = 0
|
||||
local col_cnt = 1
|
||||
local recipe_cnt = 1
|
||||
|
||||
for k,def in pairs(recipe_list) do
|
||||
local s_recipe ="style_type[label;font_size=-2;font=bold;textcolor=#FFF]"
|
||||
local in_len = #def.input
|
||||
local out_len = #def.output
|
||||
local columns = 2
|
||||
local col_gap = 0.75
|
||||
local in_cnt = 1
|
||||
|
||||
if (in_len+out_len) == 2 then
|
||||
columns = 3
|
||||
end
|
||||
|
||||
if (in_len+out_len) == 3 then
|
||||
col_gap = 1.5
|
||||
end
|
||||
|
||||
for k,def in pairs(def.input) do
|
||||
s_recipe = s_recipe.."item_image_button["..(9.5 + x_off)..","..(1.5+y_off)..";0.6,0.6;"..def[1]..";"..def[1]..";]"
|
||||
s_recipe = s_recipe.."label["..(10 + x_off)..","..(1.99 + y_off)..";"..def[2].."]"
|
||||
x_off = x_off+0.7
|
||||
|
||||
if in_cnt >= in_len then
|
||||
s_recipe = s_recipe.."image["..(9.5 + x_off)..","..(1.5+y_off)..";0.6,0.6;elepower_tome_equals.png]"
|
||||
x_off = x_off+0.7
|
||||
end
|
||||
in_cnt = in_cnt+1
|
||||
end
|
||||
|
||||
for k,def in pairs(def.output)do
|
||||
s_recipe = s_recipe.."item_image_button["..(9.5 + x_off)..","..(1.5+y_off)..";0.6,0.6;"..def[1]..";"..def[1]..";]"
|
||||
s_recipe = s_recipe.."label["..(10 + x_off)..","..(1.99 + y_off)..";"..def[2].."]"
|
||||
x_off = x_off+0.7
|
||||
end
|
||||
|
||||
if col_cnt >= columns then
|
||||
x_off = 0
|
||||
y_off = y_off + 0.7
|
||||
col_cnt = 1
|
||||
else
|
||||
x_off = x_off+col_gap
|
||||
col_cnt = col_cnt + 1
|
||||
end
|
||||
|
||||
table.insert(recipe_list_rdy,s_recipe)
|
||||
recipe_list_rdy.columns = recipe_list_rdy.columns or columns
|
||||
recipe_cnt = recipe_cnt + 1
|
||||
|
||||
--reset y_off(set) as these will be on page 2/3 etc
|
||||
if recipe_cnt > recipe_list_rdy.columns*12 then
|
||||
y_off = 0
|
||||
recipe_cnt = 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Split recipes across 2 or more pages if needed.
|
||||
local max_recipe_pp = 24 -- 2 columns
|
||||
local pg_num = tonumber(page_num) or 1
|
||||
local i = 1
|
||||
|
||||
if recipe_list_rdy.columns == 3 then
|
||||
max_recipe_pp = 36
|
||||
end
|
||||
|
||||
local recipe_rp = eletome.p_nav_bwd_fwd(craft_description,recipe_list_rdy,max_recipe_pp,pg_num,"craft_bwd_fwd")
|
||||
|
||||
-------------------------
|
||||
-- Assemble craft page --
|
||||
-------------------------
|
||||
local eletome_craft = heading_lp..head_sub_lp_ov..ov_lp_txt..machines_lp..
|
||||
head_sub_rp_rec..recipe_rp
|
||||
|
||||
return eletome_craft
|
||||
|
||||
end
|
304
elepower_tome/i_page_machines.lua
Normal file
@ -0,0 +1,304 @@
|
||||
---------------------------------------------------
|
||||
-- ___ _ --
|
||||
-- | __| |___ _ __ _____ __ _____ _ _ --
|
||||
-- | _|| / -_) '_ \/ _ \ V V / -_) '_| --
|
||||
-- |___|_\___| .__/\___/\_/\_/\___|_| --
|
||||
-- |_| --
|
||||
-- _____ --
|
||||
-- |_ _|__ _ __ ___ --
|
||||
-- | |/ _ \ ' \/ -_) --
|
||||
-- |_|\___/_|_|_\___| --
|
||||
---------------------------------------------------
|
||||
-- Machines/Node Crafters --
|
||||
---------------------------------------------------
|
||||
|
||||
function eletome.machines(machine,page_num)
|
||||
-- remove "action:" from string
|
||||
local raw_mach_input = string.match(machine, ":(.*)")
|
||||
|
||||
-- split on "-" to remove "machine"
|
||||
local machine_split = string.split(raw_mach_input,"-")
|
||||
local machine_name = machine_split[2]
|
||||
local mach_group
|
||||
|
||||
if machine_name == "ele_provider" then
|
||||
machine_name = "Generators"
|
||||
mach_group = "ele_provider"
|
||||
elseif machine_name == "ele_storage" then
|
||||
machine_name = "Powercells"
|
||||
mach_group = "ele_storage"
|
||||
elseif machine_name == "ele_user" then
|
||||
machine_name = "Machine"
|
||||
mach_group = "ele_user"
|
||||
end
|
||||
|
||||
-- remove "_"
|
||||
local mach_name = string.gsub(machine_name,"_", " ")
|
||||
|
||||
-- Assign Common styles to local vars
|
||||
local sty_h0s = eletome.common_styles.style_h0s
|
||||
local sty_h0e = eletome.common_styles.style_h0e
|
||||
local sty_h1s = eletome.common_styles.style_h1s
|
||||
local sty_h1e = eletome.common_styles.style_h1e
|
||||
local sty_h2s = eletome.common_styles.style_h2s
|
||||
local sty_h2e = eletome.common_styles.style_h2e
|
||||
local sty_h3s = eletome.common_styles.style_h3s
|
||||
local sty_h3e = eletome.common_styles.style_h3e
|
||||
local sty_h4s = eletome.common_styles.style_h4s
|
||||
local sty_h4e = eletome.common_styles.style_h4e
|
||||
|
||||
-- Additional Info Table
|
||||
local add_info = eletome.ai
|
||||
|
||||
local sort_by = add_info[machine_name:lower()].sort_by or nil
|
||||
local instructions = add_info[machine_name:lower()].instruct or nil
|
||||
-----------------------
|
||||
-- Machine left page --
|
||||
-----------------------
|
||||
local heading_lp = "hypertext[0.5,0.70;8.5,1.1;ass_mach_lp_h;"..sty_h0s..mach_name..sty_h0e.."]"
|
||||
local head_sub_lp_ov = "hypertext[0.5,1.4;8.5,1.0;mach_lp_sh_ov;"..sty_h1s.."Overview"..sty_h1e.."]"
|
||||
local lp_txt_space = 0
|
||||
local ov_lp_img = add_info[machine_name:lower()].img or ""
|
||||
if ov_lp_img ~= "" then
|
||||
if instructions then
|
||||
ov_lp_img = "style_type[image_button;bgimg=elepower_tome_bgimg_1.png]"..
|
||||
"image_button[2.25,6.6;5,3.75;"..add_info[machine_name:lower()].img..";instructions;]"..
|
||||
"tooltip[2.25,6.6;5,3.75;Click for detailed\ninstructions;"..eletome.tooltip_color.."]"..
|
||||
"hypertext[0.5,10.1;8,0.5;large_image;"..sty_h4s..
|
||||
"<action name=machine-"..machine_name..">Larger Image</action>"..
|
||||
sty_h4e.."]"
|
||||
else
|
||||
ov_lp_img = "image[2.25,6.6;5,3.75;"..add_info[machine_name:lower()].img.."]"
|
||||
end
|
||||
else
|
||||
lp_txt_space = 3.75
|
||||
end
|
||||
local ov_lp_txt = "hypertext[0.75,2.1;8.0,"..(4.5+lp_txt_space)..";mach_lp_ov_text;"..sty_h4s..(add_info[machine_name:lower()].over or "")..sty_h4e.."]"
|
||||
|
||||
------------------------
|
||||
-- Machine right page --
|
||||
------------------------
|
||||
|
||||
-- Get list of nodes
|
||||
local mach_nodes
|
||||
local mach_sort = {}
|
||||
local mach_key = {}
|
||||
|
||||
if mach_group then
|
||||
mach_key, mach_sort = eletome.get_nodes_in_group(mach_group)
|
||||
|
||||
else
|
||||
local mach_nodes = add_info[machine_name:lower()].part or {}
|
||||
|
||||
for k,node_name in pairs(mach_nodes) do
|
||||
table.insert(mach_sort,minetest.registered_items[node_name].description)
|
||||
mach_key[minetest.registered_items[node_name].description] = node_name
|
||||
end
|
||||
end
|
||||
|
||||
-- Sort the table
|
||||
if sort_by ~= nil then
|
||||
if sort_by ~= "no_sort" then
|
||||
-- Sort values by any field avliable in node registration
|
||||
mach_sort, mach_key = eletome.sort_by(sort_by,mach_sort,mach_key)
|
||||
end
|
||||
else
|
||||
-- default sort is by node.description which can work in
|
||||
-- unexpected ways due to translation wrapper.
|
||||
table.sort(mach_sort)
|
||||
end
|
||||
|
||||
local y_off = 0
|
||||
local recipe_cnt = 1
|
||||
local machine_list_rdy = {}
|
||||
|
||||
-- Recipe output for each node that makes up machine
|
||||
for k,name_des in pairs(mach_sort) do
|
||||
local name_reg = mach_key[name_des]
|
||||
local m_recipe = "style_type[item_image_button;bgimg=elepower_tome_bgimg_2.png]"
|
||||
local recipe = minetest.get_craft_recipe(name_reg)
|
||||
local x_cnt = 1
|
||||
local x_off = 0
|
||||
local no_items = 0
|
||||
|
||||
-- additional info variables
|
||||
local lb_top_img = "unknown"
|
||||
local lb_top_tt
|
||||
local lb_mid_img
|
||||
local lb_mid_tt
|
||||
local lb_btm_img = tostring(minetest.registered_items[name_reg].ele_usage or 0)
|
||||
if mach_name == "Powercells" then
|
||||
lb_btm_img = minetest.registered_items[name_reg].ele_output or 0
|
||||
end
|
||||
local lb_btm_tt = " EpUs per second"
|
||||
local mb_title_txt
|
||||
local mb_recipe_items
|
||||
|
||||
-- Check for custom values in additional info and set
|
||||
if add_info.nodes[name_reg] then
|
||||
lb_top_img = add_info.nodes[name_reg].lb_top_img or "unknown"
|
||||
lb_top_tt = add_info.nodes[name_reg].lb_top_tt or nil
|
||||
lb_mid_img = add_info.nodes[name_reg].lb_mid_img or nil
|
||||
lb_mid_tt = add_info.nodes[name_reg].lb_mid_tt or nil
|
||||
|
||||
-- don't overwrite this value if additional info value dosent exist
|
||||
-- ie retain ele_usage for node
|
||||
if add_info.nodes[name_reg].lb_btm_img then
|
||||
lb_btm_img = add_info.nodes[name_reg].lb_btm_img
|
||||
end
|
||||
|
||||
lb_btm_tt = add_info.nodes[name_reg].lb_btm_tt or " EpUs per second"
|
||||
mb_title_txt = add_info.nodes[name_reg].mb_title_txt or nil
|
||||
mb_recipe_items = add_info.nodes[name_reg].mb_recipe_items or nil
|
||||
|
||||
end
|
||||
|
||||
-- catch empty recipe.items and check new crafts
|
||||
-- and if not there set flag to not crash.
|
||||
if not recipe.items then
|
||||
|
||||
-- check elepower crafts
|
||||
recipe = eletome.get_craft_recipe(name_reg)
|
||||
|
||||
-- final catch to prevent crash
|
||||
if not recipe.craft_name then
|
||||
|
||||
-- check for additional information
|
||||
if mb_recipe_items then
|
||||
recipe.items = mb_recipe_items
|
||||
recipe.craft_name = mb_title_txt
|
||||
recipe.craft_des = mb_title_txt
|
||||
else
|
||||
no_items = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Layout output per node is 3 large squares
|
||||
-- 1st square input summary /power usage summary (background)
|
||||
-- 2nd square is items to craft (nil-background)
|
||||
-- 3rd square large image of node (background)
|
||||
|
||||
-- 1st 2nd 3rd
|
||||
-- --------- --------- ---------
|
||||
-- | |_| | |__|_|__| || ||
|
||||
-- | |_| | |__|_|__| || ||
|
||||
-- | |_| | |__|_|__| ||_____||
|
||||
-- --------- --------- ---------
|
||||
|
||||
-- background box's 1 and 3 and large node image
|
||||
m_recipe = m_recipe.."image["..(9.25)..","..(1+y_off)..";2.4,2.4;elepower_tome_bgimg_2.png]"
|
||||
m_recipe = m_recipe.."image["..(14.75)..","..(1+y_off)..";2.4,2.4;elepower_tome_bgimg_2.png]"
|
||||
|
||||
--3rd square item
|
||||
m_recipe = m_recipe.."item_image_button["..(14.85)..","..(1+y_off+0.1)..";2.2,2.2;"..mach_key[name_des]..";"..mach_key[name_des]..";]"
|
||||
|
||||
-- 1st square items
|
||||
|
||||
-- Top Item
|
||||
-- display reg craftitem or image
|
||||
if eletome.is_image(lb_top_img) then
|
||||
m_recipe = m_recipe.."image["..(10.15)..","..(1+y_off)..";0.75,0.75;"..lb_top_img.."]"
|
||||
|
||||
if lb_top_tt then
|
||||
m_recipe = m_recipe.."tooltip["..(10.15)..","..(1+y_off)..";0.75,0.75;"..lb_top_tt..";"..eletome.tooltip_color.."]"
|
||||
end
|
||||
else
|
||||
m_recipe = m_recipe.."item_image_button["..(10.15)..","..(1+y_off)..";0.75,0.75;"..lb_top_img..";"..lb_top_img..";]"
|
||||
if lb_top_tt then
|
||||
m_recipe = m_recipe.."tooltip["..lb_top_img..";"..lb_top_tt..";"..eletome.tooltip_color.."]"
|
||||
end
|
||||
end
|
||||
|
||||
-- Middle Item
|
||||
-- display node created or image
|
||||
if eletome.is_image(lb_mid_img) then
|
||||
m_recipe = m_recipe.."image["..(10.10)..","..(1+y_off+0.9)..";0.85,0.85;"..lb_mid_img.."]"
|
||||
|
||||
if lb_mid_tt then
|
||||
m_recipe = m_recipe.."tooltip["..(10.10)..","..(1+y_off+0.9)..";0.85,0.85;"..lb_mid_tt..";"..eletome.tooltip_color.."]"
|
||||
end
|
||||
else
|
||||
m_recipe = m_recipe.."item_image_button["..(10.10)..","..(1+y_off+0.9)..";0.85,0.85;"..name_reg..";"..name_reg..";]"
|
||||
if lb_mid_tt then
|
||||
m_recipe = m_recipe.."tooltip["..name_reg..";"..lb_mid_tt..";"..eletome.tooltip_color.."]"
|
||||
end
|
||||
end
|
||||
|
||||
-- Bottom Item
|
||||
-- Change power output value from num-text to equivalent
|
||||
-- image value - images scale nicer than txt here
|
||||
local i = 1
|
||||
local x_of = 0
|
||||
|
||||
if eletome.is_image(lb_btm_img) then
|
||||
m_recipe = m_recipe.."image["..(10.25+x_of)..","..(1+y_off+1.8)..";0.55,0.55;"..lb_btm_img.."]"
|
||||
m_recipe = m_recipe.."tooltip["..(10.25+x_of)..","..(1+y_off+1.8)..";0.55,0.55;"..lb_btm_tt..";"..eletome.tooltip_color.."]"
|
||||
else
|
||||
local st_len = string.len(lb_btm_img)
|
||||
|
||||
if st_len <= 4 and tonumber(lb_btm_img) then
|
||||
-- depending on txt length we have to offset
|
||||
-- img char start more left
|
||||
-- @ current img size 4 is max supported
|
||||
if st_len == 2 then
|
||||
x_of = -0.3
|
||||
elseif st_len == 3 then
|
||||
x_of = -0.6
|
||||
elseif st_len == 4 then
|
||||
x_of = -0.9
|
||||
end
|
||||
|
||||
while i <= st_len do
|
||||
local num = string.sub(tostring(lb_btm_img), i, i) or "0"
|
||||
m_recipe = m_recipe.."image["..(10.25+x_of)..","..(1+y_off+1.9)..";0.45,0.45;elepower_tome_num_"..num..".png]"
|
||||
x_of = x_of+0.35
|
||||
i=i+1
|
||||
end
|
||||
|
||||
m_recipe = m_recipe.."image["..(10.3+x_of)..","..(1+y_off+2.025)..";0.65,0.65;elepower_tome_num_epu.png]"
|
||||
m_recipe = m_recipe.."tooltip["..(10.25+x_of+(-0.3*(st_len+1)))..","..(1+y_off+1.9)..";1.5,0.65;"..lb_btm_img..lb_btm_tt..";"..eletome.tooltip_color.."]"
|
||||
|
||||
else
|
||||
minetest.log("info", "elepower_tome: "..lb_btm_img.." entered value must be 1-4 digits or a string ending in .png")
|
||||
minetest.debug()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- 2nd square items
|
||||
-- Generate the recipe grid view - Middle box
|
||||
local dis_rec,y_add = eletome.gen_craft_grid(recipe,y_off,no_items)
|
||||
|
||||
m_recipe = m_recipe..dis_rec
|
||||
y_off = y_add
|
||||
|
||||
y_off = y_off+1.7
|
||||
|
||||
-- Insert record into table and increment counters
|
||||
table.insert(machine_list_rdy,m_recipe)
|
||||
recipe_cnt = recipe_cnt + 1
|
||||
|
||||
--reset y_off(set) as these will be on page 2/3 etc
|
||||
if recipe_cnt > 3 then
|
||||
y_off = 0
|
||||
recipe_cnt = 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Split machines across 2 or more pages if needed.
|
||||
local max_recipe_pp = 3
|
||||
local pg_num = tonumber(page_num) or 1
|
||||
local recipe_rp = ""
|
||||
|
||||
local recipe_rp = eletome.p_nav_bwd_fwd(machine,machine_list_rdy,max_recipe_pp,pg_num,"mach_bwd_fwd")
|
||||
|
||||
---------------------------
|
||||
-- Assemble Machine page --
|
||||
---------------------------
|
||||
local eletome_complex = heading_lp..head_sub_lp_ov..ov_lp_txt..ov_lp_img..recipe_rp
|
||||
return eletome_complex
|
||||
|
||||
|
||||
end
|
@ -15,7 +15,20 @@
|
||||
-- Global variable for mod
|
||||
eletome = rawget(_G, "eletome") or {}
|
||||
|
||||
-- register our Tome item
|
||||
-- path, modname and translation
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
eletome.S = minetest.get_translator(modname)
|
||||
local S = eletome.S
|
||||
|
||||
-- includes
|
||||
dofile(modpath .. "/i_eletome_additional_info.lua")
|
||||
dofile(modpath .. "/i_functions.lua")
|
||||
dofile(modpath .. "/i_page_contents.lua")
|
||||
dofile(modpath .. "/i_page_crafts.lua")
|
||||
dofile(modpath .. "/i_page_machines.lua")
|
||||
|
||||
-- register our Tome/Book item
|
||||
minetest.register_craftitem("elepower_tome:tome", {
|
||||
description = "Elepower Tome",
|
||||
inventory_image = "elepower_tome.png",
|
||||
@ -29,6 +42,7 @@ minetest.register_craftitem("elepower_tome:tome", {
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- Give player elepower tome on initaial logon
|
||||
minetest.register_on_newplayer(function(player)
|
||||
player:get_inventory():add_item("main", "elepower_tome:tome")
|
||||
@ -40,7 +54,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
-- Clicked contents button any page.
|
||||
-- Clicked contents button on any page.
|
||||
if fields.content then
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_contents = eletome.contents_page()
|
||||
@ -48,60 +62,92 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
|
||||
-- Clicked a craft link on contents
|
||||
if fields.content_rp_cl_craft_txt or fields.content_rp_cr_craft_txt then
|
||||
|
||||
local craft_value = fields.content_rp_cl_craft_txt or fields.content_rp_cr_craft_txt
|
||||
if fields.craft_click then
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_craft = eletome.craft_page(craft_value)
|
||||
local eletome_craft = eletome.craft_page(fields.craft_click)
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_craft)
|
||||
end
|
||||
|
||||
-- Clicked fwd/bwd button on craft sub-page
|
||||
if fields.craft_page_fwd or fields.craft_page_bwd then
|
||||
|
||||
-- Clicked craft bwd/fwd button on craft sub-page
|
||||
if fields.craft_bwd_fwd then
|
||||
local page_num = string.match(fields.craft_bwd_fwd , "%s(%w+)%s")
|
||||
-- eletome.craft_page() expects description in format "something:craft_description"
|
||||
local craft_value = "cd:"..fields.description
|
||||
|
||||
local craft_page_fwd = fields.craft_page_fwd or ""
|
||||
local craft_page_bwd = fields.craft_page_bwd or ""
|
||||
|
||||
local page_num = string.match(craft_page_fwd, "%s(%w)%s")
|
||||
|
||||
if not page_num then
|
||||
local page_num = string.match(craft_page_bwd, "%s(%w)%s")
|
||||
end
|
||||
|
||||
local craft_value = "cd:"..fields.craft_description
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_craft = eletome.craft_page(craft_value,page_num)
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_craft)
|
||||
|
||||
end
|
||||
|
||||
--minetest.debug(dump(fields))
|
||||
-- Clicked Machine page
|
||||
if fields.machine then
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_machine = eletome.machines(fields.machine)
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_machine)
|
||||
end
|
||||
|
||||
-- Clicked Machine bwd/fwd button on Machine page
|
||||
if fields.mach_bwd_fwd then
|
||||
local page_num = string.match(fields.mach_bwd_fwd, "%s(%w+)%s")
|
||||
local mach_value = fields.description
|
||||
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_machine = eletome.machines(mach_value,page_num)
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_machine)
|
||||
end
|
||||
|
||||
-- Clicked Instructions page
|
||||
if fields.instructions then
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_instruct = eletome.instructions_page(fields.description)
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_instruct)
|
||||
end
|
||||
|
||||
-- Clicked Large Image page
|
||||
if fields.large_image then
|
||||
local eletome_bg = eletome.tome_bg
|
||||
local eletome_lrg_img = eletome.large_image_page(fields.description)
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "elepower_tome:tome", eletome_bg..eletome_lrg_img)
|
||||
end
|
||||
|
||||
--minetest.debug(dump(fields))
|
||||
end)
|
||||
----------------
|
||||
-- Tome Pages --
|
||||
----------------
|
||||
|
||||
-------------------
|
||||
-- Page Defaults --
|
||||
-------------------
|
||||
|
||||
eletome.tome_bg = "formspec_version[4]size[18,11]"..
|
||||
"bgcolor[#003782;true]".. -- fails (my understanding limitation)
|
||||
"box[0.0,0.0;18,11;#003782]".. -- workaround the above
|
||||
"box[0.5,0.5;8.5,10;#d1caaeFF]"..
|
||||
"box[9.0,0.5;8.5,10;#d1caaeFF]"..
|
||||
"button_exit[17.5,0;0.5,0.5;X;X]"..
|
||||
--"label[3.5,10.75;Elepower Tome]"..
|
||||
--"label[11.5,10.75;Elepower Tome]"..
|
||||
"button[0,0;2,0.5;content;Content]"
|
||||
"style_type[button;bgcolor=#003782]"..
|
||||
"style_type[button_exit;bgcolor=#003782]"..
|
||||
"button[0,0;2.5,0.5;content;Content]"..
|
||||
"style[fake_back;textcolor=#777777]"..
|
||||
"button[2.5,0;2.5,0.5;fake_back;Back]"..
|
||||
"style[fake_prev_page;textcolor=#777777]"..
|
||||
"button[12.5,0;2.5,0.5;fake_prev_page;<< Prev]"..
|
||||
"style[fake_next_page;textcolor=#777777]"..
|
||||
"button[15,0;2.5,0.5;fake_prev_page;Next >>]"..
|
||||
"button_exit[17.5,0;0.5,0.5;X;X]"
|
||||
|
||||
|
||||
eletome.font_color = "#1f1f1fFF"
|
||||
eletome.y_space_line = 0.4
|
||||
eletome.char_per_line = 60
|
||||
eletome.tooltip_color = "#30434c;#f9f9f9"
|
||||
|
||||
-- Common style components - some end duplicates but kept for ease of reading/updating later
|
||||
-- s = start ie pre text
|
||||
-- e = end ie post text
|
||||
eletome.font_color = "#1f1f1fFF"
|
||||
eletome.y_space_line = 0.4
|
||||
eletome.char_per_line = 60
|
||||
|
||||
-- Used for hypertext
|
||||
eletome.common_styles = {
|
||||
style_h0s = "<style color="..eletome.font_color.." size=26><b><center>",
|
||||
@ -110,16 +156,24 @@ eletome.common_styles = {
|
||||
style_h1e = "</center></b></style>",
|
||||
style_h2s = "<style color="..eletome.font_color.." size=18><center>",
|
||||
style_h2e = "</center></style>",
|
||||
style_h3s = "<style color="..eletome.font_color.." size=16><center>",
|
||||
style_h3s = "<style color="..eletome.font_color.." size=14><center>",
|
||||
style_h3e = "</center></style>", -- approximate default "label" size
|
||||
style_h4s = "<style color="..eletome.font_color.." size=12><center>",
|
||||
style_h4e = "</center></style>"
|
||||
|
||||
}
|
||||
|
||||
function eletome.contents_page()
|
||||
-- Contents page structured as 2 pages ie an open book
|
||||
-- a single column on left page and 2 columns on right page
|
||||
function eletome.instructions_page(machine)
|
||||
-- instructions page structured as 2 pages ie an open book
|
||||
-- a single column on left page and single column on the right
|
||||
-- machine structure; description = "action:machine-Miner"
|
||||
|
||||
-- remove "description = action:machine-" from string
|
||||
local machine_name = string.match(machine, "-(.*)")
|
||||
minetest.debug(machine_name)
|
||||
-- remove "_"
|
||||
local mach_name = string.gsub(machine_name,"_", " ")
|
||||
|
||||
|
||||
-- Assign Common styles to local vars
|
||||
local sty_h0s = eletome.common_styles.style_h0s
|
||||
@ -133,346 +187,96 @@ function eletome.contents_page()
|
||||
local sty_h4s = eletome.common_styles.style_h4s
|
||||
local sty_h4e = eletome.common_styles.style_h4e
|
||||
|
||||
-- Contents page left page Content
|
||||
|
||||
local content_lp_txt = "Elepower adds power to a game, Power is referred to in units and these units are referred to as EpU (Elepower Unit).\nNew crafts are added to the game as well as machines to enable these new crafts and make use of EpU/s.\n\nA big thank you to IcyDiamond the orginal creator of this mod."
|
||||
|
||||
local heading_lp = "hypertext[0.50,1.0;8.5,10;content_lp_h_tome;"..sty_h0s.."Elepower\nTome"..sty_h0e.."]"
|
||||
local content_lp = "hypertext[0.75,2.5;8.0,8;content_lp_c_text;"..sty_h3s..content_lp_txt..sty_h3s.."]"
|
||||
|
||||
|
||||
-- Contents page right page Content
|
||||
local heading_rp = "hypertext[9.0,1.0;8.5,9.0;content_rp_h_cont;"..sty_h1s.."Contents"..sty_h1e.."]"
|
||||
local heading_rp_craft = "hypertext[9.0,1.5;8.5,7.5;content_rp_sh_crafts;"..sty_h2s.."Crafts"..sty_h2e.."]"
|
||||
|
||||
local raw_all_crafts = table.copy(elepm.craft.types)
|
||||
local all_crafts = {}
|
||||
-- Gets the Human readable craft name
|
||||
-- and sorts them alphabetically
|
||||
for k,def in pairs(raw_all_crafts) do
|
||||
table.insert(all_crafts,def.description)
|
||||
end
|
||||
table.sort(all_crafts)
|
||||
|
||||
-- Generate the craft_content section
|
||||
-- 2 columns of h2 headings down the page
|
||||
local left_col = ""
|
||||
local rght_col = ""
|
||||
for k,craft_name in pairs(all_crafts) do
|
||||
if (k % 2 == 0) then -- even key - backwards fix this left should be odd....
|
||||
left_col = left_col.."<action name="..craft_name..">"..craft_name.."</action>".."\n"
|
||||
else -- odd key
|
||||
rght_col = rght_col.."<action name="..craft_name..">"..craft_name.."</action>".."\n"
|
||||
end
|
||||
end
|
||||
|
||||
local craft_rp_txt = "hypertext[09.0,2.0;4.5,7.0;content_rp_cl_craft_txt;"..sty_h3s..left_col..sty_h3e.."]"..
|
||||
"hypertext[13.5,2.0;4.5,7.0;content_rp_cr_craft_txt;"..sty_h3s..rght_col..sty_h3e.."]"
|
||||
local heading_rp_mach = "hypertext[09.0,4.5;8.5,6.5;content_rp_sh_mach;"..sty_h2s.."Machines"..sty_h2e.."]"
|
||||
|
||||
local subhead_mach_gen = "hypertext[09.0,4.8;8.5,6.5;content_rp_sh_gen;"..sty_h3s.."Generators"..sty_h3e.."]"
|
||||
|
||||
-- remove all "active" version of providers and 2nd half any descriptions with "\n"
|
||||
local i = 1
|
||||
local lft_col = ""
|
||||
local rht_col = ""
|
||||
local mach_sort = {}
|
||||
local mach_key = {}
|
||||
for name, def in pairs(minetest.registered_nodes) do
|
||||
if def.groups["ele_provider"] then
|
||||
if not string.find(name, "active") then
|
||||
local description = def.description
|
||||
|
||||
if string.find(description,"\n") then
|
||||
description = string.match(description,"(.+)\n")
|
||||
end
|
||||
table.insert(mach_sort,description)
|
||||
mach_key[description] = name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(mach_sort)
|
||||
|
||||
for k,des in pairs(mach_sort) do
|
||||
if (k % 2 == 0) then -- even key
|
||||
rht_col = rht_col.."<action name="..mach_key[des]..">"..des.."</action>".."\n"
|
||||
else -- odd key
|
||||
lft_col = lft_col.."<action name="..mach_key[des]..">"..des.."</action>".."\n"
|
||||
end
|
||||
end
|
||||
|
||||
local mach_rp_gen_txt = "hypertext[09.0,5.2;4.5,7.0;content_rp_cl_mach_txt;"..sty_h4s..lft_col..sty_h4e.."]"..
|
||||
"hypertext[13.5,5.2;4.5,7.0;content_rp_cr_mach_txt;"..sty_h4s..rht_col..sty_h4e.."]"
|
||||
|
||||
|
||||
-- Assemble contents page
|
||||
local eletome_cont = heading_lp..content_lp..
|
||||
heading_rp..heading_rp_craft..craft_rp_txt
|
||||
--heading_rp_mach..subhead_mach_gen..mach_rp_gen_txt
|
||||
|
||||
return eletome_cont
|
||||
end
|
||||
|
||||
function eletome.craft_page(craft_description,page_num)
|
||||
-- remove "action:" from string
|
||||
local craft_description = string.match(craft_description, ":(.*)")
|
||||
|
||||
-- Convert craft_description back to craft
|
||||
local raw_all_crafts = table.copy(elepm.craft.types)
|
||||
local craft_click = {}
|
||||
local craft_type
|
||||
for craft_name,def in pairs(raw_all_crafts) do
|
||||
if def.description == craft_description then
|
||||
craft_click[craft_name] = def
|
||||
craft_type = craft_name
|
||||
end
|
||||
function file_exists(img_name)
|
||||
local file=io.open(img_name,"r")
|
||||
if file~=nil then
|
||||
io.close(file)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if craft_click == "nil" then
|
||||
minetest.debug("error")
|
||||
end
|
||||
-- Craft page structured as 2 pages ie an open book
|
||||
-- a single column on left page and single column
|
||||
-- on the right page.
|
||||
---------------
|
||||
-- left page --
|
||||
---------------
|
||||
local lp_heading = "hypertext[0.5,0.7;8.5,1.1;lp_heading;"..sty_h0s..mach_name..sty_h0e.."]"
|
||||
local lp_sub_head = "hypertext[0.5,1.4;8.5,1.0;lp_sub_heading;"..sty_h1s.."Instructions"..sty_h1e.."]"
|
||||
local lp_content = ""
|
||||
local rp_content = ""
|
||||
local li = 1
|
||||
local ri = 4
|
||||
|
||||
-- Assign Common styles to local vars
|
||||
local sty_h0s = eletome.common_styles.style_h0s
|
||||
local sty_h0e = eletome.common_styles.style_h0e
|
||||
local sty_h1s = eletome.common_styles.style_h1s
|
||||
local sty_h1e = eletome.common_styles.style_h1e
|
||||
local sty_h2s = eletome.common_styles.style_h2s
|
||||
local sty_h2e = eletome.common_styles.style_h2e
|
||||
local sty_h3s = eletome.common_styles.style_h3s
|
||||
local sty_h3e = eletome.common_styles.style_h3e
|
||||
local sty_h4s = eletome.common_styles.style_h4s
|
||||
local sty_h4e = eletome.common_styles.style_h4e
|
||||
|
||||
--------------------------
|
||||
-- Craft page left page --
|
||||
--------------------------
|
||||
local heading_lp = "hypertext[0.5,1.0;8.5,9.0;craft_lp_h;"..sty_h0s..craft_description..sty_h0e.."]"
|
||||
local head_sub_lp_ov = "hypertext[0.5,1.5;8.5,7.5;craft_lp_sh_ov;"..sty_h1s.."Overview"..sty_h1e.."]"
|
||||
local ov_lp_txt = "hypertext[0.75,2.0;8.0,7.0;craft_lp_ov_text;"..sty_h3s..craft_click[craft_type].overview..sty_h3s.."]"
|
||||
|
||||
-- calculate approximatly how many lines "overview" takes
|
||||
local length = string.len(craft_click[craft_type].overview)
|
||||
local cpl = eletome.char_per_line
|
||||
local num_lines = math.ceil(length/cpl)
|
||||
local y_offset = num_lines*eletome.y_space_line
|
||||
|
||||
-- Find machines that do craft
|
||||
local mach_names = {}
|
||||
|
||||
for name,def in pairs(minetest.registered_nodes)do
|
||||
if def.craft_type == craft_type then
|
||||
if def.ele_active_node and string.find(name,"active") then -- only insert active version of machine
|
||||
table.insert(mach_names,{name,def.description})
|
||||
|
||||
elseif not def.ele_active_node then
|
||||
table.insert(mach_names,{name,def.description})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local machines_lp = "style_type[item_image_button;bgimg=elepower_tome_bqimg1.png]"
|
||||
local y_m_row = 0 --multiple rows of machines
|
||||
for k,def in pairs(mach_names)do
|
||||
if #mach_names == 1 then
|
||||
machines_lp = machines_lp.."item_image_button[4,"..(2.7+y_offset+y_m_row)..";1.25,1.25;"..def[1]..";"..def[2]..";]"..
|
||||
"hypertext[0.5,"..(4+y_offset+y_m_row)..";8.4,1;craft_mach_lab;"..sty_h3s..def[2]..sty_h3s.."]"
|
||||
|
||||
else
|
||||
if (k % 2 == 0) then -- even key
|
||||
machines_lp = machines_lp.."item_image_button[6,"..(2.7+y_offset+y_m_row)..";1.25,1.25;"..def[1]..";"..def[2]..";]"..
|
||||
"hypertext[4.5,"..(4+y_offset+y_m_row)..";4.5,1;craft_mach_lab;"..sty_h3s..def[2]..sty_h3s.."]"
|
||||
y_m_row = y_m_row + 2.5
|
||||
else -- odd key
|
||||
machines_lp = machines_lp.."item_image_button[2,"..(2.7+y_offset+y_m_row)..";1.25,1.25;"..def[1]..";"..def[2]..";]"..
|
||||
"hypertext[0.5,"..(4+y_offset+y_m_row)..";4.5,1;craft_mach_lab;"..sty_h3s..def[2]..sty_h3s.."]"
|
||||
end
|
||||
end
|
||||
end
|
||||
---------------------------
|
||||
-- Craft page right page --
|
||||
---------------------------
|
||||
local head_sub_rp_rec = "hypertext[9.5,1.0;8.0,9.0;craft_lp_h;"..sty_h1s.."Recipes"..sty_h1e.."]"
|
||||
|
||||
local craft_reg_path = elepm.craft[craft_type]
|
||||
local recipe_list = {}
|
||||
local recipe_list_rdy = {}
|
||||
|
||||
|
||||
if craft_type == "cooking" then
|
||||
-- restructure craft recipe inputs/outputs, so easier to output to formspec
|
||||
-- recipe_list = {
|
||||
-- {input={item1,num},{item2,num},output={item,num}},
|
||||
-- {input={item1,num},{item2,num},output={item1,num},{item2,num}}
|
||||
-- }
|
||||
|
||||
for name,def in pairs(minetest.registered_items) do
|
||||
local recipe = minetest.get_all_craft_recipes(name)
|
||||
|
||||
if recipe ~= nil then
|
||||
for k,def in pairs(recipe) do
|
||||
if def.method == "cooking" and def.output ~= "" then
|
||||
if string.find(def.items[1],"group") then
|
||||
def.items[1] = string.gsub(def.items[1],"group","default")
|
||||
end
|
||||
-- This structure matches below, double table nesting a bit redundant
|
||||
|
||||
table.insert(recipe_list,{input = {{def.items[1],1}},output = {{def.output,1}}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
-- restructure craft recipe inputs/outputs, so easier to output to formspec
|
||||
-- recipe_list = {
|
||||
-- {input={item1,num},{item2,num},output={item,num}},
|
||||
-- {input={item1,num},{item2,num},output={item1,num},{item2,num}}
|
||||
-- }
|
||||
|
||||
for k,v in pairs(craft_reg_path) do
|
||||
local input = {}
|
||||
local output = {}
|
||||
|
||||
if type(v.output) == "table" then -- very rarly table eg grinding-fuel_rod_depleted
|
||||
for k,v in pairs(v.output)do
|
||||
local t_out = string.split(v," ")
|
||||
table.insert(output,{t_out[1],tonumber(t_out[2]) or 1})
|
||||
end
|
||||
while li <= 3 do
|
||||
local img_path = modpath.."/textures/eletome_instructions_"..machine_name:lower().."_".. li ..".png"
|
||||
local file_check = file_exists(img_path)
|
||||
|
||||
if file_check then
|
||||
if (li % 2 == 0) then -- even
|
||||
lp_content = lp_content.."image[4.5,"..(2.0+(2.5*(li-1)))..";4,3;eletome_instructions_"..machine_name:lower().."_".. li ..".png]"
|
||||
else
|
||||
local t_out = string.gsub(tostring(v.output),"ItemStack%(\"","")
|
||||
local t_out = string.gsub(t_out,"\"%)","")
|
||||
local t_out = string.split(t_out," ")
|
||||
table.insert(output,{t_out[1],tonumber(t_out[2]) or 1})
|
||||
lp_content = lp_content.."image[1.00,"..(2.0+(2.5*(li-1)))..";4,3;eletome_instructions_"..machine_name:lower().."_".. li ..".png]"
|
||||
end
|
||||
|
||||
for k2,v2 in pairs(v.recipe)do
|
||||
table.insert(input,{k2,v2})
|
||||
end
|
||||
|
||||
table.insert(recipe_list,{input = input,output = output})
|
||||
end
|
||||
--minetest.debug(dump(recipe_list))
|
||||
end
|
||||
|
||||
-- build recipe list
|
||||
local y_off = 0
|
||||
local x_off = 0
|
||||
local col_cnt = 1
|
||||
local recipe_cnt = 1
|
||||
|
||||
for k,def in pairs(recipe_list) do
|
||||
local s_recipe ="style_type[label;font_size=-2;font=bold;textcolor=#FFF]"
|
||||
local in_len = #def.input
|
||||
local out_len = #def.output
|
||||
local columns = 2
|
||||
local col_gap = 0.75
|
||||
local in_cnt = 1
|
||||
|
||||
if (in_len+out_len) == 2 then
|
||||
columns = 3
|
||||
end
|
||||
|
||||
if (in_len+out_len) == 3 then
|
||||
col_gap = 1.5
|
||||
end
|
||||
|
||||
|
||||
for k,def in pairs(def.input) do
|
||||
|
||||
s_recipe = s_recipe.."item_image_button["..(9.5 + x_off)..","..(1.5+y_off)..";0.6,0.6;"..def[1]..";"..def[1]..";]"
|
||||
s_recipe = s_recipe.."label["..(10 + x_off)..","..(1.99 + y_off)..";"..def[2].."]"
|
||||
x_off = x_off+0.7
|
||||
|
||||
if in_cnt >= in_len then
|
||||
s_recipe = s_recipe.."image["..(9.5 + x_off)..","..(1.5+y_off)..";0.6,0.6;elepower_tome_equals.png]"
|
||||
x_off = x_off+0.7
|
||||
end
|
||||
in_cnt = in_cnt+1
|
||||
end
|
||||
|
||||
for k,def in pairs(def.output)do
|
||||
s_recipe = s_recipe.."item_image_button["..(9.5 + x_off)..","..(1.5+y_off)..";0.6,0.6;"..def[1]..";"..def[1]..";]"
|
||||
s_recipe = s_recipe.."label["..(10 + x_off)..","..(1.99 + y_off)..";"..def[2].."]"
|
||||
x_off = x_off+0.7
|
||||
end
|
||||
|
||||
if col_cnt >= columns then
|
||||
x_off = 0
|
||||
y_off = y_off + 0.7
|
||||
col_cnt = 1
|
||||
else
|
||||
x_off = x_off+col_gap
|
||||
col_cnt = col_cnt + 1
|
||||
end
|
||||
table.insert(recipe_list_rdy,s_recipe)
|
||||
recipe_list_rdy.columns = recipe_list_rdy.columns or columns
|
||||
recipe_cnt = recipe_cnt + 1
|
||||
|
||||
--reset y_off(set) as these will be on page 2/3 etc
|
||||
if recipe_cnt > recipe_list_rdy.columns*12 then
|
||||
y_off = 0
|
||||
break
|
||||
end
|
||||
|
||||
li=li+1
|
||||
end
|
||||
|
||||
-- Split recipes across 2 or more pages if needed.
|
||||
local max_recipe_pp = 24 -- 2 columns
|
||||
local num_recipe = #recipe_list_rdy
|
||||
local pg_num = tonumber(page_num) or 1
|
||||
local i = 1
|
||||
local recipe_rp = ""
|
||||
local fwd_page_name = "craft_page_fwd"
|
||||
local bwd_page_name = "craft_page_bwd"
|
||||
----------------
|
||||
-- right page --
|
||||
----------------
|
||||
while ri <= 7 do
|
||||
local img_path = modpath.."/textures/eletome_instructions_"..machine_name:lower().."_".. ri ..".png"
|
||||
local file_check = file_exists(img_path)
|
||||
|
||||
|
||||
if recipe_list_rdy.columns == 3 then
|
||||
max_recipe_pp = 36
|
||||
end
|
||||
|
||||
|
||||
if pg_num > 1 then
|
||||
-- Check if we need another fwd button
|
||||
if pg_num*max_recipe_pp < num_recipe then
|
||||
recipe_rp = recipe_rp.."button[15,0;2.5,0.5;"..fwd_page_name..";Page "..(pg_num + 1).." >>]"
|
||||
if file_check then
|
||||
if (ri % 2 ~= 0) then -- odd
|
||||
rp_content = rp_content.."image[13,"..(0.26+(2.4*(ri-4)))..";4,3;eletome_instructions_"..machine_name:lower().."_".. ri ..".png]"
|
||||
else
|
||||
rp_content = rp_content.."image[9.5,"..(0.26+(2.4*(ri-4)))..";4,3;eletome_instructions_"..machine_name:lower().."_".. ri ..".png]"
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
-- Always need back button
|
||||
recipe_rp = recipe_rp.."button[12.5,0;2.5,0.5;"..bwd_page_name..";<< "..(pg_num - 1).." Page]"
|
||||
|
||||
elseif num_recipe > max_recipe_pp then
|
||||
recipe_rp = recipe_rp.."button[15,0;2.5,0.5;"..fwd_page_name..";Page "..(pg_num + 1).." >>]"
|
||||
ri=ri+1
|
||||
end
|
||||
|
||||
-- Pass craft_description to player recieve fields when fwd/bwd pressed - not visible on formspec
|
||||
recipe_rp = recipe_rp.."field[10,12;1,0.5;craft_description;;"..craft_description.."]"
|
||||
|
||||
local pg_offset = (pg_num-1)*max_recipe_pp
|
||||
i = i+pg_offset
|
||||
|
||||
while i <= (max_recipe_pp + pg_offset) and i <= num_recipe do
|
||||
recipe_rp = recipe_rp..recipe_list_rdy[i]
|
||||
i=i+1
|
||||
end
|
||||
|
||||
-------------------------
|
||||
-- Assemble craft page --
|
||||
-------------------------
|
||||
local eletome_craft = heading_lp..head_sub_lp_ov..ov_lp_txt..machines_lp..
|
||||
head_sub_rp_rec..recipe_rp
|
||||
|
||||
return eletome_craft
|
||||
-------------------
|
||||
-- Assemble page --
|
||||
-------------------
|
||||
local eletome_inst = lp_heading..lp_sub_head..lp_content..rp_content
|
||||
|
||||
return eletome_inst
|
||||
end
|
||||
|
||||
|
||||
function eletome.large_image_page(machine)
|
||||
-- Page to view the complex machine image large size
|
||||
|
||||
-- remove "description = action:machine-" from string
|
||||
local machine_name = string.match(machine, "-(.*)")
|
||||
|
||||
-- remove "_"
|
||||
local mach_name = string.gsub(machine_name,"_", " ")
|
||||
|
||||
-- Assign Common styles to local vars
|
||||
local sty_h0s = eletome.common_styles.style_h0s
|
||||
local sty_h0e = eletome.common_styles.style_h0e
|
||||
|
||||
local heading = "hypertext[0.5,0.7;17.5,1.1;lp_heading;"..sty_h0s..mach_name..sty_h0e.."]"
|
||||
local image ="style_type[image_button;bgimg=elepower_tome_bgimg_1.png]"..
|
||||
"image_button[2.33,0.5;13.33,10;"..eletome.ai[machine_name:lower()].img..";instructions;]"..
|
||||
"tooltip[2.33,0.5;13.33,10;Click for detailed\ninstructions;"..eletome.tooltip_color.."]"
|
||||
|
||||
|
||||
-- Pass page reference value to player recieve fields when fwd/bwd pressed - not visible on formspec
|
||||
heading = heading .."field[10,12;1,0.5;description;;action:machine-"..machine_name.."]"
|
||||
|
||||
local eletome_lrg_img = image..heading
|
||||
|
||||
|
||||
|
||||
return eletome_lrg_img
|
||||
end
|
BIN
elepower_tome/textures/elepower_gui_icon_fluid_brine_lithium.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
elepower_tome/textures/elepower_gui_icon_fluid_water_brine.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 7.0 KiB |
BIN
elepower_tome/textures/elepower_tome_bgimg2.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
elepower_tome/textures/elepower_tome_bgimg_1.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
elepower_tome/textures/elepower_tome_bgimg_2.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
elepower_tome/textures/elepower_tome_bqimg2.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
elepower_tome/textures/elepower_tome_complex_fission_reactor.png
Normal file
After Width: | Height: | Size: 152 KiB |
BIN
elepower_tome/textures/elepower_tome_complex_miner.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
elepower_tome/textures/elepower_tome_complex_thermal_evap.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
elepower_tome/textures/elepower_tome_complex_water_pump.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
elepower_tome/textures/elepower_tome_icon_metal_lump.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
elepower_tome/textures/elepower_tome_mouse_rght_click.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
elepower_tome/textures/elepower_tome_mouse_rght_click.xcf
Normal file
BIN
elepower_tome/textures/elepower_tome_num_0.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
elepower_tome/textures/elepower_tome_num_0_9.xcf
Normal file
BIN
elepower_tome/textures/elepower_tome_num_1.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
elepower_tome/textures/elepower_tome_num_2.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
elepower_tome/textures/elepower_tome_num_3.png
Normal file
After Width: | Height: | Size: 588 B |
BIN
elepower_tome/textures/elepower_tome_num_4.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
elepower_tome/textures/elepower_tome_num_5.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
elepower_tome/textures/elepower_tome_num_6.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
elepower_tome/textures/elepower_tome_num_7.png
Normal file
After Width: | Height: | Size: 579 B |
BIN
elepower_tome/textures/elepower_tome_num_8.png
Normal file
After Width: | Height: | Size: 574 B |
BIN
elepower_tome/textures/elepower_tome_num_9.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
elepower_tome/textures/elepower_tome_num_epu.png
Normal file
After Width: | Height: | Size: 628 B |
BIN
elepower_tome/textures/elepower_tome_num_epu.xcf
Normal file
BIN
elepower_tome/textures/elepower_tome_steam.png
Normal file
After Width: | Height: | Size: 925 B |
BIN
elepower_tome/textures/elepower_tome_sunlight.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
elepower_tome/textures/elepower_tome_wind.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 123 KiB |
BIN
elepower_tome/textures/eletome_instructions_fission_reactor.xcf
Normal file
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 252 KiB |
BIN
elepower_tome/textures/eletome_instructions_miner.xcf
Normal file
BIN
elepower_tome/textures/eletome_instructions_miner_1.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
elepower_tome/textures/eletome_instructions_miner_2.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
elepower_tome/textures/eletome_instructions_miner_3.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
elepower_tome/textures/eletome_instructions_miner_4.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
elepower_tome/textures/eletome_instructions_miner_5.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
elepower_tome/textures/eletome_instructions_thermal_plant.xcf
Normal file
BIN
elepower_tome/textures/power_network_simple_examples.png
Normal file
After Width: | Height: | Size: 12 KiB |