EEPROM now also can be cleared via self-crafting, floppies keep their color, closes #1052.

Added some more documentation on the manual itself.
Fixed typos and stuff in documentation.
This commit is contained in:
Florian Nücke 2015-04-11 17:00:10 +02:00
parent f4c4d4c477
commit 6d7cc3c09e
10 changed files with 59 additions and 34 deletions

View File

@ -1,9 +1,10 @@
# Computers
Computers are built using a variety of different blocks and components. The bare minimum needed to build a computer is a [case](../block/case1.md), [screen](../block/screen1.md), and [keyboard](../block/keyboard.md). The Case and Screen are available in different Tiers providing different functionality and allowing for more complex Computer systems. In order for the Screen to be accessible, the Keyboard must be placed adjacent to the Screen (either on the sides or directly in front of the Screen).
Computers are built using a variety of different [blocks](../block/index.md) and components. The bare minimum needed to build a computer is a [case](../block/case1.md), [screen](../block/screen1.md), and [keyboard](../block/keyboard.md). The case and screen are available in different tiers providing different functionality and allowing for more complex computer systems. In order for the screen to be accessible, the keyboard must be placed adjacent to the screen (either on the sides or directly in front of the screen).
Once the basic structure is built, Components can be placed inside the [case](../block/case1.md). These Components include [CPUs](../item/cpu1.md), [memory (RAM)](../item/ram1.md), [hard disk drives (HDD)](../item/hdd1.md), [graphics cards](../item/graphicsCard1.md) (to be able to use the [screen](../block/screen1.md)), [network cards](../item/lanCard.md) (for communication between Computer networks), etc. There are many components available allowing for highly flexible systems designed for specific purposes.
Once the basic structure is built, components can be placed inside the [case](../block/case1.md). These components include [CPUs](../item/cpu1.md), [memory (RAM)](../item/ram1.md), [hard disk drives (HDD)](../item/hdd1.md), [graphics cards](../item/graphicsCard1.md) (to be able to use the [screen](../block/screen1.md)), [network cards](../item/lanCard.md) (for communication between computer networks), etc. There are many components available allowing for highly flexible systems designed for specific purposes.
Lower Tier Computers also require a [disk drive](../block/diskDrive.md), which takes a [floppy](../item/floppy.md) disk. An OpenOS [floppy](../item/floppy.md) disk is needed for booting up the Computer for the first time, and is used to install the Operating System to the [HDD](../item/hdd1.md). Once installed to the [HDD](../item/hdd1.md), the [floppy](../item/floppy.md) disk is no longer necessary. Additional software is also available as [floppy](../item/floppy.md) disks (such as Open Programs Package Manager, or OPPM) and are obtained from dungeon loot.
Lower tier computers also require a [disk drive](../block/diskDrive.md), which takes a [floppy](../item/floppy.md) disk. An OpenOS [floppy](../item/floppy.md) disk is needed for booting up the computer for the first time, and is used to install the operating system to the [HDD](../item/hdd1.md). Once installed to the [HDD](../item/hdd1.md), the [floppy](../item/floppy.md) disk is no longer necessary. Additional software is also available as [floppy](../item/floppy.md) disks (such as Open Programs Package Manager, or OPPM) and are obtained from dungeon loot.
The final step necessary is to provide the Computer with a Power Source. OpenComputers is compatible with all types of Power-providing mods, and will connect directly to them. For a larger network with multiple Computers, a [power converter](../block/powerConverter.md) (converts different mod's power to OC's internal Energy type), [power distributor](../block/powerDistributor.md) (distributes power to different Computers), and [capacitor](../block/capacitor.md) (power storage for the network) can be used to connect different Computers on the network using Cables.
The final step necessary is to provide the computer with a power source. OpenComputers is compatible with most major power-providing mods, and many blocks can be powered directly. You can see which blocks can be connected to external power by checking if their tooltip contains an entry about the block's power conversion speed.
For a larger network with multiple computers, a [power converter](../block/powerConverter.md) (converts different mod's power to OC's internal Energy type), [power distributor](../block/powerDistributor.md) (distributes power to different computers), and [capacitor](../block/capacitor.md) (power storage for the network) can be used to connect different computers on the network using Cables.

View File

