mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 10:21:45 -04:00
Added memory to manual (well, made it remember where you were when closing it with escape).
More documentation fixes.
This commit is contained in:
parent
33af3d6734
commit
c6bf4d156b
@ -1,5 +1,5 @@
|
||||
# Acid
|
||||
|
||||

|
||||

|
||||
|
||||
You'll probabl only see this item when playing with the hardmod recipe set, in which case you'll need it to etch [circuit boards](circuitBoard.md) to craft [printed circuit boards](printedCircuitBoard.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Arithmetic Logic Unit
|
||||
|
||||

|
||||

|
||||
|
||||
Used for crafting most things pushing numbers, such as [CPUs](cpu1.md) and [graphics cards](gpu1.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Arrow Keys
|
||||
|
||||

|
||||

|
||||
|
||||
At the risk of repeating myself: it's a button sink. Because the button economy has seen some serious inflation in recent years.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Button Group
|
||||
|
||||

|
||||

|
||||
|
||||
Because you *always* have too many buttons lying around somewhere. Don't lie. We all shift-click that button recipe time and again.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Card
|
||||
|
||||

|
||||

|
||||
|
||||
Common crafting material for most, if not all card components in OpenComputers.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Microchips
|
||||
|
||||

|
||||

|
||||
|
||||
Microchips are the bread and butter of electronic component crafting. They come in different tiers, for the different tier of devices they're used to craft with.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Circuit Board
|
||||
|
||||

|
||||

|
||||
|
||||
Intermediary crafting item made from [raw circuit boards](rawCircuitBoard.md) and used to make [printed circuit boards](printedCircuitBoard.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Control Unit
|
||||
|
||||

|
||||

|
||||
|
||||
Higher tier crafting material used in more advanced circuitry, such as [CPUs](cpu1.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Cutting Wire
|
||||
|
||||

|
||||

|
||||
|
||||
You'll usually only encounter this when playing with the hard mode recipe set. In that case, this is used for crafting [raw circuit boards](rawCircuitBoard.md). Very inefficiently.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Disc
|
||||
|
||||

|
||||

|
||||
|
||||
Basic crafting component used in crafting storage media such as [floppies](floppy.md) and [hard drives](hdd1.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Interweb
|
||||
|
||||

|
||||

|
||||
|
||||
The interweb is a basic component for all things related to long distance communication. It uses the strange mechanics of all things End to allow something along the lines of quantum communication. Used most notably in [internet cards](internetCard.md) and [linked cards](linkedCard.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Numeric Keypad
|
||||
|
||||

|
||||

|
||||
|
||||
The numpad is part of every [keyboard](../block/keyboard.md). I allows you to enter numbers. I'm seriously running out of ideas of what to write here...
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Printed Circuit Board
|
||||
|
||||

|
||||

|
||||
|
||||
The printed circuit board is, next to the [transistor](transistor.md), one of the most basic crafting materials in OpenComputers. It is used as a basis for many components, such as [cards](card.md) and a large number of [blocks](../block/index.md).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Raw Circuit Board
|
||||
|
||||

|
||||

|
||||
|
||||
Intermediary crafting material, used for crafting [circuit boards](circuitBoard.md) (or [printed circuit boards](printedCircuitBoard.md), depending on the recipe set you use).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Transistor
|
||||
|
||||

|
||||

|
||||
|
||||
The transistor is one of the most basic crafting ingredients in OpenComputers. It is mainly used to craft [microchips](chip1.md) and other electronic goodies.
|
||||
|
@ -22,6 +22,24 @@ import scala.collection.convert.WrapAsJava._
|
||||
import scala.collection.mutable
|
||||
import scala.io.Source
|
||||
|
||||
object Manual {
|
||||
final val LanguageKey = "%LANGUAGE%"
|
||||
|
||||
val history = new mutable.Stack[History]
|
||||
|
||||
reset()
|
||||
|
||||
def reset(): Unit = {
|
||||
history.clear()
|
||||
history.push(new History(s"doc/$LanguageKey/index.md"))
|
||||
}
|
||||
|
||||
class History(val path: String) {
|
||||
var offset = 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Manual extends GuiScreen {
|
||||
final val documentMaxWidth = 230
|
||||
final val documentMaxHeight = 176
|
||||
@ -29,22 +47,21 @@ class Manual extends GuiScreen {
|
||||
final val scrollPosY = 6
|
||||
final val scrollWidth = 6
|
||||
final val scrollHeight = 180
|
||||
final val languageKey = "%LANGUAGE%"
|
||||
|
||||
var guiLeft = 0
|
||||
var guiTop = 0
|
||||
var xSize = 0
|
||||
var ySize = 0
|
||||
var offset = 0
|
||||
var isDragging = false
|
||||
var document = Iterable.empty[PseudoMarkdown.Segment]
|
||||
var documentHeight = 0
|
||||
var history = mutable.Stack(s"doc/$languageKey/index.md")
|
||||
var hoveredLink = None: Option[String]
|
||||
protected var scrollButton: ImageButton = _
|
||||
|
||||
private def canScroll = maxOffset > 0
|
||||
|
||||
def offset = Manual.history.top.offset
|
||||
|
||||
def maxOffset = documentHeight - documentMaxHeight
|
||||
|
||||
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
|
||||
@ -59,7 +76,7 @@ class Manual extends GuiScreen {
|
||||
|
||||
def loadPage(path: String, localized: Boolean = false, seen: List[String] = List.empty): Iterator[String] = {
|
||||
val language = FMLCommonHandler.instance.getCurrentLanguage
|
||||
val resolvedPath = path.replaceAll(languageKey, language)
|
||||
val resolvedPath = path.replaceAll(Manual.LanguageKey, language)
|
||||
if (seen.contains(resolvedPath)) return Iterator("Redirection loop: ") ++ seen.iterator ++ Iterator(path)
|
||||
val location = new ResourceLocation(Settings.resourceDomain, resolvedPath)
|
||||
var is: InputStream = null
|
||||
@ -77,7 +94,7 @@ class Manual extends GuiScreen {
|
||||
}
|
||||
catch {
|
||||
case e: FileNotFoundException if !localized && language != "en_US" =>
|
||||
loadPage(path.replaceAll(languageKey, "en_US"), localized = true, seen)
|
||||
loadPage(path.replaceAll(Manual.LanguageKey, "en_US"), localized = true, seen)
|
||||
case t: Throwable =>
|
||||
Iterator(s"Failed loading page '$path':") ++ t.toString.lines
|
||||
}
|
||||
@ -87,24 +104,22 @@ class Manual extends GuiScreen {
|
||||
}
|
||||
|
||||
def refreshPage(): Unit = {
|
||||
document = PseudoMarkdown.parse(loadPage(history.top))
|
||||
document = PseudoMarkdown.parse(loadPage(Manual.history.top.path))
|
||||
documentHeight = PseudoMarkdown.height(document, documentMaxWidth, fontRendererObj)
|
||||
scrollTo(offset)
|
||||
}
|
||||
|
||||
def pushPage(path: String): Unit = {
|
||||
val resolvedPath = resolveLink(path, history.top)
|
||||
if (resolvedPath != history.top) {
|
||||
history.push(resolvedPath)
|
||||
scrollTo(0)
|
||||
val resolvedPath = resolveLink(path, Manual.history.top.path)
|
||||
if (resolvedPath != Manual.history.top.path) {
|
||||
Manual.history.push(new Manual.History(resolvedPath))
|
||||
refreshPage()
|
||||
}
|
||||
}
|
||||
|
||||
def popPage(): Unit = {
|
||||
if (history.size > 1) {
|
||||
history.pop()
|
||||
scrollTo(0)
|
||||
if (Manual.history.size > 1) {
|
||||
Manual.history.pop()
|
||||
refreshPage()
|
||||
}
|
||||
else {
|
||||
@ -215,7 +230,7 @@ class Manual extends GuiScreen {
|
||||
private def scrollDown() = scrollTo(offset + PseudoMarkdown.lineHeight(fontRendererObj) * 3)
|
||||
|
||||
private def scrollTo(row: Int): Unit = {
|
||||
offset = math.max(0, math.min(maxOffset, row))
|
||||
Manual.history.top.offset = math.max(0, math.min(maxOffset, row))
|
||||
val yMin = guiTop + scrollPosY
|
||||
if (maxOffset > 0) {
|
||||
scrollButton.yPosition = yMin + (scrollHeight - 13) * offset / maxOffset
|
||||
|
@ -15,6 +15,9 @@ import net.minecraft.world.World
|
||||
class Manual(val parent: Delegator) extends Delegate {
|
||||
override def onItemRightClick(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = {
|
||||
if (world.isRemote) {
|
||||
if (player.isSneaking) {
|
||||
gui.Manual.reset()
|
||||
}
|
||||
player.openGui(OpenComputers, GuiType.Manual.id, world, 0, 0, 0)
|
||||
}
|
||||
super.onItemRightClick(stack, world, player)
|
||||
@ -28,6 +31,7 @@ class Manual(val parent: Delegator) extends Delegate {
|
||||
player.openGui(OpenComputers, GuiType.Manual.id, world, 0, 0, 0)
|
||||
Minecraft.getMinecraft.currentScreen match {
|
||||
case manual: gui.Manual =>
|
||||
gui.Manual.reset()
|
||||
val descriptor = api.Items.get(new ItemStack(block))
|
||||
manual.pushPage("block/" + descriptor.name + ".md")
|
||||
case _ =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user