16 Commits

Author SHA1 Message Date
2a607bedfe Release IndustrialTest 1.1.0 (stable, release) 2024-06-12 10:57:50 +02:00
4ac7210f40 Don't try to remove node from invalid network master 2024-05-13 19:44:16 +02:00
5b5816a65c Make only higher power flow destroy transformer
Fixes #24
2024-05-13 19:03:25 +02:00
36549e9a49 Fix electric tools breaking
Fixes #13
2024-05-12 20:36:31 +02:00
bea76ecc62 Merge pull request #28 from HandfulOfFrogs/industrialtest:feat/enchantability into master 2024-05-12 19:52:31 +02:00
fd569985da Merge pull request #27 from HandfulOfFrogs/industrialtest:fix/bronze-crafting into master 2024-05-12 19:51:28 +02:00
67f503758f feat: enchantability for bronze armor and weapons 2024-05-12 10:59:12 +03:00
3fcefc5888 fix: industrialcraft/industrialtest 2024-05-12 10:58:13 +03:00
b2df6edeaf Merge pull request #23 from HandfulOfFrogs/industrialtest:cell-textures into master 2024-05-12 08:49:07 +02:00
37e0662640 feat: old-style cells (tin version) 2024-05-11 21:00:25 +03:00
bd40cea113 feat: old-style cells (gray version) 2024-05-11 20:49:17 +03:00
c1728ec7ec Merge branch 'master' of https://git.cubesoftware.xyz/mrkubax10/industrialtest into cell-textures 2024-05-11 14:04:13 +03:00
6a705dbb01 feat: new cell textures + unified texture for all cells 2024-05-11 14:03:19 +03:00
36c5b3c8ac Fix listrings in machine formspecs to make it possible to move items with shift
Fixes #12
2024-05-11 12:53:18 +02:00
961e08647f Add HandfulOfFrogs to contributors section in README.md 2024-05-11 12:03:27 +02:00
8801ef515b Deduplicate formspec code 2024-05-11 11:59:44 +02:00
36 changed files with 231 additions and 468 deletions

View File

@@ -19,5 +19,6 @@ Currently IndustrialTest supports following games:
## Contributors
- mrkubax10 <mrkubax10@onet.pl or mrkubax10 at irc.libera.chat> [programming, some graphics]
- HandfulOfFrogs <<handfuloffrogs@gmail.com>> [some programming, graphics]
- LuanHawk <Discord: LuanHawk#8733> [lead graphics]
- Migdyn <<temp1@cubesoftware.xyz>> [graphics]

59
api.lua
View File

@@ -32,15 +32,6 @@ industrialtest.api.hvPowerFlow=10200
industrialtest.api.evPowerFlow=40800
industrialtest.api.ivPowerFlow=163800
industrialtest.api.craftingMethods={
macerating="industrialtest.macerating",
compressing="industrialtest.compressing",
extracting="industrialtest.extracting",
recycling="industrialtest.recycling",
cableForming="industrialtest.cable_forming",
massFabricating="industrialtest.mass_fabricating",
}
industrialtest.internal.clamp=function(num,min,max)
return math.max(math.min(num,max),min)
end
@@ -523,6 +514,9 @@ end
industrialtest.api.removeNodeFromNetwork=function(pos,nodePos)
local meta=minetest.get_meta(pos)
if not meta:contains("industrialtest.network") then
return
end
local network=minetest.deserialize(meta:get_string("industrialtest.network"))
local removed=false
for key,node in ipairs(network) do
@@ -698,13 +692,16 @@ end
-- \param displayName Display name of cell
-- \param node Node which can be picked up with this cell
-- \returns nil
industrialtest.api.registerStorageCell=function(name,displayName,node,modname)
industrialtest.api.registerStorageCell=function(name,displayName,node,modname,color)
color = color or "#ffffffff"
if not modname then
modname="industrialtest"
end
minetest.register_craftitem("industrialtest:"..name.."_cell",{
description=S(displayName.." Cell"),
inventory_image=modname.."_"..name.."_cell.png",
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=color,
on_place=function(itemstack,user,pointed)
if pointed.type~="node" or not user or not user:is_player() then
return nil
@@ -759,16 +756,6 @@ industrialtest.api.registerMaceratorRecipe=function(config)
recipe=config.recipe or "",
time=config.time or 2
}
if mcl_craftguide ~= nil then
mcl_craftguide.register_craft({
type = industrialtest.api.craftingMethods.macerating,
width = 1,
output = definition.output,
items = {definition.recipe}
})
end
industrialtest.api.maceratorRecipes[definition.recipe]=definition
end
-- \brief Returns macerator recipe result
@@ -787,16 +774,6 @@ industrialtest.api.registerCompressorRecipe=function(config)
time=config.time or 2,
count=config.count or 1
}
if mcl_craftguide ~= nil then
mcl_craftguide.register_craft({
type = industrialtest.api.craftingMethods.compressing,
width = 1,
output = definition.output,
items = {definition.recipe}
})
end
industrialtest.api.compressorRecipes[definition.recipe]=definition
end
-- \brief Returns macerator recipe result
@@ -811,16 +788,6 @@ industrialtest.api.registerExtractorRecipe=function(config)
recipe=config.recipe or "",
time=config.time or 2
}
if mcl_craftguide ~= nil then
mcl_craftguide.register_craft({
type = industrialtest.api.craftingMethods.extracting,
width = 1,
output = definition.output,
items = {definition.recipe}
})
end
industrialtest.api.extractorRecipes[definition.recipe]=definition
end
industrialtest.api.getExtractorRecipeResult=function(recipe)
@@ -833,16 +800,6 @@ industrialtest.api.registerCableFormerRecipe=function(config)
recipe=config.recipe or "",
time=config.time or 2
}
if mcl_craftguide ~= nil then
mcl_craftguide.register_craft({
type = industrialtest.api.craftingMethods.cableForming,
width = 1,
output = definition.output,
items = {definition.recipe}
})
end
industrialtest.api.cableFormerRecipes[definition.recipe]=definition
end

