Skip to content

Commit 03a7a74

Browse files
committed
Fix constraints not being sent to clients with new characters
When a new player joined, with no currently alive character in the server database, the constraints weren't being sent
1 parent 8088451 commit 03a7a74

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
modded class MissionServer {
22

3-
override void OnEvent(EventType eventTypeId, Param params) {
4-
super.OnEvent(eventTypeId, params);
5-
6-
switch (eventTypeId) {
7-
8-
case ClientNewEventTypeID:
9-
case ClientReadyEventTypeID:
10-
11-
ClientReadyEventParams readyParams = ClientReadyEventParams.Cast(params);
12-
PlayerBase player;
13-
if (readyParams && Class.CastTo(player, readyParams.param2)) {
14-
syncSUserConfigConstraints(player);
15-
}
16-
17-
break;
18-
19-
}
3+
override PlayerBase OnClientNewEvent(PlayerIdentity identity, vector pos, ParamsReadContext ctx) {
4+
PlayerBase player = super.OnClientNewEvent(identity, pos, ctx);
5+
syncSUserConfigConstraints(identity);
6+
return player;
207
}
218

22-
protected void syncSUserConfigConstraints(PlayerBase player) {
23-
SUserConfigConstraints.getInstance().syncWith(player.GetIdentity());
9+
override void OnClientReadyEvent(PlayerIdentity identity, PlayerBase player) {
10+
super.OnClientReadyEvent(identity, player);
11+
syncSUserConfigConstraints(identity);
12+
}
13+
14+
protected void syncSUserConfigConstraints(PlayerIdentity playerIdentity) {
15+
SUserConfigConstraints.getInstance().syncWith(playerIdentity);
2416
}
2517

2618
}

0 commit comments

Comments
 (0)