Goo Pumps & Oils' Speed Pump (GPOSP)

Goo Pumps & Oils' Speed Pump (GPOSP)

9k Downloads

I'm an idiot in need to consult a Geriatrician.

Lisias opened this issue Β· 7 comments

commented

Somehow (and I really failed to understand how the devs managed to accomplish this one), KSP is failing to load the displayName attribute from the Localization file for the ResourceInfo data structure of a Resource. [edit : mystery solved]

Weird enough, the damned thing worked fine on pt-br Localization.

So, the following code:

GUILayout.Toggle (GetResourceFlags (pr.resourceName, 1) == 1, Localizer.Format(/* Pump {0} */"#GPOSP-pump", pr.info.displayName))
GUILayout.Toggle (GetResourceFlags (pr.resourceName, 2) == 2, Localizer.Format(/* Balance {0} */"#GPOSP-balance", pr.info.displayName))

Will produce this result on a en-us installment:
Screen Shot 2022-09-16 at 13 58 46

But will produce this one on a localized one (only pt-br tested to this moment):
Screen Shot 2022-09-16 at 16 20 52

This misnbehaviour is happening since KSP 1.4.3, so it's a pretty old bug. [edit: KSP is fine, I was wrong.]

On the bright side, it's virtually impossible that nobody else got hit by this before, so I'm looking for the solution on google and github. [edit: so it is that I found the problem when I decided to look on the right place!!]

commented

Found the problem. This is one of the most embarrassing misdiagnosing of my career… #facePalm

Everything is working fine on KSP. The en-us localization was not working because I dumbly shoved {0} on the string, instead of <<1>> as it's expected by Localization.Format.

it's working on pt-br because I did right on that file.

(sigh).

Fixing the mess.

commented

Now I was caught with my pants down!!!!!!

The following code:

		string displayName = string.IsNullOrEmpty(pr.info.displayName) ? "" : pr.info.displayName.Trim();
		displayName = string.IsNullOrEmpty(displayName) ? pr.resourceName : displayName;
		Log.force("displayName `{0}` `{1}` `{2}`", displayName, pr.resourceName, pr.info.displayName);
		SetResourceFlags(pr.resourceName, GetResourceFlags(pr.resourceName, ~1) | (GUILayout.Toggle(GetResourceFlags(pr.resourceName, 1) == 1, Localizer.Format(/* Pump {0} */"#GPOSP-pump", displayName)) ? 1 : 0));
		SetResourceFlags(pr.resourceName, GetResourceFlags(pr.resourceName, ~2) | (GUILayout.Toggle(GetResourceFlags(pr.resourceName, 2) == 2, Localizer.Format(/* Balance {0} */"#GPOSP-balance", displayName)) ? 2 : 0));

when running on a en-us localized KSP (from 1.4.3 to 1.12.3), give me on KSP.log:

[LOG 23:25:30.407] [GPOSpeedPump] displayName `Xenon Gas` `XenonGas` `Xenon Gas`

What's completely right! But yet, I have on GUI:

Screen Shot 2022-09-16 at 23 32 02

And yet, when running on a pt-br localized game, things works as expected on GUI!

It's, apparently, a problem on Localizer.Format but only when using en-us localisation (or, alternatively, the damned thing only works with pt-br???).

I'm pretty at lost on this one….

commented

Changing the issue Tittle to reflect the findings.

commented

"fixed" on commit d924ef1 .

Screen Shot 2022-09-17 at 00 04 05

Now I will kick 1.9.0.8 trough the door, get some fries and bacon and a bottle of cheap wine on the nearest shop and stay away from computers until the Sun shines, curing the hangover and smoothing the face.

commented
  • what is the name of this release? Goo Strikes Again? (but in PT-BR?)

What about "O Retorno de Goo" :)

when/who is pushing what to CF? will wait for two (or more) weeks to let it 🍲 and 🎈 before sending (who) to SD/CKAN

I will do it Saturday (well, today) by noon, and SpaceDock/CKAN Saturday night - assuming no one (including me) finds something in the mean time.

Stupid mistakes are social beings, it's not unusual that you find more once the first shows up - so it's better to spend a bit of time playing it tomorrow morning looking for something weird. Just in case….

commented

Found the problem. This is one of the most embarrassing misdiagnosing of my career… #facePalm

Everything is working fine on KSP. The en-us localization was not working because I dumbly shoved {0} on the string, instead of <<1>> as it's expected by Localization.Format.

it's working on pt-br because I did right on that file.

(sigh).

Fixing the mess.

I've done that innumerable times, seriously - I have a massive issue remembering what is zero based, and what is one based in all things programming!

commented

I took today off to avoid that same fate - smelling the πŸ”₯ a little πŸ”₯

will update and push the revised docs tomorrow after the 🌞 shines!

only two questions remain:

  • what is the name of this release? Goo Strikes Again? (but in PT-BR?)
  • when/who is pushing what to CF? will wait for two (or more) weeks to let it 🍲 and 🎈 before sending (who) to SD/CKAN

and most ‼️ πŸ™‡β€β™‚οΈ thank you.