eronoobos / BABAR-The-Shardifant

Balanced Annihilation & Balanced Annilhation Reloaded configuration for Shard
2 stars 1 forks source link

shard get unit table widget upgrade #4

Closed pandaro closed 8 years ago

pandaro commented 8 years ago

What should be update in order to use shardgetunittable.lua at its latest version?

eronoobos commented 8 years ago

https://github.com/eronoobos/BABAR-The-Shardifant/commit/94e2eb848678e94cae73bb2668be6bf8358a6870

eronoobos commented 8 years ago

https://github.com/eronoobos/BABAR-The-Shardifant/commit/17da41e2f434f45c9c1d7cca1a4688a9c8e50bd1 small improvement in human readability

pandaro commented 8 years ago

I saw now your job, thanks. A question still, I have seen that you have created a file inside the BAR folder called: "getunitfeaturetable.lua". Also this file can create a unitTable and FeatureTable. questions: 1 will only do so if it's Shard LuaAI? 2 may create misunderstandings? 3 if I wanted to add to unitTable different values such as: speed maxslope movement class unitCanBuild (in the case of a factory) 3.1 What do you think about that? 3.2 where files should I change? getunitfeaturetable or Shard_help_unit_table?

4 too many questions?

eronoobos commented 8 years ago
  1. Yes. Shard C++ does not have access to UnitDefs, which is the reason unitTable and featureTable are needed. see https://github.com/eronoobos/BABAR-The-Shardifant/blob/17da41e2f434f45c9c1d7cca1a4688a9c8e50bd1/common.lua
  2. It has! But I don't know a better way to do it.

3.1

speed: Good idea

maxslope: This would only be useful for Shard LuaAI, which has access to the UnitDefs directly, so it seems unnecessary. Tardendai would probably disagree.

movement class: Ok, but if movement class is to be used, then mtype shouldn't. Refactoring everything to use movement class instead of mtype sounds daunting to me, but maybe it wouldn't be so bad.

unitCanBuild: Same as maxslope. Shard C++ already has access to this through unit:CanBuild(unittype). Edit: Ah, I see, but not as a table of stuff it can build. You could build such tables from many tests of unit:CanBuild(unittype), but true, that might not be the way to go about it.

3.2 Both. They have basically the same code now, just one writes stuff to files at the end. I would be cool if they could share code, but the widget has to be copied to luaui/widgets/, and the place where the BA/BAR config lives on the hard drive relative to there isn't predictable. The best I can do is to set it up so getunitfeaturetable.lua is a block of code that can be copied straight into the widget, except for the return unitTable, featureTable bit

PS Another point of potential confusion: I should probably remove the unused https://github.com/eronoobos/BABAR-The-Shardifant/blob/17da41e2f434f45c9c1d7cca1a4688a9c8e50bd1/devwidgets/ShardGetUnittable.lua but I keep thinking Beherith did something smart that I'll need in the future.

eronoobos commented 8 years ago

ok i made copy-paste blocks https://github.com/eronoobos/BABAR-The-Shardifant/blob/170ac762074fd31c728db1e2736b1fec07f20ed6/getunitfeaturetable.lua https://github.com/eronoobos/BABAR-The-Shardifant/blob/170ac762074fd31c728db1e2736b1fec07f20ed6/devwidgets/shard_help_unit_feature_table.lua