@ -1,32 +1,34 @@
# OpenComputers Manual
OpenComputers is a mod that adds persistent, modular, and highly configurable [computers](general/computer.md), [servers](item/server1.md), [robots](block/robot.md), and [drones](item/drone.md). All devices can be programmed using Lua 5.2, allowing for systems with varying complexity depending on the usage.
OpenComputers is a mod that adds persistent, modular, and highly configurable [computers](general/computer.md), [servers](item/server1.md), [robots](block/robot.md), and [drones](item/drone.md) to the game. All devices can be programmed using Lua 5.2, allowing for systems with varying complexity depending on the usage.
To learn about how to use the manual, check out [the page about the manual](item/manual.md) (that green text is a link, you can click it). You can find a table of contents at the bottom of this page.
Persistence ensures that a running [computer](general/computer.md) retains its state when the chunk it is in is unloaded. This means that if the player moves away from the [computer](general/computer.md), or logs off, the [computer](general/computer.md) will remember its last known state and continue from that point on when the player goes near the [computer](general/computer.md). Persistence works for all devices except for [tablets](item/tablet.md).
All devices are modular and can be assembled with a wide range of components, just like [computers](general/computer.md) in real life. Players who enjoy tinkering will be able to optimize devices to their heart's content. If desired, devices can be [dismantled](block/disassembler.md) and rebuilt if the initial configuration wasn't satisfactory. For [computers](general/computer.md) and [servers](item/server1.md), components can be swapped out on-the-fly simply by opening the corresponding GUI.
OpenComputers devices are compatible with many different mods for manipulation of blocks and entities (through the [adapter](block/adapter.md), or specific upgrades in a [robot](block/robot.md) or [drone](item/drone.md)), or as a source of power.
OpenComputers devices are compatible with many different mods for manipulation of blocks and entities (through the [adapter](block/adapter.md), or specific upgrades in a [robot](block/robot.md) or [drone](item/drone.md)). Power can be supplied using a large range of other mods, including, but not limited to, Redstone Flux, IndustrialCraft2 EU, Mekanism Joules, Applied Energistics 2 energy as well as Factorization Charge.
Most devices are able to run a basic Operating System called [OpenOS](general/openOS.md) (with the exception of drones and microcontrollers). OpenComputers allows for creation of custom OSes and Architectures, should the player desire it.
Most devices are able to run a basic operating system called [OpenOS](general/openOS.md) (with the exception of drones and microcontrollers). OpenComputers allows for creation of custom OSes and Architectures, should the player desire it.
Devices have access to various resources such as [disk space](item/hdd1.md) and [memory (RAM)](item/ram1.md). [Microcontrollers](block/microcontroller.md) are [computers](general/computer.md) with less functionality and components, and do not have an Operating System, requiring creative use of programming. [Robots](block/robot.md) are mobile [computers](general/computer.md) and are able to interact with blocks and entities (but are unable to interact with external OpenComputers components). [Drones](item/drone.md) are entity-based [robots](block/robot.md) with limited functionality, able to move differently and are able to interact differently with the world. [Servers](item/server1.md) are higher tier [computers](general/computer.md) and are able to hold more components, increasing the amount of resources available to control larger networks and run larger programs.
Devices have access to various resources such as [disk space](item/hdd1.md) and [memory (RAM)](item/ram1.md). [Microcontrollers](block/microcontroller.md) are cheap [computers](general/computer.md) with less functionality and components, and do not have an operating system, requiring creative use of programming. [Robots](block/robot.md) are mobile [computers](general/computer.md) and are able to interact with blocks and entities (but are unable to interact with external OpenComputers components). [Drones](item/drone.md) are fast, entity-based [robots](block/robot.md) with limited functionality, able to move differently and are able to interact differently with the world. [Servers](item/server1.md) are higher tier [computers](general/computer.md) and are able to hold more components, increasing the amount of resources available to control larger networks and run larger programs.
This manual contains detailed information regarding all blocks and items, how to set up different types of systems and devices, as well as an introduction to Lua programming.
This manual contains detailed information regarding all blocks and items, how to set up different types of systems and devices, as well as an introduction to Lua programming.
## Table of Contents
### Devices
[Computers](general/computer.md)
[Servers](item/server1.md)
[Microcontrollers](block/microcontroller.md)
[Robots](block/robot.md)
[Drones](item/drone.md)
- [Computers](general/computer.md)
- [Servers](item/server1.md)
- [Microcontrollers](block/microcontroller.md)
- [Robots](block/robot.md)
- [Drones](item/drone.md)
### Software and Programming
[OpenOS](general/openOS.md)
[Lua](general/lua.md)
- [OpenOS](general/openOS.md)
- [Lua](general/lua.md)
### Blocks and Items
[Items](item/index.md)
[Blocks](block/index.md)
- [Items](item/index.md)
- [Blocks](block/index.md)

