Esempio n. 1
0
        public static void Postfix(CaravanArrivalAction_VisitSettlement __instance, Caravan caravan, Settlement ___settlement)
        {
            if (!___settlement.HasMap)
            {
                LongEventHandler.QueueLongEvent(delegate()
                {
                    var filePreset = SettlementGeneration.GetPresetFor(___settlement, out LocationDef locationDef);
                    if (filePreset != null)
                    {
                        customSettlementGeneration = true;
                        locationData = new LocationData {
                            file = filePreset, locationDef = locationDef
                        };
                    }
                    Map orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(___settlement.Tile, null);
                    CaravanEnterMapUtility.Enter(caravan, orGenerateMap, CaravanEnterMode.Edge, 0, true, null);

                    if (filePreset != null)
                    {
                        SettlementGeneration.InitialiseLocationGeneration(orGenerateMap, filePreset, locationDef);
                    }
                }, "GeneratingMapForNewEncounter", false, null, true);
                return;
            }
            Map orGenerateMap2 = GetOrGenerateMapUtility.GetOrGenerateMap(___settlement.Tile, null);

            CaravanEnterMapUtility.Enter(caravan, orGenerateMap2, CaravanEnterMode.Edge, 0, true, null);
        }
Esempio n. 2
0
        public override void Generate(Map map, GenStepParams parms)
        {
            var filePreset = SettlementGeneration.GetPresetFor(map.Parent, locationDef);

            if (filePreset != null)
            {
                GetOrGenerateMapPatch.locationData = new LocationData {
                    file = filePreset, locationDef = locationDef
                };
            }
        }
Esempio n. 3
0
        public static void Prefix(ref Caravan caravan, ref Settlement settlement)
        {
            var filePreset = SettlementGeneration.GetPresetFor(settlement, out LocationDef locationDef);

            if (filePreset != null)
            {
                locationData = new LocationData {
                    file = filePreset, locationDef = locationDef
                };
                customSettlementGeneration = true;
            }
        }
Esempio n. 4
0
 public static void Postfix(IntVec3 mapSize, MapParent parent, MapGeneratorDef mapGenerator, IEnumerable <GenStepWithParams> extraGenStepDefs = null, Action <Map> extraInitBeforeContentGen = null)
 {
     Log.Message("GetOrGenerateMapPatch.caravanArrival: " + GetOrGenerateMapPatch.caravanArrival);
     if (!caravanArrival)
     {
         var preset = SettlementGeneration.GetPresetFor(parent, out LocationDef locationDef);
         if (preset != null && locationDef != null)
         {
             SettlementGeneration.DoSettlementGeneration(parent.Map, preset.FullName, locationDef, parent.Faction, false);
         }
     }
 }