void ServeAdjacentDocker(Actor host, Actor client, IDockActivity requester) { // Since there is 0 tolerance about distance, we WILL arrive at the dock (or we get stuck haha) client.QueueActivity(new MoveAdjacentTo(client, Target.FromActor(host))); var dock = host.Trait <Dock>(); // resource transfer activities are queued by OnDock. client.QueueActivity(requester.DockActivities(host, client, dock)); client.QueueActivity(requester.ActivitiesAfterDockDone(host, client, dock)); }
// requester: It the activity that knows what to do on dock and we provide it as the parameter. // For example, if you make a mine layer repair at the service dock, // it will repair and stay in the base. However, when the mine layer is ordered to // lay mines in an area, it will eventually run out of mine and reload at a service depot, // then continue with the mining process. // In this example, it wasn't the client nor the host that knew what to do! public void ReserveDock(Actor host, Actor client, IDockActivity requester) { if (info.DockNextToActor) { ServeAdjacentDocker(host, client, requester); return; } // First, put the new client in the queue then process it. if (!queue.Contains(client)) { queue.Add(client); // Initialize this noob. // It might had been transferred from proc A to this proc. var dc = client.Trait <DockClient>(); dc.DockState = DockState.NotAssigned; dc.Requester = requester; } // notify the queue ProcessQueue(host, client); }