Exemple #1
0
        public void ResolveFactionPilots()
        {
            if (!this.ResolvedPawns)
            {
                this.ResolvedPawns = true;

                if (this.handlers != null && this.handlers.Count > 0)
                {
                    foreach (VehicleHandlerGroup group in this.handlers)
                    {
                        VehicleRole role = group.role;
                        if (role.slotsToOperate > 0)
                        {
                            int minimum = Math.Min(role.slotsToOperate, role.slots);
                            int maximum = Math.Max(role.slotsToOperate, role.slots);
                            int range   = Rand.Range(minimum, maximum);
                            for (int i = 0; i < range; i++)
                            {
                                Pawn newPawn = GeneratePawn(role.preferredHandlers);
                                if (newPawn != null)
                                {
                                    group.handlers.Add(newPawn);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
 public VehicleHandlerTemp(VehicleHandlerGroup originHandler)
 {
     uniqueID = Find.UniqueIDsManager.GetNextThingID();
     vehicle  = originHandler.vehicle;
     role     = originHandler.role;
     if (handlers == null)
     {
         handlers = new List <Pawn>(); // ThingOwner<Pawn>(this, false, LookMode.Reference);
     }
     if ((originHandler.handlers?.Count ?? 0) > 0)
     {
         foreach (var p in originHandler.handlers)
         {
             if (p.Spawned)
             {
                 p.DeSpawn();
             }
             if (p.holdingOwner != null)
             {
                 p.holdingOwner = null;
             }
             if (!p.IsWorldPawn())
             {
                 Find.WorldPawns.PassToWorld(p, PawnDiscardDecideMode.Decide);
             }
         }
     }
     handlers.AddRange(originHandler.handlers);
     //this.handlers = newHandlers;
 }
 public VehicleHandlerGroup(Pawn newVehicle, VehicleRole newRole, List <Pawn> newHandlers)
 {
     this.uniqueID = Find.UniqueIDsManager.GetNextThingID();
     this.vehicle  = newVehicle;
     this.role     = newRole;
     if (this.handlers == null)
     {
         this.handlers = new ThingOwner <Pawn>(this, false, LookMode.Reference);
     }
     if ((newHandlers?.Count ?? 0) > 0)
     {
         foreach (Pawn p in newHandlers)
         {
             if (p.Spawned)
             {
                 p.DeSpawn();
             }
             if (p.holdingOwner != null)
             {
                 p.holdingOwner = null;
             }
             if (!p.IsWorldPawn())
             {
                 Find.WorldPawns.PassToWorld(p, PawnDiscardDecideMode.Decide);
             }
         }
     }
     this.handlers.TryAddRange(newHandlers);
     //this.handlers = newHandlers;
 }
Exemple #4
0
 public VehicleHandlerGroup(Pawn newVehicle, VehicleRole newRole, List <Pawn> newHandlers)
 {
     this.uniqueID = Find.UniqueIDsManager.GetNextThingID();
     this.vehicle  = newVehicle;
     this.role     = newRole;
     this.handlers = newHandlers;
 }
 public VehicleHandlerGroup(Pawn newVehicle, VehicleRole newRole)
 {
     this.uniqueID = Find.UniqueIDsManager.GetNextThingID();
     this.vehicle  = newVehicle;
     this.role     = newRole;
     if (this.handlers == null)
     {
         this.handlers = new ThingOwner <Pawn>(this, false, LookMode.Reference);
     }
 }