View File

@ -2,10 +2,12 @@
![A good read.](oredict:oc:manual)
The thing you're reading right now! The manual contains a wealth of information about OpenComputers (and possibly more). If you need information on an item or block in the mod, look no further! Then realize your question isn't answered and alt-tab to the [wiki](http://ocdoc.cil.li). Or [IRC](http://webchat.esper.net/?channels=#oc). Or the [forums](http://oc.cil.li/). Anyway! Most basic questions (and some advanced ones) should be covered by the manual.
The thing you're reading right now! The manual contains a wealth of information about OpenComputers (and possibly more). If you need information on an item or block in the mod, look no further! Scroll down to learn how to use (mouse wheel or the scroll bar to the right).
## Usage
![Your new best friend.](opencomputers:doc/img/manual.png)
There are two main ways you can look things up in the manual: manual navigation (pun maybe intended) by following the links, or by sneak-activating a supported block while holding the manual in your hand; the latter will open the page for that block in the manual.
Navigating the manual is similar to browsing a wiki: click on links (1) to follow them to the page they reference. Right-click or press the jump key to go back one page. Press escape or the inventory key to close the manual. To the left you will find a few tabs (2) that provide a way to quickly jump to select pages, such as the block and item index. To the right you will find the scroll bar (3). You can either drag it manually, or use the mouse wheel to scroll in a page.
To navigate left-click on links (green text [like this one](../index.md)) to follow them, right-click anywhere or press space to go back to the previous page. Press escape to close the manual immediately. If you're lost, use the tabs to the left to return to and index page.
When opening the manual again at a later point, you will return to the page you were on when you closed it. You can start over on the main index page by using it while sneaking. It is also possible to directly jump to a page concerning a block in the world by using the block while sneaking with the manual in hand.
If your questions are not answered by the manual, other places with information are the [wiki](http://ocdoc.cil.li), OpenComputers' [IRC channel](http://webchat.esper.net/?channels=#oc) and the [forums](http://oc.cil.li/).

View File

@ -2,7 +2,7 @@
![Remote access.](oredict:oc:terminal)
The remote terminal can be used to remote control [servers](server.md). To use it, sneak-activate a server that is installed in a [server rack](../block/serverRack.md) (click on the [server rack](../block/serverRack.md) block in the world, targeting the [server](server1.md) to bind the terminal to).
The remote terminal can be used to remote control [servers](server1.md). To use it, sneak-activate a server that is installed in a [server rack](../block/serverRack.md) (click on the [server rack](../block/serverRack.md) block in the world, targeting the [server](server1.md) to bind the terminal to).
When a terminal is bound to a [server](server1.md), a virtual [screen](../block/screen1.md) and [keyboard](../block/keyboard.md) get connected to the server. This can lead to unexpected behavior if another real screen and/or keyboard is connected to the server, so this should be avoided. When using the terminal in hand after binding it, a GUI will open in the same manner as a [keyboard](../block/keyboard.md) attached to a [screen](../block/screen1.md).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -18,7 +18,7 @@ object Document {
* Parses a plain text document into a list of segments.
*/
def parse(document: Iterable[String]): Iterable[Segment] = {
var segments = document.flatMap(line => Iterable(new segment.TextSegment(null, Option(line).getOrElse("")), new segment.NewLineSegment())).toArray
var segments = document.flatMap(line => Iterable(new segment.TextSegment(null, Option(line).fold("")(_.reverse.dropWhile(_.isWhitespace).reverse)), new segment.NewLineSegment())).toArray
for ((pattern, factory) <- segmentTypes) {
segments = segments.flatMap(_.refine(pattern, factory))
}

View File

@ -1,14 +1,12 @@
package li.cil.oc.client.renderer.markdown.segment.render
import li.cil.oc.Settings
import li.cil.oc.api.manual.ImageProvider
import li.cil.oc.api.manual.ImageRenderer
import net.minecraft.util.ResourceLocation
object TextureImageProvider extends ImageProvider {
override def getImage(data: String): ImageRenderer = {
val path = if (data.startsWith("/")) data else "doc/" + data
val location = new ResourceLocation(Settings.resourceDomain, path)
val location = new ResourceLocation(data)
new TextureImageRenderer(location)
}
}

View File

@ -12,6 +12,7 @@ import li.cil.oc.common.item.data.PrintData
import li.cil.oc.common.item.data.RobotData
import li.cil.oc.common.item.data.TabletData
import li.cil.oc.integration.Mods
import li.cil.oc.util.Color
import li.cil.oc.util.ExtendedNBT._
import li.cil.oc.util.SideTracker
import net.minecraft.init.Blocks
@ -71,15 +72,27 @@ object ExtendedRecipe {
}
if (api.Items.get(craftedStack) == floppy || hdds.contains(api.Items.get(craftedStack))) {
if (!craftedStack.hasTagCompound) {
craftedStack.setTagCompound(new NBTTagCompound())
}
val nbt = craftedStack.getTagCompound
if (recipe.getRecipeSize == 1) {
// Formatting / loot to normal disk conversion.
craftedStack.setTagCompound(null)
// Formatting / loot to normal disk conversion, only keep coloring.
val colorKey = Settings.namespace + "color"
for (slot <- 0 until inventory.getSizeInventory) {
val stack = inventory.getStackInSlot(slot)
if (stack != null && api.Items.get(stack) != null && (api.Items.get(stack) == floppy || api.Items.get(stack).name == "lootDisk") && stack.hasTagCompound) {
val oldData = stack.getTagCompound
if (oldData.hasKey(colorKey) && oldData.getInteger(colorKey) != Color.dyes.indexOf("lightGray")) {
nbt.setTag(colorKey, oldData.getTag(colorKey).copy())
}
}
}
if (nbt.hasNoTags) {
craftedStack.setTagCompound(null)
}
}
else {
if (!craftedStack.hasTagCompound) {
craftedStack.setTagCompound(new NBTTagCompound())
}
val nbt = craftedStack.getTagCompound
for (slot <- 0 until inventory.getSizeInventory) {
val stack = inventory.getStackInSlot(slot)
if (stack != null && api.Items.get(stack) == floppy && stack.hasTagCompound) {
@ -135,7 +148,12 @@ object ExtendedRecipe {
data.save(craftedStack)
}
if (api.Items.get(craftedStack) == eeprom && !ItemStack.areItemStackTagsEqual(craftedStack, luaBios)) breakable {
// EEPROM copying.
if (api.Items.get(craftedStack) == eeprom &&
!ItemStack.areItemStackTagsEqual(craftedStack, luaBios) &&
recipe.isInstanceOf[ExtendedShapelessOreRecipe] &&
recipe.asInstanceOf[ExtendedShapelessOreRecipe].getInput != null &&
recipe.asInstanceOf[ExtendedShapelessOreRecipe].getInput.size == 2) breakable {
for (slot <- 0 until inventory.getSizeInventory) {
val stack = inventory.getStackInSlot(slot)
if (stack != null && api.Items.get(stack) == eeprom && stack.hasTagCompound) {
@ -148,6 +166,7 @@ object ExtendedRecipe {
}
}
// Swapping EEPROM in devices.
recraft(craftedStack, inventory, mcu, stack => new MCUDataWrapper(stack))
recraft(craftedStack, inventory, drone, stack => new MCUDataWrapper(stack))
recraft(craftedStack, inventory, robot, stack => new RobotDataWrapper(stack))

View File

@ -224,6 +224,9 @@ object Recipes {
GameRegistry.addRecipe(new ExtendedShapelessOreRecipe(hdd.createItemStack(1), hdd.createItemStack(1)))
}
// EEPROM formatting.
GameRegistry.addRecipe(new ExtendedShapelessOreRecipe(eeprom.createItemStack(1), eeprom.createItemStack(1)))
// Print light value increments.
val lightPrint = print.createItemStack(1)