Fixed Codebreaker items not being placed in MP
This commit is contained in:
1 parent
f5ceadb8eb
commit
edb48ae04f
6 files changed
+15
-7
No files matched your search
@@ -46,7 +46,7 @@ namespace CalamityMod.Items.DraedonMisc
|
||||
return false;
|
||||
|
||||
codebreakerTileEntity.ContainsAdvancedDisplay = true;
|
||||
codebreakerTileEntity.SyncConstituents();
|
||||
codebreakerTileEntity.SyncConstituents((short)Main.myPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.DraedonMisc
|
||||
return false;
|
||||
|
||||
codebreakerTileEntity.ContainsCoolingCell = true;
|
||||
codebreakerTileEntity.SyncConstituents();
|
||||
codebreakerTileEntity.SyncConstituents((short)Main.myPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace CalamityMod.Items.DraedonMisc
|
||||
return false;
|
||||
|
||||
codebreakerTileEntity.ContainsDecryptionComputer = true;
|
||||
codebreakerTileEntity.SyncConstituents();
|
||||
codebreakerTileEntity.SyncConstituents((short)Main.myPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace CalamityMod.Items.DraedonMisc
|
||||
return false;
|
||||
|
||||
codebreakerTileEntity.ContainsSensorArray = true;
|
||||
codebreakerTileEntity.SyncConstituents();
|
||||
codebreakerTileEntity.SyncConstituents((short)Main.myPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.DraedonMisc
|
||||
return false;
|
||||
|
||||
codebreakerTileEntity.ContainsVoltageRegulationSystem = true;
|
||||
codebreakerTileEntity.SyncConstituents();
|
||||
codebreakerTileEntity.SyncConstituents((short)Main.myPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace CalamityMod.TileEntities
|
||||
}
|
||||
}
|
||||
|
||||
public void SyncConstituents()
|
||||
public void SyncConstituents(short sender)
|
||||
{
|
||||
// Don't bother sending packets in singleplayer.
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
@@ -183,13 +183,15 @@ namespace CalamityMod.TileEntities
|
||||
|
||||
packet.Write((byte)CalamityModMessageType.UpdateCodebreakerConstituents);
|
||||
packet.Write(ID);
|
||||
packet.Write(sender);
|
||||
packet.Write(containmentFlagWrapper);
|
||||
packet.Send();
|
||||
packet.Send(-1, sender);
|
||||
}
|
||||
|
||||
public static void ReadConstituentsUpdateSync(Mod mod, BinaryReader reader)
|
||||
{
|
||||
int id = reader.ReadInt32();
|
||||
short sender = reader.ReadInt16();
|
||||
bool exists = ByID.TryGetValue(id, out TileEntity tileEntity);
|
||||
|
||||
// Continue reading to the end even if a tile entity with the given ID does not exist.
|
||||
@@ -215,6 +217,12 @@ namespace CalamityMod.TileEntities
|
||||
codebreakerTileEntity.ContainsAdvancedDisplay = containsAdvancedDisplay;
|
||||
codebreakerTileEntity.ContainsVoltageRegulationSystem = containsVoltageRegulationSystem;
|
||||
codebreakerTileEntity.ContainsCoolingCell = containsCoolingCell;
|
||||
|
||||
// Send the packet again to the other clients if this packet was received on the server.
|
||||
// Since ModPackets go solely to the server when sent by a client this is necesssary
|
||||
// to ensure that all clients are informed of what happened.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
codebreakerTileEntity.SyncConstituents(sender);
|
||||
}
|
||||
|
||||
public void SyncContainedStuff()
|
||||
|
||||
Reference in new issue
Block a user