diff --git a/Assemblies/MoreFactionInteraction.dll b/Assemblies/MoreFactionInteraction.dll
index 7184672..d321758 100644
Binary files a/Assemblies/MoreFactionInteraction.dll and b/Assemblies/MoreFactionInteraction.dll differ
diff --git a/Defs/Incidents/Incidents_World_Misc.xml b/Defs/Incidents/Incidents_World_Misc.xml
index 66e3098..2d51f22 100644
--- a/Defs/Incidents/Incidents_World_Misc.xml
+++ b/Defs/Incidents/Incidents_World_Misc.xml
@@ -34,7 +34,7 @@
MoreFactionInteraction.World_Incidents.IncidentWorker_HuntersLodge
Hunter's lodge
PositiveEvent
- You are invited to {0}'s {1} summer retreat. There's usually a large herd of {2} coming through around this time of year. They have all the required facilities there to make meals, and they've extended their hospitality to you. This offer expires in {3} days.
+ You are invited to {0}'s {1} summer retreat. {2}. There is an outpost at the site with all the required facilities to make meals, and they've extended their hospitality to you. This offer expires in {3} days.
0.8
15
30
diff --git a/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Indoors.xml b/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Indoors.xml
index a9b0f8f..45392cc 100644
--- a/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Indoors.xml
+++ b/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Indoors.xml
@@ -25,10 +25,9 @@
(3, 3)
- 0.65
+ 0.45
- 0.5
(5, 5)
@@ -37,7 +36,11 @@
(5, 5)
- 1.25
+ 0.45
+
+
+ (4, 4)
+ 0.3
diff --git a/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Outdoors.xml b/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Outdoors.xml
index a801c39..6bd62c8 100644
--- a/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Outdoors.xml
+++ b/Defs/RuleDefs/SymbolResolver_Rules_BasePart_Outdoors.xml
@@ -75,9 +75,6 @@
0.65
-
- 0.3
-
(4, 4)
diff --git a/Defs/Sites/Cores/HuntersLodge.xml b/Defs/Sites/Cores/HuntersLodge.xml
index b38db8b..2b60482 100644
--- a/Defs/Sites/Cores/HuntersLodge.xml
+++ b/Defs/Sites/Cores/HuntersLodge.xml
@@ -7,6 +7,7 @@
A small outpost, used by friendly factions as a hunting base.
World/WorldObjects/Sites/GenericSite
World/WorldObjects/Expanding/Sites/Nothing
+ true
10
diff --git a/Defs/Sites/Parts/MigratoryHerd.xml b/Defs/Sites/Parts/MigratoryHerd.xml
index 52349d5..5930b71 100644
--- a/Defs/Sites/Parts/MigratoryHerd.xml
+++ b/Defs/Sites/Parts/MigratoryHerd.xml
@@ -7,10 +7,10 @@
A small outpost, used by friendly factions as a hunting base.
World/WorldObjects/Sites/GenericSite
World/WorldObjects/Expanding/Sites/Nothing
- there is an outpost at the site you're free to use
+ There's usually a large herd of {0} coming through around this time of year
MoreFactionInteraction.World_Incidents.SitePartWorker_MigratoryHerd
- true
true
+ true
Visit {0}
Visiting {0}
Your caravan has arrived at the hunter's lodge. It seems nobody is here, but they've obviously been expecting you and have made the place hospitable.
diff --git a/Languages/English/Keyed/Keys.xml b/Languages/English/Keyed/Keys.xml
index 96e4802..7b4bd5e 100644
--- a/Languages/English/Keyed/Keys.xml
+++ b/Languages/English/Keyed/Keys.xml
@@ -11,7 +11,6 @@
Desperate trader
{0} thanks you. Their trade caravan will arrive in about {1}.
trader
- {0} invited you to hunt {1} here.
Caravan is working.
diff --git a/MoreFactionInteraction/MoreFactionWar/IncidentWorker_FactionPeaceTalks.cs b/MoreFactionInteraction/MoreFactionWar/IncidentWorker_FactionPeaceTalks.cs
index af1b97f..fd645a9 100644
--- a/MoreFactionInteraction/MoreFactionWar/IncidentWorker_FactionPeaceTalks.cs
+++ b/MoreFactionInteraction/MoreFactionWar/IncidentWorker_FactionPeaceTalks.cs
@@ -36,7 +36,7 @@ protected override bool TryExecuteWorker(IncidentParms parms)
factionWarPeaceTalks.SetFaction(newFaction: faction);
factionWarPeaceTalks.SetWarringFactions(factionOne: faction, factionInstigator: instigatingFaction);
int randomInRange = TimeoutDaysRange.RandomInRange;
- factionWarPeaceTalks.GetComponent().StartTimeout(/*ticks: randomInRange **/ GenDate.TicksPerDay);
+ factionWarPeaceTalks.GetComponent().StartTimeout(ticks: randomInRange * GenDate.TicksPerDay);
Find.WorldObjects.Add(o: factionWarPeaceTalks);
string text = string.Format(format: this.def.letterText.AdjustedFor(p: faction.leader), faction.def.leaderTitle, faction.Name, instigatingFaction.Name, randomInRange).CapitalizeFirst();
diff --git a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/GenStep_HuntersLodge.cs b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/GenStep_HuntersLodge.cs
index 6d3a8ce..7c73af7 100644
--- a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/GenStep_HuntersLodge.cs
+++ b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/GenStep_HuntersLodge.cs
@@ -7,7 +7,7 @@ namespace MoreFactionInteraction.World_Incidents
{
public class GenStep_HuntersLodge : GenStep
{
- private const int Size = 24;
+ private const int Size = 36;
private static List possibleRects = new List();
@@ -29,7 +29,9 @@ public override void Generate(Map map, GenStepParams genStepParams)
ThingSetMakerParams maxFoodAndStuffForHuntersLodge = default;
maxFoodAndStuffForHuntersLodge.totalMarketValueRange = new FloatRange(200, 500);
- maxFoodAndStuffForHuntersLodge.totalNutritionRange = new FloatRange(0, 50);
+ maxFoodAndStuffForHuntersLodge.totalNutritionRange = new FloatRange(20, 50);
+
+ //maxFoodAndStuffForHuntersLodge.filter.SetAllow(ThingCategoryDefOf.PlantFoodRaw, true);
resolveParams.thingSetMakerParams = maxFoodAndStuffForHuntersLodge;
diff --git a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/MFI_SymbolResolver_BasePart_Indoors.cs b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/MFI_SymbolResolver_BasePart_Indoors.cs
index a004884..3146348 100644
--- a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/MFI_SymbolResolver_BasePart_Indoors.cs
+++ b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/MFI_SymbolResolver_BasePart_Indoors.cs
@@ -4,6 +4,7 @@
using System.Text;
using Verse;
using RimWorld.BaseGen;
+using UnityEngine;
namespace MoreFactionInteraction.World_Incidents.GenStep_SymbolResolver
{
@@ -70,4 +71,28 @@ public override void Resolve(ResolveParams rp)
}
}
}
+
+ class MFI_SymbolResolver_BasePart_Indoors_Leaf_GloriousPotat : SymbolResolver
+ {
+ public override void Resolve(ResolveParams rp)
+ {
+ CellRect rect = new CellRect(rp.rect.maxX - 3, rp.rect.maxZ - 3, 4, 4);
+ ThingDef gloriousPotat = ThingDefOf.RawPotatoes;
+ int num = Rand.RangeInclusive(2, 3);
+ for (int i = 0; i < num; i++)
+ {
+ ResolveParams resolveParams = rp;
+ resolveParams.rect = rect.ContractedBy(1);
+ resolveParams.singleThingDef = gloriousPotat;
+ resolveParams.singleThingStackCount = Rand.RangeInclusive(Mathf.Min(10, gloriousPotat.stackLimit), Mathf.Min(50, gloriousPotat.stackLimit));
+ BaseGen.symbolStack.Push("thing", resolveParams);
+ }
+ ResolveParams resolveParams2 = rp;
+ resolveParams2.rect = rect;
+ BaseGen.symbolStack.Push("ensureCanReachMapEdge", resolveParams2);
+ ResolveParams resolveParams3 = rp;
+ resolveParams3.rect = rect;
+ BaseGen.symbolStack.Push("emptyRoom", resolveParams3);
+ }
+ }
}
diff --git a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_HuntersLodgeBase.cs b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_HuntersLodgeBase.cs
index 9dada67..b596445 100644
--- a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_HuntersLodgeBase.cs
+++ b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_HuntersLodgeBase.cs
@@ -37,11 +37,6 @@ public override void Resolve(ResolveParams rp)
BaseGen.symbolStack.Push(symbol: "ensureCanReachMapEdge", resolveParams: resolveParams4);
ResolveParams mainBasePart = rp;
- ThingSetMakerParams thingSet = default;
- thingSet.totalMarketValueRange = new FloatRange(300, 1000);
- thingSet.filter = new ThingFilter();
- thingSet.filter.SetAllow(ThingCategoryDefOf.PlantFoodRaw, true);
- rp.thingSetMakerParams = thingSet;
mainBasePart.faction = faction;
BaseGen.symbolStack.Push(symbol: "MFI_basePart_outdoors_division", resolveParams: mainBasePart);
}
diff --git a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_Kitchen.cs b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_Kitchen.cs
index 2ea9f23..0a9a35e 100644
--- a/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_Kitchen.cs
+++ b/MoreFactionInteraction/World Incidents/GenStep_SymbolResolver/SymbolResolver_Kitchen.cs
@@ -62,10 +62,11 @@ public override void Resolve(ResolveParams rp)
Rot4 rot = (!flipACoin) ? Rot4.North : Rot4.West;
if (!GenSpawn.WouldWipeAnythingWith(thingPos: potentialSpot, thingRot: rot, thingDef: thingDef, map: map, predicate: x => x.def.category == ThingCategory.Building))
{
- if (!BaseGenUtility.AnyDoorAdjacentCardinalTo(rect: GenAdj.OccupiedRect(center: potentialSpot, rot: rot, size: thingDef.Size + thingDef.interactionCellOffset.ToIntVec2), map: map))
+ IntVec2 dontTouchMe = new IntVec2(thingDef.Size.x + 1, thingDef.Size.z + 1);
+ if (!BaseGenUtility.AnyDoorAdjacentCardinalTo(rect: GenAdj.OccupiedRect(center: potentialSpot, rot: rot, size: dontTouchMe), map: map))
{
ResolveParams resolveParams = rp;
- resolveParams.rect = GenAdj.OccupiedRect(center: potentialSpot, rot: rot, size: thingDef.size);
+ resolveParams.rect = GenAdj.OccupiedRect(center: potentialSpot, rot: rot, size: thingDef.Size);
resolveParams.singleThingDef = (Rand.Element(a: thingDef, b: tableButcher));
resolveParams.thingRot = rot;
bool? skipSingleThingIfHasToWipeBuildingOrDoesntFit = rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit;
diff --git a/MoreFactionInteraction/World Incidents/IncidentWorker_HerdMigration_Ambush.cs b/MoreFactionInteraction/World Incidents/IncidentWorker_HerdMigration_Ambush.cs
index 94d05cd..6df1ae5 100644
--- a/MoreFactionInteraction/World Incidents/IncidentWorker_HerdMigration_Ambush.cs
+++ b/MoreFactionInteraction/World Incidents/IncidentWorker_HerdMigration_Ambush.cs
@@ -29,13 +29,12 @@ protected override List GeneratePawns(IncidentParms parms)
{
Map map = parms.target as Map;
- this.pawnKindDef = PawnKindDefOf.Thrumbo;
- if (Find.WorldObjects.SiteAt(map.Tile) is Site site)
- {
- SitePartWorker_MigratoryHerd sitePart =
- (SitePartWorker_MigratoryHerd) site.parts.First(predicate: x => x.def == MFI_DefOf.MFI_HuntersLodgePart).def.Worker;
- this.pawnKindDef = sitePart?.pawnKindDef;
- }
+ if (map == null)
+ this.pawnKindDef = PawnKindDefOf.Thrumbo; //something went really wrong. Let's uh.. brush it under the rug.
+
+ else if (Find.WorldObjects.SiteAt(map.Tile) is Site site)
+ this.pawnKindDef = site.parts.First(predicate: x => x.def == MFI_DefOf.MFI_HuntersLodgePart).parms.animalKind;
+
int num = new IntRange(min: 30, max: 50).RandomInRange;
List list = new List();
diff --git a/MoreFactionInteraction/World Incidents/IncidentWorker_HuntersLodge.cs b/MoreFactionInteraction/World Incidents/IncidentWorker_HuntersLodge.cs
index 23212c4..7bbb0ec 100644
--- a/MoreFactionInteraction/World Incidents/IncidentWorker_HuntersLodge.cs
+++ b/MoreFactionInteraction/World Incidents/IncidentWorker_HuntersLodge.cs
@@ -2,10 +2,10 @@
using RimWorld;
using RimWorld.Planet;
using Verse;
-//using Kitchen.Sink;
namespace MoreFactionInteraction.World_Incidents
{
+
public class IncidentWorker_HuntersLodge : IncidentWorker
{
private const int MinDistance = 2;
@@ -33,32 +33,27 @@ protected override bool TryExecuteWorker(IncidentParms parms)
if (site == null)
return false;
- if (!this.TryFindAnimalKind(tile: tile, animalKind: out PawnKindDef pawnKindDef))
- return false;
-
- if (pawnKindDef == null) pawnKindDef = PawnKindDefOf.Thrumbo; //mostly for testing.
-
int randomInRange = TimeoutDaysRange.RandomInRange;
+
site.Tile = tile;
site.GetComponent().StartTimeout(ticks: randomInRange * GenDate.TicksPerDay);
site.SetFaction(newFaction: faction);
-
- if(site.parts.First(predicate: x => x.def == MFI_DefOf.MFI_HuntersLodgePart).Def.Worker is SitePartWorker_MigratoryHerd sitePart)
- sitePart.pawnKindDef = pawnKindDef;
+ site.customLabel = site.def.LabelCap + site.parts.First(predicate: x => x.def == MFI_DefOf.MFI_HuntersLodgePart).def.Worker
+ .GetPostProcessedThreatLabel(site, site.parts.FirstOrDefault());
Find.WorldObjects.Add(o: site);
- string text = string.Format(format: this.def.letterText, faction, faction.def.leaderTitle, pawnKindDef.GetLabelPlural(), randomInRange).CapitalizeFirst();
+
+ string text = string.Format(format: this.def.letterText,
+ faction,
+ faction.def.leaderTitle,
+ SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault()),
+ randomInRange)
+ .CapitalizeFirst();
+
Find.LetterStack.ReceiveLetter(label: this.def.letterLabel, text: text, textLetterDef: this.def.letterDef, lookTargets: site);
return true;
}
- private bool TryFindAnimalKind(int tile, out PawnKindDef animalKind)
- {
- return (from k in DefDatabase.AllDefs
- where k.RaceProps.CanDoHerdMigration && Find.World.tileTemperatures.SeasonAndOutdoorTemperatureAcceptableFor(tile: tile, animalRace: k.race)
- select k).TryRandomElementByWeight(weightSelector: (PawnKindDef x) => x.RaceProps.wildness, result: out animalKind);
- }
-
private static bool TryFindTile(out int tile)
{
return TileFinder.TryFindNewSiteTile(tile: out tile, minDist: MinDistance, maxDist: MaxDistance, allowCaravans: true, preferCloserTiles: false);
diff --git a/MoreFactionInteraction/World Incidents/SitePartWorker_MigratoryHerd.cs b/MoreFactionInteraction/World Incidents/SitePartWorker_MigratoryHerd.cs
index 5f687df..ec0a867 100644
--- a/MoreFactionInteraction/World Incidents/SitePartWorker_MigratoryHerd.cs
+++ b/MoreFactionInteraction/World Incidents/SitePartWorker_MigratoryHerd.cs
@@ -1,13 +1,13 @@
using RimWorld;
using RimWorld.Planet;
using Verse;
+using System.Linq;
+using UnityEngine;
namespace MoreFactionInteraction.World_Incidents
{
public class SitePartWorker_MigratoryHerd : SitePartWorker
{
- public PawnKindDef pawnKindDef;
-
public override string GetPostProcessedThreatLabel(Site site, SiteCoreOrPartBase siteCoreOrPart)
{
return string.Concat(base.GetPostProcessedThreatLabel(site, siteCoreOrPart),
@@ -17,15 +17,6 @@ public override string GetPostProcessedThreatLabel(Site site, SiteCoreOrPartBase
);
}
-
- //public IncidentParms parmesan;
- //public Faction faction;
-
- //public override string CompInspectStringExtra()
- //{
- // return "MFI_HuntersLodgeInspectString".Translate(new object[] { faction, pawnKindDef.GetLabelPlural() });
- //}
-
public override void PostMapGenerate(Map map)
{
IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(incCat: IncidentCategoryDefOf.Misc, target: map);
@@ -33,22 +24,26 @@ public override void PostMapGenerate(Map map)
Find.Storyteller.incidentQueue.Add(qi: queuedIncident);
}
-
+ public override string GetPostProcessedDescriptionDialogue(Site site, SiteCoreOrPartBase siteCoreOrPart)
+ {
+ return string.Format(base.GetPostProcessedDescriptionDialogue(site, siteCoreOrPart), GenLabel.BestKindLabel(siteCoreOrPart.parms.animalKind, Gender.None, true));
+ }
+
+ private bool TryFindAnimalKind(int tile, out PawnKindDef animalKind)
+ {
+ return (from k in DefDatabase.AllDefs
+ where k.RaceProps.CanDoHerdMigration && Find.World.tileTemperatures.SeasonAndOutdoorTemperatureAcceptableFor(tile: tile, animalRace: k.race)
+ select k).TryRandomElementByWeight(weightSelector: (PawnKindDef x) => x.RaceProps.wildness, result: out animalKind);
+ }
- //public override void PostExposeData()
- //{
- // base.PostExposeData();
- // Scribe_Defs.Look(ref pawnKindDef, "MFI_HuntersLodgepawnKindDef");
- // Scribe_References.Look(ref faction, "MFI_HuntersLodgeFaction");
- // Scribe_Deep.Look(ref this.parmesan, "MFI_HuntersLodgeincidentParms", new object[0]);
- //}
+ public override SiteCoreOrPartParams GenerateDefaultParams(Site site, float myThreatPoints)
+ {
+ SiteCoreOrPartParams siteCoreOrPartParams = base.GenerateDefaultParams(site, myThreatPoints);
+ if (TryFindAnimalKind(site.Tile, out siteCoreOrPartParams.animalKind))
+ {
+ siteCoreOrPartParams.threatPoints = Mathf.Max(siteCoreOrPartParams.threatPoints, siteCoreOrPartParams.animalKind.combatPower);
+ }
+ return siteCoreOrPartParams;
+ }
}
-
- //class WorldObjectCompProperties_MigratoryHerd : WorldObjectCompProperties
- //{
- // public WorldObjectCompProperties_MigratoryHerd()
- // {
- // this.compClass = typeof(SitePartWorker_MigratoryHerd);
- // }
- //}
}