Update of patch #6557 (project freeciv):

                  Status:                    None => Ready For Test         
             Assigned to:                    None => jtn                    

    _______________________________________________________

Follow-up Comment #1:

Patches attached.
* (Player):trait(), :trait_base(), :trait_current_mod()
* (Nation):trait_min(), :trait_max(), :trait_default()

Also attached is a Lua server script that produces an ugly dump of current
players' traits.


jtn: 'lua cmd find.player(2):trait_mod("aggressive", 10)'
jtn: 'lua file ../dump_traits.lua'
/lua: Loading Freeciv script file './../dump_traits.lua'.
/lua: Askia Mohammad Benkan  Human  [Songhai       ]
/lua: Dinis           AI     [Portuguese    :   min <= fixed <= max  ]
/lua:   tra: 50              [                   30       50       90]
/lua:   agg: 54              [                   30       50       90]
/lua:   exp: 78              [                   30       50       90]
/lua: Jama kaNdaba    AI     [Zulu          :   min <= fixed <= max  ]
/lua:   tra: 61              [                   30       50       90]
/lua:   agg: 93 (83+10)      [                   30       50       90]
/lua:   exp: 63              [                   30       50       90]


Traits aren't currently sent to the client, although in principle they could
be. So these are server-only functions.

So I've done something new here: I've extended the Player and Nation modules
defined in common/scriptcore with some methods defined only in
server/scripting/tolua_server.pkg. I've done this so that if we expose traits
to the client in future, the function implementations can move to common/
without changing the API.

This seems to work -- server- and client-side scripting have the right methods
-- but I don't know if I have any right to get away with it. (tolua_module()
looks like it might be designed to handle it?)

Also possibly controversial is that the existing trait_mod() function added in
2.5 now throws an error if given an invalid trait string instead of just
returning false; this is for consistency with the new functions, which have no
other way to fail. Is this going to cause trouble for anyone? The set of
traits is pretty much fixed for a given Freeciv version, so I've assumed not.

(file #25670, file #25671, file #25672)
    _______________________________________________________

Additional Item Attachment:

File name: trunk-lua-trait-fns.patch      Size:12 KB
File name: S2_6-lua-trait-fns.patch       Size:12 KB
File name: dump_traits.lua                Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?6557>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to