Conversation
Rewrite flight/launch sync to work around MP bugs with RW 1.6 PlanetTile: - Use prefix→static sync method pattern for Launch, OrderFlyToTiles, VehicleCaravan.Launch, and StartTargetingLocalMap - Serialize GlobalTargetInfo as int triples (tileId/layerId/worldObjectId) to avoid MP's broken PlanetTile serializer (8-byte write vs 4-byte read) - Fix arrival action state loss by syncing StartTargetingLocalMap for both spawned and caravan cases - Use MP.InInterface for OrderFlyToTiles so LeaveMap works during ticks - Add thingId fallback in SyncVehiclePawn for arrival race conditions Other fixes: - Update type references for VF API changes (renamed classes/methods) - Fix turret Reload overload, add launch fleck RNG isolation - Sync VVE turret methods and handbrakeDealsDamage setting - Cache fuel gizmo field ref, extract TargetData helpers, cleanup
Opened a PR to fix this rwmt/Multiplayer#840, thank you for mentioning it
I'm not sure I understand, do you want to read a ThingComp without a valid parent (i.e. parent = null)? Why then, you are passing the parent as an argument to a SyncMethod and not care about a possible null value? The only way this would make sense to me is if private static bool PreLaunch(CompVehicleLauncher __instance,
SmashTools.Targeting.TargetData<GlobalTargetInfo> targetData, IArrivalAction arrivalAction)
{
if (!MP.IsInMultiplayer || MP.IsExecutingSyncCommand)
return true;
ExtractTargetData(targetData.targets, out var tileIds, out var layerIds, out var worldObjectIds);
// vvv pass Thing instead of ThingComp
SyncedLaunch(__instance.Vehicle, tileIds, layerIds, worldObjectIds, (VehicleArrivalAction)arrivalAction);
return false;
}
private static void SyncedLaunch(VehiclePawn vehicle, List<int> tileIds, List<int> layerIds, List<int> worldObjectIds, VehicleArrivalAction arrivalAction)
{
if (arrivalAction != null)
arrivalActionVehicleField(arrivalAction) = vehicle;
// vvv No null checks
vehicle.CompVehicleLauncher.Launch(ReconstructTargetData(tileIds, layerIds, worldObjectIds), arrivalAction);
}I do agree that the MP serialization should read and write a consistent amount of data and not misalign anything. I just don't understand how does your fix for this, actually fix anything (assuming you are not serializing a |
|
@mibac138 As for the null check I think there was race condition I was protecting againts. There is an interval of time when the vehicle already left the settlement (lauched) but not yet transitioned to the world map. Will double check as well together with the planet tile thing. So let's wait for merge and release. |
Summary