public void GiveSoldThingToTrader(Thing toGive, int countToGive, Pawn playerNegotiator)
        {
            if (this.Goods.Contains(toGive))
            {
                Log.Error("Tried to add " + toGive + " to stock (pawn's trader tracker), but it's already here.", false);
                return;
            }
            Pawn pawn = toGive as Pawn;

            if (pawn != null)
            {
                pawn.PreTraded(TradeAction.PlayerSells, playerNegotiator, this.pawn);
                this.AddPawnToStock(pawn);
            }
            else
            {
                Thing thing = toGive.SplitOff(countToGive);
                thing.PreTraded(TradeAction.PlayerSells, playerNegotiator, this.pawn);
                Thing thing2 = TradeUtility.ThingFromStockToMergeWith(this.pawn, thing);
                if (thing2 != null)
                {
                    if (!thing2.TryAbsorbStack(thing, false))
                    {
                        thing.Destroy(DestroyMode.Vanish);
                    }
                }
                else
                {
                    this.AddThingToRandomInventory(thing);
                }
            }
        }
Example #2
0
        public void GiveSoldThingToTrader(Thing toGive, int countToGive, Pawn playerNegotiator)
        {
            Thing thing = toGive.SplitOff(countToGive);

            thing.PreTraded(TradeAction.PlayerSells, playerNegotiator, this);
            Thing thing2 = TradeUtility.ThingFromStockToMergeWith(this, thing);

            if (thing2 != null)
            {
                if (!thing2.TryAbsorbStack(thing, respectStackLimit: false))
                {
                    thing.Destroy();
                }
                return;
            }
            Pawn pawn = thing as Pawn;

            if (pawn != null && pawn.RaceProps.Humanlike)
            {
                soldPrisoners.Add(pawn);
            }
            things.TryAdd(thing, canMergeWithExistingStacks: false);
        }
Example #3
0
        public void GiveSoldThingToTrader(Thing toGive, int countToGive, Pawn playerNegotiator)
        {
            Thing thing = toGive.SplitOff(countToGive);

            thing.PreTraded(TradeAction.PlayerSells, playerNegotiator, this);
            Thing thing2 = TradeUtility.ThingFromStockToMergeWith(this, thing);

            if (thing2 != null)
            {
                if (!thing2.TryAbsorbStack(thing, false))
                {
                    thing.Destroy(DestroyMode.Vanish);
                }
            }
            else
            {
                Pawn pawn = thing as Pawn;
                if (pawn != null && pawn.RaceProps.Humanlike)
                {
                    this.soldPrisoners.Add(pawn);
                }
                this.things.TryAdd(thing, false);
            }
        }