View File

@@ -33,12 +33,6 @@ for _,mod in ipairs(requiredMclModules) do
end
end
if industrialtest.mtgAvailable then
industrialtest.stackMax=99
elseif industrialtest.mclAvailable then
industrialtest.stackMax=64
end
industrialtest.mods={}
if industrialtest.mtgAvailable then
industrialtest.mods._3dArmor=minetest.get_modpath("3d_armor")
@@ -53,10 +47,11 @@ if industrialtest.mtgAvailable and not industrialtest.mods._3dArmor then
end
industrialtest.elementKeys={}
industrialtest.internal={}
if industrialtest.mclAvailable then
industrialtest.stackMax=64
industrialtest.internal.mclMakeStrippedTrunk=function(itemstack,placer,pointedThing,electricTool)
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_tools/init.lua#L360
if pointedThing.type ~= "node" then return end
@@ -85,9 +80,22 @@ if industrialtest.mclAvailable then
end
return itemstack
end
industrialtest.internal.explode=function(pos,radius,dropChance)
mcl_explosions.explode(pos,radius,{drop_chance=dropChance})
end
industrialtest.internal.getItemSlotBg=mcl_formspec.get_itemslot_bg
elseif industrialtest.mtgAvailable then
industrialtest.stackMax=99
industrialtest.internal.explode=function(pos,radius)
tnt.boom(pos,{radius=radius})
end
industrialtest.internal.getItemSlotBg=function()
return ""
end
end
-- compatibilty that adds not existing elements
@@ -194,7 +202,7 @@ if industrialtest.mclAvailable then
minetest.register_tool("industrialtest:"..material.."_pickaxe",{
description=S(materialDisplayName.." Pickaxe"),
inventory_image="industrialtest_mcl_"..material.."_pickaxe.png",
groups={tool=1,pickaxe=1,dig_speed_class=config.digSpeedClass},
groups={tool=1,pickaxe=1,dig_speed_class=config.digSpeedClass,enchantability=config.enchantability},
tool_capabilities={
full_punch_interval=1,
max_drop_level=config.dropLevel,
@@ -210,7 +218,7 @@ if industrialtest.mclAvailable then
minetest.register_tool("industrialtest:"..material.."_shovel",{
description=S(materialDisplayName.." Shovel"),
inventory_image="industrialtest_mcl_"..material.."_shovel.png",
groups={tool=1,shovel=1,dig_speed_class=config.digSpeedClass},
groups={tool=1,shovel=1,dig_speed_class=config.digSpeedClass,enchantability=config.enchantability},
tool_capabilities={
full_punch_interval=1,
max_drop_level=config.dropLevel,
@@ -262,7 +270,7 @@ if industrialtest.mclAvailable then
minetest.register_tool("industrialtest:"..material.."_axe",{
description=S(materialDisplayName.." Axe"),
inventory_image="industrialtest_mcl_"..material.."_axe.png",
groups={tool=1,axe=1,dig_speed_class=config.digSpeedClass},
groups={tool=1,axe=1,dig_speed_class=config.digSpeedClass,enchantability=config.enchantability},
tool_capabilities={
full_punch_interval=1,
max_level_drop=config.levelDrop,
@@ -279,7 +287,7 @@ if industrialtest.mclAvailable then
minetest.register_tool("industrialtest:"..material.."_sword",{
description=S(materialDisplayName.." Sword"),
inventory_image="industrialtest_mcl_"..material.."_sword.png",
groups={weapon=1,sword=1,dig_speed_class=config.digSpeedClass},
groups={weapon=1,sword=1,dig_speed_class=config.digSpeedClass,enchantability=config.enchantability},
tool_capabilities={
full_punch_interval=0.625,
max_drop_level=config.maxDropLevel,
@@ -296,7 +304,7 @@ if industrialtest.mclAvailable then
minetest.register_tool("industrialtest:"..material.."_hoe",{
description=S(materialDisplayName.." Hoe"),
inventory_image="industrialtest_mcl_"..material.."_hoe.png",
groups={tool=1,hoe=1},
groups={tool=1,hoe=1,enchantability=config.enchantability},
tool_capabilities={
full_punch_interval=1,
damage_groups={fleshy=1}
@@ -364,6 +372,7 @@ if industrialtest.mclAvailable then
cook_material=config.armorCookMaterial,
sound_equip=config.armorEquipSound,
sound_unequip=config.armorUnequipSound,
enchantability=config.enchantability,
textures={
head="industrialtest_mcl_"..material.."_helmet.png",
torso="industrialtest_mcl_"..material.."_chestplate.png",
@@ -521,7 +530,7 @@ if industrialtest.mclAvailable then
})
minetest.register_craft({
type="shaped",
output="industrialcraft:bronze_ingot 9",
output="industrialtest:bronze_ingot 9",
recipe={
{"mcl_copper:copper_ingot","mcl_copper:copper_ingot","mcl_copper:copper_ingot"},
{"mcl_copper:copper_ingot","industrialtest:tin_ingot","mcl_copper:copper_ingot"},
@@ -567,7 +576,8 @@ if industrialtest.mclAvailable then
},
armorCookMaterial="industrialtest:bronze_nugget",
armorEquipSound="mcl_armor_equip_iron",
armorUnequipSound="mcl_armor_unequip_iron"
armorUnequipSound="mcl_armor_unequip_iron",
enchantability=15,
})
--register other blocks that are not availabe in MCL
@@ -610,37 +620,7 @@ if industrialtest.mclAvailable then
y_max=mcl_worlds.layer_to_y(16),
y_min=mcl_vars.mg_overworld_min
})
mcl_craftguide.register_craft_type("industrialtest.macerating", {
description = S("Macerating"),
icon = "industrialtest_machine_block.png^industrialtest_macerator_front_active.png"
})
mcl_craftguide.register_craft_type("industrialtest.compressing", {
description = S("Compressing"),
icon = "industrialtest_machine_block.png^industrialtest_compressor_front_active.png"
})
mcl_craftguide.register_craft_type("industrialtest.extracting", {
description = S("Extracting"),
icon = "industrialtest_machine_block.png^industrialtest_extractor_front_active.png"
})
mcl_craftguide.register_craft_type("industrialtest.recycling", {
description = S("Recycling"),
icon = "industrialtest_machine_block.png^industrialtest_recycler_top_active.png"
})
mcl_craftguide.register_craft_type("industrialtest.cable_forming", {
description = S("Cable Forming"),
icon = "industrialtest_machine_block.png^industrialtest_cable_former_front_active.png"
})
mcl_craftguide.register_craft_type("industrialtest.mass_fabricating", {
description = S("Mass Fabricating"),
icon = "industrialtest_machine_block.png^industrialtest_mass_fabricator_front_active.png"
})
elseif industrialtest.mtgAvailable then
industrialtest.internal.explode=function(pos,radius)
tnt.boom(pos,{radius=radius})
end
industrialtest.internal.registerMetal=function(name,displayName,hardness)
minetest.register_craftitem("industrialtest:"..name.."_lump",{
description=S(displayName.." Lump"),

View File

@@ -31,6 +31,14 @@ local colors={
sulfur="#b88805ff",
tin="#ebd182ff",
uranium="#3b8c09ff",
-- fluid colors
lava="#ff5712ff",
water="#277bbcff",
river_water="#0ebfc2ff",
biomass="#2a8626ff",
biofuel="#4eba49ff",
coalfuel="#462228ff",
coolant="#188676ff"
}
-- Power storage items
@@ -626,12 +634,12 @@ minetest.register_craft({
{"",industrialtest.elementKeys.tinIngot,""}
}
})
industrialtest.api.registerStorageCell("water","Water",industrialtest.elementKeys.waterSource)
industrialtest.api.registerStorageCell("water","Water",industrialtest.elementKeys.waterSource,nil,colors.water)
if industrialtest.mtgAvailable then
industrialtest.api.registerStorageCell("river_water","River Water","default:river_water_source")
industrialtest.api.registerStorageCell("river_water","River Water","default:river_water_source",nil,colors.river_water)
end
industrialtest.api.registerStorageCell("lava","Lava",industrialtest.elementKeys.lavaSource)
industrialtest.api.registerStorageCell("lava","Lava",industrialtest.elementKeys.lavaSource,nil,colors.lava)
minetest.register_tool("industrialtest:uranium_cell",{
description=S("Uranium Cell"),
@@ -639,7 +647,9 @@ minetest.register_tool("industrialtest:uranium_cell",{
_industrialtest_placedInNuclearReactor=1,
_industrialtest_nuclearReactorFuel=1
},
inventory_image="industrialtest_uranium_cell.png",
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=colors.uranium,
})
minetest.register_craft({
type="shapeless",
@@ -656,7 +666,9 @@ minetest.register_tool("industrialtest:coolant_cell",{
_industrialtest_placedInNuclearReactor=1,
_industrialtest_nuclearReactorCoolant=1
},
inventory_image="industrialtest_coolant_cell.png",
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=colors.coolant,
})
minetest.register_craft({
type="shaped",
@@ -681,7 +693,9 @@ end
minetest.register_craftitem("industrialtest:bio_cell",{
description=S("Bio Cell"),
inventory_image="industrialtest_bio_cell.png"
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=colors.biomass,
})
minetest.register_craft({
type="shapeless",
@@ -694,7 +708,9 @@ minetest.register_craft({
minetest.register_craftitem("industrialtest:biofuel_cell",{
description=S("Biofuel Cell"),
inventory_image="industrialtest_bio_cell.png",
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=colors.biofuel,
groups={
_industrialtest_fuel=1
},
@@ -709,7 +725,9 @@ industrialtest.api.registerExtractorRecipe({
minetest.register_craftitem("industrialtest:hydrated_coal_cell",{
description=S("Hydrated Coal Cell"),
inventory_image="industrialtest_hydrated_coal_cell.png"
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=colors.coal,
})
minetest.register_craft({
type="shapeless",
@@ -722,7 +740,9 @@ minetest.register_craft({
minetest.register_craftitem("industrialtest:coalfuel_cell",{
description=S("Coalfuel Cell"),
inventory_image="industrialtest_coalfuel_cell.png",
inventory_image="industrialtest_cell_fluid.png",
inventory_overlay="industrialtest_cell_casing.png",
color=colors.coalfuel,
groups={
_industrialtest_fuel=1
},

View File

@@ -24,7 +24,7 @@ industrialtest.internal.registerSimpleElectricItemProcessor({
capacity=1400,
flow=industrialtest.api.lvPowerFlow,
opPower=80,
method=industrialtest.api.craftingMethods.cableForming,
method="industrialtest.cable_forming",
efficiency=1
})
minetest.register_craft({

View File

@@ -24,46 +24,24 @@ canningMachine.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local powerPercent=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100
local srcPercent=meta:get_float("srcTime")/canningMachine.canningTime*100
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;src;3.4,1.8;1,1]",
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.4,3.9;1,1]",
(srcPercent>0 and "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,1.8;1,1]",
"list[context;leftover;6.4,2.8;1,1]",
"list[context;upgrades;9,0.9;1,4]",
"listring[context;src]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;leftover]",
"listring[context;upgrades]"
}
elseif industrialtest.mclAvailable then
formspec={
local formspec={
"list[context;src;3.4,1.8;1,1]",
mcl_formspec.get_itemslot_bg(3.4,1.8,1,1),
industrialtest.internal.getItemSlotBg(3.4,1.8,1,1),
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.4,3.9;1,1]",
mcl_formspec.get_itemslot_bg(3.4,3.9,1,1),
industrialtest.internal.getItemSlotBg(3.4,3.9,1,1),
(srcPercent>0 and "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,1.8;1,1]",
mcl_formspec.get_itemslot_bg(6.4,1.8,1,1),
industrialtest.internal.getItemSlotBg(6.4,1.8,1,1),
"list[context;leftover;6.4,2.8;1,1]",
mcl_formspec.get_itemslot_bg(6.4,2.8,1,1),
industrialtest.internal.getItemSlotBg(6.4,2.8,1,1),
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"listring[context;src]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;upgrades]"
}
end
"listring[context;dst]"
}
return table.concat(formspec,"")
end

View File

@@ -71,32 +71,18 @@ end
chargepad.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local charged=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;charged;1,2.5;1,1]",
"listring[context;charged]",
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
"listring[context;discharged]",
"label[2.7,3.9;"..S("Discharge").."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;1,2.5;1,1]",
"listring[context;charged]",
mcl_formspec.get_itemslot_bg(1,2.5,1,1),
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
"listring[context;discharged]",
mcl_formspec.get_itemslot_bg(3,2.5,1,1),
"label[2.7,3.9;"..S("Discharge").."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
end
local formspec={
"list[context;charged;1,2.5;1,1]",
industrialtest.internal.getItemSlotBg(1,2.5,1,1),
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
industrialtest.internal.getItemSlotBg(3,2.5,1,1),
"label[2.7,3.9;"..S("Discharge").."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"listring[context;charged]",
"listring[context;discharged]"
}
return table.concat(formspec,"")
end

View File

@@ -72,19 +72,21 @@ machine.getFormspec=function(pos,config)
"formspec_version[4]",
"size[10.8,12]",
"label[0.5,0.5;"..config.displayName.."]",
(config.getFormspec and config.getFormspec(pos) or ""),
"list[current_player;main;0.5,6.25;8,1]",
"list[current_player;main;0.5,7.5;8,3;8]"
"list[current_player;main;0.5,7.5;8,3;8]",
"listring[current_player;main]",
(config.getFormspec and config.getFormspec(pos) or "")
}
elseif industrialtest.mclAvailable then
formspec={
"size[10.04,12]",
"label[0.25,0.25;"..config.displayName.."]",
(config.getFormspec and config.getFormspec(pos) or ""),
"list[current_player;main;0.5,7;9,3;9]",
mcl_formspec.get_itemslot_bg(0.5,7,9,3),
"list[current_player;main;0.5,10.24;9,1]",
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1)
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1),
"listring[current_player;main]",
(config.getFormspec and config.getFormspec(pos) or "")
}
end
return table.concat(formspec,"")
@@ -453,7 +455,7 @@ local function craftResultProxy(method,item)
time=output.time,
src=after.items[1]
}
elseif method==industrialtest.api.craftingMethods.macerating then
elseif method=="industrialtest.macerating" then
local output=industrialtest.api.getMaceratorRecipeResult(item:get_name())
if not output then
return {
@@ -469,7 +471,7 @@ local function craftResultProxy(method,item)
time=output.time,
src=srcAfter
}
elseif method==industrialtest.api.craftingMethods.compressing then
elseif method=="industrialtest.compressing" then
local output=industrialtest.api.getCompressorRecipeResult(item:get_name())
if not output or item:get_count()<output.count then
return {
@@ -485,7 +487,7 @@ local function craftResultProxy(method,item)
time=output.time,
src=srcAfter
}
elseif method==industrialtest.api.craftingMethods.extracting then
elseif method=="industrialtest.extracting" then
local output=industrialtest.api.getExtractorRecipeResult(item:get_name())
if not output then
return {
@@ -501,7 +503,7 @@ local function craftResultProxy(method,item)
time=output.time,
src=srcAfter
}
elseif method==industrialtest.api.craftingMethods.recycling then
elseif method=="industrialtest.recycling" then
local srcAfter=ItemStack(item:get_name())
srcAfter:set_count(item:get_count()-1)
return {
@@ -509,7 +511,7 @@ local function craftResultProxy(method,item)
time=2,
src=srcAfter
}
elseif method==industrialtest.api.craftingMethods.cableForming then
elseif method=="industrialtest.cable_forming" then
local output=industrialtest.api.getCableFormerRecipeResult(item:get_name())
if not output then
return {
@@ -525,7 +527,7 @@ local function craftResultProxy(method,item)
time=output.time,
src=srcAfter
}
elseif method==industrialtest.api.craftingMethods.massFabricating then
elseif method=="industrialtest.mass_fabricating" then
if item:get_count()<34 then
return {
item=ItemStack(),
@@ -548,42 +550,22 @@ simpleElectricItemProcessor.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local powerPercent=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100
local srcPercent=meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;src;3.4,1.8;1,1]",
"listring[context;src]",
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.4,3.9;1,1]",
"listring[context;powerStorage]",
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,2.8;1,1]",
"listring[context;dst]",
"list[context;upgrades;9,0.9;1,4]",
"listring[context;upgrades]"
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;src;3.4,1.8;1,1]",
mcl_formspec.get_itemslot_bg(3.4,1.8,1,1),
"listring[context;src]",
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.4,3.9;1,1]",
mcl_formspec.get_itemslot_bg(3.4,3.9,1,1),
"listring[context;powerStorage]",
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,2.8;1,1]",
mcl_formspec.get_itemslot_bg(6.4,2.8,1,1),
"listring[context;dst]",
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
"listring[context;upgrades]"
}
end
local formspec={
"list[context;src;3.4,1.8;1,1]",
industrialtest.internal.getItemSlotBg(3.4,1.8,1,1),
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.4,3.9;1,1]",
industrialtest.internal.getItemSlotBg(3.4,3.9,1,1),
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,2.8;1,1]",
industrialtest.internal.getItemSlotBg(6.4,2.8,1,1),
"list[context;upgrades;9,0.9;1,4]",
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"listring[context;src]",
"listring[context;dst]"
}
return table.concat(formspec,"")
end

View File

@@ -24,7 +24,7 @@ industrialtest.internal.registerSimpleElectricItemProcessor({
capacity=1400,
flow=industrialtest.api.lvPowerFlow,
opPower=120,
method=industrialtest.api.craftingMethods.compressing,
method="industrialtest.compressing",
efficiency=1
})
minetest.register_craft({

View File

@@ -22,37 +22,21 @@ fluidGenerator.getFormspec=function(pos,config)
local fluidPercent=meta:get_float("fluidAmount")/100
local powerPercent=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
local fluid=meta:get_string("fluid")
local formspec
local fuel=config.getFuel(fluid)
local tile=(fuel and fuel.texture or "industrialtest_gui_fluid_bg.png")
if industrialtest.mtgAvailable then
formspec={
"list[context;src;2,1.8;1,1]",
"listring[context;src]",
(fluidPercent>0 and "image[2,3;1,1;industrialtest_gui_fluid_bg.png^[lowpart:"..fluidPercent..":"..tile.."]" or "image[2,3;1,1;industrialtest_gui_fluid_bg.png]"),
"list[context;dst;2,4.2;1,1]",
"listring[context;dst]",
"list[context;charged;6,3;1,1]",
"listring[context;charged]",
"box[9,1;0.3,4.8;#202020]",
(powerPercent>0 and "box[9,"..(1+4.8-(powerPercent*4.8))..";0.3,"..(powerPercent*4.8)..";#FF1010]" or "")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;src;2,1.8;1,1]",
mcl_formspec.get_itemslot_bg(2,1.8,1,1),
"listring[context;src]",
(fluidPercent>0 and "image[2,3;1,1;industrialtest_gui_fluid_bg.png^[lowpart:"..fluidPercent..":"..tile.."]" or "image[2,3;1,1;industrialtest_gui_fluid_bg.png]"),
"list[context;dst;2,4.2;1,1]",
mcl_formspec.get_itemslot_bg(2,4.2,1,1),
"listring[context;dst]",
"list[context;charged;6,3;1,1]",
mcl_formspec.get_itemslot_bg(6,3,1,1),
"listring[context;charged]",
"box[9,1;0.3,4.8;#202020]",
(powerPercent>0 and "box[9,"..(1+4.8-(powerPercent*4.8))..";0.3,"..(powerPercent*4.8)..";#FF1010]" or "")
}
end
local formspec={
"list[context;src;2,1.8;1,1]",
industrialtest.internal.getItemSlotBg(2,1.8,1,1),
(fluidPercent>0 and "image[2,3;1,1;industrialtest_gui_fluid_bg.png^[lowpart:"..fluidPercent..":"..tile.."]" or "image[2,3;1,1;industrialtest_gui_fluid_bg.png]"),
"list[context;dst;2,4.2;1,1]",
industrialtest.internal.getItemSlotBg(2,4.2,1,1),
"list[context;charged;6,3;1,1]",
industrialtest.internal.getItemSlotBg(6,3,1,1),
"box[9,1;0.3,4.8;#202020]",
(powerPercent>0 and "box[9,"..(1+4.8-(powerPercent*4.8))..";0.3,"..(powerPercent*4.8)..";#FF1010]" or ""),
"listring[context;src]",
"listring[context;dst]"
}
return table.concat(formspec,"")
end

View File

@@ -21,32 +21,17 @@ generator.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local fuelPercent=meta:get_int("fuelTime")/meta:get_int("maxFuelTime")*100
local charged=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;charged;4.9,1.8;1,1]",
"listring[context;charged]",
(fuelPercent>0 and "image[4.9,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[4.9,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;src;4.9,3.9;1,1]",
"listring[context;src]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;4.7,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
"listring[context;charged]",
(fuelPercent>0 and "image[4.7,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[4.7,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;src;4.7,3.9;1,1]",
mcl_formspec.get_itemslot_bg(4.7,3.9,1,1),
"listring[context;src]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
end
local formspec={
"list[context;charged;4.7,1.8;1,1]",
industrialtest.internal.getItemSlotBg(4.7,1.8,1,1),
(fuelPercent>0 and "image[4.7,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[4.7,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;src;4.7,3.9;1,1]",
industrialtest.internal.getItemSlotBg(4.7,3.9,1,1),
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"listring[context;src]"
}
return table.concat(formspec,"")
end

View File

@@ -43,44 +43,23 @@ inductionFurnace.getFormspec=function(pos)
local maxSrcTime=meta:get_float("maxSrcTime")
local srcPercent=maxSrcTime>0 and meta:get_float("srcTime")/maxSrcTime*100 or 0
local heat=meta:get_int("heat")
local formspec
if industrialtest.mtgAvailable then
formspec={
local formspec={
"list[context;src;3.7,1.8;2,1]",
industrialtest.internal.getItemSlotBg(3.7,1.8,2,1),
(powerPercent>0 and "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.7,3.9;1,1]",
industrialtest.internal.getItemSlotBg(3.7,3.9,1,1),
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6,2.8;2,1;]",
industrialtest.internal.getItemSlotBg(6,2.8,2,1),
"list[context;upgrades;9,0.9;1,4]",
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"label[0.5,2.8;"..minetest.formspec_escape(S("Heat: @1 %",heat)).."]",
"listring[context;src]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;upgrades]"
"listring[context;dst]"
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;src;3.7,1.8;2,1]",
mcl_formspec.get_itemslot_bg(3.7,1.8,2,1),
(powerPercent>0 and "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.7,3.9;1,1]",
mcl_formspec.get_itemslot_bg(3.7,3.9,1,1),
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6,2.8;2,1;]",
mcl_formspec.get_itemslot_bg(6,2.8,2,1),
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
"label[0.5,2.8;"..minetest.formspec_escape(S("Heat: @1 %",heat)).."]",
"listring[context;src]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;upgrades]"
}
end
return table.concat(formspec,"")
end

View File

@@ -25,17 +25,17 @@ ironFurnace.getFormspec=function(fuelPercent,srcPercent)
"size[10.8,12]",
"label[0.5,0.5;"..S("Iron Furnace").."]",
"list[context;src;3.4,1.8;1,1]",
"listring[context;src]",
(fuelPercent>0 and "image[3.4,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[3.4,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;fuel;3.4,3.9;1,1]",
"listring[context;fuel]",
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,2.8;1,1]",
"listring[context;dst]",
"list[current_player;main;0.5,6.25;8,1]",
"list[current_player;main;0.5,7.5;8,3;8]"
"list[current_player;main;0.5,7.5;8,3;8]",
"listring[current_player;main]",
"listring[context;src]",
"listring[context;dst]"
}
elseif industrialtest.mclAvailable then
formspec={
@@ -43,21 +43,21 @@ ironFurnace.getFormspec=function(fuelPercent,srcPercent)
"label[0.25,0.25;"..S("Iron Furnace").."]",
"list[context;src;3.4,1.8;1,1]",
mcl_formspec.get_itemslot_bg(3.4,1.8,1,1),
"listring[context;src]",
(fuelPercent>0 and "image[3.4,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[3.4,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;fuel;3.4,3.9;1,1]",
mcl_formspec.get_itemslot_bg(3.4,3.9,1,1),
"listring[context;fuel]",
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6.4,2.8;1,1]",
mcl_formspec.get_itemslot_bg(6.4,2.8,1,1),
"listring[context;dst]",
"list[current_player;main;0.5,7;9,3;9]",
mcl_formspec.get_itemslot_bg(0.5,7,9,3),
"list[current_player;main;0.5,10.24;9,1]",
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1)
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1),
"listring[current_player;main]",
"listring[context;src]",
"listring[context;dst]"
}
end
return table.concat(formspec,"")

View File

@@ -24,7 +24,7 @@ industrialtest.internal.registerSimpleElectricItemProcessor({
capacity=1200,
flow=industrialtest.api.lvPowerFlow,
opPower=100,
method=industrialtest.api.craftingMethods.macerating,
method="industrialtest.macerating",
efficiency=1
})
minetest.register_craft({

View File

@@ -23,30 +23,16 @@ reactor.getFormspec=function(pos)
local charged=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
local size=math.floor(meta:get_int("size")/3)
local switchText=(meta:get_int("enabled")==0 and S("Start") or S("Stop"))
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;fuel;1,1;"..size..","..size.."]",
"listring[context;fuel]",
"list[context;charged;7.7,2.8;1,1]",
"listring[context;charged]",
"button[7.7,1;1,0.8;toggle;"..minetest.formspec_escape(switchText).."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;fuel;1,1;"..size..","..size.."]",
mcl_formspec.get_itemslot_bg(1,1,size,size),
"listring[context;fuel]",
"list[context;charged;7,2.8;1,1]",
mcl_formspec.get_itemslot_bg(7.7,2.8,1,1),
"listring[context;charged]",
"button[7.7,1;1,0.8;toggle;"..minetest.formspec_escape(switchText).."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
end
local formspec={
"list[context;fuel;1,1;"..size..","..size.."]",
industrialtest.internal.getItemSlotBg(1,1,size,size),
"list[context;charged;7,2.8;1,1]",
industrialtest.internal.getItemSlotBg(7.7,2.8,1,1),
"button[7.7,1;1,0.8;toggle;"..minetest.formspec_escape(switchText).."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"listring[context;fuel]"
}
return table.concat(formspec,"")
end

View File

@@ -20,32 +20,18 @@ local powerStorage={}
powerStorage.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local charged=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;charged;1,2.5;1,1]",
"listring[context;charged]",
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
"listring[context;discharged]",
"label[2.7,3.9;"..S("Discharge").."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;1,2.5;1,1]",
"listring[context;charged]",
mcl_formspec.get_itemslot_bg(1,2.5,1,1),
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
"listring[context;discharged]",
mcl_formspec.get_itemslot_bg(3,2.5,1,1),
"label[2.7,3.9;"..S("Discharge").."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
end
local formspec={
"list[context;charged;1,2.5;1,1]",
industrialtest.internal.getItemSlotBg(1,2.5,1,1),
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
industrialtest.internal.getItemSlotBg(3,2.5,1,1),
"label[2.7,3.9;"..S("Discharge").."]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"listring[context;charged]",
"listring[context;discharged]"
}
return table.concat(formspec,"")
end

View File

@@ -27,51 +27,26 @@ rotaryMacerator.getFormspec=function(pos)
local srcPercent=maxSrcTime>0 and meta:get_float("srcTime")/maxSrcTime*100 or 0
local rpm=meta:get_int("rpm")
local buttonMaintainSpeedText=meta:get_int("maintainSpeed")==1 and S("Don't maintain speed") or S("Maintain speed")
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;src;3.8,1.8;1,1]",
"list[context;modifier;4.9,1.8;1,1]",
(powerPercent>0 and "image[3.8,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.8,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.8,3.9;1,1]",
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6,2.8;1,1;]",
"list[context;upgrades;9,0.9;1,4]",
"label[0.5,2.8;"..minetest.formspec_escape(S("Speed: @1",rpm)).."]",
"button[0.5,3.4;3,0.8;maintainSpeed;"..minetest.formspec_escape(buttonMaintainSpeedText).."]",
"listring[context;src]",
"listring[context;modifier]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;upgrades]"
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;src;3.8,1.8;1,1]",
mcl_formspec.get_itemslot_bg(3.8,1.8,1,1),
"list[context;modifier;4.9,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.9,1.8,1,1),
(powerPercent>0 and "image[3.8,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.8,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.8,3.9;1,1]",
mcl_formspec.get_itemslot_bg(3.8,3.9,1,1),
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6,2.8;1,1;]",
mcl_formspec.get_itemslot_bg(6,2.8,1,1),
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
"label[0.5,2.8;"..minetest.formspec_escape(S("Speed: @1",rpm)).."]",
"button[0.5,3.4;3,0.8;maintainSpeed;"..minetest.formspec_escape(buttonMaintainSpeedText).."]",
"listring[context;src]",
"listring[context;modifier]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;upgrades]"
}
end
local formspec={
"list[context;src;3.8,1.8;1,1]",
industrialtest.internal.getItemSlotBg(3.8,1.8,1,1),
"list[context;modifier;4.9,1.8;1,1]",
industrialtest.internal.getItemSlotBg(4.9,1.8,1,1),
(powerPercent>0 and "image[3.8,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.8,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;powerStorage;3.8,3.9;1,1]",
industrialtest.internal.getItemSlotBg(3.8,3.9,1,1),
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
"list[context;dst;6,2.8;1,1;]",
industrialtest.internal.getItemSlotBg(6,2.8,1,1),
"list[context;upgrades;9,0.9;1,4]",
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"label[0.5,2.8;"..minetest.formspec_escape(S("Speed: @1",rpm)).."]",
"button[0.5,3.4;3,0.8;maintainSpeed;"..minetest.formspec_escape(buttonMaintainSpeedText).."]",
"listring[context;src]",
"listring[context;dst]"
}
return table.concat(formspec,"")
end

View File

@@ -20,23 +20,13 @@ local solarPanel={}
solarPanel.getFormspec=function(pos)
local amount=minetest.get_natural_light(vector.offset(pos,0,1,0))/15.0
local charging=amount>0.5
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;charged;4.9,1.8;1,1]",
"listring[context;charged]",
(charging and "image[4.9,2.8;1,1;industrialtest_gui_sun_fg.png]"
or "image[4.9,2.8;1,1;industrialtest_gui_sun_bg.png]")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;4.7,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
"listring[context;charged]",
(charging and "image[4.7,2.8;1,1;industrialtest_gui_sun_fg.png]"
or "image[4.7,2.8;1,1;industrialtest_gui_sun_bg.png]")
}
end
local formspec={
"list[context;charged;4.7,1.8;1,1]",
industrialtest.internal.getItemSlotBg(4.7,1.8,1,1),
(charging and "image[4.7,2.8;1,1;industrialtest_gui_sun_fg.png]"
or "image[4.7,2.8;1,1;industrialtest_gui_sun_bg.png]"),
"listring[context;charged]"
}
return table.concat(formspec,"")
end

View File

@@ -20,33 +20,17 @@ local toolWorkshop={}
toolWorkshop.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local powerPercent=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;powerStorage;3.7,3.7;1,1;0]",
"listring[context;powerStorage]",
(powerPercent>0 and "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;src;5.9,3.2;1,1;0]",
"listring[context;src]",
"list[context;upgrades;9,0.9;1,4]",
"listring[context;upgrades]"
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;powerStorage;3.7,3.7;1,1;0]",
mcl_formspec.get_itemslot_bg(3.7,3.7,1,1),
"listring[context;powerStorage]",
(powerPercent>0 and "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;src;5.9,3.2;1,1;0]",
mcl_formspec.get_itemslot_bg(5.9,3.2,1,1),
"listring[context;src]",
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
"listring[context;upgrades]"
}
end
local formspec={
"list[context;powerStorage;3.7,3.7;1,1;0]",
industrialtest.internal.getItemSlotBg(3.7,3.7,1,1),
(powerPercent>0 and "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
or "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png]"),
"list[context;src;5.9,3.2;1,1;0]",
industrialtest.internal.getItemSlotBg(5.9,3.2,1,1),
"list[context;upgrades;9,0.9;1,4]",
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"listring[context;src]"
}
return table.concat(formspec,"")
end

View File

@@ -20,7 +20,7 @@ local transformer={}
transformer.onPowerFlow=function(pos,side,amount)
local normalized=industrialtest.api.normalizeSide(pos,side)
local def=minetest.registered_nodes[minetest.get_node(pos).name]
if normalized~=5 and amount>=def._industrialtest_lowerFlow then
if normalized~=5 and amount>def._industrialtest_lowerFlow then
minetest.remove_node(pos)
industrialtest.internal.explode(pos,2)
end

View File

@@ -20,23 +20,13 @@ local windMill={}
windMill.getFormspec=function(pos)
local meta=minetest.get_meta(pos)
local charging=meta:get_int("charging")
local formspec
if industrialtest.mtgAvailable then
formspec={
"list[context;charged;4.9,1.8;1,1]",
"listring[context;charged]",
(charging>0 and "image[4.9,3;1,1;industrialtest_gui_wind_bg.png^[lowpart:"..charging..":industrialtest_gui_wind_fg.png]"
or "image[4.9,3;1,1;industrialtest_gui_wind_bg.png]")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;4.7,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
"listring[context;charged]",
(charging>0 and "image[4.7,3;1,1;industrialtest_gui_wind_bg.png^[lowpart:"..charging..":industrialtest_gui_wind_fg.png]"
or "image[4.7,3;1,1;industrialtest_gui_wind_bg.png]")
}
end
local formspec={
"list[context;charged;4.7,1.8;1,1]",
industrialtest.internal.getItemSlotBg(4.7,1.8,1,1),
(charging>0 and "image[4.7,3;1,1;industrialtest_gui_wind_bg.png^[lowpart:"..charging..":industrialtest_gui_wind_fg.png]"
or "image[4.7,3;1,1;industrialtest_gui_wind_bg.png]"),
"listring[context;charged]"
}
return table.concat(formspec,"")
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

View File

@@ -31,6 +31,10 @@ local function registerElectricChainsaw(config)
local definition={
description=config.displayName,
inventory_image="industrialtest_"..config.name..".png",
after_use=function(itemstack)
-- Hack to make sure that chainsaw won't be destroyed when has 0 EU
return nil
end,
_industrialtest_powerStorage=true,
_industrialtest_powerCapacity=10000,
_industrialtest_powerFlow=industrialtest.api.lvPowerFlow,
@@ -70,10 +74,6 @@ local function registerElectricChainsaw(config)
end
return nil
end
definition.after_use=function(itemstack)
-- Hack to make sure that chainsaw won't be destroyed when has 0 EU in MCL
return nil
end
definition._mcl_diggroups={
axey={
speed=config.inactiveDigSpeed,

View File

@@ -31,6 +31,10 @@ local function registerElectricDrill(config)
local definition={
description=config.displayName,
inventory_image="industrialtest_"..config.name..".png",
after_use=function()
-- Hack to make sure that drill won't be destroyed when has 0 EU
return nil
end,
_industrialtest_powerStorage=true,
_industrialtest_powerCapacity=10000,
_industrialtest_powerFlow=industrialtest.api.lvPowerFlow,
@@ -64,10 +68,6 @@ local function registerElectricDrill(config)
tool=1,
dig_speed_class=config.digSpeedClass
}
definition.after_use=function()
-- Hack to make sure that drill won't be destroyed when has 0 EU in MCL
return nil
end
definition._mcl_diggroups={
pickaxey={
speed=config.inactiveDigSpeed,

View File

@@ -31,6 +31,10 @@ local function registerElectricSaber(config)
local definition={
description=config.displayName,
inventory_image="industrialtest_"..config.name..".png",
after_use=function()
-- Hack to make sure that saber won't be destroyed when has 0 EU
return nil
end,
_industrialtest_powerStorage=true,
_industrialtest_powerCapacity=10000,
_industrialtest_powerFlow=industrialtest.api.lvPowerFlow,
@@ -62,10 +66,6 @@ local function registerElectricSaber(config)
max_drop_level=config.maxDropLevel,
damage_groups={fleshy=config.inactiveDamage}
}
definition.after_use=function()
-- Hack to make sure that saber won't be destroyed when has 0 EU in MCL
return nil
end
definition._mcl_toollike_wield=true
definition._mcl_diggroups={
swordy={