#-----------------------------------------------------#
             THANK YOU FOR READING ME!
#-----------------------------------------------------#

To make a tome, call the function "MakeTome" in modmain.lua
It is global like most variables, so you need to use
"GLOBAL.MakeTome(...)" to access it.

The Parameters (the ... in above example) are:

1) name of the prefab
	- It should be unique.
	- You can set name, description and recipe with that name.
	- If you want to do any fancy code magic with the prefab,
	  you can use AddPrefabPostInit as with any basegame prefab.
	
2) table with page data
	- most likely the actual reason you even make the tome
	- The data table contains another table for each page.
	  That means each page is a table in a "portfolio table".
	- Each page can have a field "head", "page", "atlas" and "tex".
	- I recommend multi-line strings for the page field.
	- example at the end
	- Due to the way Lua works, you can modify the table at any
	  time and it will change in the book too.

3)anim name
	- the animation that plays when on the ground
	- also the image displayed in the inventory
	- you can use the following existing ones:
		- book_sleep (blue with gold ornaments)
		- book_gardening (green with yellow label)
		- book_brimstone (red and damaged)
		- book_birds (dark red with elegant patterns)
		- book_tentacles (purple with spiral)

4) name of custom animation for the item
	- This is optional.
	- This name is used for the animation file.
	- This name is used for the build and bank.
	- This name is used for the inventory image atlas.
	- The previous parameter is still used for the animation.
	- The inventory image is still the previous one too.
	- If no custom animation is given, the default one will be loaded.

5) whether (and how) the book spawns when starting a new world
	- This is optional.
	- only works when generating a new game
	- If it's "FAR", the book will spawn anywhere in the
	  world (often near a road).
	- If it's "NEAR" (or true), it'll appear just on the
	  border of the screen.
	- If it's false or nil, no book will be spawned.
	- can be forced or disabled in the mod options (!)
	- You can use your own spawning method instead (e.g. SetPiece)

6) spawn chance when generating
	- This is optional and extends the previous setting.
	- The lower this number is, the rarer the book spawns.
	- If it's not given, the book will always spawn.
	- It defaults to 100% if forced in the options,
	  UNLESS you set it to -1, that'll prevent spawning.

7) table with "Table of Contents" data
	- This is optional.
	- If you aren't making a tome for pages of text, then you're making it for this.
	- This is the data for the button page at the beginning, the index.
	- The data table contains another table for each button.
	- Every button can have a custom name, have a brief tooltip/hovertext,
	  link to a specific header, execute a unique function callback
	  and disable itself if needed.
	- No field is required (as with pages), but names are useful.
	- example at the end

8) whether the book can only be iterated by the ToC
	- This is optional and extends the previous setting.
	- If set to true, it'll prevent the player from skimming to
	  pages with a different header. Pages without header are
	  considered as part of the left (previous) header.
	  
9) whether the book is floatable in ShipWrecked
	- This is false by default.
	- If set to true when using a custom build, make sure to set a "_water" animation!

#-----------------------------------------------------#
                      EXAMPLES
#-----------------------------------------------------#
using a hypothetical bug-themed mod:

all_buttons = {
	{
		name = "Equipment", --button name
		goto = "Hazmat Gear", --header name
	},{
		name = "Summon Moth",
		
		hover = "Click here to summon a bug!",

		cb = function(book,screen) --the callback function
			local moth = GLOBAL.SpawnPrefab("bugmoth") --we are in modmain.lua, hence global
			--you can probably imagine the rest of this, there's good game file examples
		end
	},{
		name = "Open R&D",
		
		cb = function(book,screen)
			--properly close the screen
			TheFrontEnd:PopScreen(screen)
			if not screen.was_paused then
				SetPause(false)
			end
			GLOBAL.GetWorld():PushEvent("continuefrompause")
			--now open the R&D screen that we haven't actually made because this is an example
			TheFrontEnd:PushScreen(RnDScreen())
		end
		
		condition = function(book) --the test whether to enable this button
			return GLOBAL.HasUnlockedBugResearch --assuming we have a global variable for that
			--more complicated tests are possible, but this is an example
		end
	}
}

all_pages = {
	{
		--no header is no problem!
		page = [[On your journey, you will notice many wild and --main text body
			threatening bugs. Most of them are harmless at first, --remember to make paragraphs!
			but can infect you with harmful diseases or grow out
			of control.]],
		atlas = "images/guide/web.xml", --images are behind the text, fit for backgrounds
		tex = "web.tex", --this is a premade background (as seen in "images/guide" in this mod)
	},
	{
		head = "Hazmat Gear", --header (title)
		page = [[To combat this threat, you need proper protection
		and utility. You can craft the hazmat suit and the
		"gas pain" at abandoned insect labs found all over
		the world.
		
		The hazmat gear works exceptionally well against bugs,
		but not against other creatures. (Spiders aren't bugs)]],
		--no background anymore
	},
	{
		--no field is required, in fact you could make an empty page (which is boring though)
		atlas = "images/guide/bugmod/bugmod1.xml", --try to keep your files in a folder...
		tex = "bugmod1.tex", --...that way you won't clash with other mods as easily.
	},
} --end of the package (the data table)



Remember that you still need to set the strings for
the tome's name and character examination! (as said above)

If you have any concerns, notice any bugs, or want
to request new features, feel free to contact me
via the Klei Forums or Steam. (username: mobbstar)