チケット #45068

Lua: Research information API

登録: 2022-07-09 03:03 最終更新: 2022-09-18 02:00

報告者:
担当者:
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
優先度:
5 - 中
重要度:
5 - 中
解決法:
修正済み
ファイル:
2

詳細

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.

チケットの履歴 (12 件中 3 件表示)

2022-07-09 03:03 更新者: ihnatus
  • 新しいチケット "Lua: Research information API" が作成されました
2022-07-09 06:22 更新者: 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.

2022-07-09 07:36 更新者: ihnatus
コメント

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 更新者: 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?)

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 更新者: ihnatus
コメント

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 更新者: cazfi
  • 担当者(未割り当て) から ihnatus に更新されました
2022-09-14 04:11 更新者: ihnatus
コメント

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 更新者: cazfi
  • 担当者ihnatus から cazfi に更新されました
  • 解決法なし から 受領 に更新されました
コメント

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 更新者: cazfi
  • 状況オープン から 完了 に更新されました
  • 解決法受領 から 修正済み に更新されました
2022-09-18 02:00 更新者: cazfi
コメント

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

添付ファイルリスト

編集

ログインしていません。ログインしていない状態では、コメントに記載者の記録が残りません。 » ログインする