Beispiel #1
0
        public static void GenerateFactionsIntoWorldPostFix()
        {
            Log.Message("GeneratingShipTracker");
            ShipTracker shipTracker = (ShipTracker)WorldObjectMaker.MakeWorldObject(ShipNamespaceDefOfs.ShipTracker);

            shipTracker.Tile = TileFinder.RandomStartingTile();
            Find.WorldObjects.Add(shipTracker);
        }
Beispiel #2
0
        //public static bool AdjustToPrefix(ref Transferable __instance, int destination)
        //{
        //    if (!Find.WindowStack.Windows.Any(x => x.GetType() == typeof(Dialog_LoadShipCargo)))
        //    {
        //        if (!__instance.CanAdjustTo(destination).Accepted)
        //        {
        //            Log.Error("Failed to adjust transferable counts");
        //            return false;
        //        }
        //    }

        //    int countTotransferInt = Traverse.Create(__instance).Field("countToTransfer").GetValue<int>();
        //    Log.Message(countTotransferInt.ToString());

        //    Log.Message(destination.ToString() + " vs. " + countTotransferInt.ToString() + " vs " + __instance.CountToTransfer.ToString());
        //    Log.Message(__instance.GetMaximum().ToString() + "  " + __instance.GetMinimum());
        //    countTotransferInt = __instance.ClampAmount(destination);
        //    return false;
        //}

        //public static bool CanAdjustToPostFix(ref TransferableOneWay instance, ref AcceptanceReport _result, int destination)
        //{
        //    Log.Message(destination.ToString() + " vs. " + instance.CountToTransfer.ToString());

        //    if (destination == instance.CountToTransfer)
        //    {
        //        return true;
        //    }
        //    int num = instance.ClampAmount(destination);
        //    if (num != instance.CountToTransfer)
        //    {
        //        return true;
        //    }
        //    if (destination < instance.CountToTransfer)
        //    {
        //        Log.Message("Underflow");
        //        return instance.UnderflowReport().Accepted;
        //    }

        //    Log.Message("Overrflow");
        //    return instance.OverflowReport().Accepted;
        //}

        public static void GenerateFactionsIntoWorldPostFix()
        {
            Log.Message("GeneratingShipTracker");
            ShipTracker shipTracker = (ShipTracker)WorldObjectMaker.MakeWorldObject(ShipNamespaceDefOfs.ShipTracker);
            int         tile        = 0;

            while (!(Find.WorldObjects.AnyWorldObjectAt(tile) || Find.WorldGrid[tile].biome == BiomeDefOf.Ocean))
            {
                tile = Rand.Range(0, Find.WorldGrid.TilesCount);
            }
            shipTracker.Tile = tile;
            Find.WorldObjects.Add(shipTracker);
        }