49 Commits
temp ... 1.1.0

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
a844b4f982 Merge pull request #11 from HandfulOfFrogs/industrialtest:master into master 2024-05-10 21:38:32 +02:00
1f048d5226 Merge pull request #19 from HandfulOfFrogs/industrialtest:plate-textures into master 2024-05-10 21:28:48 +02:00
82071bf480 feat: new plate textures 2024-05-10 22:04:34 +03:00
2d4fa3b68b fix: use industrialtest.updateDelay 2024-05-10 21:45:06 +03:00
d12529ab2f feat: iron furnace hopper compat 2024-05-10 21:45:06 +03:00
9c0668b996 feat: mcl hopper compat for common machines 2024-05-10 21:45:06 +03:00
05bb4303b8 fix: iron furnace was unbreakable 2024-05-10 21:45:06 +03:00
d01d03c3a3 Fix indentation in machines/induction_furnace.lua 2024-05-10 19:11:16 +02:00
2669b7bc27 Normalize machine source and destination inventory list names 2024-05-10 19:11:16 +02:00
9781ce9ff1 Merge pull request #18 from HandfulOfFrogs/industrialtest:texture-changes into master 2024-05-10 18:51:16 +02:00
a9b3beecc6 feat: lead & tin block textures 2024-05-10 18:56:21 +03:00
7a0784d144 feat: color adjustments & textures 2024-05-10 18:52:45 +03:00
9c75570d64 Merge branch 'sharp-uranium' into texture-changes 2024-05-10 18:09:01 +03:00
868d01b008 Subtract fuel time after adding source time in Iron Furnace
Fixes #17
2024-05-10 17:05:31 +02:00
4445d8a7b4 feat: add paper wrap to battery textures 2024-05-10 18:00:59 +03:00
2fce391b9a fix: make advanced re-battery orange
(whoops! thought it was lead!)
2024-05-10 17:56:14 +03:00
d176e89ab4 feat: outlined textures for some crafting mats and tweaked colors for dusts 2024-05-10 17:50:19 +03:00
e41d21b179 Merge pull request #15 from HandfulOfFrogs/industrialtest:sharp-uranium into master 2024-05-10 15:43:09 +02:00
ce8121caf1 fix: make uranium ingot texture less blurry 2024-05-10 16:14:47 +03:00
b91e3a882e Release IndustrialTest 1.0.0 (stable, release) 2024-04-13 15:44:21 +02:00
dc62ef6217 Add MCL iridium textures 2024-04-13 15:43:00 +02:00
ca78a0b4c2 Add Quantum Boots textures 2024-04-13 11:50:45 +02:00
993dc5733c Add Quantum Leggings textures 2024-04-12 19:42:29 +02:00
a678973814 Add Quantum Bodyarmor textures 2024-04-12 19:36:00 +02:00
e5a917860a Add Quantum Helmet textures by me and LuanHawk 2024-04-08 19:57:09 +02:00
8bfff9ec52 Obviously I cannot fix something once
Fix MCL Bronze Armor crafts
2024-04-05 21:53:50 +02:00
5ad62134c8 Add Block of Iridium texture 2024-04-02 11:53:17 +02:00
42823b9dcc Add Iridium textures for MTG 2024-04-02 11:52:51 +02:00
4749f31d12 Fix Block of Iridium and Iridium Ore being unbreakable in MTG creative 2024-04-02 11:51:50 +02:00
a8f788d4d9 Implement Quantum Suit
Maximum tier armor with following features:
- Breath points refill underwater
- Electric Jetpack capabilities
- Faster running with Aux1 key
- Higher jumping with Aux1 key
2024-03-29 12:06:48 +01:00
be0caaa284 Add Reinforced Glass texture 2024-03-29 11:57:37 +01:00
b0de104227 Add Reinforced Stone texture 2024-03-29 11:57:09 +01:00
9b4d4be94d Add reinforced nodes: stone and glass
Useful when building reactor explosion protection
2024-03-29 11:56:00 +01:00
75 changed files with 812 additions and 553 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]

11
api.lua
View File

@@ -514,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
@@ -672,6 +675,7 @@ industrialtest.api.registerPlate=function(name,displayName,resources,color,regis
minetest.register_craftitem("industrialtest:"..name,{
description=displayName,
inventory_image="industrialtest_plate.png",
inventory_overlay="industrialtest_plate_overlay.png",
color=color
})
if registerCompressorRecipe then
@@ -688,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

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,
@@ -253,7 +261,7 @@ if industrialtest.mclAvailable then
return itemstack
end,
sound={breaks="default_tool_breaks"},
_repair_material="industrialtest:"..material,
_repair_material="industrialtest:"..materialItem,
_mcl_toollike_wield=true,
_mcl_diggroups={
shovely={speed=config.speed,level=config.level,uses=config.uses}
@@ -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,
@@ -270,7 +278,7 @@ if industrialtest.mclAvailable then
},
on_place=industrialtest.internal.mclMakeStrippedTrunk,
sound={breaks="default_tool_breaks"},
_repair_material="industrialtest:"..material,
_repair_material="industrialtest:"..materialItem,
_mcl_toollike_wield=true,
_mcl_diggroups={
axey={speed=config.speed,level=config.level,uses=config.uses}
@@ -279,14 +287,14 @@ 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,
damage_groups={fleshy=config.damage+2},
},
sound={breaks="default_tool_breaks"},
_repair_material="industrialtest:"..material,
_repair_material="industrialtest:"..materialItem,
_mcl_toollike_wield=true,
_mcl_diggroups={
swordy={speed=config.speed,level=config.level,uses=config.uses},
@@ -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}
@@ -349,7 +357,7 @@ if industrialtest.mclAvailable then
return itemstack
end
end,
_repair_material="industrialtest:"..material,
_repair_material="industrialtest:"..materialItem,
_mcl_toollike_wield=true,
_mcl_diggroups={
hoey={speed=config.speed,level=config.level,uses=config.uses}
@@ -360,10 +368,11 @@ if industrialtest.mclAvailable then
description=materialDisplayName,
durability=config.uses,
points=config.armorPoints,
craft_material="industrialtest:"..material,
craft_material="industrialtest:"..materialItem,
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
@@ -611,10 +621,6 @@ if industrialtest.mclAvailable then
y_min=mcl_vars.mg_overworld_min
})
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

