Slothoth's Global Relations Panel

Slothoth's Global Relations Panel v1.031

Hello, I’ve prepared 12-language translations for your mod. If possible, please integrate them into your future updates.
 

Attachments

Happy to! Will do a quick test to make sure the different sized text still looks ok first
 
Hi, I have issues with this mod.
- First one is a small localization issue
- The more annoying is I cannot see other civs' relationships : nothing happens when I mouseover them.

1743244376533.png


UI.log:

Code:
[2025-03-29 11:42:01]    JS Error: fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:143: TypeError: Cannot read properties of undefined (reading 'x')
 While executing JS fs://game/core/ui/context-manager/context-manager.js:165:38
[2025-03-29 11:42:01]    JS Error (Line):                     line.setAttribute("x2", `${buttonPositions[j].x}`);
 While executing JS fs://game/core/ui/context-manager/context-manager.js:165:38
[2025-03-29 11:42:01]    JS Error (Stack): TypeError: Cannot read properties of undefined (reading 'x')
    at GlobalRelationsPanel.setupLines (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:143:67)
    at GlobalRelationsPanel.updatePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:443:14)
    at GlobalRelationsPanel.initializePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:430:14)
    at GlobalRelationsPanel.onAttach (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:90:14)
    at c.doAttach (fs://game/core/ui/component-support.js:257:15)
    at c.initialize (fs://game/core/ui/component-support.js:243:22)
    at connectedCallback (fs://game/core/ui/component-support.js:292:22)
    at ContextManagerSingleton.push (fs://game/core/ui/context-manager/context-manager.js:165:38)
    at GlobalRelations_PanelSubsystemDock

Thanks
 
Last edited:
Hi, I have issues with this mod.
- First one is a small localization issue
- The more annoying is I cannot see other civs' relationships : nothing happens when I mouseover them.

View attachment 727412

UI.log:

Code:
[2025-03-29 11:42:01]    JS Error: fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:143: TypeError: Cannot read properties of undefined (reading 'x')
 While executing JS fs://game/core/ui/context-manager/context-manager.js:165:38
[2025-03-29 11:42:01]    JS Error (Line):                     line.setAttribute("x2", `${buttonPositions[j].x}`);
 While executing JS fs://game/core/ui/context-manager/context-manager.js:165:38
[2025-03-29 11:42:01]    JS Error (Stack): TypeError: Cannot read properties of undefined (reading 'x')
    at GlobalRelationsPanel.setupLines (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:143:67)
    at GlobalRelationsPanel.updatePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:443:14)
    at GlobalRelationsPanel.initializePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:430:14)
    at GlobalRelationsPanel.onAttach (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:90:14)
    at c.doAttach (fs://game/core/ui/component-support.js:257:15)
    at c.initialize (fs://game/core/ui/component-support.js:243:22)
    at connectedCallback (fs://game/core/ui/component-support.js:292:22)
    at ContextManagerSingleton.push (fs://game/core/ui/context-manager/context-manager.js:165:38)
    at GlobalRelations_PanelSubsystemDock

Thanks
Huh, odd. Maybe that recent update did something, will debug and get a fix up
 
I see buttonPositions array is initialized from player_diplo.length,
JavaScript:
 for (let i = 0; i < this.player_diplo.length; i++) {
[...]
buttonPositions[playerFromRibbon.id] = {x: xPercent, y: yPercent};

but later indices from Players.GetAliveIds() are used to access it using j.

JavaScript:
for (const i of Players.getAliveIds()) {
            const first_player = Players.get(i);
            if (!first_player.isMajor) {continue}
            const playerDiplomacy = first_player.Diplomacy;
            for (const j of Players.getAliveIds()) {
                if (i===j)  {continue}
                const second_player = Players.get(j);
                const backupDiplomacy = second_player.Diplomacy;
                const relationshipType = playerDiplomacy.getRelationshipEnum(j)
                if (!second_player.isMajor) {continue}
                if (playerDiplomacy.hasMet(j) || backupDiplomacy.hasMet(i)) {
                    const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
                    line.setAttribute("x1", `${buttonPositions[i].x}%`);
                    line.setAttribute("y1", `${buttonPositions[i].y}%`);
                    line.setAttribute("x2", `${buttonPositions[j].x}%`);
                    line.setAttribute("y2", `${buttonPositions[j].y}%`);

Crash happens here when accessing array using j
Code:
line.setAttribute("x2", `${buttonPositions[j].x}%`);

I have 13 players, but only 8 are displayed in the ribbon, could it be the issue?
 
Hi, I have issues with this mod.
- First one is a small localization issue
- The more annoying is I cannot see other civs' relationships : nothing happens when I mouseover them.

View attachment 727412

UI.log:

Code:
[2025-03-29 11:42:01]    JS Error: fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:143: TypeError: Cannot read properties of undefined (reading 'x')
 While executing JS fs://game/core/ui/context-manager/context-manager.js:165:38
[2025-03-29 11:42:01]    JS Error (Line):                     line.setAttribute("x2", `${buttonPositions[j].x}`);
 While executing JS fs://game/core/ui/context-manager/context-manager.js:165:38
[2025-03-29 11:42:01]    JS Error (Stack): TypeError: Cannot read properties of undefined (reading 'x')
    at GlobalRelationsPanel.setupLines (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:143:67)
    at GlobalRelationsPanel.updatePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:443:14)
    at GlobalRelationsPanel.initializePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:430:14)
    at GlobalRelationsPanel.onAttach (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:90:14)
    at c.doAttach (fs://game/core/ui/component-support.js:257:15)
    at c.initialize (fs://game/core/ui/component-support.js:243:22)
    at connectedCallback (fs://game/core/ui/component-support.js:292:22)
    at ContextManagerSingleton.push (fs://game/core/ui/context-manager/context-manager.js:165:38)
    at GlobalRelations_PanelSubsystemDock

Thanks
Hello, I’ve prepared 12-language translations for your mod. If possible, please integrate them into your future updates.
Try my localization translations.
 
I have 13 players, but only 8 are displayed in the ribbon, could it be the issue?
FYI Now that I met more civs, more lines are drawn

1743255111671.png


But I I still end up crashing in the setupLines function:

Code:
[2025-03-29 14:29:53]    JS Error (Stack): TypeError: Cannot read properties of undefined (reading 'x')
    at GlobalRelationsPanel.setupLines (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:146:67)
    at GlobalRelationsPanel.updatePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:446:14)
    at GlobalRelationsPanel.initializePolygonLayout (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:433:14)
    at GlobalRelationsPanel.onAttach (fs://game/sloth-global-relations-panel/ui/global-relations-panel/global-relations-panel.js:90:14)
    at c.doAttach (fs://game/core/ui/component-support.js:257:15)
    at c.initialize (fs://game/core/ui/component-support.js:243:22)
    at connectedCallback (fs://game/core/ui/component-support.js:292:22)
    at ContextManagerSingleton.push (fs://game/core/ui/context-manager/context-manager.js:165:38)
    at GlobalRelations_PanelSubsystemDock
 
Yeah so it was not having met all civs I believe. As currently I am iterating over all civs, including unmet ones without a button as you guessed. Should be fixed now
 
Thanks for the fast fix! I will get the update for my next game session.

EDIT:
Works perfectly now, huge thanks!

1743270141185.png
 
Last edited:
Hi @Smayo
Thank you for the great mod.
Wanted to ask regarding one observation of leader icon placement.

Seems like on vanilla icons leader heads "appearing" inside hex frame (on load-save screen and diplo).

Spoiler vanilla :


1744353667821.png
1744354108082.png
1744353773953.png




In the mod they seem to be in front of the hex-frame.
Is this a planned design approach for the mod?

Spoiler mod :


1744353812077.png

 
Last edited:
Hi @Smayo
Thank you for the great mod.
Wanted to ask regarding one observation of leader icon placement.

Seems like on vanilla icons leader heads "appearing" inside hex frame (on load-save screen and diplo).



In the mod they seem to be in front of the hex-frame.
Is this a planned design approach for the mod?

Spoiler mod :
Yeah I’m aware of this. Part of the reason I kept it different than the original diplo banner is that the heads go above the hex frame, which obscures the connecting lines or strategics.
 
Back
Top Bottom