private static void CreateLord(Faction faction, IntVec3 chillSpot, List <Pawn> pawns, Map map) { var mapComp = Hospitality_MapComponent.Instance(map); int stayDuration = (int)(Rand.Range(1f, 2.4f) * GenDate.TicksPerDay); var lordJob = new LordJob_VisitColony(faction, chillSpot, stayDuration); LordMaker.MakeNewLord(faction, lordJob, map, pawns); // Set default interaction pawns.ForEach(delegate(Pawn p) { var compGuest = p.GetComp <CompGuest>(); if (compGuest != null) { compGuest.mayBuy = mapComp.defaultMayBuy; compGuest.chat = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.Chat; compGuest.GuestArea = mapComp.defaultAreaRestriction; } }); bool gotTrader = false; if (Rand.Value < 0.75f) { gotTrader = TryConvertOnePawnToSmallTrader(pawns, faction, map); } string label; string description; Pawn pawn = pawns.Find(x => faction.leader == x); if (pawns.Count == 1) { string traderDesc = (!gotTrader) ? string.Empty : "SingleVisitorArrivesTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "SingleVisitorArrivesLeaderInfo".Translate(); label = "LetterLabelSingleVisitorArrives".Translate(); description = "SingleVisitorArrives".Translate(new object[] { pawns[0].GetTitle().ToLower(), faction.Name, pawns[0].Name, traderDesc, leaderDesc }); description = description.AdjustedFor(pawns[0]); } else { string traderDesc = (!gotTrader) ? string.Empty : "GroupVisitorsArriveTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "GroupVisitorsArriveLeaderInfo".Translate(new object[] { pawn.LabelShort }); label = "LetterLabelGroupVisitorsArrive".Translate(); description = "GroupVisitorsArrive".Translate(new object[] { faction.Name, traderDesc, leaderDesc }); } Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.Good, pawns[0]); }
public override void Notify_PawnLost(Pawn p, PawnLostCondition condition) { base.Notify_PawnLost(p, condition); switch (condition) { case PawnLostCondition.ExitedMap: case PawnLostCondition.ChangedFaction: //foreach (var action in e.actions.OfType<EventAction_Pawns>()) action.RemovePawn(p); break; case PawnLostCondition.Undefined: case PawnLostCondition.Vanished: case PawnLostCondition.IncappedOrKilled: case PawnLostCondition.MadePrisoner: case PawnLostCondition.LeftVoluntarily: case PawnLostCondition.Drafted: Hospitality_MapComponent.Instance(lord.Map).QueueEvent(new Event { delayTicks = (int)(GenDate.TicksPerHour * Rand.Range(1f, 3f)), actions = new List <EventAction> { new EventAction_AngerForPawn(p, faction), new EventAction_BreakPawns(new List <Pawn> { p }) } }); break; default: throw new ArgumentOutOfRangeException("condition"); } }
private void SetDefaults(PrisonerInteractionModeDef mode) { Map map = SelPawn.MapHeld; if (map == null) { return; } var oldMode = Hospitality_MapComponent.Instance(map).defaultInteractionMode; if (oldMode == mode) { return; } Hospitality_MapComponent.Instance(map).defaultInteractionMode = mode; var guests = GuestUtility.GetAllGuests(map); foreach (var guest in guests) { var comp = guest.GetComp <CompGuest>(); if (comp == null) { continue; } comp.chat = mode == PrisonerInteractionModeDefOf.Chat; } }
private void SetAllDefaults(Pawn pawn) { Map map = SelPawn.MapHeld; if (map == null) { return; } var mapComp = Hospitality_MapComponent.Instance(map); if (pawn.GetComp <CompGuest>() != null) { mapComp.defaultInteractionMode = pawn.GetComp <CompGuest>().chat ? PrisonerInteractionModeDefOf.ReduceResistance : PrisonerInteractionModeDefOf.NoInteraction; } mapComp.defaultAreaRestriction = pawn.GetGuestArea(); mapComp.defaultAreaShopping = pawn.GetShoppingArea(); var guests = GuestUtility.GetAllGuests(map); foreach (var guest in guests) { var comp = guest.GetComp <CompGuest>(); if (comp != null) { comp.chat = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.ReduceResistance; comp.GuestArea = mapComp.defaultAreaRestriction; comp.ShoppingArea = mapComp.defaultAreaShopping; } } }
public static void PlanNewVisit(IIncidentTarget map, float afterDays, Faction faction = null) { var realMap = map as Map; if (realMap == null) { return; } IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, IncidentCategory.AllyArrival, realMap); if (faction != null) { incidentParms.faction = faction; } var incident = new FiringIncident(IncidentDefOf.VisitorGroup, null, incidentParms); Hospitality_MapComponent.Instance(realMap).QueueIncident(incident, afterDays); }
private void SetAllDefaults(Pawn pawn) { Map map = SelPawn.MapHeld; if (map == null) { return; } var mapComp = Hospitality_MapComponent.Instance(map); if (pawn.GetComp <CompGuest>() != null) { mapComp.defaultInteractionMode = pawn.GetComp <CompGuest>().chat ? PrisonerInteractionModeDefOf.Chat : PrisonerInteractionModeDefOf.NoInteraction; mapComp.defaultMayBuy = pawn.GetComp <CompGuest>().mayBuy; } if (pawn.playerSettings != null) { mapComp.defaultAreaRestriction = pawn.GetComp <CompGuest>().GuestArea; } var guests = GuestUtility.GetAllGuests(map); foreach (var guest in guests) { var comp = guest.GetComp <CompGuest>(); if (comp != null) { comp.chat = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.Chat; comp.GuestArea = mapComp.defaultAreaRestriction; comp.mayBuy = mapComp.defaultMayBuy; } } }
private static void CreateLord(Faction faction, IntVec3 chillSpot, List <Pawn> pawns, Map map) { var mapComp = Hospitality_MapComponent.Instance(map); int stayDuration = (int)(Rand.Range(1f, 2.4f) * GenDate.TicksPerDay); var lordJob = new LordJob_VisitColony(faction, chillSpot, stayDuration); LordMaker.MakeNewLord(faction, lordJob, map, pawns); // Set default interaction pawns.ForEach(delegate(Pawn p) { var compGuest = p.GetComp <CompGuest>(); if (compGuest != null) { compGuest.chat = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.ReduceResistance; compGuest.GuestArea = mapComp.defaultAreaRestriction; compGuest.ShoppingArea = mapComp.defaultAreaShopping; } }); bool gotTrader = false; int traderIndex = 0; if (Rand.Value < 0.75f) { gotTrader = TryConvertOnePawnToSmallTrader(pawns, faction, map, out traderIndex); } string label; string description; Pawn pawn = pawns.Find(x => faction.leader == x); if (pawns.Count == 1) { string traderDesc = !gotTrader ? string.Empty : "SingleVisitorArrivesTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "SingleVisitorArrivesLeaderInfo".Translate(); label = "LetterLabelSingleVisitorArrives".Translate(); description = "SingleVisitorArrives".Translate(new object[] { pawns[0].story.Title, faction.Name, pawns[0].Name, traderDesc, leaderDesc }); description = description.AdjustedFor(pawns[0]); } else { string traderDesc = (!gotTrader) ? string.Empty : "GroupVisitorsArriveTraderInfo".Translate(); string leaderDesc = (pawn == null) ? string.Empty : "GroupVisitorsArriveLeaderInfo".Translate(new object[] { pawn.LabelShort }); label = "LetterLabelGroupVisitorsArrive".Translate(); description = "GroupVisitorsArrive".Translate(new object[] { faction.Name, traderDesc, leaderDesc }); } // NEW PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(pawns, ref label, ref description, "LetterRelatedPawnsNeutralGroup".Translate(new object[] { Faction.OfPlayer.def.pawnsPlural }), true, true); //Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.NeutralEvent, pawns[0], faction, null); var lookTarget = gotTrader ? pawns[traderIndex] : pawns[0]; Find.LetterStack.ReceiveLetter(label, description, LetterDefOf.PositiveEvent, lookTarget, faction); }