Ejemplo n.º 1
0
        protected override void ScatterAt(IntVec3 loc, Map map, GenStepParams parms, int stackCount = 1)
        {
            if (!TryGetRandomValidRotation(loc, map, out Rot4 rot))
            {
                Log.Warning("Could not find any valid rotation for " + thingDef);
                return;
            }
            if (clearSpaceSize > 0)
            {
                foreach (IntVec3 item in GridShapeMaker.IrregularLump(loc, map, clearSpaceSize))
                {
                    item.GetEdifice(map)?.Destroy();
                }
            }
            Thing thing = ThingMaker.MakeThing(thingDef, stuff);

            if (thingDef.Minifiable)
            {
                thing = thing.MakeMinified();
            }
            if (thing.def.category == ThingCategory.Item)
            {
                thing.stackCount = stackCount;
                thing.SetForbidden(value: true, warnOnFail: false);
                GenPlace.TryPlaceThing(thing, loc, map, ThingPlaceMode.Near, out Thing lastResultingThing);
                if (nearPlayerStart && lastResultingThing != null && lastResultingThing.def.category == ThingCategory.Item && TutorSystem.TutorialMode)
                {
                    Find.TutorialState.AddStartingItem(lastResultingThing);
                }
            }
            else
            {
                GenSpawn.Spawn(thing, loc, map, rot);
            }
        }
Ejemplo n.º 2
0
 public bool TryDropCarriedThing(IntVec3 dropLoc, int count, ThingPlaceMode mode, out Thing resultingThing, Action <Thing, int> placedAction = null)
 {
     if (this.innerContainer.TryDrop(this.CarriedThing, dropLoc, this.pawn.MapHeld, mode, count, out resultingThing, placedAction, null))
     {
         if (resultingThing != null && this.pawn.Faction.HostileTo(Faction.OfPlayer))
         {
             resultingThing.SetForbidden(true, false);
         }
         return(true);
     }
     return(false);
 }
 public bool TryDropCarriedThing(IntVec3 dropLoc, ThingPlaceMode mode, out Thing resultingThing, Action <Thing, int> placedAction = null)
 {
     if (innerContainer.TryDrop(CarriedThing, dropLoc, pawn.MapHeld, mode, out resultingThing, placedAction))
     {
         if (resultingThing != null && pawn.Faction.HostileTo(Faction.OfPlayer))
         {
             resultingThing.SetForbidden(value: true, warnOnFail: false);
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
 internal void <> m__0(Thing t, int unused)
 {
     if (this.forbid)
     {
         t.SetForbiddenIfOutsideHomeArea();
     }
     if (this.unforbid)
     {
         t.SetForbidden(false, false);
     }
     if (t.def.IsPleasureDrug)
     {
         LessonAutoActivator.TeachOpportunity(ConceptDefOf.DrugBurning, OpportunityType.Important);
     }
 }
        protected override void ScatterAt(IntVec3 loc, Map map, int stackCount = 1)
        {
            Rot4 rot;

            if (!this.TryGetRandomValidRotation(loc, map, out rot))
            {
                Log.Warning("Could not find any valid rotation for " + this.thingDef, false);
            }
            else
            {
                if (this.clearSpaceSize > 0)
                {
                    foreach (IntVec3 c in GridShapeMaker.IrregularLump(loc, map, this.clearSpaceSize))
                    {
                        Building edifice = c.GetEdifice(map);
                        if (edifice != null)
                        {
                            edifice.Destroy(DestroyMode.Vanish);
                        }
                    }
                }
                Thing thing = ThingMaker.MakeThing(this.thingDef, this.stuff);
                if (this.thingDef.Minifiable)
                {
                    thing = thing.MakeMinified();
                }
                if (thing.def.category == ThingCategory.Item)
                {
                    thing.stackCount = stackCount;
                    thing.SetForbidden(true, false);
                    Thing thing2;
                    GenPlace.TryPlaceThing(thing, loc, map, ThingPlaceMode.Near, out thing2, null, null);
                    if (this.nearPlayerStart && thing2 != null && thing2.def.category == ThingCategory.Item && TutorSystem.TutorialMode)
                    {
                        Find.TutorialState.AddStartingItem(thing2);
                    }
                }
                else
                {
                    GenSpawn.Spawn(thing, loc, map, rot, WipeMode.Vanish, false);
                }
            }
        }