-- I know I should be wrapping my text, rather than making the lines super long, but ya know what, if it bothers you so much just fix it yourself. :P

local bg_screen = --32px resolution
   'formspec_version[3]'..
   'size[12,8]'..
   'bgcolor[;neither]'..
   'background[-1,-1;14,10;sss_items_book_bg.png]'..
   'style_type[textarea;border=true;font_size=24;textcolor=black]'

local handbook_cadet =
   bg_screen..
   'textarea[.75,0;5,8;;; So you want to be a cadet, it\'s not all fun and games, unlike a civilian you will have an important job to do.]'..
   'textarea[6.3125,0;5,8;;; You will be responsible for carrying out tasks from higher ranking officers, usually tasks they just don\'t want to do themselves. '..
   'You can expect a lot of mundane tasks, and even downright awful tasks, but this is the first step to climbing the ranks. '..
   'It should be mentioned that there are benefits, the food is much better, and the living quarters are nicer as well.]'

local handbook_mechanic =
   bg_screen..
   'textarea[.75,0;5,8;;; The mechanic keeps the ship running and is mostly independent. Other than the head engineer and Captain nobody tells you what to do.]'..
   'textarea[6.3125,0;5,8;;; Food and living quarters are greatly improved over a lowly cadet, and you have access to many areas that are otherwise off limits.'..
   ' It\'s not all fun and games though. Some maintenance work is extremely dangerous, working on engines, or going on space walks.'..
   ' You may face extreme peril, but you literally hold hundreds of lives in your hands on a daily basis. This is not a job for the faint of heart or soy boys.]'

local handbook_orange =
   bg_screen..
   'textarea[.75,0;5,8;;;I only had three weeks, what do you expect of me?]'..
   'textarea[6.3125,0;5,8;;;Obviously I can\'t fully flesh out every book in the game. '..
   'Plus with different size screens the text renders differently and there is no good way to make multiple paged books outside of using textures for every page,'..
   ' which I could do, but again I only have three weeks.]'

local handbook_blue =
   bg_screen..
   'textarea[.75,0;5,8;;;I only had three weeks, what do you expect of me? I could fill the books with that fake Latin text I suppose, but time constraints.]'..
   'textarea[6.3125,0;5,8;;;Obviously I can\'t fully flesh out every book in the game. '..
   'Plus with different size screens the text renders differently and there is no good way to make multiple paged books outside of using textures for every page, '..
   'which I could do, but again I only have three weeks.]'

local handbook_blue_1 =
   bg_screen..
   'textarea[.75,0;5,8;;;So we had a bit of a space storm last night. Sounded pretty bad. There\'s been a lot of activity since that. I don\'t know what exactly is going on, but I have a feeling this could be big trouble.]'..
   'textarea[6.3125,0;5,8;;;I overheard somebody saying something about more damage then expected. I hope we have the parts to fix whatever got damaged.]'

local handbook_blue_2 =
   bg_screen..
   'textarea[.75,0;5,8;;;So my mates thought that it would be funny to get me a book with a submarine on the cover when they heard I made the draw for the ship\'s crew. Real funny guys, real funny. Man I miss them, but they\'ll hopefully make it on one of the next trips. With only one trip every six year that could be a while.]'..
   'textarea[6.3125,0;5,8;;;They want me to record things here so when I arrive I can transpond it to them and they can see what exactly they are getting themselves into. I told them it will be just like school, I mean we literally train in a replica of the ship.]'


local handbook_purple =
   bg_screen..
   'textarea[.75,0;5,8;;;Sometimes I worry about this trip. Six years is such a long time to be in space. What if something happens to our ship, who would rescue us?]'..
   'textarea[6.3125,0;5,8;;;I heard the others talking about some high ranking passengers. I guess they\'re in deep sleep. Maybe I can get an autograph when we arrive..... ]'

local handbook_green =
   bg_screen..
   'textarea[.75,0;5,8;;;So I was given this by my parents when I embarked on this journ-ie-y, ugh. (I can\'t figure out how to spell that.) Anyway they said it would be good to keep a log of sorts of the trip.]'..
   'textarea[6.3125,0;5,8;;;Allegedly there are better oppertunities on smyrna, hard to say what is really going on, we get so little news, and it takes so long for news to get to earth even with our long range radios. I guess all the bouncing back and forth between satelites can be flakey.]'

local handbook_green_1 =
   bg_screen..
   'textarea[.75,0;5,8;;;I HATE THIS TRIP. EVERYTHING ABOUT IT SUCKS. NEVER SHOULD HAVE LET MY PARENTS TALK ME INTO THIS JOB. ]'..
   'textarea[6.3125,0;5,8;;;I CAN\'T DO ANYTHING FUN, NO WINDOWS TO SEE ANYTHING OUT OF, AND ALL THE MOVIES THAT WE HAVE IVE SEEN LIKE A DOZEN TIMES.]'

local handbook_green_2 =
   bg_screen..
   'textarea[.75,0;5,8;;;I need an AI to write these things for me.]'..
   'textarea[6.3125,0;5,8;;;This is just taking too much time. Although there is the story element I need to weave in. Hmm.]'

local handbook_red =
   bg_screen..
   'textarea[.75,0;5,8;;;So I like totally got this rad journal to record my thoughts in, and OMG the captain is SOOO CUTE!!! Like I can\'t even. I really want to get a picture with him, but that would be soooo awkward, plus like who would I show it too?\n I have no idea what the cover says, but the graphics just spoke me to, yaknow. ]'..
   'textarea[6.3125,0;5,8;;;My duties aren\'t too bad, mostly running around getting things for the officers, same as any of the other cadets.\n The food leaves a bit to be desired, but I\'ll take this over what the passengers are eating any day.]'

local handbook_1 =
   bg_screen..
   'textarea[.75,0;5,8;;;We had quite the storm the other day. It knocked our long range radios offline. I went out with a few mechanics to assess the damage, and well honestly we\'re screwed. The debris field should not have caused this level of damage. There was no indication of any pre-existing damage, as we regularly do inspections, and they\'ve all been good.]'..
   'textarea[6.3125,0;5,8;;;The question is what happened? Sabotage? The radios are well guarded and have shields to prevent this from happening. We are blind right now. No way to communicate with earth or Smyrna. Radar isn\'t really much use out here as there is nothing to navigate against, though it does help prevent collisions with space rocks. There is but little chance that we can repair the damage and find our course.]'

local handbook_2 =
   bg_screen..
   'textarea[.75,0;5,8;;;Well we had a funeral today, I should be used to these things by now. It\'s not like I\'ve never officiated one before. Was a young man, a cadet. Personally I always thought there was something a little off about him, but I have no say in the screening process, that\'s left up to far higher ranking people.]'..
   'textarea[6.3125,0;5,8;;;There is something chilling about wrapping a body in a plastic bag and jettisoning it out into the void of space. People will say we should bring the bodies along to the end of the journey so they can get a proper burial, but we still have nearly three years before we arrive. We have neither the facilities or the skill to store a body for that length of time without it just rotting completely away.]'

local handbook_3 =
   bg_screen..
   'textarea[.75,0;5,8;;;I know people are going to say I\'m crazy, but I can\'t help but think that somebody has sabotaged this journey. The damage that was reported from that storm we went through was NOT typical of a space storm. I saw that pictures the mechanics took, somebody wants us dead.]'..
   'textarea[6.3125,0;5,8;;;I\'m not privy to the passengers in deep sleep, but it was rumored that there were a few VERY IMPORTANT people onboard. I don\'t know if I can believe somebody would be willing to sacrifice the entire crew and all the passengers just to kill a few people, but then again it is the perfect plan...]'

local handbook_4 =
   bg_screen..
   'textarea[.75,0;5,8;;;A trip like this, it\'s hard to believe, people wait for years to spend six more years couped up in a little ship floating about in the vastness of space. Why do we all have to be so uncontent with our lot in life. I suppose I\'m not one to talk, having taken this trip several times, but this is my job. The passengers I\'ll never understand. I realize it is cheaper to not go into deep sleep in those cyrogenic chambers but certainly passing six years without aging or knowing it was six years has to be worth the money.]'..
   'textarea[6.3125,0;5,8;;;Most of these people have spent their life working to save money for the trip, then they piss away six years of their life to get to another planet, to spend the rest of their life working to finish paying off the trip.]'

