Refactor electric drills

This commit is contained in:
2025-04-14 14:48:42 +02:00
parent b108ce7c6a
commit 9cb5748b73
4 changed files with 68 additions and 131 deletions

View File

@@ -78,28 +78,36 @@ end
function industrialtest.ActivatedElectricTool.defineToolCapabilities(self,def,times,digSpeed)
if industrialtest.mtgAvailable then
if self.digs then
def.tool_capabilities.groupcaps={
[self.digs]={
def.tool_capabilities.groupcaps={}
for _,digType in ipairs(self.digs) do
def.tool_capabilities.groupcaps[digType]={
times=times,
maxlevel=self.digLevel
maxlevel=self.digLevel+1
}
}
if self.digs=="choppy" then
def.groups.axe=1
if digType=="choppy" then
def.groups.axe=1
elseif digType=="cracky" then
def.groups.pickaxe=1
elseif digType=="crumbly" then
def.groups.shovel=1
end
end
end
elseif industrialtest.mclAvailable then
local digTypeMapping={
choppy="axey"
choppy="axey",
cracky="pickaxey",
crumbly="shovely"
}
def.groups.dig_speed_class=self.digSpeedClass
def._mcl_diggroups={
[digTypeMapping[self.digs]]={
def._mcl_diggroups={}
for _,digType in ipairs(self.digs) do
def._mcl_diggroups[digTypeMapping[digType]]={
speed=digSpeed,
level=self.digLevel+4,
level=5-self.digLevel,
uses=-1
}
}
end
end
end