コード例 #1
0
 public static bool TryDropAndSetForbidden(Thing th, IntVec3 pos, Map map, ThingPlaceMode mode, out Thing resultingThing, bool forbidden)
 {
     if (GenDrop.TryDropSpawn_NewTmp(th, pos, map, ThingPlaceMode.Near, out resultingThing))
     {
         if (resultingThing != null)
         {
             resultingThing.SetForbidden(forbidden, warnOnFail: false);
         }
         return(true);
     }
     resultingThing = null;
     return(false);
 }
コード例 #2
0
        private void DeconstructGunAndReset()
        {
            if (gun != null && PositionHeld != null && MapHeld != null)
            {
                Thing resultingThing;
                //GenDrop.TryDropSpawn(gun, PositionHeld, MapHeld, ThingPlaceMode.Near, out resultingThing);
                GenDrop.TryDropSpawn_NewTmp(gun, PositionHeld, MapHeld, ThingPlaceMode.Near, out resultingThing);
            }
            forceCreateGunAndTop = false;
            collectingGunAllowed = false;
            gun = null;
            top = null;

            ResetCurrentTarget();
            burstCooldownTicksLeft = 0;

            loaded   = false;
            holdFire = false;
        }
コード例 #3
0
        public static void dropSidearm(Pawn pawn, Thing weapon, bool intentional)
        {
            if (weapon == null)
            {
                return;
            }
            if (pawn.IsQuestLodger() && intentional)
            {
                return;
            }

            if (pawn.equipment.Primary == weapon)
            {
                Pawn_EquipmentTracker_TryDropEquipment.dropEquipmentSourcedBySimpleSidearms = true;
                pawn.equipment.TryDropEquipment(pawn.equipment.Primary, out _, pawn.Position, false);
                Pawn_EquipmentTracker_TryDropEquipment.dropEquipmentSourcedBySimpleSidearms = false;
            }
            else
            {
                if (weapon.stackCount > 1)
                {
                    var toDrop = weapon.SplitOff(1);
                    GenDrop.TryDropSpawn_NewTmp(toDrop, pawn.Position, pawn.Map, ThingPlaceMode.Near, out _);
                }
                else
                {
                    pawn.inventory.innerContainer.TryDrop(weapon, pawn.Position, pawn.Map, ThingPlaceMode.Near, out _, null);
                }
            }

            CompSidearmMemory pawnMemory = CompSidearmMemory.GetMemoryCompForPawn(pawn);

            if (pawnMemory == null)
            {
                return;
            }
            pawnMemory.InformOfDroppedSidearm(weapon, intentional);
        }
コード例 #4
0
 protected virtual void OnDropThing(Thing t, int count)
 {
     GenDrop.TryDropSpawn_NewTmp(t.SplitOff(count), base.SelThing.Position, base.SelThing.Map, ThingPlaceMode.Near, out var _);
 }