Page MenuHomeFeedback Tracker

Mission header settings in server config get ignored on restart
Awaiting internal Testing, NormalPublic

Description

When restarting a mission (e.g. #restart command or a game mode with auto reload enabled), the mission header settings in the server config JSON get ignored.

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce
  1. Start a mission on a dedicated server with some "missionHeader" parameters changed in the server config JSON.
  2. Join the server, log in as admin and execute the "#restart" command.
Additional Information

There seems to be also other settings that get ignored on restart, for instance, "disableThirdPerson".

Event Timeline

ookexoo created this task.May 19 2023, 7:53 PM
Geez changed the task status from New to Awaiting internal Testing.May 23 2023, 12:26 PM
ookexoo added a comment.EditedOct 22 2023, 9:05 AM

Since this hasn't been tested yet, I'll take the liberty to provide a more detailed repro. I created and published a test mod with the ID 5EAC510A8E6EC623, which contains the following code and in essence defines a new variable for the mission header and its value is written in the chat for all clients:

//------------------------------------------------------------------------------------------------
modded class SCR_MissionHeader : MissionHeader
{
	[Attribute(defvalue: "11", desc: "My mission header variable")]
	int m_iMHT_myVariable;
};

//------------------------------------------------------------------------------------------------
modded class SCR_BaseGameMode : BaseGameMode
{
	//------------------------------------------------------------------------------------------------
	//! Schedule printing of my header variable
	override protected void OnGameStart()
	{
		super.OnGameStart();
		
		if (!Replication.IsServer())
			return;

		GetGame().GetCallqueue().CallLater(MHT_PrintMyVariable, 1000, true);
	}
	
	//------------------------------------------------------------------------------------------------
	//! Broadcast and print my variable to all clients
	protected void MHT_PrintMyVariable()
	{
		SCR_MissionHeader header = SCR_MissionHeader.Cast(GetGame().GetMissionHeader());
		if (!header)
			return;
		
		Rpc(MHT_PrintInChatBroadcast, header.m_iMHT_myVariable.ToString());
	}
	
	//------------------------------------------------------------------------------------------------
	//! Print chat message for all clients
	[RplRpc(RplChannel.Unreliable, RplRcver.Broadcast)]
	protected void MHT_PrintInChatBroadcast(string message)
	{
		PlayerController ctrl = GetGame().GetPlayerController();
		if (!ctrl)
			return;
		
		SCR_ChatComponent.Cast(ctrl.FindComponent(SCR_ChatComponent)).ShowMessage(message);
	}
}

And I have the following configuration for my dedicated server:

{
    "bindAddress": "",
    "bindPort": 2001,
    "publicAddress": "",
    "publicPort": 2001,
    "game": {
        "name": "Kex's Mission Header Test",
        "passwordAdmin": "pw",
        "scenarioId": "{83D06A42096F671C}Missions/MpTest/10_MpTest.conf",
        "maxPlayers": 10,
        "gameProperties": {
            "missionHeader": {
                "m_iMHT_myVariable": 7
            }
        },
        "mods": [
            {
                "modId": "5EAC510A8E6EC623",
                "name": "Mission Header Test"
            }
        ]
    }
}

The expected behavior is that if you connect to the server, you should see 7 printed in the chat. This is initially indeed the case, however if you execute #login pw followed by #login restart, you will see that 11 will be printed after the restart. I hope this helps resolving the issue.

Source code: