terasology / books Goto Github PK
View Code? Open in Web Editor NEWModule introducing books and bookcases
Module introducing books and bookcases
Way back in the olden days, in the time before time, bookcases had a filter on what items they would accept (only books, naturally). This was removed over time as the engine matured, and we might not have the original event anymore.
Mentioned briefly with more details at the bottom of #2
As a modder I would want to be able to attach quests (tasks) to a book. If the book is in a players inventory it should be active and if it is removed it should become inactive. I would want to define the book and the quest requirements in the same prefab.
As a player I would want to be able to find books in the world and acquire quests while I have said book.
See https://github.com/Terasology/QuestExamples for an example of a simple quest bound to an entity placed in the world. Update that module to depend on Books and place a book that has a quest attached to it in a chest spawned near the player. Handle logic for when the book enters and exits the player's inventory (might be some similar code in BookcaseSystem
)
Meaning book filtering wasn't working when connected to a headless client, yet was OK on the authority in a client/server + client two player setup running locally. Probably book drops as well.
Easy fix, got it ready, but trying to get into documenting changes better.
As somewhat of an extension to #21 I would want to be able to create a book (or even just a single piece of parchment, really - a scrip?) in-game and map text in the book to game objects. Imagine a merchant writing up a contract to acquire 20 wood trunk blocks for 2 silver pieces.
I would want to be able to enter an edit screen on a created book (or piece or parchment) and have the ability to add a text box or drop-down as a widget in-line with the text, then what I select or enter in that field should correspond to an in-game object (thus the idea for a drop-down - simply prefill with all valid objects, later probably provider some filtering/auto-complete)
A contract book/scrip likely would some hard-wired sections, unlike regular books. They might start prefilled with the selectors. The author would indicate the following things:
If a player has such a book/scrip that requests 5 dirt blocks in return for 2 stone blocks and presses the button with 5 dirt blocks in their inventory they should have those blocks subtracted and 2 stone blocks added.
Note that at some point it may make sense to develop a new module that simply depends on Books (such as a trading/merchant module and/or involve the existing Economy module)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Can't actually write anything so it is a pretty minor cosmetic issue.
To replicate: open a book, without changing pages (should start with the inside of the front cover + page one visible) click in the upper left of the inside cover and a blinking cursor will appear. You can't do anything with it like write stuff.
The HTML widgets in NUI currently can display images. It would be nice if books could do something similar, although that might be tricky vs. keeping the editing interface simple (how would you edit in an image?)
I would like to be able to craft books (and bookshelves) in JoshariasSurvival.
There is a crafting system of some note in JS already and some related items. For instance I believe you can crush wood into "wood chunks" which could probably be crushed a second time in a new workstation similar to the sifting station (so you can add water) to then create "wood pulp" (optionally include an additional step that produces saw dust and use that for the wood pulp combine)
With wood pulp created you could perhaps turn it into individual pieces of parchment in a regular assembly station by using metal plates or something as involved tools. Take the pieces of parchment (5? or one per page in the final book product?) and combine again with string to get a book.
Planks also exist (and could probably be used as the flat tools rather than metal plates?) and could be used as a recipe to make a bookshelf instead of a chest.
Creativity is welcome, research pre-industrial ways of manufacturing paper to come up with different recipes if desired. Could even make a tier 2 option using the mechanized workstations in JS to fashion an outright printing press of some sort.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
This ancient module still has a copy of the default font shipped under /assets/fonts
- that should be deleted and the books should use one of our standard Noto fonts.
Oddly when I tried to simply delete the font files and replace the one instance in bookScreen.skin
with Noto the main pages of a book no longer had any text appear. Not sure what I'm missing.
Did some testing! Still a few issues to look for
e
clicks. Try placing a chest when you spawn, without even having requested any book-related stuff via console. First e
click does nothing (almost like it is being caught by something else / consumed early) then the second click opens the cheste
click issue?~~~Quite possibly some of these predate the recent overhaul by @Waterpicker. I just fixed a JSON formatting issue and put -SNAPSHOT
back on the version number in module.txt (source should always be SNAPSHOT and Jenkins / release management handles the non-snaphots, lest things go boom). Also fixed some tabs -> spaces and a waaay outdated "craftPlace" thing
Actually, that appears to have fixed the e
eating. Yay! I fixed something :-)
Crash log:
14:28:44.714 [main] INFO o.t.logic.console.ConsoleImpl - [CONSOLE] You received an item of Books:bluebook
14:29:23.882 [main] ERROR o.terasology.engine.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.IndexOutOfBoundsException: Index: 3, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.terasology.books.rendering.nui.layers.BookScreen$3.get(BookScreen.java:145)
at org.terasology.books.rendering.nui.layers.BookScreen$3.get(BookScreen.java:136)
at org.terasology.rendering.nui.widgets.UILabel.getText(UILabel.java:65)
at org.terasology.rendering.nui.widgets.UILabel.onDraw(UILabel.java:89)
at org.terasology.rendering.nui.internal.CanvasImpl.drawStyledWidget(CanvasImpl.java:406)
at org.terasology.rendering.nui.internal.CanvasImpl.drawWidget(CanvasImpl.java:392)
at org.terasology.rendering.nui.layouts.relative.RelativeLayout.onDraw(RelativeLayout.java:78)
at org.terasology.rendering.nui.internal.CanvasImpl.drawStyledWidget(CanvasImpl.java:406)
at org.terasology.rendering.nui.internal.CanvasImpl.drawWidget(CanvasImpl.java:392)
at org.terasology.rendering.nui.CoreScreenLayer.onDraw(CoreScreenLayer.java:104)
at org.terasology.rendering.nui.internal.CanvasImpl.drawStyledWidget(CanvasImpl.java:406)
at org.terasology.rendering.nui.internal.CanvasImpl.drawWidget(CanvasImpl.java:392)
at org.terasology.rendering.nui.internal.NUIManagerInternal.render(NUIManagerInternal.java:468)
at org.terasology.engine.modes.StateIngame.renderUserInterface(StateIngame.java:234)
at org.terasology.engine.modes.StateIngame.render(StateIngame.java:218)
at org.terasology.engine.subsystem.lwjgl.LwjglGraphics.postUpdate(LwjglGraphics.java:189)
at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:423)
at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:369)
at org.terasology.engine.Terasology.main(Terasology.java:150)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
14:29:23.883 [main] INFO o.terasology.engine.TerasologyEngine - Shutting down Terasology...
14:29:23.966 [main] INFO o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
14:29:23.969 [main] INFO o.t.p.i.ReadWriteStorageManager - Saving - Snapshot created: Writing phase starts
14:29:23.972 [main] INFO o.t.n.internal.NetworkSystemImpl - Client disconnected: Cervator
14:29:23.976 [main] INFO o.t.logic.console.ConsoleImpl - [NOTIFICATION] Player "Cervator" has left the game
14:29:23.976 [main] INFO o.t.n.internal.NetworkSystemImpl - Network shutdown
14:29:25.282 [Saving-0] INFO o.t.p.internal.SaveTransaction - Save game finished
14:29:28.202 [main] WARN o.t.rendering.nui.asset.UIFormat - Field 'emptyIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UIIconBar","id":"breathBar","icon":"engine:icons#bubble","family":"breathBar","emptyIcon":"engine:icons#burstBubble","halfIconMode":"shrink","spacing":2,"maxIcons":10,"layoutInfo":{"use-content-width":true,"use-content-height":true,"position-left":{"target":"CENTER"},"position-right":{"target":"RIGHT","widget":"healthBar"},"position-bottom":{"target":"TOP","widget":"healthBar","offset":1}}}
14:29:28.203 [main] WARN o.t.rendering.nui.asset.UIFormat - Field 'crosshairIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UICrosshair","id":"crosshair","crosshairIcon":"engine:gui#crosshair","layoutInfo":{"use-content-width":true,"use-content-height":true,"position-horizontal-center":{},"position-vertical-center":{}}}
14:29:28.226 [main] WARN o.t.rendering.nui.skin.UISkinFormat - Failed to resolve UIWidget class UIInputBindButton, skipping style information
java.lang.IndexOutOfBoundsException: Index: 3, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.terasology.books.rendering.nui.layers.BookScreen$3.get(BookScreen.java:145)
at org.terasology.books.rendering.nui.layers.BookScreen$3.get(BookScreen.java:136)
at org.terasology.rendering.nui.widgets.UILabel.getText(UILabel.java:65)
at org.terasology.rendering.nui.widgets.UILabel.onDraw(UILabel.java:89)
at org.terasology.rendering.nui.internal.CanvasImpl.drawStyledWidget(CanvasImpl.java:406)
at org.terasology.rendering.nui.internal.CanvasImpl.drawWidget(CanvasImpl.java:392)
at org.terasology.rendering.nui.layouts.relative.RelativeLayout.onDraw(RelativeLayout.java:78)
at org.terasology.rendering.nui.internal.CanvasImpl.drawStyledWidget(CanvasImpl.java:406)
at org.terasology.rendering.nui.internal.CanvasImpl.drawWidget(CanvasImpl.java:392)
at org.terasology.rendering.nui.CoreScreenLayer.onDraw(CoreScreenLayer.java:104)
at org.terasology.rendering.nui.internal.CanvasImpl.drawStyledWidget(CanvasImpl.java:406)
at org.terasology.rendering.nui.internal.CanvasImpl.drawWidget(CanvasImpl.java:392)
at org.terasology.rendering.nui.internal.NUIManagerInternal.render(NUIManagerInternal.java:468)
at org.terasology.engine.modes.StateIngame.renderUserInterface(StateIngame.java:234)
at org.terasology.engine.modes.StateIngame.render(StateIngame.java:218)
at org.terasology.engine.subsystem.lwjgl.LwjglGraphics.postUpdate(LwjglGraphics.java:189)
at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:423)
at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:369)
at org.terasology.engine.Terasology.main(Terasology.java:150)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
For more details, see the log files in J:\Dev\Terasology\Git\integrate\Terasology\logs\2016-06-18_14-21-06
The recipe in Recipes/pickaxe.prefab
seems to be and example for how to make a book recipe. Without this example "as-code" the dependency to CoreAssets
can be removed.
Instead, this information should be contained in the README.
When the player opens the recipe book and turns the page twice, to display the recipes, a nullpointer exception occurs and the recipes do not display correctly. Here is the stacktrace:
java.lang.NullPointerException: null
at org.terasology.books.RecipeParagraph.<init>(RecipeParagraph.java:46)
at org.terasology.books.rendering.nui.layers.BookScreen.createRecipeParagraph(BookScreen.java:176)
at org.terasology.books.rendering.nui.layers.BookScreen.createParagraphs(BookScreen.java:159)
at org.terasology.books.rendering.nui.layers.BookScreen.createDocument(BookScreen.java:142)
at org.terasology.books.rendering.nui.layers.BookScreen.updatePage(BookScreen.java:226)
at org.terasology.books.rendering.nui.layers.BookScreen.lambda$initialise$0(BookScreen.java:314)
at org.terasology.rendering.nui.widgets.UIButton.activate(UIButton.java:208)
at org.terasology.rendering.nui.widgets.UIButton.access$100(UIButton.java:41)
at org.terasology.rendering.nui.widgets.UIButton$1.onMouseRelease(UIButton.java:99)
at org.terasology.rendering.nui.internal.CanvasImpl.processMouseRelease(CanvasImpl.java:247)
at org.terasology.rendering.nui.internal.NUIManagerInternal.mouseButtonEvent(NUIManagerInternal.java:576)
at org.terasology.rendering.nui.internal.NUIManagerInternalMethodAccess.invoke(Unknown Source)
at org.terasology.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:531)
at org.terasology.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:301)
at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:280)
at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:204)
at org.terasology.input.InputSystem.send(InputSystem.java:367)
at org.terasology.input.InputSystem.sendMouseEvent(InputSystem.java:354)
at org.terasology.input.InputSystem.processMouseButtonInput(InputSystem.java:184)
at org.terasology.input.InputSystem.processMouseInput(InputSystem.java:169)
at org.terasology.input.InputSystem.update(InputSystem.java:129)
at org.terasology.engine.modes.StateIngame.handleInput(StateIngame.java:192)
at org.terasology.engine.subsystem.lwjgl.LwjglInput.postUpdate(LwjglInput.java:55)
at org.terasology.engine.TerasologyEngine.tick(TerasologyEngine.java:467)
at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:421)
at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:397)
at org.terasology.engine.Terasology.main(Terasology.java:155)
I think this might be a nice example, as it contains a lot of text as well. There are images play the role I described at 5 above, meaning that they play as a summary of the text, thus the user will read it only if they really want to see further details.
I don't think it is necessary to have the buttons on top of the book, but it's an idea as well.
As noted near the bottom of #2 we could use some page numbers and maybe move things around for a more polished interface.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.