Add simple item fluid storage API

This commit is contained in:
2024-01-11 19:48:09 +01:00
parent 0895cb42ea
commit e69d16aeb0
3 changed files with 88 additions and 9 deletions

View File

@@ -96,10 +96,11 @@ local function onGlobalStep(player,inv,itemstack,index,def)
end
jetpack.tryFly=function(itemstack)
if itemstack:get_wear()>=65533 then
local meta=itemstack:get_meta()
if meta:get_int("industrialtest.fluidAmount")==0 then
return false
end
itemstack:set_wear(itemstack:get_wear()+2)
industrialtest.api.addFluidToItem(itemstack,-1)
return true
end
@@ -109,9 +110,12 @@ registerJetpack({
displayName=S("Jetpack"),
groups={
_industrialtest_fueled=1,
_industrialtest_emptyOnConstruct=1
_industrialtest_fluidStorage=1
},
tryFly=jetpack.tryFly
tryFly=jetpack.tryFly,
customKeys={
_industrialtest_fluidCapacity=5000
}
})
minetest.register_craft({
type="shaped",