Mining UI - Adding a list of favorite planets - Idea and pseudocode
Opened this issue · 1 comments
Hi Histidine,
I'm back (cf. 14th September 2022) with yet another idea to hopefully improve the mining experience.
The concept
The player can see the current distance and exhaustion for the planets he wants to mine again.
How?
When the player selects an uncolonized planet and opens the mining menu, he sees three additional options :
- add the planet to his favorites (if the planet is not in the favorites yet)
- remove the planet from his favorites (if the planet is in the favorites)
- see the list of favorites (if the favorite least is not empty)
When the players selects an asteroid and opens the mining menu, he sees one additional option:
- see the list of favorites (if the favorite least is not empty)
The list of favorites shows a table (similar to the fantastic job you did with the database of mining ships/weapons/wings)
The columns are:
- planet name
- mining resources (Ore+W/Rare Ore+X/Organics+Y/Volatiles+Z) <== perhaps with the icons like we have in the vanilla planets table
- Location (system)
- distance to the planet
- current exhaustion level
- Optional: if fleet has janus device, add another column with boolean "active gate in the system"
Edit: An image should be easier to understand. (Paint skills!)
The pseudocode
(Sorry for all the horrible pseudocode below, I think the last time I wrote java was ~2006)
-
create an ArrayList to store the favorite planets
List<SectorEntityToken> arr_fav_mine_pl = new ArrayList<>();
-
add the new lines to the mining menu (Nexerelin\data\campaign\rules.csv)
I don't know if it's possible for options to be conditionaly hidden.
Maybe it's impossible since the functions for start mining and prisoner actions make the option greyed, not hidden.
Anyway, I think we want something like
if (current_target instanceof PlanetAPI && !arr_fav_mine_pl.contains(current_target)) {show or activate the line "Add this planet to the mining favorites"}
if (current_target instanceof PlanetAPI && arr_fav_mine_pl.contains(current_target)) {show or activate the line "Remove this planet from the mining favorites"}
if (arr_fav_mine_pl.length) {show or activate the line "Show favorite mining planets"}
- effect of the new menu options
"Add this planet to the mining favorites" calls a function add_fav_mine_pl(planet_id)
"Remove this planet from the mining favorites" calls a function del_fav_mine_pl(planet_id)
"Show favorite mining planets" calls a function show_fav_mine_planets()
3a) function del_fav_mine_pl(planet_id)
arr_fav_mine_pl.remove(planet_id)
3b) function add_fav_mine_pl(planet_id)
arr_fav_mine_pl.add(planet_id)
3c) function show_fav_mine_planets()
List<Pair<SectorEntityToken, Float>> miningFavPlanets = new ArrayList<>();
for (SectorEntityToken current_planet in arr_fav_mine_pl){
MiningReport report = MiningHelperLegacy.getMiningReport(playerFleet, current_planet, 1);
float exhaustion = report.exhaustion;
miningFavPlanets.add(new Pair<>(current_planet, exhaustion));
}
No idea how you put that in a table and add the other parameters (resources, distance...)
- Possible causes of bugs.
a)What happens it a planet in the mining favorites is no longer eligible (for example if it got colonized)?
Perhaps add a check inside the loop in functionshow_fav_mine_planets
that callsdel_fav_mine_pl
if necessary
What do you think?
Ronkhar
Thanks for the ideas! I might try some stuff in the future, although not for next update.