Changed APU component support a bit, to fix tooltip

(Still a hack, but it's local and quite straightforward)
This commit is contained in:
repo_alt 2022-03-05 10:48:02 +03:00
parent 41a717fb2c
commit 8727571e95
4 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,7 @@ class APU(val parent: Delegator, val tier: Int) extends traits.Delegate with tra
else super.rarity(stack)
override def cpuTier = math.min(Tier.Three, tier + 1)
override def cpuTierForComponents = tier + 1
override def gpuTier = tier

View File

@ -6,6 +6,7 @@ class CPU(val parent: Delegator, val tier: Int) extends traits.Delegate with tra
override val unlocalizedName = super.unlocalizedName + tier
override def cpuTier = tier
override def cpuTierForComponents = tier
override protected def tooltipName = Option(super.unlocalizedName)
}

View File

@ -17,8 +17,9 @@ import scala.language.existentials
trait CPULike extends Delegate {
def cpuTier: Int
def cpuTierForComponents: Int // Creative APU provides components like T4 CPU, but there is no T4 CPU
override protected def tooltipData: Seq[Any] = Seq(Settings.get.cpuComponentSupport(cpuTier))
override protected def tooltipData: Seq[Any] = Seq(Settings.get.cpuComponentSupport(cpuTierForComponents))
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]) {
tooltip.addAll(Tooltip.get("CPU.Architecture", api.Machine.getArchitectureName(DriverCPU.architecture(stack))))

View File

@ -25,8 +25,7 @@ object DriverAPU extends DriverCPU with HostAware {
}
override def supportedComponents(stack: ItemStack) = Delegator.subItem(stack) match {
// have to use GPU tier here because CPU tier is limited by 3, creative tier is special
case Some(apu: common.item.APU) => Settings.get.cpuComponentSupport(apu.gpuTier + 1)
case Some(apu: common.item.APU) => Settings.get.cpuComponentSupport(apu.cpuTierForComponents)
case _ => Settings.get.cpuComponentSupport(1)
}