← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1512093-workers into lp:widelands

 

Review: Approve website related

Works for the website related stuff :-)

Anyway two diff comments.

Diff comments:

> 
> === modified file 'data/tribes/workers/atlanteans/carrier/init.lua'
> --- data/tribes/workers/atlanteans/carrier/init.lua	2017-02-12 09:10:57 +0000
> +++ data/tribes/workers/atlanteans/carrier/init.lua	2017-04-21 18:41:03 +0000
> @@ -10,7 +25,22 @@
>  add_walking_animations(animations, "walk", dirname, "walk", {8, 25}, 10)
>  add_walking_animations(animations, "walkload", dirname, "walkload", {8, 25}, 10)
>  
> -
> +-- RST
> +-- .. function:: new_carrier_type(table)
> +--
> +--    This function adds the definition of a carrier to the engine.
> +--
> +--    :arg table: This table contains all the data that the game engine will add
> +--                to this carrier. It contains the :ref:`lua_tribes_workers_common`,
> +--                plus the following additional properties:

Related to above: Since there is only one additional property, shouldn't it be 'property:' instead of 'properties:'?

> +--
> +--    **ware_hotspot**
> +--        *Optional*. The x, y coordinates for adjusting the placement of the
> +--        ware being carried. The default value is ``{0, 15}``. Increase ``x``
> +--        to shift the ware to the left and ``y`` to shift it upwards. For example::
> +--
> +--           ware_hotspot = { -2, 13 },
> +--
>  tribes:new_carrier_type {
>     msgctxt = "atlanteans_worker",
>     --msgctxt = msgctxt,
> 
> === added file 'doc/sphinx/source/lua_tribes_workers.rst.org'
> --- doc/sphinx/source/lua_tribes_workers.rst.org	1970-01-01 00:00:00 +0000
> +++ doc/sphinx/source/lua_tribes_workers.rst.org	2017-04-21 18:41:03 +0000
> @@ -0,0 +1,95 @@
> +.. _workers:
> +
> +Workers
> +=======
> +
> +Workers are defined in their ``init.lua`` file. They also have a corresponding
> +``helptexts.lua`` file that contains their help text.
> +Worker files are placed in ``data/tribes/workers/<tribe_name>/<worker_name>/``.
> +
> +Types of Workers
> +----------------
> +
> +In addition to the basic worker type, Widelands knows about the following sub types:
> +
> +.. toctree::
> +   :maxdepth: 3
> +
> +REPLACE_ME
> +
> +.. _lua_tribes_workers_common:
> +
> +
> +Common Worker Properties
> +------------------------
> +
> +Workers are defined with Lua functions called ``new_worker_type{table}``. The contents of ``table`` depend on the type of worker that you are defining. The common properties shared by all workers are:
> +
> +  **msgctxt**: The context that Gettext will use to disambiguate the
> +  translations for strings in this table.
> +
> +  **name**: A string containing the internal name of this worker.
> +
> +  **descname**: The translatable display name. Use ``pgettext`` with the
> +  ``msgctxt`` above to fetch the string.
> +
> +  **helptext_script**: The full path to the ``helptexts.lua`` script for this worker.
> +
> +  **icon**: The full path to the menu icon for this worker.
> +
> +  **vision_range**
> +      The size of the radius that the worker sees.
> +
> +  **buildcost**
> +      *Optional*. A table with the wares and workers used by warehouses to
> +      create this worker, containing warename - amount pairs, e.g.::
> +
> +          buildcost = { atlanteans_carrier = 1, hammer = 1 }
> +
> +  **default_target_quantity**:
> +      *Optional*. An int defining the default target quantity for the worker's
> +      tribe's economy. Use this if the worker is produced by a production site
> +      rather than the warehouses. For example, ``default_target_quantity = 10``
> +
> +  **experience**
> +      *Optional*. The amount of experience that the worker needs to gather
> +      in order to be transformend into a higher worker type. If `becomes`
> +      is defined, this needs to be set as well.
> +
> +  **becomes**
> +      *Optional*. The name of the higher worker type that this worker will
> +      transform to after gaining enough experience. If `experience`
> +      is defined, this needs to be set as well.
> +
> +  **animations**:
> +       A table containing all animations for this worker.
> +       Workers have an "idle" animation. They also have directional animations
> +       called "walk" and "walkload" which are defined with the help of
> +       :func:`add_walking_animations`, plus additional :ref:`animations` used in their
> +       worker programs. The "idle" and "walk" animations are mandatory.
> +
> +  **programs**:
> +      *Optional*. If the worker leaves the building to do his work, the worker
> +      programs that define which type of space or resource the worker has to find
> +      on the map in order to do his work, and what that work is, including any
> +      animations and sounds played.
> +      See :doc:`worker_program`.
> +
> +TODO(GunChleoc): create Worker Program Reference
> +

The TODO appears in the documentation on the website. Is this intended?

> +Help Texts
> +----------
> +
> +Each worker has a ``helptexts.lua`` script, which is located in the same directory as its ``init.lua`` script.
> +The function in this file returns a text that is used for the worker by the Tribal Encyclopedia.
> +
> +.. function:: worker_helptext()
> +
> +   Returns a localized string with the helptext for this worker type.
> +   It needs to be fetched by pgettext, using ``<tribename>_worker`` as the
> +   message context. Example::
> +
> +      function worker_helptext()
> +         -- TRANSLATORS: Helptext for a worker: Armorsmith
> +         return pgettext("atlanteans_worker", "Produces armor for the soldiers.")
> +      end


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1512093-workers/+merge/322981
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1512093-workers.


References