Syncing Mouse variables

This commit is contained in:
IbanPlay committed 2021-12-19 20:07:14 +01:00
1 parent c1b8550714
commit 40a6443245
6 files changed
+139 -34

No files matched your search

+23 -6
View File
@@ -280,11 +280,24 @@ namespace CalamityMod
Main.player[reader.ReadInt32()].Calamity().HandleReforgeTierSafety(reader);
break;
//
// Default case: with no idea how long the packet is, we can't safely read data.
// Throw an exception now instead of allowing the network stream to corrupt.
//
default:
//
// Mouse control syncs
//
case CalamityModMessageType.RightClickSync:
Main.player[reader.ReadInt32()].Calamity().HandleRightClick(reader);
break;
case CalamityModMessageType.MousePositionSync:
Main.player[reader.ReadInt32()].Calamity().HandleMousePosition(reader);
break;
//
// Default case: with no idea how long the packet is, we can't safely read data.
// Throw an exception now instead of allowing the network stream to corrupt.
//
default:
CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}.");
throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID.");
}
@@ -399,6 +412,10 @@ namespace CalamityMod
// Reforge syncs
ItemTypeLastReforgedSync, // TODO -- there has to be a better way to do this, but I don't know what it is
ReforgeTierSafetySync
ReforgeTierSafetySync,
// Mouse Controls syncs
RightClickSync,
MousePositionSync
}
}