2 nits - not tested yet. Diff comments:
> > === modified file 'data/scripting/win_conditions/territorial_lord.lua' > --- data/scripting/win_conditions/territorial_lord.lua 2019-03-09 > 10:55:24 +0000 > +++ data/scripting/win_conditions/territorial_lord.lua 2019-03-26 > 07:43:29 +0000 > @@ -57,6 +58,16 @@ > end > end > > + -- Install statistics hook > + hooks.custom_statistic = { > + name = wc_terr_lord, > + pic = "images/wui/stats/genstats_territorial_small.png", > + calculator = function(p) > + local pts = > count_owned_valuable_fields_for_all_players(wl.Game().players) > + return (pts[p.number]*100//fields) / twice > + end, > + } > + > -- here is the main loop!!! > while true do > -- Sleep 30 seconds == STATISTICS_SAMPLE_TIME > > === modified file 'data/scripting/win_conditions/territorial_time.lua' > --- data/scripting/win_conditions/territorial_time.lua 2019-03-09 > 10:55:24 +0000 > +++ data/scripting/win_conditions/territorial_time.lua 2019-03-26 > 07:43:29 +0000 > @@ -73,6 +74,16 @@ > end > end > > + -- Install statistics hook > + hooks.custom_statistic = { > + name = wc_terr_time, > + pic = "images/wui/stats/genstats_territorial_small.png", > + calculator = function(p) > + local pts = > count_owned_valuable_fields_for_all_players(wl.Game().players) > + return (pts[p.number]*100//fields) / twice. Also, code duplication - can this be moved to territorial_functions? > + end, > + } > + > -- here is the main loop!!! > while true do > -- Sleep 30 seconds == STATISTICS_SAMPLE_TIME -- https://code.launchpad.net/~widelands-dev/widelands/bug-1817550-Statistics-hook-Winconditions/+merge/365086 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1817550-Statistics-hook-Winconditions into lp:widelands. _______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp