public void MakePawnAndInitCrafting(DroidCraftingDef def)
        {
            //Update costs.
            orderProcessor.requestedItems.Clear();

            foreach (ThingOrderRequest cost in def.costList)
            {
                ThingOrderRequest costCopy = new ThingOrderRequest();
                costCopy.nutrition = cost.nutrition;
                costCopy.thingDef  = cost.thingDef;
                costCopy.amount    = cost.amount;

                orderProcessor.requestedItems.Add(costCopy);
            }

            craftingTime = def.timeCost;

            //Apply template.
            if (def.useDroidCreator)
            {
                pawnBeingCrafted = DroidUtility.MakeDroidTemplate(def.pawnKind, Faction, Map.Tile);
            }
            else
            {
                pawnBeingCrafted = PawnGenerator.GeneratePawn(def.pawnKind, Faction);
            }

            crafterStatus = CrafterStatus.Filling;
        }
示例#2
0
        public override void DoSpawn(Pawn usedBy)
        {
            Faction newFaction = GetFaction();

            Pawn spawnPawn = DroidUtility.MakeDroidTemplate(SpawnerProps.pawnKind, newFaction, parent.Map.Tile);

            if (spawnPawn != null)
            {
                GenPlace.TryPlaceThing(spawnPawn, parent.Position, parent.Map, ThingPlaceMode.Near);

                if (SpawnerProps.sendMessage)
                {
                    Messages.Message("AndroidSpawnedDroidMessageText".Translate(spawnPawn.Name.ToStringFull, usedBy.Name.ToStringFull), new GlobalTargetInfo(spawnPawn), MessageTypeDefOf.NeutralEvent);
                }
            }
        }