示例#1
0
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn selPawn)
        {
            IEnumerator <FloatMenuOption> enumerator = base.GetFloatMenuOptions(selPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                FloatMenuOption current = enumerator.Current;
                yield return(current);
            }
            Action action = delegate
            {
                if (selPawn.CanReach(this, PathEndMode.ClosestTouch, Danger.Deadly))
                {
                    Job job = new Job(ShipNamespaceDefOfs.EnterShip, this);
                    selPawn.jobs.TryTakeOrderedJob(job);
                }
            };

            if (DropShipUtility.AllPawnsInShip(this).Count < this.compShip.sProps.maxPassengers + 1)
            {
                yield return(new FloatMenuOption("EnterShip".Translate(), action, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            else
            {
                yield return(new FloatMenuOption("ShipPassengersFull".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
        }
        public override void Tick()
        {
            base.Tick();
            if (containingShip.shipState == ShipState.Incoming)
            {
                this.containingShip.drawTickOffset--;
                if (this.containingShip.drawTickOffset <= 0)
                {
                    this.ShipImpact();
                }
                this.containingShip.refuelableComp.ConsumeFuel(this.containingShip.refuelableComp.Props.fuelConsumptionRate / 60f);
            }

            if (this.containingShip.shipState == ShipState.Outgoing)
            {
                this.containingShip.drawTickOffset++;
                if (this.containingShip.drawTickOffset >= containingShip.compShip.sProps.TicksToDespawn)
                {
                    if (this.leavingForTarget)
                    {
                        this.ShipsLeaving();
                    }
                    else
                    {
                        List <Pawn> pawns = DropShipUtility.AllPawnsInShip(this.containingShip);
                        for (int i = 0; i < pawns.Count; i++)
                        {
                            Find.WorldPawns.PassToWorld(pawns[i]);
                        }

                        this.Destroy();
                    }
                }
            }
        }
示例#3
0
        public override void Tick()
        {
            base.Tick();
            for (int i = 0; i < DropShipUtility.AllPawnsInShip(this).Count; i++)
            {
                Pawn  pawn = DropShipUtility.AllPawnsInShip(this)[i];
                float num  = 0.6f;
                float num2 = RestUtility.PawnHealthRestEffectivenessFactor(pawn);
                num = 0.7f * num + 0.3f * num * num2;
                pawn.needs.rest.TickResting(num);
            }

            if (this.shipState == ShipState.Incoming)
            {
                this.drawTickOffset--;
                if (this.drawTickOffset <= 0)
                {
                    this.drawTickOffset = 0;
                }
                this.refuelableComp.ConsumeFuel(this.refuelableComp.Props.fuelConsumptionRate / 100f);
            }

            if (ReadyForTakeoff && ActivatedLaunchSequence)
            {
                this.timeToLiftoff--;
                if (this.ShouldWait)
                {
                    int num = GenDate.TicksPerHour;
                    this.timeToLiftoff += num;
                    this.timeWaited    += num;
                    if (this.timeWaited >= maxTimeToWait)
                    {
                        this.ShouldWait    = false;
                        this.timeToLiftoff = 0;
                    }
                }
                if (this.timeToLiftoff == 0)
                {
                    this.shipState = ShipState.Outgoing;
                    this.ActivatedLaunchSequence = false;
                }
            }

            if (shipState == ShipState.Outgoing)
            {
                this.drawTickOffset++;
                this.refuelableComp.ConsumeFuel(this.refuelableComp.Props.fuelConsumptionRate / 100f);
                if (this.Spawned)
                {
                }
            }
        }
示例#4
0
        public static void SetupShipTrading(LandedShip landedShip)
        {
            List <Pawn> allPawns = new List <Pawn>();

            foreach (ShipBase current in landedShip.ships)
            {
                allPawns = DropShipUtility.AllPawnsInShip(current);
                for (int k = 0; k < allPawns.Count; k++)
                {
                    ThingContainer innerContainer2 = current.GetInnerContainer();
                    for (int l = 0; l < innerContainer2.Count; l++)
                    {
                        if (!(innerContainer2[l] is Pawn))
                        {
                            Pawn pawn2 = CaravanInventoryUtility.FindPawnToMoveInventoryTo(innerContainer2[l], allPawns, null, null);
                            pawn2.inventory.innerContainer.TryAdd(innerContainer2[l], true);
                        }
                    }
                }
            }
        }
示例#5
0
        public override void Tick()
        {
            base.Tick();
            if (Find.Targeter.IsTargeting || Find.WorldTargeter.IsTargeting)
            {
                if (this.isTargeting)
                {
                    GhostDrawer.DrawGhostThing(UI.MouseCell(), this.Rotation, this.def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint);
                }
            }
            else
            {
                this.isTargeting = false;
            }
            for (int i = 0; i < DropShipUtility.AllPawnsInShip(this).Count; i++)
            {
                Pawn  pawn = DropShipUtility.AllPawnsInShip(this)[i];
                float num  = 0.6f;
                float num2 = RestUtility.PawnHealthRestEffectivenessFactor(pawn);
                num = 0.7f * num + 0.3f * num * num2;
                pawn.needs.rest.TickResting(num);
            }

            if (this.shipState == ShipState.Incoming)
            {
                this.drawTickOffset--;
                if (this.drawTickOffset <= 0)
                {
                    this.drawTickOffset = 0;
                }
                this.refuelableComp.ConsumeFuel(this.refuelableComp.Props.fuelConsumptionRate / 60f);
            }

            if (ReadyForTakeoff && ActivatedLaunchSequence)
            {
                this.timeToLiftoff--;
                if (this.ShouldWait)
                {
                    int num = GenDate.TicksPerHour;
                    this.timeToLiftoff += num;
                    this.timeWaited    += num;
                    if (this.timeWaited >= maxTimeToWait)
                    {
                        this.ShouldWait    = false;
                        this.timeToLiftoff = 0;
                    }
                }
                if (this.timeToLiftoff == 0)
                {
                    this.shipState = ShipState.Outgoing;
                    this.ActivatedLaunchSequence = false;
                    this.timeWaited = 0;
                }
            }

            if (shipState == ShipState.Outgoing)
            {
                this.drawTickOffset++;
                this.refuelableComp.ConsumeFuel(this.refuelableComp.Props.fuelConsumptionRate / 60f);
                if (this.Spawned)
                {
                    ShipBase_Traveling travelingShip = new ShipBase_Traveling(this);
                    GenSpawn.Spawn(travelingShip, this.Position, this.Map);
                    this.DeSpawn();
                }
            }
        }
示例#6
0
        public override void Tick()
        {
            base.Tick();
            if (Find.Targeter.IsTargeting || Find.WorldTargeter.IsTargeting)
            {
                if (this.IsTargeting)
                {
                    GhostDrawer.DrawGhostThing(UI.MouseCell(), this.Rotation, this.def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint);
                }
            }
            else
            {
                this.IsTargeting = false;
            }
            for (int i = 0; i < DropShipUtility.AllPawnsInShip(this).Count; i++)
            {
                Pawn  pawn = DropShipUtility.AllPawnsInShip(this)[i];
                float num  = 0.6f;
                num = 0.7f * num + 0.3f * num;
                pawn.needs.rest.TickResting(num);
            }

            if (this.shipState == ShipState.Incoming)
            {
                this.drawTickOffset--;
                if (this.drawTickOffset <= 0)
                {
                    this.drawTickOffset = 0;
                }
                this.ConsumeFuel();
            }

            if (ReadyForTakeoff && ActivatedLaunchSequence)
            {
                this.timeToLiftoff--;
                if (this.ShouldWait)
                {
                    int num = GenDate.TicksPerHour;
                    this.timeToLiftoff += num;
                    this.timeWaited    += num;
                    if (this.timeWaited >= maxTimeToWait)
                    {
                        this.ShouldWait    = false;
                        this.timeToLiftoff = 0;
                    }
                }
                if (this.timeToLiftoff == 0)
                {
                    this.shipState = ShipState.Outgoing;
                    this.ActivatedLaunchSequence = false;
                    this.timeWaited = 0;
                }
            }

            if (shipState == ShipState.Outgoing)
            {
                this.drawTickOffset++;
                this.ConsumeFuel();
                if (this.Spawned)
                {
                    ShipBase_Traveling travelingShip = new ShipBase_Traveling(this, this.LaunchAsFleet, ShipArrivalAction.StayOnWorldMap);

                    Map     curMap = this.Map;
                    IntVec3 curPos = this.Position;

                    //GenSpawn.Spawn(travelingShip, curPos, curMap, this.Rotation, false);
                    this.DeSpawn();
                    //Log.Message(GenAdj.CellsOccupiedBy(curPos, Rot4.North, def.Size).Count().ToString());
                    //foreach (IntVec3 current in GenAdj.CellsOccupiedBy(curPos, Rot4.North, def.Size))
                    //{

                    //    Log.Message("A: " + curMap.thingGrid.ThingsAt(current).ToList<Thing>().Count.ToString());
                    //    foreach (Thing current2 in curMap.thingGrid.ThingsAt(current).ToList<Thing>())
                    //    {
                    //        if (current2.def == null) Log.Message("NoDef?");
                    //        Log.Message("B");
                    //        if (GenSpawn.SpawningWipes(def, current2.def))
                    //        {
                    //            Log.Message("Destroyng:" + current2.Label);
                    //            current2.Destroy(DestroyMode.Vanish);
                    //        }
                    //    }
                    //}
                    GenSpawn.Spawn(travelingShip, curPos, curMap, this.Rotation, WipeMode.Vanish, false);
                }
            }
        }