Make it possible to make stripped trunks with chainsaw

This commit is contained in:
2023-04-08 19:28:33 +02:00
parent 90c9779bf0
commit 248bcd1af5
3 changed files with 45 additions and 29 deletions

View File

@@ -216,6 +216,17 @@ local function registerElectricChainsaw(config)
definition.groups={
dig_speed_class=config.digSpeedClass,
}
definition.on_place=function(itemstack,user,pointed)
local meta=itemstack:get_meta()
if meta:get_int("industrialtest.powerAmount")>=20 then
local itemstackCopy=itemstack
if itemstack:get_wear()~=industrialtest.internal.mclMakeStrippedTrunk(itemstackCopy,user,pointed,true):get_wear() then
industrialtest.api.addPowerToItem(itemstack,-20)
return itemstack
end
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