← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/document_world into lp:widelands

 

Some proofreading. The part in new_editor_<element_type>_category{table} is quite complicated for me.

Did not read all.

Diff comments:

> === modified file 'data/world/critters/badger/init.lua'
> --- data/world/critters/badger/init.lua	2017-02-12 09:10:57 +0000
> +++ data/world/critters/badger/init.lua	2017-09-01 07:57:51 +0000
> @@ -1,3 +1,14 @@
> +-- RST
> +-- .. _lua_world_critters:
> +--
> +-- Critters (Animals)
> +-- ------------------
> +--
> +-- Critters are entities owned by the world that will move around the map at random, usually animals.
> +--

But no Fish.

> +-- Critters are defined in
> +-- ``data/world/critters/<critter_name>/init.lua``.
> +
>  dirname = path.dirname(__file__)
>  
>  animations = {
> 
> === modified file 'data/world/immovables/bush1/init.lua'
> --- data/world/immovables/bush1/init.lua	2015-11-03 18:18:27 +0000
> +++ data/world/immovables/bush1/init.lua	2017-09-01 07:57:51 +0000
> @@ -1,5 +1,101 @@
> +-- RST
> +-- .. _lua_world_immovables:
> +--
> +-- Immovables
> +-- ----------
> +--
> +-- Immovables are entities owned by the world that are placed in a fixed position
> +-- on the map. They include trees, rocks, artifacts, and eye candy.
> +--
> +-- Immovables are defined in
> +-- ``data/world/immovables/<immovable_name>/init.lua``.
> +-- Some immovables are grouped into subdirectories, e.g. trees and rocks.
> +-- There are also some specialized immovables:
> +--
> +-- * `Artifacts`_
> +-- * `Rocks`_
> +-- * `Trees`_
> +
>  dirname = path.dirname(__file__)
>  
> +-- RST
> +-- .. function:: new_immovable_type{table}
> +--
> +--    This function adds the definition of an immovable to the engine.
> +--
> +--    :arg table: This table contains all the data that the game engine will add
> +--       to this immovable. It contains the following entries:
> +--
> +--    **name**
> +--        *Mandatory*. A string containing the internal name of this immovable, e.g.::
> +--
> +--            name = "alder_summer_old",
> +--
> +--    **descname**
> +--        *Mandatory*. The translatable display name, e.g.::
> +--
> +--            descname = _"Alder (Old)",
> +--
> +--    **species**
> +--        *Mandatory for trees*. `Trees`_ have 4 variants (sapling, pole, mature, and old),
> +--        so we will want a simplified translatable display name for the editor help, e.g.::
> +--
> +--            species = _"Alder",
> +--
> +--    **editor_category**
> +--        *Mandatory*. The category that is used in the editor tools for placing an
> +--        immovable of this type on the map, e.g.::
> +--
> +--            editor_category = "trees_deciduous",
> +--
> +--    **size**
> +--        *Optional*. The size of the immovable. Defaults to ``none``. Possible values

size has effect on placing roads. Immovable with size 'none' get removed when place for a road is needed.

> +--        are ``none``, ``small``, ``medium``, and ``big``, e.g.::
> +--
> +--            size = "small",
> +--
> +--    **attributes**
> +--        *Optional*. Attributes can be used by other programs to identify a class
> +--        of immovables, e.g.::
> +--
> +--            attributes = { "tree" }, -- This is a tree, so it can be felled
> +--
> +--    **programs**
> +--        *Mandatory*. Every immovable has an automatic default program,
> +--        which will simply play the ``idle`` animation. Leave the table empty if
> +--        this is all you need. You can also overwrite this default ``program``,
> +--        like this::
> +--
> +--            program = {
> +--               "animate=idle 50000",
> +--               "remove=18",
> +--               "grow=alder_summer_old",
> +--            },
> +--
> +--    **terrain_affinity**
> +--        *Mandatory for trees*. If your immovable is a tree (c.f. `Trees`_), you will need to specify its
> +--        terrain affinity, which will determine its chances to survive on different
> +--        terrains. Terrain affinity is a table and looks like this::
> +--
> +--          terrain_affinity = {
> +--             -- Temperature is in arbitrary units.
> +--             preferred_temperature = 125,
> +--
> +--             -- In percent (1 being very wet).
> +--             preferred_humidity = 0.65,
> +--
> +--             -- In percent (1 being very fertile).
> +--             preferred_fertility = 0.6,
> +--
> +--             -- A value in [0, 1] that defines how well this immovable can deal with non-ideal terrain.
> +--             -- A lower value means that it is less picky, i.e. it can deal better with it.
> +--             pickiness = 0.6,
> +--          }
> +--
> +--    **animations**
> +--        *Mandatory*. A table containing all animations for this immovable.
> +--        Every immovable needs to have at least an ``idle`` animation.
> +--        See :doc:`animations` for a detailed description of the animation format.
>  world:new_immovable_type{
>     name = "bush1",
>     descname = _ "Bush",
> 
> === modified file 'data/world/init.lua'
> --- data/world/init.lua	2017-02-12 09:10:57 +0000
> +++ data/world/init.lua	2017-09-01 07:57:51 +0000
> @@ -1,3 +1,45 @@
> +-- RST
> +-- init.lua
> +-- --------
> +--
> +-- World initialization.
> +-- All world entities are loaded via this file.
> +--
> +-- This file also defines the editor categories for world elements so that they
> +-- can be added to the editor tools. The available element types are ``terrain``,
> +-- ``immovable``, and ``critter``. Editor categories are defined by:
> +--
> +-- .. function:: new_editor_<element_type>_category{table}
> +--
> +--    This function adds the definition for an editor category, to be added as a
> +--    tab to the tool for ``<element_type>``. Only elements of the given type can
> +--    be in the editor category.

All above is confusing for me because of undefined terms. What is a editor category? Element type? 'Editor tools' are the entries in the window called 'Tools' containing "hight tool, ..., terrains,  immovables,..."?

> +--
> +--    :arg table: This table contains all the data that the game engine will add
> +--        to this editor category. It contains the following entries:
> +--
> +--    **name**
> +--        *Mandatory*. A string containing the internal name of this editor category
> +--        for reference, e.g.::
> +--
> +--            name = "summer",
> +--
> +--    **descname**
> +--        *Mandatory*. The translatable display name, e.g.::
> +--
> +--            descname = _"Summer",
> +--
> +--    **picture**
> +--        *Mandatory*. An image to represent this category in the editor tool's tab, e.g.::
> +--
> +--            picture = "world/pics/editor_terrain_category_green.png",
> +--
> +--    **items_per_row**
> +--        *Mandatory*. How many items will be displayed in each row by the tool, e.g.::
> +--
> +--            items_per_row = 6,
> +--
> +
>  world = wl.World()
>  
>  set_textdomain("world")
> @@ -11,126 +53,65 @@
>     end)
>  
>     print_loading_message("┃    Terrains", function()
> +
> +-- RST
> +-- .. function:: new_editor_terrain_category{table}
> +--
> +--    This function adds the definition for a category in the "Terrains" tool.
> +--    Only terrains can be in this editor category.
> +--
> +--    :arg table: This table contains all the data that the game engine will
> +--       add to this editor category. See above.
> +      world:new_editor_terrain_category{
> +         name = "summer",
> +         descname = _ "Summer",
> +         picture = "world/pics/editor_terrain_category_green.png",
> +         items_per_row = 6,
> +      }
> +      world:new_editor_terrain_category{
> +         name = "wasteland",
> +         descname = _ "Wasteland",
> +         picture = "world/pics/editor_terrain_category_wasteland.png",
> +         items_per_row = 6,
> +      }
> +      world:new_editor_terrain_category{
> +         name = "winter",
> +         descname = _ "Winter",
> +         picture = "world/pics/editor_terrain_category_winter.png",
> +         items_per_row = 6,
> +      }
> +      world:new_editor_terrain_category{
> +         name = "desert",
> +         descname = _ "Desert",
> +         picture = "world/pics/editor_terrain_category_desert.png",
> +         items_per_row = 6,
> +      }
> +
>        include "world/terrains/init.lua"
>     end)
>  
> -   world:new_editor_immovable_category{
> -      name = "miscellaneous",
> -      descname = _ "Miscellaneous",
> -      picture = "world/immovables/ruin5/idle.png",
> -      items_per_row = 6,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "artifacts",
> -      descname = _ "Artifacts" .. "<br>" .. _ "These immovables are used by the win condition “Artifacts”.",
> -      picture = "world/immovables/manmade/artifacts/artifact00/idle.png",
> -      items_per_row = 6,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "plants",
> -      descname = _ "Plants",
> -      picture = "world/immovables/cactus3/idle.png",
> -      items_per_row = 8,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "standing_stones",
> -      descname = _ "Standing Stones",
> -      picture = "world/immovables/standing_stones/standing_stone4_desert/idle.png",
> -      items_per_row = 4,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "rocks",
> -      descname = _ "Rocks",
> -      picture = "world/immovables/rocks/greenland_rocks6/idle.png",
> -      items_per_row = 6,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "trees_dead",
> -      descname = _ "Dead Trees",
> -      picture = "world/immovables/trees/deadtree2/idle.png",
> -      items_per_row = 8,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "trees_coniferous",
> -      descname = _ "Coniferous Trees",
> -      picture = "world/immovables/trees/spruce/old/idle_0.png",
> -      items_per_row = 8,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "trees_deciduous",
> -      descname = _ "Deciduous Trees",
> -      picture = "world/immovables/trees/alder/old/idle_0.png",
> -      items_per_row = 8,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "trees_palm",
> -      descname = _ "Palm Trees",
> -      picture = "world/immovables/trees/palm_borassus/old/idle_0.png",
> -      items_per_row = 8,
> -   }
> -
> -   world:new_editor_immovable_category{
> -      name = "trees_wasteland",
> -      descname = _ "Wasteland Trees",
> -      picture = "world/immovables/trees/umbrella_red/old/idle_0.png",
> -      items_per_row = 8,
> -   }
> -
> -   world:new_editor_critter_category {
> -      name = "critters_herbivores",
> -      -- TRANSLATORS: A category in the editor for placing animals on the map.
> -      descname = _ "Herbivores",
> -      picture = "world/critters/sheep/idle_00.png",
> -      items_per_row = 10,
> -   }
> -
> -   world:new_editor_critter_category {
> -      name = "critters_carnivores",
> -      -- TRANSLATORS: A category in the editor for placing animals on the map.
> -      descname = _ "Carnivores",
> -      picture = "world/critters/fox/idle_00.png",
> -      items_per_row = 10,
> -   }
> -
> -   world:new_editor_critter_category {
> -      name = "critters_aquatic",
> -      -- TRANSLATORS: A category in the editor for placing animals on the map.
> -      descname = _ "Aquatic",
> -      picture = "world/critters/duck/idle_00.png",
> -      items_per_row = 10,
> -   }
> -
>     print_loading_message("┃    Immovables", function()
> -      include "world/immovables/grass1/init.lua"
> -      include "world/immovables/grass2/init.lua"
> -      include "world/immovables/grass3/init.lua"
> -      include "world/immovables/bush1/init.lua"
> -      include "world/immovables/bush2/init.lua"
> -      include "world/immovables/bush3/init.lua"
> -      include "world/immovables/bush4/init.lua"
> -      include "world/immovables/bush5/init.lua"
> -      include "world/immovables/cactus1/init.lua"
> -      include "world/immovables/cactus3/init.lua"
> -      include "world/immovables/cactus4/init.lua"
> -      include "world/immovables/cactus2/init.lua"
> +-- RST
> +-- .. function:: new_editor_immovable_category{table}
> +--
> +--    This function adds the definition for a category in the "Immovables" tool.
> +--    Only immovables can be in this editor category.
> +--
> +--    :arg table: This table contains all the data that the game engine will
> +--       add to this editor category. See above.

Add an empty line

> +      world:new_editor_immovable_category{
> +         name = "miscellaneous",
> +         descname = _ "Miscellaneous",
> +         picture = "world/immovables/ruin5/idle.png",
> +         items_per_row = 6,
> +      }
> +
>        include "world/immovables/pebble1/init.lua"
>        include "world/immovables/pebble2/init.lua"
>        include "world/immovables/pebble3/init.lua"
>        include "world/immovables/pebble4/init.lua"
>        include "world/immovables/pebble5/init.lua"
>        include "world/immovables/pebble6/init.lua"
> -      include "world/immovables/manmade/artifacts/artifact00/init.lua"
> -      include "world/immovables/manmade/artifacts/artifact01/init.lua"
> -      include "world/immovables/manmade/artifacts/artifact02/init.lua"
> -      include "world/immovables/manmade/artifacts/artifact03/init.lua"
>        include "world/immovables/mushroom1/init.lua"
>        include "world/immovables/mushroom2/init.lua"
>        include "world/immovables/manmade/snowman/init.lua"
> @@ -236,7 +299,23 @@
>     end)
>  
>     print_loading_message("┃    Critters", function()
> -      -- Herbivores
> +
> +-- RST
> +-- .. function:: new_editor_critter_category{table}
> +--
> +--    This function adds the definition for a category in the "Animals" tool.
> +--    Only critters can be in this editor category.
> +--
> +--    :arg table: This table contains all the data that the game engine will
> +--       add to this editor category. See above.

add Empty line

> +      world:new_editor_critter_category {
> +         name = "critters_herbivores",
> +         -- TRANSLATORS: A category in the editor for placing animals on the map.
> +         descname = _ "Herbivores",
> +         picture = "world/critters/sheep/idle_00.png",
> +         items_per_row = 10,
> +      }
> +
>        include "world/critters/bunny/init.lua"
>        include "world/critters/sheep/init.lua"
>        include "world/critters/wisent/init.lua"


-- 
https://code.launchpad.net/~widelands-dev/widelands/document_world/+merge/329950
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/document_world into lp:widelands.


References