Incidencia #45068

Lua: Research information API

Abrir Fecha: 2022-07-09 03:03 Última actualización: 2022-09-18 02:00

Informador:
Propietario:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
2

Details

Add functionality to test costs and progress of players' research.

This ticket is a natural base of #44936 and is related to #42683.

In the patch attached I have introduced an API to game.info object with research-related ruleset data, maybe more fields should be made available in it in further tickets.

Ticket History (3/12 Histories)

2022-07-09 03:03 Updated by: ihnatus
  • New Ticket "Lua: Research information API" created
2022-07-09 06:22 Updated by: cazfi
Comentario

First question: Does lua API already know if the there's an embassy within the team? Otherwise the script can't tell if zero returned by some of these methods is a "real" zero, or just lack of embassy.

2022-07-09 07:36 Updated by: ihnatus
Comentario

Reply To cazfi

First question: Does lua API already know if the there's an embassy within the team? Otherwise the script can't tell if zero returned by some of these methods is a "real" zero, or just lack of embassy

That matter is requested in #44772 and might be resolved in #44779, neither is yet resolved. But you can check if plr:researching()==false that happens if you don't know what they are researching that happens when you don't have embassy.

2022-07-09 08:32 Updated by: cazfi
Comentario

About TECH_COST_CIV1CIV2 "/* Avoid getting error messages and return at least something */" : Does the value returned make any sense in any use-case, or is it just a nonsense number which the script cannot tell to be nonsense? Could we just return a negative value to indicate an error? (or can negative value be valid return?)

Maybe clarify "needs at least an embassy" -comments about the cases (all of these?) where the embassy is required from the team, and not necessarily from the player themself.

api_methods_player_tech_bulbs() outside multiresearch could still work logically with no much implementation effort -> current bulbs count for current research target, zero for any other.

2022-07-10 03:13 Updated by: ihnatus
Comentario

Reply To ihnatus

But you can check if plr:researching()==false that happens if you don't know what they are researching that happens when you don't have embassy.

Appears that you can't. A_UNSET is sent to clients insto A_UNKNOWN when no embassy info is provided. Maybe it's a bug since comments in research.h tell another.

2022-07-19 15:12 Updated by: cazfi
  • Propietario Update from (Ninguno) to ihnatus
2022-09-14 04:11 Updated by: ihnatus
Comentario

Reply To cazfi

About TECH_COST_CIV1CIV2 "/* Avoid getting error messages and return at least something */" : Does the value returned make any sense in any use-case, or is it just a nonsense number which the script cannot tell to be nonsense? Could we just return a negative value to indicate an error? (or can negative value be valid return?)

There are methods to detect the unclear case if it's needed, I don't think we should elaborate here too much over basic functions, at least in this patch.

Maybe clarify "needs at least an embassy" -comments about the cases (all of these?) where the embassy is required from the team, and not necessarily from the player themself.

Made comments, in my view, more clear. The embassy checking should be resolved elsewhere.

api_methods_player_tech_bulbs() outside multiresearch could still work logically with no much implementation effort -> current bulbs count for current research target, zero for any other.

Modified api_methods_player_tech_bulbs() to do sensible thing out of multiresearch:

  1. bulbs[plr][tech_to_switch] = plr.got_tech and plr.bulbs or 0 + plr:bulbs_saved(tech_to_switch)

2022-09-15 22:10 Updated by: cazfi
  • Propietario Update from ihnatus to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

Thanks. I'll try to get this handled in a timely manner (try = some things interfere, this has not been a good week)

2022-09-18 01:58 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed
2022-09-18 02:00 Updated by: cazfi
Comentario

I'd appreciate if you can take care of the wiki update part (you've been active in updating that lua manual anyway)

Editar

Please login to add comment to this ticket » Entrar