diff --git a/README.md b/README.md index cbf03e1..06ad71f 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ It was limited at the source. You can modify it by your own, just making the rol * Left/right: Turn to left/right, work on and out ground. * Left and Right together: center all commands * Sneak and Jump together: give/take the controls to/from pilot student +* Up and Down together: enable/disable HUD ----------------------- License of source code: diff --git a/hidroplane_manual.lua b/hidroplane_manual.lua new file mode 100644 index 0000000..f480fd7 --- /dev/null +++ b/hidroplane_manual.lua @@ -0,0 +1,174 @@ +dofile(minetest.get_modpath("hidroplane") .. DIR_DELIM .. "hidroplane_global_definitions.lua") + +-------------- +-- Manual -- +-------------- + +function hidroplane.manual_formspec(name) + local basic_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_bg.png]" + }, "") + + basic_form = basic_form.."button[1.75,1.5;4,1;short;Shortcuts]" + basic_form = basic_form.."button[1.75,3.5;4,1;panel;Panel]" + basic_form = basic_form.."button[1.75,5.5;4,1;fuel;Refueling]" + basic_form = basic_form.."button[1.75,7.5;4,1;op;Operation]" + basic_form = basic_form.."button[10.25,1.5;4,1;paint;Painting]" + basic_form = basic_form.."button[10.25,3.5;4,1;tips;Tips]" + + minetest.show_formspec(name, "hidroplane:manual_main", basic_form) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname == "hidroplane:manual_main" then + if fields.short then + local text = { + "Shortcuts \n\n", + "* Right click: enter in/get off plane \n", + "* Left click (with biofuel): add fuel to plane \n", + "* Right click and Sneak: enter in flight instructor mode (limited \n", + " vision, so use external camera) \n", + "* E: Start/stop engine \n", + "* Jump: Increase power, forward on ground \n", + "* Sneak: Decrease power, brake on ground \n", + "* Backward: go up flying - nose up \n", + "* Forward: go down flying - nose down \n", + "* Left/right: Turn to left/right, work on and out ground. \n", + "* Left and Right together: center all commands \n", + "* Sneak and Jump together: give/take the controls to/from \n", + " pilot student \n", + "* Up and Down together: enable/disable HUD" + } + local shortcut_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_bg.png]", + "image[0.5,3.75;6,6;hidroplane_manual_up_view.png]", + "label[9.25,0.5;", table.concat(text, ""), "]", + }, "") + minetest.show_formspec(player:get_player_name(), "hidroplane:manual_shortcut", shortcut_form) + end + if fields.panel then + local text = { + "The Panel \n\n", + "In front of the pilot is the instrument panel. \n", + "It's used to obtain important flight information, namely: \n", + "rate of climb/descent, speed, power applied and fuel level. \n\n", + "The climber is the instrument that indicates the rate \n", + " of climb and descent, it's on the left of the panel, \n", + " marked with the letter C in blue. \n", + "The speed indicator indicates the longitudinal speed of the \n", + " aircraft. It's on the center of the panel and is marked \n", + " with the letter S in white. \n", + "The power gauge indicates the power applied to the engine. \n", + "It's at upper right position of the panel, with an yellow P. \n", + "The fuel gauge, located on the right and below, indicates the \n", + "fuel available on the aircraft. It's marked with the green F." + } + local panel_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_bg.png]", + "image[0.2,1.75;7,7;hidroplane_manual_panel.png]", + "label[9.25,0.5;", table.concat(text, ""), "]", + }, "") + minetest.show_formspec(player:get_player_name(), "hidroplane:manual_panel", panel_form) + end + if fields.fuel then + local text = { + "Fuel \n\n", + "To fly, the aircraft needs fuel for its engine. So it is \n", + "necessary to supply it. To do this, it is necessary to \n", + "have the selected fuel in hand and punch it in the float. \n", + "Depending on the fuel mod used and which container, a \n", + "greater or lesser number of fuel units may be required to \n", + "fill the tank. In the case of the Lokrates biofuel mod, \n", + "with 10 bottles it is possible to fill the tank. With the \n", + "vial, 40 units will be needed. \n", + "Don't forget to check the fuel gauge on the panel." + } + local fuel_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_bg.png]", + "image[2,3.75;4,2;hidroplane_manual_fuel.png]", + "label[9.25,0.5;", table.concat(text, ""), "]", + }, "") + minetest.show_formspec(player:get_player_name(), "hidroplane:fuel", fuel_form) + end + if fields.op then + local text = { + "Operation \n\n", + "The aircraft can operate directly from the water or land. \n", + "When operating on land the landing gear will \n", + "automatically extend. \n", + "When boarding the aircraft, centralize the commands (A \n", + "and D keys), press E to start the engine and hold Jump \n", + "until the power reaches maximum. When the speed \n", + "reaches the green range, lightly pull the stick using the S \n", + "key. Always keep the speed within the green range to \n", + "avoid stalling. To land, remove all power, but keep the \n", + "speed at the limit between the green and white range, \n", + "still in the green. When you are about to touch the soil or \n", + "water, lightly pull the stick to level and touch it gently. \n", + "It's possible to operate with an external camera, \n", + "activating the HUD. \n", + "It's possible for a passenger to board the aircraft, just \n", + "click the right button on the floater. But the passenger \n", + "will only be able to enter if the pilot has already boarded." + } + local op_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_bg.png]", + "image[0.5,1.75;6,6;hidroplane_manual_side_view.png]", + "label[9.25,0.5;", table.concat(text, ""), "]", + }, "") + minetest.show_formspec(player:get_player_name(), "hidroplane:op", op_form) + end + if fields.paint then + local text = { + "Painting \n\n", + "Painting the aircraft is quite simple. It works in the same \n", + "way as the fuel supply, but instead of using fuel to punch \n", + "the floater, use a dye of the chosen color." + } + local paint_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_colors.png]", + "label[9.25,0.5;", table.concat(text, ""), "]", + }, "") + minetest.show_formspec(player:get_player_name(), "hidroplane:paint", paint_form) + end + if fields.tips then + local text = { + "Tips \n\n", + "* During a stall, centralize the controls (A + D shortcut) \n", + " and apply maximum power, then gently pull the control. \n", + "* The \"repair tool\" can repair damage suffered by the \n", + " aircraft. To use it, have some steel ingots in the \n", + " inventory, which will be subtracted for repair \n", + "* There is a turbo mode that can be used for long climbs, \n", + " just hold the jump key. But be careful with the angle of \n", + " attack, because even with full power it is not possible to \n", + " climb with an angle of attack that is too high. \n", + "* When boarding as a flight instructor, use \n", + " the external camera with the hud on. \n", + "* As an instructor, only pass control to the student at \n", + " altitudes that allow time for reaction, unless you \n", + " already trust that student.", + } + local tips_form = table.concat({ + "formspec_version[3]", + "size[16,10]", + "background[-0.7,-0.5;17.5,11.5;hidroplane_manual_bg.png]", + "label[0.5,0.5;", table.concat(text, ""), "]", + }, "") + minetest.show_formspec(player:get_player_name(), "hidroplane:tips", tips_form) + end + end +end) + diff --git a/init.lua b/init.lua index 1d291be..8467234 100644 --- a/init.lua +++ b/init.lua @@ -31,6 +31,7 @@ dofile(minetest.get_modpath("hidroplane") .. DIR_DELIM .. "hidroplane_fuel_manag dofile(minetest.get_modpath("hidroplane") .. DIR_DELIM .. "hidroplane_custom_physics.lua") dofile(minetest.get_modpath("hidroplane") .. DIR_DELIM .. "hidroplane_utilities.lua") dofile(minetest.get_modpath("hidroplane") .. DIR_DELIM .. "hidroplane_entities.lua") +dofile(minetest.get_modpath("hidroplane") .. DIR_DELIM .. "hidroplane_manual.lua") -- -- helpers and co. @@ -82,3 +83,12 @@ minetest.register_chatcommand("hydro_eject", { end }) +minetest.register_chatcommand("hydro_manual", { + params = "", + description = "Hydroplane operation manual", + privs = {interact = true}, + func = function(name, param) + hidroplane.manual_formspec(name) + end +}) + diff --git a/textures/hidroplane_manual_bg.png b/textures/hidroplane_manual_bg.png new file mode 100644 index 0000000..1cdb4fd Binary files /dev/null and b/textures/hidroplane_manual_bg.png differ diff --git a/textures/hidroplane_manual_colors.png b/textures/hidroplane_manual_colors.png new file mode 100644 index 0000000..79e2060 Binary files /dev/null and b/textures/hidroplane_manual_colors.png differ diff --git a/textures/hidroplane_manual_fuel.png b/textures/hidroplane_manual_fuel.png new file mode 100644 index 0000000..dde2eb6 Binary files /dev/null and b/textures/hidroplane_manual_fuel.png differ diff --git a/textures/hidroplane_manual_panel.png b/textures/hidroplane_manual_panel.png new file mode 100644 index 0000000..ee12c33 Binary files /dev/null and b/textures/hidroplane_manual_panel.png differ diff --git a/textures/hidroplane_manual_side_view.png b/textures/hidroplane_manual_side_view.png new file mode 100644 index 0000000..6f3accf Binary files /dev/null and b/textures/hidroplane_manual_side_view.png differ diff --git a/textures/hidroplane_manual_up_view.png b/textures/hidroplane_manual_up_view.png new file mode 100644 index 0000000..cfa5d2c Binary files /dev/null and b/textures/hidroplane_manual_up_view.png differ