@@ -15,6 +15,31 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local S=minetest.get_translator("industrialtest")
local colors={
bronze="#be4325ff",
clay="#707070ff",
coal="#262523ff",
copper="#bf644aff",
diamond="#77cefbff",
gold="#eac162ff",
iron="#afaca5ff",
lapis_lazuli="#3a4cceff",
lead="#6d6393ff",
mese="#909000ff",
obsidian="#292843ff",
refined_iron="#94bab9ff",
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
minetest.register_tool("industrialtest:re_battery",{
@@ -197,13 +222,13 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("coal","Coal",resources,"#101010ff",true)
industrialtest.api.registerResourceDust("coal","Coal",resources,colors.coal,true)
industrialtest.api.registerResourceDust("clay","Clay",{
{
resource=industrialtest.elementKeys.clayBlock,
count=2
}
},"#9090a0ff",true)
},colors.clay,true)
resources={
{
resource=industrialtest.elementKeys.diamondBlock,
@@ -221,7 +246,7 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("diamond","Diamond",resources,"#90e2c9ff",true)
industrialtest.api.registerResourceDust("diamond","Diamond",resources,colors.diamond,true)
minetest.register_craft({
type="cooking",
output=industrialtest.elementKeys.diamond,
@@ -248,7 +273,7 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("iron","Iron",resources,"#b5b5b5ff",true)
industrialtest.api.registerResourceDust("iron","Iron",resources,colors.iron,true)
minetest.register_craft({
type="cooking",
output=industrialtest.elementKeys.ironIngot,
@@ -269,9 +294,9 @@ if industrialtest.mclAvailable then
count=9
},
{resource="mcl_core:lapis_lazuli"}
},"#292d76ff",true)
},colors.lapis_lazuli,true)
end
industrialtest.api.registerResourceDust("obsidian","Obsidian",{{resource=industrialtest.elementKeys.obsidian}},"#292843ff",true)
industrialtest.api.registerResourceDust("obsidian","Obsidian",{{resource=industrialtest.elementKeys.obsidian}},colors.obsidian,true)
resources={
{
resource=industrialtest.elementKeys.goldBlock,
@@ -293,7 +318,7 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("gold","Gold",resources,"#e4e526ff",true)
industrialtest.api.registerResourceDust("gold","Gold",resources,colors.gold,true)
minetest.register_craft({
type="cooking",
output=industrialtest.elementKeys.goldIngot,
@@ -320,7 +345,7 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("copper","Copper",resources,"#a45e25ff",true)
industrialtest.api.registerResourceDust("copper","Copper",resources,colors.copper,true)
minetest.register_craft({
type="cooking",
output=industrialtest.elementKeys.copperIngot,
@@ -347,7 +372,7 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("tin","Tin",resources,"#f1f1f1ff",true)
industrialtest.api.registerResourceDust("tin","Tin",resources,colors.tin,true)
minetest.register_craft({
type="cooking",
output=industrialtest.elementKeys.tinIngot,
@@ -374,7 +399,7 @@ if industrialtest.mclAvailable then
count=2
})
end
industrialtest.api.registerResourceDust("uranium","Uranium",resources,"#3b8c09ff",true)
industrialtest.api.registerResourceDust("uranium","Uranium",resources,colors.uranium,true)
minetest.register_craft({
type="cooking",
output="industrialtest:uranium_ingot",
@@ -391,7 +416,7 @@ if industrialtest.mtgAvailable then
count=2
},
{resource="default:mese_crystal"}
},"#909000ff",true)
},colors.mese,true)
minetest.register_craft({
type="cooking",
output="default:mese_crystal",
@@ -404,7 +429,7 @@ industrialtest.api.registerResourceDust("bronze","Bronze",{
count=9
},
{resource=industrialtest.elementKeys.bronzeIngot}
},"#e48e88ff",true)
},colors.bronze,true)
minetest.register_craft({
type="shaped",
output="industrialtest:bronze_dust 9",
@@ -431,7 +456,7 @@ industrialtest.api.registerRotaryMaceratorModifier({
output="industrialtest:bronze_dust",
uses=4
})
industrialtest.api.registerResourceDust("sulfur","Sulfur",{},"#e3ff33ff",false)
industrialtest.api.registerResourceDust("sulfur","Sulfur",{},colors.sulfur,false)
industrialtest.api.registerExtractorRecipe({
output="industrialtest:sulfur_dust",
recipe=industrialtest.elementKeys.gunpowder
@@ -450,7 +475,7 @@ industrialtest.api.registerResourceDust("lead","Lead",{
count=2
},
{resource="industrialtest:lead_ingot"}
},"#eafef8ff",true)
},colors.lead,true)
minetest.register_craft({
type="cooking",
output="industrialtest:lead_ingot",
@@ -461,7 +486,7 @@ industrialtest.api.registerResourceDust("refined_iron","Refined Iron",{
resource="industrialtest:refined_iron_ingot",
count=1
}
},"#7c8588ff",true)
},colors.refined_iron,true)
industrialtest.api.registerRotaryMaceratorModifier({
name=industrialtest.elementKeys.ironLump,
modifier=industrialtest.elementKeys.coal,
@@ -524,14 +549,14 @@ industrialtest.api.registerPlate("bronze_plate",S("Bronze Plate"),{
resource=industrialtest.elementKeys.bronzeIngot,
count=1
}
},"#e48e88ff",true)
},colors.bronze,true)
industrialtest.api.registerPlate("copper_plate",S("Copper Plate"),{
{
resource=industrialtest.elementKeys.copperIngot,
count=1
}
},"#f48e44ff",true)
},colors.copper,true)
industrialtest.api.registerPlate("advanced_alloy",S("Advanced Alloy"),{
{
@@ -552,14 +577,25 @@ industrialtest.api.registerPlate("tin_plate",S("Tin Plate"),{
resource=industrialtest.elementKeys.tinIngot,
count=1
}
},"#e0e0e0ff",true)
},colors.tin,true)
industrialtest.api.registerPlate("lead_plate",S("Lead Plate"),{
{
resource="industrialtest:lead_ingot",
count=1
}
},"#eafef8ff",true)
},colors.lead,true)
industrialtest.api.registerPlate("iridium_plate",S("Iridium Plate"),{},false,"#ffffffff")
minetest.register_craft({
type="shaped",
output="industrialtest:iridium_plate",
recipe={
{"industrialtest:iridium_ingot","industrialtest:advanced_alloy","industrialtest:iridium_ingot"},
{"industrialtest:advanced_alloy",industrialtest.elementKeys.diamond,"industrialtest:advanced_alloy"},
{"industrialtest:iridium_ingot","industrialtest:advanced_alloy","industrialtest:iridium_ingot"}
}
})
-- Cells
minetest.register_craftitem("industrialtest:empty_cell",{
@@ -598,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"),
@@ -611,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",
@@ -628,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",
@@ -653,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",
@@ -666,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
},
@@ -681,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",
@@ -694,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

@@ -66,6 +66,7 @@ dofile(modpath.."/tools/nano_suit.lua")
dofile(modpath.."/tools/solar_helmet.lua")
dofile(modpath.."/tools/static_boots.lua")
dofile(modpath.."/tools/treetap.lua")
dofile(modpath.."/tools/quantum_suit.lua")
dofile(modpath.."/tools/wrench.lua")
dofile(modpath.."/upgrades.lua")

View File

@@ -24,52 +24,30 @@ 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;fuel;3.4,1.8;1,1]",
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,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;target;6.4,1.8;1,1]",
"list[context;dst;6.4,1.8;1,1]",
industrialtest.internal.getItemSlotBg(6.4,1.8,1,1),
"list[context;leftover;6.4,2.8;1,1]",
industrialtest.internal.getItemSlotBg(6.4,2.8,1,1),
"list[context;upgrades;9,0.9;1,4]",
"listring[context;fuel]",
"listring[context;powerStorage]",
"listring[context;target]",
"listring[context;leftover]",
"listring[context;upgrades]"
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"listring[context;src]",
"listring[context;dst]"
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;fuel;3.4,1.8;1,1]",
mcl_formspec.get_itemslot_bg(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),
(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;target;6.4,1.8;1,1]",
mcl_formspec.get_itemslot_bg(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),
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
"listring[context;fuel]",
"listring[context;powerStorage]",
"listring[context;target]",
"listring[context;upgrades]"
}
end
return table.concat(formspec,"")
end
canningMachine.onConstruct=function(pos,meta,inv)
inv:set_size("fuel",1)
inv:set_size("target",1)
inv:set_size("src",1)
inv:set_size("dst",1)
inv:set_size("leftover",1)
inv:set_size("powerStorage",1)
inv:set_size("upgrades",4)
@@ -79,8 +57,8 @@ end
canningMachine.onTimer=function(pos,elapsed,meta,inv)
local shouldRerunTimer=false
local shouldUpdateFormspec=false
local fuelSlot=inv:get_stack("fuel",1)
local targetSlot=inv:get_stack("target",1)
local fuelSlot=inv:get_stack("src",1)
local targetSlot=inv:get_stack("dst",1)
local leftoverSlot=inv:get_stack("leftover",1)
local powerStorageSlot=inv:get_stack("powerStorage",1)
local targetMeta=targetSlot:get_meta()
@@ -102,13 +80,13 @@ canningMachine.onTimer=function(pos,elapsed,meta,inv)
end
canningMachine.allowMetadataInventoryMove=function(pos,fromList,fromIndex,toList,count)
if toList=="fuel" then
if toList=="src" then
local inv=minetest.get_meta(pos):get_inventory()
local itemstack=inv:get_stack(fromList,fromIndex)
local def=itemstack:get_definition()
return (def.groups and def.groups._industrialtest_fuel) and count or 0
end
if toList=="target" then
if toList=="dst" then
local inv=minetest.get_meta(pos):get_inventory()
local itemstack=inv:get_stack(fromList,fromIndex)
local def=itemstack:get_definition()
@@ -118,11 +96,11 @@ canningMachine.allowMetadataInventoryMove=function(pos,fromList,fromIndex,toList
end
canningMachine.allowMetadataInventoryPut=function(pos,listname,index,stack)
if listname=="fuel" then
if listname=="src" then
local def=stack:get_definition()
return (def.groups and def.groups._industrialtest_fuel) and stack:get_count() or 0
end
if listname=="target" then
if listname=="dst" then
local def=stack:get_definition()
return (def.groups and def.groups._industrialtest_fueled) and stack:get_count() or 0
end
@@ -132,9 +110,9 @@ end
canningMachine.allowMetadataInventoryTake=function(pos,listname,index,stack)
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local fuelSlot=inv:get_stack("fuel",1)
local targetSlot=inv:get_stack("target",1)
if ((listname=="fuel" and stack:get_count()==fuelSlot:get_count()) or (listname=="target" and stack:get_count()==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
local fuelSlot=inv:get_stack("src",1)
local targetSlot=inv:get_stack("dst",1)
if ((listname=="src" and stack:get_count()==fuelSlot:get_count()) or (listname=="dst" and stack:get_count()==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
meta:set_float("srcTime",0)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
@@ -148,9 +126,9 @@ end
canningMachine.onMetadataInventoryMove=function(pos,fromList,fromIndex,toList,toIndex,count)
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local fuelSlot=inv:get_stack("fuel",1)
local targetSlot=inv:get_stack("target",1)
if ((fromList=="fuel" and count==fuelSlot:get_count()) or (fromList=="target" and count==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
local fuelSlot=inv:get_stack("src",1)
local targetSlot=inv:get_stack("dst",1)
if ((fromList=="src" and count==fuelSlot:get_count()) or (fromList=="dst" and count==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
meta:set_float("srcTime",0)
meta:set_string("formspec",canningMachine.getFormspec(pos))
end
@@ -158,8 +136,8 @@ end
canningMachine.activeOnTimer=function(pos,elapsed,meta,inv)
local shouldUpdateFormspec=false
local fuelSlot=inv:get_stack("fuel",1)
local targetSlot=inv:get_stack("target",1)
local fuelSlot=inv:get_stack("src",1)
local targetSlot=inv:get_stack("dst",1)
local powerStorageSlot=inv:get_stack("powerStorage",1)
shouldRerunTimer,shouldUpdateFormspec=industrialtest.internal.chargeFromPowerStorageItem(meta,inv)
@@ -193,8 +171,8 @@ canningMachine.activeOnTimer=function(pos,elapsed,meta,inv)
if srcTime>=canningMachine.canningTime then
if industrialtest.api.itemHasFluidStorage(fuelSlot) then
industrialtest.api.transferFluidToItem(fuelSlot,targetSlot,fuelMeta:get_int("industrialtest.fluidAmount"))
inv:set_stack("fuel",1,fuelSlot)
inv:set_stack("target",1,targetSlot)
inv:set_stack("src",1,fuelSlot)
inv:set_stack("dst",1,targetSlot)
else
local def=fuelSlot:get_definition()
local leftoverSlot=inv:get_stack("leftover",1)
@@ -207,9 +185,9 @@ canningMachine.activeOnTimer=function(pos,elapsed,meta,inv)
return false,shouldUpdateFormspec
end
industrialtest.api.addFluidToItem(targetSlot,def._industrialtest_fuelAmount)
inv:set_stack("target",1,targetSlot)
inv:set_stack("dst",1,targetSlot)
fuelSlot:take_item(1)
inv:set_stack("fuel",1,fuelSlot)
inv:set_stack("src",1,fuelSlot)
leftoverSlot:add_item(ItemStack(def._industrialtest_emptyVariant))
inv:set_stack("leftover",1,leftoverSlot)
end
@@ -233,7 +211,7 @@ industrialtest.internal.registerMachine({
registerActiveVariant=true,
sounds="metal",
powerSlots={"powerStorage"},
storageSlots={"fuel","target","powerStorage","upgrades"},
storageSlots={"src","dst","powerStorage","upgrades"},
groups={
_industrialtest_hasPowerInput=1
},

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={
local formspec={
"list[context;charged;1,2.5;1,1]",
"listring[context;charged]",
industrialtest.internal.getItemSlotBg(1,2.5,1,1),
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
"listring[context;discharged]",
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 "")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;1,2.5;1,1]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"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 "")
"listring[context;discharged]"
}
end
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,"")
@@ -357,9 +359,29 @@ function industrialtest.internal.registerMachine(config)
if config.sounds=="metal" then
definition.sounds=mcl_sounds.node_sound_metal_defaults()
end
definition.groups={pickaxey=1}
definition.groups={
pickaxey=1,
container=2
}
definition._mcl_blast_resistance=3.5
definition._mcl_hardness=3.9
definition._mcl_hoppers_on_try_pull=function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack("dst", 1)
if not stack:is_empty() and hop_inv:room_for_item(hop_list, stack) then
return inv, "dst", 1
end
return nil, nil, nil
end
definition._mcl_hoppers_on_try_push=function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src")
end
definition._mcl_hoppers_on_after_push=function(pos)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
end
definition.groups._industrialtest_wrenchUnmountable=1
if config.requiresWrench then
@@ -528,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={
local formspec={
"list[context;src;3.4,1.8;1,1]",
"listring[context;src]",
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]",
"listring[context;powerStorage]",
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]",
"listring[context;dst]",
industrialtest.internal.getItemSlotBg(6.4,2.8,1,1),
"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),
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"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]"
"listring[context;dst]"
}
end
return table.concat(formspec,"")
end

View File

@@ -22,50 +22,34 @@ 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;fluid;2,1.8;1,1]",
"listring[context;fluid]",
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;leftover;2,4.2;1,1]",
"listring[context;leftover]",
"list[context;dst;2,4.2;1,1]",
industrialtest.internal.getItemSlotBg(2,4.2,1,1),
"list[context;charged;6,3;1,1]",
"listring[context;charged]",
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 "")
(powerPercent>0 and "box[9,"..(1+4.8-(powerPercent*4.8))..";0.3,"..(powerPercent*4.8)..";#FF1010]" or ""),
"listring[context;src]",
"listring[context;dst]"
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;fluid;2,1.8;1,1]",
mcl_formspec.get_itemslot_bg(2,1.8,1,1),
"listring[context;fluid]",
(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;leftover;2,4.2;1,1]",
mcl_formspec.get_itemslot_bg(2,4.2,1,1),
"listring[context;leftover]",
"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
return table.concat(formspec,"")
end
fluidGenerator.onConstruct=function(pos,meta,inv)
inv:set_size("charged",1)
inv:set_size("fluid",1)
inv:set_size("leftover",1)
inv:set_size("src",1)
inv:set_size("dst",1)
meta:set_float("fluidAmount",0)
meta:set_string("fluid","")
end
fluidGenerator.onTimer=function(pos,elapsed,meta,inv,config)
local fluidSlot=inv:get_stack("fluid",1)
local fluidSlot=inv:get_stack("src",1)
local chargedSlot=inv:get_stack("charged",1)
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
local shouldUpdateFormspec=false
@@ -77,8 +61,8 @@ fluidGenerator.onTimer=function(pos,elapsed,meta,inv,config)
local leftoverAddingSucceeded=false
for _,item in ipairs(fuel.storageItems) do
if item.name==fluidSlot:get_name() and item.leftover then
if inv:room_for_item("leftover",ItemStack(item.leftover)) then
inv:add_item("leftover",ItemStack(item.leftover))
if inv:room_for_item("dst",ItemStack(item.leftover)) then
inv:add_item("dst",ItemStack(item.leftover))
leftoverAddingSucceeded=true
end
leftover=true
@@ -86,7 +70,7 @@ fluidGenerator.onTimer=function(pos,elapsed,meta,inv,config)
end
if not leftover or leftoverAddingSucceeded then
fluidSlot:take_item()
inv:set_stack("fluid",1,fluidSlot)
inv:set_stack("src",1,fluidSlot)
meta:set_string("fluid",fuel.name)
meta:set_float("fluidAmount",meta:get_float("fluidAmount")+1000)
shouldUpdateFormspec=true
@@ -127,7 +111,7 @@ fluidGenerator.metadataChange=function(pos)
end
fluidGenerator.activeOnTimer=function(pos,elapsed,meta,inv,config)
local fluidSlot=inv:get_stack("fluid",1)
local fluidSlot=inv:get_stack("src",1)
local chargedSlot=inv:get_stack("charged",1)
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
local shouldUpdateFormspec=false
@@ -140,8 +124,8 @@ fluidGenerator.activeOnTimer=function(pos,elapsed,meta,inv,config)
local leftoverAddingSucceeded=false
for _,item in ipairs(fuel.storageItems) do
if item.name==fluidSlot:get_name() and item.leftover then
if inv:room_for_item("leftover",ItemStack(item.leftover)) then
inv:add_item("leftover",ItemStack(item.leftover))
if inv:room_for_item("dst",ItemStack(item.leftover)) then
inv:add_item("dst",ItemStack(item.leftover))
leftoverAddingSucceeded=true
end
leftover=true
@@ -149,7 +133,7 @@ fluidGenerator.activeOnTimer=function(pos,elapsed,meta,inv,config)
end
if not leftover or leftoverAddingSucceeded then
fluidSlot:take_item()
inv:set_stack("fluid",1,fluidSlot)
inv:set_stack("src",1,fluidSlot)
meta:set_string("fluid",fuel.name)
meta:set_float("fluidAmount",meta:get_float("fluidAmount")+1000)
shouldUpdateFormspec=true
@@ -196,7 +180,7 @@ local function registerFluidGenerator(config)
requiresWrench=true,
registerActiveVariant=config.registerActiveVariant,
powerSlots={"charged"},
storageSlots={"fluid","fluidLeftover"},
storageSlots={"src","dst"},
sounds="metal",
groups={
_industrialtest_hasPowerOutput=1

View File

@@ -21,38 +21,23 @@ 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;fuel;4.9,3.9;1,1]",
"listring[context;fuel]",
"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={
local formspec={
"list[context;charged;4.7,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
"listring[context;charged]",
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;fuel;4.7,3.9;1,1]",
mcl_formspec.get_itemslot_bg(4.7,3.9,1,1),
"listring[context;fuel]",
"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 "")
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"listring[context;src]"
}
end
return table.concat(formspec,"")
end
generator.onConstruct=function(pos,meta,inv)
inv:set_size("charged",1)
inv:set_size("fuel",1)
inv:set_size("src",1)
meta:set_int("fuelTime",0)
meta:set_int("maxFuelTime",1)
end
@@ -60,7 +45,7 @@ end
generator.onTimer=function(pos,elapsed,meta,inv)
local powerFlow=meta:get_int("industrialtest.powerFlow")
local chargedSlot=inv:get_stack("charged",1)
local fuelSlot=inv:get_stack("fuel",1)
local fuelSlot=inv:get_stack("src",1)
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
local shouldUpdateFormspec=flowTransferred
local shouldRerunTimer=(afterFlow and meta:get_int("industrialtest.powerAmount")>0)
@@ -79,7 +64,7 @@ generator.onTimer=function(pos,elapsed,meta,inv)
if output.time>0 then
meta:set_int("fuelTime",output.time)
meta:set_int("maxFuelTime",output.time)
inv:set_stack("fuel",1,after.items[1])
inv:set_stack("src",1,after.items[1])
minetest.swap_node(pos,{
name="industrialtest:generator_active",
param2=minetest.get_node(pos).param2
@@ -92,7 +77,7 @@ end
generator.activeOnTimer=function(pos,elapsed,meta,inv)
local chargedSlot=inv:get_stack("charged",1)
local fuelSlot=inv:get_stack("fuel",1)
local fuelSlot=inv:get_stack("src",1)
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
local shouldUpdateFormspec=flowTransferred
local shouldRerunTimer=(afterFlow and meta:get_int("industrialtest.powerAmount")>0)
@@ -111,7 +96,7 @@ generator.activeOnTimer=function(pos,elapsed,meta,inv)
if output.time>0 then
meta:set_int("fuelTime",output.time)
meta:set_int("maxFuelTime",output.time)
inv:set_stack("fuel",1,after.items[1])
inv:set_stack("src",1,after.items[1])
end
end
if meta:get_int("fuelTime")>0 then
@@ -141,7 +126,7 @@ industrialtest.internal.registerMachine({
ioConfig="oooooo",
registerActiveVariant=true,
powerSlots={"charged"},
storageSlots={"charged","fuel"},
storageSlots={"charged","src"},
sounds="metal",
groups={
_industrialtest_hasPowerOutput=1

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,"")
@@ -155,11 +155,6 @@ ironFurnace.activeOnTimer=function(pos,elapsed)
meta:set_float("maxSrcTime",output.time*0.7)
end
end
if meta:get_float("fuelTime")>0 then
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
shouldUpdateFormspec=true
shouldRerunTimer=true
end
if meta:get_float("maxSrcTime")>0 then
if meta:get_float("fuelTime")>0 then
meta:set_float("srcTime",meta:get_float("srcTime")+elapsed)
@@ -180,6 +175,11 @@ ironFurnace.activeOnTimer=function(pos,elapsed)
})
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
if meta:get_float("fuelTime")>0 then
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
shouldUpdateFormspec=true
shouldRerunTimer=true
end
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
local output,after=minetest.get_craft_result({
method="cooking",
@@ -223,6 +223,23 @@ ironFurnace.allowMetadataInventoryPut=function(pos,listname,index,stack)
return stack:get_count()
end
ironFurnace.allowMetadataInventoryTake=function(pos,listname,index,stack)
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local srcSlot=inv:get_stack("src",1)
local dstSlot=inv:get_stack("dst",1)
if listname=="src" and stack:get_count()==srcSlot:get_count() then
meta:set_float("srcTime",-1)
meta:set_float("maxSrcTime",0)
if meta:get_float("maxFuelTime")>0 then
meta:set_string("formspec",ironFurnace.getFormspec(meta:get_float("fuelTime")/meta:get_float("maxFuelTime")*100,0))
end
elseif listname=="dst" and dstSlot:get_free_space()==0 then
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
return stack:get_count()
end
ironFurnace.onMetadataInventoryMove=function(pos,fromList,fromIndex,toList,toIndex,count)
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
@@ -243,22 +260,6 @@ ironFurnace.onMetadataInventoryPut=function(pos,listname,index,stack)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
ironFurnace.onMetadataInventoryTake=function(pos,listname,index,stack)
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local srcSlot=inv:get_stack("src",1)
local dstSlot=inv:get_stack("dst",1)
if listname=="src" and stack:get_count()==srcSlot:get_count() then
meta:set_float("srcTime",-1)
meta:set_float("maxSrcTime",0)
if meta:get_float("maxFuelTime")>0 then
meta:set_string("formspec",ironFurnace.getFormspec(meta:get_float("fuelTime")/meta:get_float("maxFuelTime")*100,0))
end
elseif listname=="dst" and dstSlot:get_free_space()==0 then
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
end
local definition={
description=S("Iron Furnace"),
tiles={
@@ -276,9 +277,9 @@ local definition={
on_timer=ironFurnace.onTimer,
allow_metadata_inventory_move=ironFurnace.allowMetadataInventoryMove,
allow_metadata_inventory_put=ironFurnace.allowMetadataInventoryPut,
allow_metadata_inventory_take=ironFurnace.allowMetadataInventoryTake,
on_metadata_inventory_move=ironFurnace.onMetadataInventoryMove,
on_metadata_inventory_put=ironFurnace.onMetadataInventoryPut,
on_metadata_inventory_take=ironFurnace.onMetadataInventoryTake
on_metadata_inventory_put=ironFurnace.onMetadataInventoryPut
}
if industrialtest.mtgAvailable then
definition.groups={
@@ -292,12 +293,21 @@ if industrialtest.mtgAvailable then
return not (inv:get_list("src")[1]:get_count()>0 or inv:get_list("fuel")[1]:get_count()>0 or inv:get_list("dst")[1]:get_count()>0)
end
elseif industrialtest.mclAvailable then
definition.groups={
pickaxey=1,
container=2
}
definition.after_dig_node=function(pos,oldnode,oldmeta)
industrialtest.internal.mclAfterDigNode(pos,oldmeta,{"src","fuel","dst"})
end
definition.sounds=mcl_sounds.node_sound_metal_defaults()
definition._mcl_blast_resistance=3
definition._mcl_hardness=3.5
definition._mcl_hoppers_on_try_pull = mcl_furnaces.hoppers_on_try_pull
definition._mcl_hoppers_on_try_push = mcl_furnaces.hoppers_on_try_push
definition._mcl_hoppers_on_after_push = function(pos)
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
end
end
minetest.register_node("industrialtest:iron_furnace",definition)
definition=table.copy(definition)
@@ -316,7 +326,9 @@ definition.drop="industrialtest:iron_furnace"
definition.on_timer=ironFurnace.activeOnTimer
if industrialtest.mclAvailable then
definition.groups={
not_in_creative_inventory=1
not_in_creative_inventory=1,
pickaxey=1,
container=2
}
definition._doc_items_create_entry=false
end

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={
local formspec={
"list[context;fuel;1,1;"..size..","..size.."]",
"listring[context;fuel]",
"list[context;charged;7.7,2.8;1,1]",
"listring[context;charged]",
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]"
}
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
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={
local formspec={
"list[context;charged;1,2.5;1,1]",
"listring[context;charged]",
industrialtest.internal.getItemSlotBg(1,2.5,1,1),
"label[0.9,3.9;"..S("Charge").."]",
"list[context;discharged;3,2.5;1,1]",
"listring[context;discharged]",
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 "")
}
elseif industrialtest.mclAvailable then
formspec={
"list[context;charged;1,2.5;1,1]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or ""),
"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 "")
"listring[context;discharged]"
}
end
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={
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;modifier]",
"listring[context;powerStorage]",
"listring[context;dst]",
"listring[context;upgrades]"
"listring[context;dst]"
}
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
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={
local formspec={
"list[context;charged;4.7,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
"listring[context;charged]",
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]")
or "image[4.7,2.8;1,1;industrialtest_gui_sun_bg.png]"),
"listring[context;charged]"
}
end
return table.concat(formspec,"")
end

View File

@@ -20,45 +20,29 @@ 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={
local formspec={
"list[context;powerStorage;3.7,3.7;1,1;0]",
"listring[context;powerStorage]",
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;tool;5.9,3.2;1,1;0]",
"listring[context;tool]",
"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]",
"listring[context;upgrades]"
industrialtest.internal.getItemSlotBg(9,0.9,1,4),
"listring[context;src]"
}
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;tool;5.9,3.2;1,1;0]",
mcl_formspec.get_itemslot_bg(5.9,3.2,1,1),
"listring[context;tool]",
"list[context;upgrades;9,0.9;1,4]",
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
"listring[context;upgrades]"
}
end
return table.concat(formspec,"")
end
toolWorkshop.onConstruct=function(pos,meta,inv)
inv:set_size("powerStorage",1)
inv:set_size("tool",1)
inv:set_size("src",1)
inv:set_size("upgrades",4)
end
toolWorkshop.onTimer=function(pos,elapsed,meta,inv)
local powerStorageSlot=inv:get_stack("powerStorage",1)
local toolSlot=inv:get_stack("tool",1)
local toolSlot=inv:get_stack("src",1)
local requiredPower=industrialtest.api.getMachineSpeed(meta)*10000
local shouldRerunTimer=false
local shouldUpdateFormspec=false
@@ -86,7 +70,7 @@ end
toolWorkshop.activeOnTimer=function(pos,elapsed,meta,inv)
local powerStorageSlot=inv:get_stack("powerStorage",1)
local toolSlot=inv:get_stack("tool",1)
local toolSlot=inv:get_stack("src",1)
local speed=industrialtest.api.getMachineSpeed(meta)
local requiredPower=speed*10000
local shouldRerunTimer=false
@@ -105,7 +89,7 @@ toolWorkshop.activeOnTimer=function(pos,elapsed,meta,inv)
if toolSlot:get_count()>0 and toolSlot:get_wear()>0 and meta:get_int("industrialtest.powerAmount")>=requiredPower then
local removed=math.min(toolSlot:get_wear(),speed*200)
toolSlot:set_wear(toolSlot:get_wear()-removed)
inv:set_stack("tool",1,toolSlot)
inv:set_stack("src",1,toolSlot)
industrialtest.api.addPower(meta,-requiredPower)
shouldRerunTimer=true
shouldUpdateFormspec=true
@@ -128,7 +112,7 @@ local function isTool(stack)
end
toolWorkshop.allowMetadataInventoryMove=function(pos,fromList,fromIndex,toList,toIndex,count)
if toList=="tool" then
if toList=="src" then
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local movedItemStack=inv:get_stack(fromList,fromIndex)
@@ -160,7 +144,7 @@ industrialtest.internal.registerMachine({
requiresWrench=true,
registerActiveVariant=true,
powerSlots={"powerStorage"},
storageSlots={"tool"},
storageSlots={"src"},
sounds="metal",
groups={
_industrialtest_hasPowerInput=1

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={
local formspec={
"list[context;charged;4.7,1.8;1,1]",
mcl_formspec.get_itemslot_bg(4.7,1.8,1,1),
"listring[context;charged]",
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]")
or "image[4.7,3;1,1;industrialtest_gui_wind_bg.png]"),
"listring[context;charged]"
}
end
return table.concat(formspec,"")
end

View File

@@ -39,7 +39,7 @@ if industrialtest.mtgAvailable then
y_min=-31000
})
industrialtest.internal.registerMetal("iridium","Iridium",4)
industrialtest.internal.registerMetal("iridium","Iridium",3)
minetest.register_ore({
ore_type="scatter",
ore="industrialtest:stone_with_iridium",

View File

@@ -411,3 +411,85 @@ if not industrialtest.mods.mclRubber then
})
end
end
definition={
description=S("Reinforced Stone"),
tiles={"industrialtest_reinforced_stone.png"}
}
if industrialtest.mtgAvailable then
definition.groups={cracky=3}
definition.sounds=default.node_sound_stone_defaults()
definition.on_blast=function(pos,intensity)
if intensity>20 then
minetest.remove_node(pos)
minetest.add_item(pos,ItemStack("industrialtest:reinforced_stone"))
end
end
elseif industrialtest.mclAvailable then
definition.groups={
pickaxey=1,
stone=1,
building_block=1,
material_stone=1
}
definition.sounds=mcl_sounds.node_sound_stone_defaults()
definition._mcl_blast_resistance=1200
definition._mcl_hardness=5
end
minetest.register_node("industrialtest:reinforced_stone",definition)
minetest.register_craft({
type="shaped",
output="industrialtest:reinforced_stone 8",
recipe={
{industrialtest.elementKeys.stone,industrialtest.elementKeys.stone,industrialtest.elementKeys.stone},
{industrialtest.elementKeys.stone,"industrialtest:advanced_alloy",industrialtest.elementKeys.stone},
{industrialtest.elementKeys.stone,industrialtest.elementKeys.stone,industrialtest.elementKeys.stone}
}
})
definition={
description=S("Reinforced Glass"),
drawtype="glasslike_framed_optional",
tiles={"industrialtest_reinforced_glass.png"},
use_texture_alpha="clip",
paramtype="light",
sunlight_propagates=true
}
if industrialtest.mtgAvailable then
definition.groups={cracky=3}
definition.sounds=default.node_sound_glass_defaults()
definition.on_blast=function(pos,intensity)
if intensity>10 then
minetest.remove_node(pos)
minetest.add_item(pos,ItemStack("industrialtest:reinforced_glass"))
end
end
elseif industrialtest.mclAvailable then
definition.groups={
glass=1,
building_block=1,
material_glass=1
}
definition.sounds=mcl_sounds.node_sound_glass_defaults()
definition._mcl_blast_resistance=15
definition._mcl_hardness=1.5
end
minetest.register_node("industrialtest:reinforced_glass",definition)
minetest.register_craft({
type="shaped",
output="industrialtest:reinforced_glass 7",
recipe={
{industrialtest.elementKeys.glass,industrialtest.elementKeys.glass,industrialtest.elementKeys.glass},
{"industrialtest:advanced_alloy",industrialtest.elementKeys.glass,"industrialtest:advanced_alloy"},
{industrialtest.elementKeys.glass,industrialtest.elementKeys.glass,industrialtest.elementKeys.glass}
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:reinforced_glass 7",
recipe={
{industrialtest.elementKeys.glass,"industrialtest:advanced_alloy",industrialtest.elementKeys.glass},
{industrialtest.elementKeys.glass,industrialtest.elementKeys.glass,industrialtest.elementKeys.glass},
{industrialtest.elementKeys.glass,"industrialtest:advanced_alloy",industrialtest.elementKeys.glass}
}
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 405 B

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: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 977 B

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 953 B

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 851 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 527 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={

View File

@@ -38,7 +38,8 @@ local function registerNanoSuitPart(config)
_industrialtest_powerStorage=true,
_industrialtest_powerCapacity=1000000,
_industrialtest_powerFlow=industrialtest.api.evPowerFlow,
_industrialtest_damageReduction=config.damageReduction
_industrialtest_damageReduction=config.damageReduction,
industrialtest_powerPerDamage=5000
})
elseif industrialtest.mclAvailable then
groups.armor=1
@@ -58,7 +59,8 @@ local function registerNanoSuitPart(config)
_industrialtest_powerStorage=true,
_industrialtest_powerCapacity=1000000,
_industrialtest_powerFlow=industrialtest.api.evPowerFlow,
_industrialtest_damageReduction=config.damageReduction
_industrialtest_damageReduction=config.damageReduction,
_industrialtest_powerPerDamage=5000
})
end
end
@@ -149,12 +151,12 @@ minetest.register_on_player_hpchange(function(player,hpChange)
if def.groups and def.groups._industrialtest_nanoSuit then
local meta=stack:get_meta()
local targetReducedDamage=math.floor(math.abs(hpChange)*def._industrialtest_damageReduction)
local requiredPower=targetReducedDamage*5000
local requiredPower=targetReducedDamage*def._industrialtest_powerPerDamage
local availablePower=math.min(meta:get_int("industrialtest.powerAmount"),requiredPower)
local reducedDamage=math.floor(availablePower/5000)
local reducedDamage=math.floor(availablePower/def._industrialtest_powerPerDamage)
if reducedDamage>0 then
result=result+reducedDamage
industrialtest.api.addPowerToItem(stack,-reducedDamage*5000)
industrialtest.api.addPowerToItem(stack,-reducedDamage*def._industrialtest_powerPerDamage)
inv:set_stack("armor",i,stack)
end
end

275
tools/quantum_suit.lua Normal file
View File

@@ -0,0 +1,275 @@
-- IndustrialTest
-- Copyright (C) 2024 mrkubax10
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local S=minetest.get_translator("industrialtest")
local quantumSuit={}
quantumSuit.helmetBreathRefillOpPower=1000
quantumSuit.leggingsSpeedOpPower=125
quantumSuit.leggingsSpeedMaxVel=4
quantumSuit.bootsJumpOpPower=50
quantumSuit.bootsFallDamageReductionOpPower=900
local playerPositions={}
local playerLeggingsSpeedEnabled={}
local playerBootsJumpEnabled={}
local function registerQuantumSuitPart(config)
config.groups=config.groups or {}
config.groups._industrialtest_nanoSuit=1
if config.element=="head" then
config.groups.armor_head=1
elseif config.element=="torso" then
config.groups.armor_torso=1
elseif config.element=="legs" then
config.groups.armor_legs=1
elseif config.element=="feet" then
config.groups.armor_feet=1
end
local definition={
description=config.displayName,
inventory_image="industrialtest_"..config.name.."_inv.png",
groups=config.groups,
_industrialtest_powerStorage=true,
_industrialtest_powerCapacity=10000000,
_industrialtest_powerFlow=industrialtest.api.ivPowerFlow,
_industrialtest_damageReduction=config.damageReduction,
_industrialtest_powerPerDamage=30
}
if config.customKeys then
for k,v in pairs(config.customKeys) do
definition[k]=v
end
end
if industrialtest.mtgAvailable then
definition.groups.armor_heal=0
armor:register_armor("industrialtest:"..config.name,definition)
elseif industrialtest.mclAvailable then
definition.groups.armor=1
definition.groups.non_combat_armor=1
definition.sounds={
_mcl_armor_equip="mcl_armor_equip_iron",
_mcl_armor_unequip="mcl_armor_unequip_iron"
}
definition.on_place=mcl_armor.equip_on_use
definition.on_secondary_use=mcl_armor.equip_on_use
definition._mcl_armor_element=config.element
definition._mcl_armor_texture=(config.element=="feet" and "industrialtest_mcl_" or "industrialtest_")..config.name..".png"
minetest.register_tool("industrialtest:"..config.name,definition)
end
end
local function findInPlayerArmorList(player,itemname)
local inv
if industrialtest.mclAvailable then
inv=player:get_inventory()
elseif industrialtest.mtgAvailable then
_,inv=armor:get_valid_player(player,"")
end
local armorList=inv:get_list("armor")
for i,stack in ipairs(armorList) do
if stack:get_name()==itemname then
return i,stack,inv
end
end
end
quantumSuit.tryFly=function(itemstack)
local meta=itemstack:get_meta()
if meta:get_int("industrialtest.powerAmount")<10 then
return false
end
industrialtest.api.addPowerToItem(itemstack,-10)
return true
end
registerQuantumSuitPart({
name="quantum_helmet",
displayName=S("Quantum Helmet"),
element="head",
damageReduction=0.15
})
minetest.register_craft({
type="shaped",
output="industrialtest:quantum_helmet",
recipe={
{"industrialtest:reinforced_glass","industrialtest:nano_helmet","industrialtest:reinforced_glass"},
{"industrialtest:iridium_plate","industrialtest:lapotron_crystal","industrialtest:iridium_plate"},
{"industrialtest:advanced_electronic_circuit","industrialtest:empty_cell","industrialtest:advanced_electronic_circuit"}
}
})
registerQuantumSuitPart({
name="quantum_bodyarmor",
displayName=S("Quantum Bodyarmor"),
element="torso",
damageReduction=0.4,
groups={
_industrialtest_jetpack=1
},
customKeys={
_industrialtest_tryFly=quantumSuit.tryFly
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:quantum_bodyarmor",
recipe={
{"industrialtest:advanced_alloy","industrialtest:nano_bodyarmor","industrialtest:advanced_alloy"},
{"industrialtest:iridium_plate","industrialtest:lapotron_crystal","industrialtest:iridium_plate"},
{"industrialtest:iridium_plate","industrialtest:electric_jetpack","industrialtest:iridium_plate"}
}
})
registerQuantumSuitPart({
name="quantum_leggings",
displayName=S("Quantum Leggings"),
element="legs",
damageReduction=0.30
})
minetest.register_craft({
type="shaped",
output="industrialtest:quantum_leggings",
recipe={
{"industrialtest:machine_block","industrialtest:lapotron_crystal","industrialtest:machine_block"},
{"industrialtest:iridium_plate","industrialtest:nano_leggings","industrialtest:iridium_plate"},
{industrialtest.elementKeys.yellowDust,"",industrialtest.elementKeys.yellowDust}
}
})
registerQuantumSuitPart({
name="quantum_boots",
displayName=S("Quantum Boots"),
element="feet",
damageReduction=0.15
})
minetest.register_craft({
type="shaped",
output="industrialtest:quantum_boots",
recipe={
{"industrialtest:iridium_plate","industrialtest:nano_boots","industrialtest:iridium_plate"},
{industrialtest.elementKeys.ironBoots,"industrialtest:lapotron_crystal",industrialtest.elementKeys.ironBoots}
}
})
minetest.register_globalstep(function(dtime)
local players=minetest.get_connected_players()
for _,player in ipairs(players) do
local control=player:get_player_control()
local playerName=player:get_player_name()
if playerLeggingsSpeedEnabled[playerName] then
local shouldStopSpeed=true
if control.up and control.aux1 then
local index,stack,inv=findInPlayerArmorList(player,"industrialtest:quantum_leggings")
if index and stack and inv then
local meta=stack:get_meta()
local requiredPower=vector.distance(player:get_pos(),playerPositions[playerName])*quantumSuit.leggingsSpeedOpPower
if meta:get_int("industrialtest.powerAmount")>=requiredPower then
industrialtest.api.addPowerToItem(stack,-requiredPower)
inv:set_stack("armor",index,stack)
shouldStopSpeed=false
end
end
end
if shouldStopSpeed then
player:set_physics_override({
speed=1
})
playerLeggingsSpeedEnabled[playerName]=false
end
elseif control.up and control.aux1 then
local index,stack,inv=findInPlayerArmorList(player,"industrialtest:quantum_leggings")
if index and stack and inv then
local meta=stack:get_meta()
local requiredPower=vector.distance(player:get_pos(),playerPositions[playerName])*quantumSuit.leggingsSpeedOpPower
if meta:get_int("industrialtest.powerAmount")>=requiredPower then
player:set_physics_override({
speed=quantumSuit.leggingsSpeedMaxVel
})
playerLeggingsSpeedEnabled[playerName]=true
end
end
end
if playerBootsJumpEnabled[playerName] then
local shouldStopJump=not control.aux1
if control.jump and control.aux1 then
local index,stack,inv=findInPlayerArmorList(player,"industrialtest:quantum_boots")
if index and stack and inv then
local meta=stack:get_meta()
if meta:get_int("industrialtest.powerAmount")>=quantumSuit.bootsJumpOpPower then
industrialtest.api.addPowerToItem(stack,-quantumSuit.bootsJumpOpPower)
inv:set_stack("armor",index,stack)
shouldStopJump=false
end
end
end
if shouldStopJump then
player:set_physics_override({
jump=1
})
playerBootsJumpEnabled[playerName]=false
end
elseif control.aux1 then
local index,stack,inv=findInPlayerArmorList(player,"industrialtest:quantum_boots")
if index and stack and inv then
local meta=stack:get_meta()
local requiredPower=vector.distance(player:get_pos(),playerPositions[playerName])*quantumSuit.leggingsSpeedOpPower
if meta:get_int("industrialtest.powerAmount")>=quantumSuit.bootsJumpOpPower then
player:set_physics_override({
jump=2
})
playerBootsJumpEnabled[playerName]=true
end
end
end
if player:get_breath()<10 then
local index,stack,inv=findInPlayerArmorList(player,"industrialtest:quantum_helmet")
if index and stack and inv then
local meta=stack:get_meta()
local refilled=math.min(9-player:get_breath(),math.floor(meta:get_int("industrialtest.powerAmount")/quantumSuit.helmetBreathRefillOpPower))
if refilled>0 then
player:set_breath(player:get_breath()+refilled)
industrialtest.api.addPowerToItem(stack,-refilled*quantumSuit.helmetBreathRefillOpPower)
inv:set_stack("armor",index,stack)
end
end
end
playerPositions[playerName]=player:get_pos()
end
end)
minetest.register_on_player_hpchange(function(player,hpChange,reason)
if reason.type~="fall" then
return hpChange
end
local index,stack,inv=findInPlayerArmorList(player,"industrialtest:quantum_boots")
if not index or not stack or not inv then
return hpChange
end
local damage=math.abs(hpChange)
local meta=stack:get_meta()
local reducedDamage=math.min(damage,math.floor(meta:get_int("industrialtest.powerAmount")/(damage*quantumSuit.bootsFallDamageReductionOpPower)))
industrialtest.api.addPowerToItem(stack,-reducedDamage*quantumSuit.bootsFallDamageReductionOpPower)
inv:set_stack("armor",index,stack)
return hpChange+reducedDamage
end,true)