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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user