public override void ProcessPacket(Guid sourcePlayerId, Packet packet, IProcessorContext context) { UpdateDisasterPacket updateDisasterPacket = (UpdateDisasterPacket)packet; ServerProcessorContext processorContext = (ServerProcessorContext)context; SimulationManager simulationManager = processorContext.Server.SimulationManager; DisasterManager disasterManager = processorContext.Server.DisasterManager; Player?simulationOwner = simulationManager.GetSimulationOwner(); if (simulationOwner == null || sourcePlayerId != simulationOwner.Value.Id) { //Deny request if client isn't the simulation owner return; } disasterManager.UpdateDisaster(updateDisasterPacket.CurrentTime); }
public override void ProcessAction(ulong currentTick, ClientProcessorContext context) { Player?simulationOwner = context.Client.SimulationManager.GetSimulationOwner(); if (simulationOwner == null || simulationOwner.Value != context.Client.LocalPlayer) { return; } DisasterManager disasterManager = context.Client.DisasterManager; if (!disasterManager.AnyDisasterInProgress()) { return; } // Pull the current time from our disaster proxy IDisasterProxy disasterProxy = disasterManager.GetCurrentDisasterProxy(); disasterManager.UpdateDisaster(disasterProxy.Time); }