[1.187.204] Dedicated Server Ignoring FactionStateChanged
Dedicated Servers are ignoring the calls to at least the following faction related methods:
MyAPIGateway.Session.Factions.DeclareWar MyAPIGateway.Session.Factions.SendPeaceRequest MyAPIGateway.Session.Factions.AcceptPeaceThese methods can be utilized on the client connection, which will then sync to the server, but cannot be invoked directly on the server. I wrote the following mod to demonstrate this issue: https://steamcommunity.com/sharedfiles/filedetails/?id=1502198252If any of the above methods are invoked on the dedicated server, the server ignores the call and MyAPIGateway.Session.Factions.FactionStateChanged is never triggered. If the client invokes the above methods, the server will acknowledge the call, change faction states appropriately, and report those states back to the client.
Download the mod to a dedicated server (must be dedicated, cannot be SP or local MP)
Create your own player-only faction
1) Enter "/sfm factionStatus" in chat - this will show you your current status to the default "friendly" faction (should be hostile at this point)
2) Enter "/sfm serverResetFactions" in chat, notice the messaged displayed. Check the faction tab and you will see no actual faction relation changes (will still be hostile at this point) - this code is run on the DS.
3) Enter "/sfm clientResetFactions" in chat, notice the messages displayed now (different from step 2). Check the faction tab and you will see that instead of hostile, you are now neutral with "CIVL". This code is run from the client. The messages displayed show that the server first acknowledges the faction change request (blue text), the client messages are displayed (red text), then the client is updated with the new faction state (blue text again). The blue text was not present in the server message because the server failed to process the faction status change, so the FactionStateChanged event was never triggered.
4) This can be repeated with war declaration as well using "/sfm serverWar Tag1 Tag2" or "/sfm clientWar Tag1 Tag2". You will notice that the FactionStateChanged event is never triggered when using the server directly. Only the client will trigger the FactionStateChanged event on the server.