Ticket #45068

Lua: Research information API

Eröffnet am: 2022-07-09 03:03 Letztes Update: 2022-09-18 02:00

Auswertung:
Verantwortlicher:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
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-Verlauf (3/12 Historien)

2022-07-09 03:03 Aktualisiert von: ihnatus
  • New Ticket "Lua: Research information API" created
2022-07-09 06:22 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: ihnatus
Kommentar

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 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: ihnatus
Kommentar

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 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to ihnatus
2022-09-14 04:11 Aktualisiert von: ihnatus
Kommentar

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 Aktualisiert von: cazfi
  • Verantwortlicher Update from ihnatus to cazfi
  • Lösung Update from Keine to Accepted
Kommentar

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 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt
2022-09-18 02:00 Aktualisiert von: cazfi
Kommentar

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

Bearbeiten

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Anmelden