Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add day zero check on pack decline message #96

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Source/PacksV2/PackJoinWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef
PacksV2WorldComponent packsComp = Find.World.GetComponent<PacksV2WorldComponent>();

base.Interacted(initiator, recipient, extraSentencePacks, out letterText, out letterLabel, out letterDef, out lookTargets);
if(!packsComp.PawnHasPackWithMembers(recipient)&&packsComp.PawnHasPack(recipient))
if(!packsComp.PawnHasPackWithMembers(recipient) && packsComp.PawnHasPack(recipient))
packsComp.RemovePack(packsComp.GetPack(recipient));

Pack pack = packsComp.GetPack(initiator);
Expand All @@ -33,8 +33,10 @@ public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef
//Get the current date.
var date = new RimworldDate();
bool joined = false;

//Important for day 0 pack creation!
if (date.ToString() == pack.CreationDate.ToString())
bool isDayZero = date.ToString() == pack.CreationDate.ToString();
if (isDayZero)
{
packsComp.JoinPawnToPack(recipient, ref pack);
joined = true;
Expand All @@ -57,7 +59,8 @@ public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef
}

//An interaction that simply serves as a little bit of flavour text when a recipient does not like the pack.
if(recipientOpinion < RimValiMod.settings.packOpReq)
//Day 0 check to prevent confusing messages
if(recipientOpinion < RimValiMod.settings.packOpReq && !isDayZero)
recipient.interactions.TryInteractWith(initiator, AvaliDefs.DeclinePackJoin);
}

Expand Down