RedMew icon indicating copy to clipboard operation
RedMew copied to clipboard

Add players' logistic requests synch between instances

Open RedRafe opened this issue 11 months ago • 2 comments

Just like the quick-bar module, allows saving/loading/deleting of the player's logistic requests between instances, accessing the data on our server.

Additionally, since the logi bars are not enabled on new games until logibots are researched, upon finishing the research of the logi tech, server will attempt at loading each player's data

(I reordered the color file alphabetically, but no changes there)

RedRafe avatar Mar 04 '24 07:03 RedRafe

Resolved all. There's only one minor inconvenience left:

logistic requests are enabled when logistcs is researched. I do apply saved data at the research completion & for all players joining for the first time after that. But if a player had already joined & left, they will have to manually say /logistic-requests-load upon rejoins to apply that. Call it good, or add more logic?

Honestly I didnt want to re-apply on player joined cuz it may apply for those who already did and override some changes, but, I could always add some more logic and keep track of players that already got initialized to filter out those & make it automatic for everyone

RedRafe avatar Mar 04 '24 19:03 RedRafe

logistic requests are enabled when logistcs is researched. I do apply saved data at the research completion & for all players joining for the first time after that. But if a player had already joined & left, they will have to manually say /logistic-requests-load upon rejoins to apply that. Call it good, or add more logic?

That's an annoying edge case. I think it probably is worth fixing. I think keeping track of players that have been initialized as you suggest would be the way to go.

grilledham avatar Mar 04 '24 19:03 grilledham

Updated the code, I think I got it one step further this round:

  1. I've added a bit of overhead with Force shenanigans, based on this: Force::character_logistic_requests

true if character requester logistics is enabled.

The new logic tracks initialized forces as well, and only allows setting bar based on that param:

  • makes it more robust with modded runs that mess with the logistic tech
  • makes it more robust with multi-forces maps
  1. I've moved the player_initialized logic outside the simple set_bar_callback as you suggested, so other functions will be responsible to call a set bars only when it actually possible (based on their own conditions). but players are still able to call it manually whenever they want.

An additional message is displayed (in manual mode) if server = true AND logistics = false, so players are notified their attempt at setting bars didn't go through cuz their force hasnt unlocked logistics yet

RedRafe avatar Mar 07 '24 09:03 RedRafe