Made assembler a component so it can be queried for its status and assembly can be started automatically.
Cleaned up textures folder a little.
BIN
assets/items.psd
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 446 B After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
Before Width: | Height: | Size: 338 B After Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 156 B After Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 998 B |
@ -34,9 +34,9 @@ object Textures extends ResourceManagerReloadListener {
|
|||||||
val blockRobot = new ResourceLocation(Settings.resourceDomain, "textures/blocks/robot.png")
|
val blockRobot = new ResourceLocation(Settings.resourceDomain, "textures/blocks/robot.png")
|
||||||
val blockScreenUpIndicator = new ResourceLocation(Settings.resourceDomain, "textures/blocks/screen/up_indicator.png")
|
val blockScreenUpIndicator = new ResourceLocation(Settings.resourceDomain, "textures/blocks/screen/up_indicator.png")
|
||||||
|
|
||||||
val upgradeCrafting = new ResourceLocation(Settings.resourceDomain, "textures/items/upgrade_crafting_equipped.png")
|
val upgradeCrafting = new ResourceLocation(Settings.resourceDomain, "textures/model/UpgradeCrafting.png")
|
||||||
val upgradeGenerator = new ResourceLocation(Settings.resourceDomain, "textures/items/upgrade_generator_equipped.png")
|
val upgradeGenerator = new ResourceLocation(Settings.resourceDomain, "textures/model/UpgradeGenerator.png")
|
||||||
val upgradeInventory = new ResourceLocation(Settings.resourceDomain, "textures/items/upgrade_inventory_equipped.png")
|
val upgradeInventory = new ResourceLocation(Settings.resourceDomain, "textures/model/UpgradeInventory.png")
|
||||||
|
|
||||||
object Cable {
|
object Cable {
|
||||||
var iconCap: Icon = _
|
var iconCap: Icon = _
|
||||||
|
@ -18,19 +18,19 @@ object Icons {
|
|||||||
def onItemIconRegister(e: TextureStitchEvent.Pre) {
|
def onItemIconRegister(e: TextureStitchEvent.Pre) {
|
||||||
val iconRegister = e.map
|
val iconRegister = e.map
|
||||||
if (iconRegister.textureType == 1) {
|
if (iconRegister.textureType == 1) {
|
||||||
bySlotType += Slot.Card -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_card")
|
bySlotType += Slot.Card -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/card")
|
||||||
bySlotType += Slot.Disk -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_disk")
|
bySlotType += Slot.Disk -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/floppy")
|
||||||
bySlotType += Slot.HardDiskDrive -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_hdd")
|
bySlotType += Slot.HardDiskDrive -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/hdd")
|
||||||
bySlotType += Slot.Memory -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_ram")
|
bySlotType += Slot.Memory -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/memory")
|
||||||
bySlotType += Slot.Processor -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_cpu")
|
bySlotType += Slot.Processor -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/cpu")
|
||||||
bySlotType += Slot.Tool -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_tool")
|
bySlotType += Slot.Tool -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/tool")
|
||||||
bySlotType += Slot.Upgrade -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_upgrade")
|
bySlotType += Slot.Upgrade -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/upgrade")
|
||||||
bySlotType += Slot.UpgradeContainer -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_upgrade_dynamic")
|
bySlotType += Slot.UpgradeContainer -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/container")
|
||||||
|
|
||||||
byTier += Tier.None -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_na")
|
byTier += Tier.None -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/na")
|
||||||
byTier += Tier.One -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_tier0")
|
byTier += Tier.One -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/tier0")
|
||||||
byTier += Tier.Two -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_tier1")
|
byTier += Tier.Two -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/tier1")
|
||||||
byTier += Tier.Three -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_tier2")
|
byTier += Tier.Three -> iconRegister.registerIcon(Settings.resourceDomain + ":icons/tier2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.tileentity
|
|||||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||||
import li.cil.oc.api.Driver
|
import li.cil.oc.api.Driver
|
||||||
import li.cil.oc.api.driver.{Slot, UpgradeContainer}
|
import li.cil.oc.api.driver.{Slot, UpgradeContainer}
|
||||||
import li.cil.oc.api.network.{SidedEnvironment, Visibility}
|
import li.cil.oc.api.network._
|
||||||
import li.cil.oc.common.{InventorySlots, Tier}
|
import li.cil.oc.common.{InventorySlots, Tier}
|
||||||
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
||||||
import li.cil.oc.util.ExtendedNBT._
|
import li.cil.oc.util.ExtendedNBT._
|
||||||
@ -14,7 +14,8 @@ import net.minecraft.nbt.NBTTagCompound
|
|||||||
import net.minecraftforge.common.ForgeDirection
|
import net.minecraftforge.common.ForgeDirection
|
||||||
|
|
||||||
class RobotAssembler extends traits.Environment with traits.PowerAcceptor with traits.Inventory with traits.Rotatable with SidedEnvironment {
|
class RobotAssembler extends traits.Environment with traits.PowerAcceptor with traits.Inventory with traits.Rotatable with SidedEnvironment {
|
||||||
val node = api.Network.newNode(this, Visibility.None).
|
val node = api.Network.newNode(this, Visibility.Network).
|
||||||
|
withComponent("assembler").
|
||||||
withConnector(Settings.get.bufferConverter).
|
withConnector(Settings.get.bufferConverter).
|
||||||
create()
|
create()
|
||||||
|
|
||||||
@ -55,11 +56,11 @@ class RobotAssembler extends traits.Environment with traits.PowerAcceptor with t
|
|||||||
if (caseTier >= 0) Settings.robotComplexityByTier(caseTier) else 0
|
if (caseTier >= 0) Settings.robotComplexityByTier(caseTier) else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def start(finishImmediately: Boolean) {
|
def start(finishImmediately: Boolean = false): Boolean = this.synchronized {
|
||||||
if (!isAssembling && robot.isEmpty && complexity <= maxComplexity) {
|
if (!isAssembling && robot.isEmpty && complexity <= maxComplexity) {
|
||||||
for (slot <- 0 until getSizeInventory) {
|
for (slot <- 0 until getSizeInventory) {
|
||||||
val stack = getStackInSlot(slot)
|
val stack = getStackInSlot(slot)
|
||||||
if (stack != null && !isItemValidForSlot(slot, stack)) return
|
if (stack != null && !isItemValidForSlot(slot, stack)) return false
|
||||||
}
|
}
|
||||||
val data = new ItemUtils.RobotData()
|
val data = new ItemUtils.RobotData()
|
||||||
data.tier = ItemUtils.caseTier(items(0).get)
|
data.tier = ItemUtils.caseTier(items(0).get)
|
||||||
@ -87,11 +88,25 @@ class RobotAssembler extends traits.Environment with traits.PowerAcceptor with t
|
|||||||
|
|
||||||
for (slot <- 0 until getSizeInventory) items(slot) = None
|
for (slot <- 0 until getSizeInventory) items(slot) = None
|
||||||
onInventoryChanged()
|
onInventoryChanged()
|
||||||
|
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
else false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
@Callback(doc = """function(): string, number[, number] -- The current state of the assember, `busy' or `idle', followed by the progress or complexity and maximum complexity, respectively.""")
|
||||||
|
def status(context: Context, args: Arguments): Array[Object] = {
|
||||||
|
if (isAssembling) result("busy", progress)
|
||||||
|
else result("idle", complexity, maxComplexity)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(doc = """function():boolean -- Start assembling, if possible. Returns whether assembly was started or not.""")
|
||||||
|
def start(context: Context, args: Arguments): Array[Object] = result(start())
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
override def canUpdate = isServer
|
override def canUpdate = isServer
|
||||||
|
|
||||||
override def updateEntity() {
|
override def updateEntity() {
|
||||||
|