File: tree_help.lua

package info (click to toggle)
widelands 1%3A21-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 594,308 kB
  • sloc: cpp: 134,669; ansic: 18,676; python: 7,200; sh: 912; xml: 439; makefile: 175
file content (27 lines) | stat: -rw-r--r-- 802 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- RST
-- tree_help.lua
-- -------------
--
-- This script returns a formatted entry for the tree help in the editor.
-- Pass the internal tree name to the coroutine to select the tree type.

include "scripting/richtext.lua"
include "scripting/help.lua"

return {
   func = function(tree_name)
      set_textdomain("widelands_editor")
      local world = wl.World();
      local tree = wl.Editor():get_immovable_description(tree_name)
      local result = li_object(tree.name, "")

      -- TRANSLATORS: A header in the editor help. Terrains preferred by a type of tree.
      result = result .. vspace(3) .. h2(vspace(12) .. _"Preferred terrains") .. vspace(3)
      result = result .. terrain_affinity_help(tree)

      return {
         title = tree.species,
         text = result
      }
   end
}