← Back to team overview

widelands-dev team mailing list archive

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

 

Regarding the types of workers

https://wl.widelands.org/docs/wl/autogen_toc_lua_tribes_workers/#types-of-workers

it should be added that the common worker properties do also apply to these special workers. Something like: 

"In addition to the basic worker type, see below, Widelands knows about the following sub types, which should have also the Common Worker Properties:"

Can't find the right wording here :-S

Two comments, otherwise looks good to me.

Clashing of developer and user :-D

Diff comments:

> 
> === modified file 'src/logic/map_objects/tribes/worker_program.cc'
> --- src/logic/map_objects/tribes/worker_program.cc	2017-01-25 18:55:59 +0000
> +++ src/logic/map_objects/tribes/worker_program.cc	2017-08-28 18:56:09 +0000
> @@ -30,6 +30,53 @@
>  #include "sound/sound_handler.h"
>  
>  namespace Widelands {
> +/* RST
> +.. _tribes_worker_programs:
> +
> +Worker Programs
> +===============
> +
> +Worker programs are defined in the ``programs`` subtable specified in calls to
> +:ref:`tribes:new_worker_type{table} <lua_tribes_workers_common>`.
> +Each worker program is a Lua table in itself and defined as a series of command strings.
> +Commands can also have parameters, which are separated from each other by a blank space.
> +These parameters can also have values, which are separated from the parameter name by a colon (:).
> +The table looks like this::
> +
> +   programs = {
> +      program_name1 = {
> +         "command1 parameter1:value1 parameter2:value2",
> +         "command2 parameter1",
> +         "return"
> +      },
> +      program_name2 = {
> +         "command3",
> +         "command4 parameter1 parameter2 parameter3",
> +         "return"
> +      }
> +   },
> +
> +The available programs are:

>From my understanding it should be: "The available commands are:"

Maybe clarify that program_name is a string which could be set individually? E.g.: 'harvest', 'release', 'hunt', 'plant', ...

> +
> +- `createware`_
> +- `mine`_
> +- `breed`_
> +- `setbobdescription`_
> +- `findobject`_
> +- `findspace`_
> +- `walk`_
> +- `animation`_
> +- `return`_
> +- `object`_
> +- `plant`_
> +- `create_bob`_
> +- `object remove`_
> +- `geologist`_
> +- `geologist_find`_
> +- `scout`_
> +- `play_sound`_
> +- `construct`_
> +*/
>  
>  const WorkerProgram::ParseMap WorkerProgram::parsemap_[] = {
>     {"mine", &WorkerProgram::parse_mine},
> @@ -393,11 +613,28 @@
>  	act->iparam1 = 1;  // drop a ware on our owner's flag
>  }
>  
> +/* RST
> +object
> +^^^^^^
> +.. function:: object \<program_name\>
> +
> +   :arg string program_name: The name of the program to be executed.
> +
> +   Cause the currently selected object to execute its given program. Example::
> +
> +      chop = {
> +         "findobject attrib:tree radius:10",
> +         "walk object",
> +         "play_sound sound/woodcutting fast_woodcutting 250",
> +         "animation hacking 10000",
> +         "play_sound sound/woodcutting tree-falling 130",
> +         "object fall", -- Cause the tree to fall
> +         "animation idle 2000",
> +         "createware log",
> +         "return"
> +      }
> +*/

Add the code for the 'fall' command to get a complete example.

>  /**
> - * object \<command\>
> - *
> - * Cause the currently selected object to execute the given program.
> - *
>   * sparam1 = object command name
>   */
>  void WorkerProgram::parse_object(Worker::Action* act, const std::vector<std::string>& cmd) {


-- 
https://code.launchpad.net/~widelands-dev/widelands/document_worker_program/+merge/329696
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/document_worker_program.


References