15 Commits

Author SHA1 Message Date
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
960b2e5b45 Don't try to check if other reactor chambers are powered if Nuclear Reactor wasn't initialized
Fixes #7
2024-03-28 07:13:32 +01:00
34 changed files with 409 additions and 176 deletions

View File

@@ -647,7 +647,7 @@ end
-- \returns nil
industrialtest.api.registerResourceDust=function(name,displayName,resources,color,registerMaceratorRecipe)
minetest.register_craftitem("industrialtest:"..name.."_dust",{
description=S("@1 Dust", displayName),
description=S(displayName.." Dust"),
inventory_image="industrialtest_dust.png",
color=color
})
@@ -693,7 +693,7 @@ industrialtest.api.registerStorageCell=function(name,displayName,node,modname)
modname="industrialtest"
end
minetest.register_craftitem("industrialtest:"..name.."_cell",{
description=S("@1 Cell", displayName),
description=S(displayName.." Cell"),
inventory_image=modname.."_"..name.."_cell.png",
on_place=function(itemstack,user,pointed)
if pointed.type~="node" or not user or not user:is_player() then

View File

@@ -47,7 +47,7 @@ end
local function registerCable(name,displayName,size,flow,registerInsulated)
local definition={
description=S("@1 Cable", displayName),
description=S(displayName.." Cable"),
inventory_image="industrialtest_"..name.."_cable_inv.png",
tiles={"industrialtest_"..name.."_cable.png"},
wield_image="industrialtest_"..name.."_cable_inv.png",
@@ -142,7 +142,7 @@ local function registerCable(name,displayName,size,flow,registerInsulated)
minetest.register_node("industrialtest:"..name.."_cable",definition)
if registerInsulated then
definition=table.copy(definition)
definition.description=S("Insulated @1 Cable", displayName)
definition.description=S("Insulated "..displayName.." Cable")
definition.inventory_image="industrialtest_insulated_"..name.."_cable_inv.png"
definition.tiles={"industrialtest_insulated_"..name.."_cable.png"}
definition.wield_image="industrialtest_insulated_"..name.."_cable_inv.png"

View File

@@ -93,11 +93,13 @@ override={
if meta:get_int("meseconPowered")==1 then
return
end
local chambers=minetest.deserialize(meta:get_string("chambers"))
for _,chamber in ipairs(chambers) do
local chamberMeta=minetest.get_meta(chamber)
if chamberMeta:get_int("meseconPowered")==1 then
return
if meta:contains("chambers") then
local chambers=minetest.deserialize(meta:get_string("chambers"))
for _,chamber in ipairs(chambers) do
local chamberMeta=minetest.get_meta(chamber)
if chamberMeta:get_int("meseconPowered")==1 then
return
end
end
end

View File

@@ -94,15 +94,15 @@ end
if industrialtest.mclAvailable then
industrialtest.internal.registerMetal=function(name,displayName,oreBlastResistance,oreHardness,rawBlockBlastResistance,rawBlockHardness,blockBlastResistance,blockHardness)
minetest.register_craftitem("industrialtest:raw_"..name,{
description=S("Raw @1", displayName),
description=S("Raw "..displayName),
inventory_image="industrialtest_mcl_raw_"..name..".png"
})
minetest.register_craftitem("industrialtest:"..name.."_ingot",{
description=S("@1 Ingot", displayName),
description=S(displayName.." Ingot"),
inventory_image="industrialtest_mcl_"..name.."_ingot.png"
})
minetest.register_node("industrialtest:stone_with_"..name,{
description=S("@1 Ore", displayName),
description=S(displayName.." Ore"),
tiles={"default_stone.png^industrialtest_mcl_stone_with_"..name..".png"},
sounds=mcl_sounds.node_sound_stone_defaults(),
drop="industrialtest:raw_"..name,
@@ -114,7 +114,7 @@ if industrialtest.mclAvailable then
_mcl_fortune_drop = mcl_core.fortune_drop_ore,
})
minetest.register_node("industrialtest:deepslate_with_"..name,{
description=S("Deepslate with @1", displayName),
description=S("Deepslate with "..displayName),
tiles={"mcl_deepslate_top.png^industrialtest_mcl_stone_with_"..name..".png","mcl_deepslate_top.png^industrialtest_mcl_stone_with_"..name..".png","mcl_deepslate.png^industrialtest_mcl_stone_with_"..name..".png"},
sounds=mcl_sounds.node_sound_stone_defaults(),
drop="industrialtest:raw_"..name,
@@ -128,7 +128,7 @@ if industrialtest.mclAvailable then
_mcl_fortune_drop = mcl_core.fortune_drop_ore,
})
minetest.register_node("industrialtest:raw_"..name.."_block",{
description=S("Raw @1 Block", displayName),
description=S("Raw "..displayName.." Block"),
tiles={"industrialtest_mcl_raw_"..name.."_block.png"},
groups={pickaxey=2,building_block=1,blast_furnace_smeltable=1},
sounds=mcl_sounds.node_sound_metal_defaults(),
@@ -136,7 +136,7 @@ if industrialtest.mclAvailable then
_mcl_hardness=rawBlockHardness,
})
minetest.register_node("industrialtest:"..name.."_block",{
description=S("Block of @1", displayName),
description=S("Block of "..displayName),
tiles={"industrialtest_"..name.."_block.png"},
groups={pickaxey=2,building_block=1},
sounds=mcl_sounds.node_sound_metal_defaults(),
@@ -192,7 +192,7 @@ if industrialtest.mclAvailable then
end
industrialtest.registerToolset=function(material,materialItem,materialDisplayName,config)
minetest.register_tool("industrialtest:"..material.."_pickaxe",{
description=S("@1 Pickaxe", materialDisplayName),
description=S(materialDisplayName.." Pickaxe"),
inventory_image="industrialtest_mcl_"..material.."_pickaxe.png",
groups={tool=1,pickaxe=1,dig_speed_class=config.digSpeedClass},
tool_capabilities={
@@ -208,7 +208,7 @@ if industrialtest.mclAvailable then
}
})
minetest.register_tool("industrialtest:"..material.."_shovel",{
description=S("@1 Shovel", materialDisplayName),
description=S(materialDisplayName.." Shovel"),
inventory_image="industrialtest_mcl_"..material.."_shovel.png",
groups={tool=1,shovel=1,dig_speed_class=config.digSpeedClass},
tool_capabilities={
@@ -253,14 +253,14 @@ 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}
}
})
minetest.register_tool("industrialtest:"..material.."_axe",{
description=S("@1 Axe", materialDisplayName),
description=S(materialDisplayName.." Axe"),
inventory_image="industrialtest_mcl_"..material.."_axe.png",
groups={tool=1,axe=1,dig_speed_class=config.digSpeedClass},
tool_capabilities={
@@ -270,14 +270,14 @@ 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}
}
})
minetest.register_tool("industrialtest:"..material.."_sword",{
description=S("@1 Sword", materialDisplayName),
description=S(materialDisplayName.." Sword"),
inventory_image="industrialtest_mcl_"..material.."_sword.png",
groups={weapon=1,sword=1,dig_speed_class=config.digSpeedClass},
tool_capabilities={
@@ -286,7 +286,7 @@ if industrialtest.mclAvailable then
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},
@@ -294,7 +294,7 @@ if industrialtest.mclAvailable then
}
})
minetest.register_tool("industrialtest:"..material.."_hoe",{
description=S("@1 Hoe", materialDisplayName),
description=S(materialDisplayName.." Hoe"),
inventory_image="industrialtest_mcl_"..material.."_hoe.png",
groups={tool=1,hoe=1},
tool_capabilities={
@@ -349,7 +349,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,7 +360,7 @@ 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,
@@ -552,7 +552,7 @@ if industrialtest.mclAvailable then
}
})
industrialtest.elementKeys.bronzeIngot="industrialtest:bronze_ingot"
industrialtest.registerToolset("bronze","bronze_ingot",S("Bronze"),{
industrialtest.registerToolset("bronze","bronze_ingot","Bronze",{
digSpeedClass=4,
dropLevel=4,
speed=6,
@@ -617,22 +617,22 @@ elseif industrialtest.mtgAvailable then
industrialtest.internal.registerMetal=function(name,displayName,hardness)
minetest.register_craftitem("industrialtest:"..name.."_lump",{
description=S("@1 Lump", displayName),
description=S(displayName.." Lump"),
inventory_image="industrialtest_mtg_"..name.."_lump.png"
})
minetest.register_craftitem("industrialtest:"..name.."_ingot",{
description=S("@1 Ingot", displayName),
description=S(displayName.." Ingot"),
inventory_image="industrialtest_mtg_"..name.."_ingot.png"
})
minetest.register_node("industrialtest:stone_with_"..name,{
description=S("@1 Ore", displayName),
description=S(displayName.." Ore"),
tiles={"default_stone.png^industrialtest_mtg_stone_with_"..name..".png"},
sounds=default.node_sound_stone_defaults(),
drop="industrialtest:"..name.."_lump",
groups={cracky=hardness},
})
minetest.register_node("industrialtest:"..name.."_block",{
description=S("Block of @1", displayName),
description=S("Block of "..displayName),
tiles={"industrialtest_"..name.."_block.png"},
groups={cracky=hardness,level=2},
sounds=default.node_sound_metal_defaults(),

View File

@@ -561,6 +561,17 @@ industrialtest.api.registerPlate("lead_plate",S("Lead Plate"),{
}
},"#eafef8ff",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",{
description=S("Empty Cell"),

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

@@ -1,140 +0,0 @@
# textdomain: industrialtest
@1@n@2 / @3 EU=
@1@n@2 / @3 mB=
@1 Dust=
@1 Cell=
@1 Cable=
Insulated @1 Cable=
Raw @1=
@1 Ingot=
@1 Ore=
Deepslate with @1=
Raw @1 Block=
Block of @1=
@1 Pickaxe=
@1 Shovel=
@1 Axe=
@1 Sword=
@1 Hoe=
Bronze Ingot=
Bronze Nugget=
Bronze=
Block of Bronze=
@1 Lump=
RE-Battery=
Advanced RE-Battery=
Energy Crystal=
Lapotron Crystal=
Refined Iron Ingot=
Mixed Metal Ingot=
Sticky Resin=
Rubber=
Raw Carbon Fibre=
Raw Carbon Mesh=
Hydrated Coal Dust=
Hydrated Coal=
Bronze Plate=
Copper Plate=
Advanced Alloy=
Carbon Plate=
Tin Plate=
Lead Plate=
Empty Cell=
Uranium Cell=
Coolant Cell=
Bio Cell=
Biofuel Cell=
Hydrated Coal Cell=
Coalfuel Cell=
Electronic Circuit=
Advanced Electronic Circuit=
Scrap=
UU-Matter=
Plantball=
Compressed Plantball=
Fuel Can=
Cable Former=
Canning Machine=
BatBox Chargepad=
CESU Chargepad=
MFE Chargepad=
MFSU Chargepad=
Charge=
Discharge=
Compressor=
Electric Furnace=
Extractor=
Geothermal Generator=
Water Mill=
Generator=
Heat: @1 %=
Induction Furnace=
Iron Furnace=
Macerator=
Mass Fabricator=
Start=
Stop=
Nuclear Reactor=
Nuclear Reactor Chamber=
BatBox=
CESU=
MFE=
MFSU=
Recycler=
Don't maintain speed=
Maintain speed=
Speed: @1=
Rotary Macerator=
Solar Panel=
LV Solar Array=
MV Solar Array=
HV Solar Array=
Tool Workshop=
LV Transformer=
MV Transformer=
HV Transformer=
EV Transformer=
Wind Mill=
Machine Block=
Advanced Machine Block=
Rubber Wood=
Rubber Leaves=
Rubber Sapling=
BatPack=
LapPack=
Electric Chainsaw=
Diamond Electric Chainsaw=
Electric Drill=
Diamond Electric Drill=
Electric Hoe=
Diamond Electric Hoe=
Electric Saber=
Diamond Electric Saber=
Jetpack=
Electric Jetpack=
Mining Laser (Mode @1)=
Mining Laser (Mode 1)=
Nano Helmet=
Nano Bodyarmor=
Nano Leggings=
Nano Boots=
Solar Helmet=
Static Boots=
Treetap=
Electric Treetap=
Wrench=
Electric Wrench=
Overclocker Upgrade=
Transformer Upgrade=
Power Storage Upgrade=
Power Storage Inspector=
Power Capacity: @1=
Power Flow: @1=
Power Amount: @1=
Power IO Config: @1=
Power Capacity=
Power Flow=
Power Amount=
Power IO Config=
Update=
Connections:=

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.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 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.

After

Width:  |  Height:  |  Size: 1.1 KiB

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.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

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.

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.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

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)