local handbook_5 =
   bg_screen..
   'textarea[.75,0;5,8;;;This trip is going to be my last, I\'ve made up my mind. I gotta settle down and get married. Obviously as a married man I wouldn\'t be allowed to keep this job, due to the company policies, but I should be okay with my wages from this trip.]'..
   'textarea[6.3125,0;5,8;;;I guess it makes sense to not allow married people on as crew, too much potential for drama and family issues. When we\'re all stuck together for six years, well its just a recipe for bad things to happen.]'

local handbook_6 =
   bg_screen..
   'textarea[.75,0;5,8;;;831 days, almost two and a half years or so. Honestly I\'m surprised he lasted this long. It\'s not my place, as the captain of this ship, to be happy when a crew member passes, but there was something off about that young man. I honestly did\'t expect him to last this long. It could have just been me, but I feel like he had some odd fasination with me, and I don\'t think it had anything to do with my being the captain.]'..
   'textarea[6.3125,0;5,8;;;I\'d never met him before we took off, a late addition. I suppose somebody that knew him had a lot of money to get him aboard. Always had a weird feeling when he was around. I know nothing about his life before the ship, as there is close to zero resources available to us on the ship to do any sort of research.]'

minetest.register_craftitem('sss_items:handbook_orange', {
   description = 'Handbook',
   inventory_image = 'sss_items_handbook_orange.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_orange)
   end
})

minetest.register_craftitem('sss_items:handbook_blue', {
   description = 'Handbook',
   inventory_image = 'sss_items_handbook_blue.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_blue)
   end
})

minetest.register_craftitem('sss_items:handbook_blue_1', {
   description = 'Handbook',
   inventory_image = 'sss_items_handbook_blue_1.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_blue_1)
   end
})

minetest.register_craftitem('sss_items:handbook_blue_2', {
   description = 'Handbook',
   inventory_image = 'sss_items_handbook_blue_2.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_blue_2)
   end
})

minetest.register_craftitem('sss_items:handbook_purple', {
   description = 'Handbook',
   inventory_image = 'sss_items_handbook_purple.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_purple)
   end
})

minetest.register_craftitem('sss_items:handbook_green', {
   description = 'Handbook',
   inventory_image = 'sss_items_handbook_green.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_green)
   end
})

minetest.register_craftitem('sss_items:handbook_green_1', {
   description = 'Journal',
   inventory_image = 'sss_items_handbook_green_1.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_green_1)
   end
})

minetest.register_craftitem('sss_items:handbook_green_2', {
   description = 'Journal',
   inventory_image = 'sss_items_handbook_green_2.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_green_2)
   end
})

minetest.register_craftitem('sss_items:handbook_red', {
   description = 'Journal',
   inventory_image = 'sss_items_handbook_red.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_red)
   end
})

minetest.register_craftitem('sss_items:handbook_cadet', {
   description = 'Cadet\'s Handbook',
   inventory_image = 'sss_items_handbook_cadet.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_cadet)
   end
})

minetest.register_craftitem('sss_items:handbook_mechanic', {
   description = 'Mechanic\'s Handbook',
   inventory_image = 'sss_items_handbook_mechanic.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_mechanic)
   end
})

minetest.register_craftitem('sss_items:handbook_1', {
   description = 'Random Journal',
   inventory_image = 'sss_items_handbook_1.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_1)
   end
})

minetest.register_craftitem('sss_items:handbook_2', {
   description = 'Random Journal',
   inventory_image = 'sss_items_handbook_2.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_2)
   end
})

minetest.register_craftitem('sss_items:handbook_3', {
   description = 'Random Journal',
   inventory_image = 'sss_items_handbook_3.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_3)
   end
})

minetest.register_craftitem('sss_items:handbook_4', {
   description = 'Random Journal',
   inventory_image = 'sss_items_handbook_4.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_4)
   end
})

minetest.register_craftitem('sss_items:handbook_5', {
   description = 'Random Journal',
   inventory_image = 'sss_items_handbook_5.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_5)
   end
})

minetest.register_craftitem('sss_items:handbook_6', {
   description = 'Random Journal',
   inventory_image = 'sss_items_handbook_6.png',
   on_use = function(itemstack, user)
      local name = user:get_player_name()
      minetest.show_formspec(name, 'sss_items:handbook', handbook_6)
   end
})
