widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11046
Re: [Merge] lp:~widelands-dev/widelands/document_worker_program into lp:widelands
> it should be added that the common worker properties do also apply to these special workers.
That's already documented in the subclasses themselves, like this:
"This table contains all the data that the game engine will add to this carrier. It contains the Common Worker Properties, plus the following additional property:"
https://wl.widelands.org/docs/wl/autogen_carriers_lua_tribes_workers_init/
> Clashing of developer and user :-D
The documentation is for the user, so your feedback is invaluable :)
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:
I have updated the programs table and the text above it. Is that what you had in mind?
> +
> +- `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"
> + }
> +*/
Good idea, we need the documentation for world first though, so I can then simply link to it. I'm working on that in a separate branch.
> /**
> - * 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.
Follow ups
References