@@ -84,7 +84,7 @@ public void Finish() {
84
84
85
85
public void ProcessMessages ( ) {
86
86
ProcessObjectUpdates ( ) ;
87
- while ( _peer . ReadMessage ( out NetIncomingMessage msg ) ) {
87
+ while ( _peer . ReadMessage ( out NetIncomingMessage ? msg ) ) {
88
88
switch ( msg . MessageType ) {
89
89
case NetIncomingMessageType . WarningMessage :
90
90
logger . Warn ( msg . ReadString ) ;
@@ -142,7 +142,7 @@ private void ProcessObjectUpdates() {
142
142
}
143
143
144
144
private void ProcessConnectionApproval ( NetIncomingMessage msg ) {
145
- NetConnection connection = msg . SenderConnection ;
145
+ NetConnection connection = msg . SenderConnection ! ;
146
146
string username = msg . ReadString ( ) ;
147
147
string displayName = msg . ReadString ( ) ;
148
148
if ( string . IsNullOrEmpty ( username ) ) {
@@ -171,10 +171,10 @@ private void ProcessConnectionApproval(NetIncomingMessage msg) {
171
171
SendChatMessage ( null , null , $ "\f 1{ displayName } is joining the game") ;
172
172
}
173
173
174
- private void ProcessStatusChanged ( NetConnectionStatus status , string reason , NetConnection connection ) {
174
+ private void ProcessStatusChanged ( NetConnectionStatus status , string reason , NetConnection ? connection ) {
175
175
switch ( status ) {
176
176
case NetConnectionStatus . Connected : {
177
- if ( connection . Tag is not PlayerObject player ) {
177
+ if ( connection ? . Tag is not PlayerObject player ) {
178
178
logger . Warn ( "Tag was not player, ignoring connect!" ) ;
179
179
return ;
180
180
}
@@ -196,7 +196,7 @@ private void ProcessStatusChanged(NetConnectionStatus status, string reason, Net
196
196
break ;
197
197
}
198
198
case NetConnectionStatus . Disconnected : {
199
- if ( connection . Tag is not PlayerObject player ) {
199
+ if ( connection ? . Tag is not PlayerObject player ) {
200
200
logger . Warn ( "Tag was not player, ignoring disconnect!" ) ;
201
201
return ;
202
202
}
@@ -208,8 +208,8 @@ private void ProcessStatusChanged(NetConnectionStatus status, string reason, Net
208
208
}
209
209
}
210
210
211
- private static void ProcessConnectionLatencyUpdated ( NetConnection connection , float roundTripTime ) {
212
- if ( connection . Tag is not PlayerObject player ) {
211
+ private static void ProcessConnectionLatencyUpdated ( NetConnection ? connection , float roundTripTime ) {
212
+ if ( connection ? . Tag is not PlayerObject player ) {
213
213
logger . Warn ( "Tag was not player, ignoring ping update!" ) ;
214
214
return ;
215
215
}
@@ -270,15 +270,15 @@ private void ProcessRemoveObject(NetBuffer msg) {
270
270
}
271
271
272
272
private static void ProcessPlayerMove ( NetIncomingMessage msg ) {
273
- if ( msg . SenderConnection . Tag is not PlayerObject player ) {
273
+ if ( msg . SenderConnection ? . Tag is not PlayerObject player ) {
274
274
logger . Warn ( "Tag was not player, ignoring player move!" ) ;
275
275
return ;
276
276
}
277
277
player . move = msg . ReadVector2Int ( ) ;
278
278
}
279
279
280
280
private void ProcessPlayerInteract ( NetIncomingMessage msg ) {
281
- if ( msg . SenderConnection . Tag is not PlayerObject player ) {
281
+ if ( msg . SenderConnection ? . Tag is not PlayerObject player ) {
282
282
logger . Warn ( "Tag was not player, ignoring player interact!" ) ;
283
283
return ;
284
284
}
@@ -295,7 +295,7 @@ private void ProcessPlayerInteract(NetIncomingMessage msg) {
295
295
}
296
296
297
297
private void ProcessChatMessage ( NetIncomingMessage msg ) {
298
- if ( msg . SenderConnection . Tag is not PlayerObject player ) {
298
+ if ( msg . SenderConnection ? . Tag is not PlayerObject player ) {
299
299
logger . Warn ( "Tag was not player, ignoring chat message!" ) ;
300
300
return ;
301
301
}
0 commit comments