Skip to content

Commit

Permalink
Merge pull request #194 from edbmods/alpha-18-support
Browse files Browse the repository at this point in the history
Beta 18 support
  • Loading branch information
edbmods authored Nov 18, 2017
2 parents 05fbc4b + be34386 commit 8d02e45
Show file tree
Hide file tree
Showing 29 changed files with 184 additions and 156 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Change them to the values specific to your project.

[assembly: AssemblyTitle("EdBPrepareCarefully")]
[assembly: AssemblyDescription("A RimWorld Alpha 17 mod")]
[assembly: AssemblyDescription("A RimWorld mod")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdB Prepare Carefully Mod")]
Expand All @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("0.17.1.7")]
[assembly: AssemblyVersion("0.18.1")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
4 changes: 2 additions & 2 deletions Resources/About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<name>EdB Prepare Carefully</name>
<author>EdB</author>
<url></url>
<targetVersion>0.17.1557</targetVersion>
<targetVersion>0.18.1722</targetVersion>
<description>Customize your colonists, choose your gear and prepare carefully for your crash landing!

If you get a set of starting colonists that you like, save them as a preset so that you can start your game the same way next time.

[Version 0.17.1.7]
[Version 0.18.1]
</description>
</ModMetaData>
7 changes: 7 additions & 0 deletions Resources/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
_____________________________________________________________________________

Version 0.18.1
_____________________________________________________________________________

- Added support for Beta 18.

_____________________________________________________________________________

Version 0.17.1.7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<EdB.PrepareCarefully.CarefullyPawnRelationDefs>
<Defs>

<EdB.PrepareCarefully.CarefullyPawnRelationDef>
<defName>Parent</defName>
Expand Down Expand Up @@ -81,4 +81,4 @@
<inverse>Kin</inverse>
</EdB.PrepareCarefully.CarefullyPawnRelationDef>

</EdB.PrepareCarefully.CarefullyPawnRelationDefs>
</Defs>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<EdB.PrepareCarefully.CarefullyPawnRelationDefs>
<Defs>

<EdB.PrepareCarefully.CarefullyPawnRelationDef>
<defName>Spouse</defName>
Expand Down Expand Up @@ -69,4 +69,4 @@
</conflicts>
</EdB.PrepareCarefully.CarefullyPawnRelationDef>

</EdB.PrepareCarefully.CarefullyPawnRelationDefs>
</Defs>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<EdB.PrepareCarefully.CarefullyPawnRelationDefs>
<Defs>

<EdB.PrepareCarefully.CarefullyPawnRelationDef>
<defName>Bond</defName>
<animal>true</animal>
</EdB.PrepareCarefully.CarefullyPawnRelationDef>

</EdB.PrepareCarefully.CarefullyPawnRelationDefs>
</Defs>
4 changes: 2 additions & 2 deletions Resources/Defs/Scenarios/ScenParts_Fixed.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
<Defs>
<!-- This file is no longer used, but since the workshop doesn't seem to consistently
delete files on mod updates, we're leaving it here to avoid mod corruption errors.
We leave a placeholder pawn relation def since that should leave no side-effects.
-->
<EdB.PrepareCarefully.CarefullyPawnRelationDef>
<defName>ScenParts_FixedDummyDefinition</defName>
</EdB.PrepareCarefully.CarefullyPawnRelationDef>
</ThingDefs>
</Defs>
4 changes: 2 additions & 2 deletions Resources/Defs/ThingDefs/EdBPrepareCarefully.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
<Defs>
<!-- This file is no longer used, but since the workshop doesn't seem to consistently
delete files on mod updates, we're leaving it here to avoid mod corruption errors.
We leave a placeholder pawn relation def since that should leave no side-effects.
-->
<EdB.PrepareCarefully.CarefullyPawnRelationDef>
<defName>EdBPrepareCarefullyDummyDefinition</defName>
</EdB.PrepareCarefully.CarefullyPawnRelationDef>
</ThingDefs>
</Defs>
23 changes: 11 additions & 12 deletions Source/AgeInjuryUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void GenerateRandomOldAgeInjuries(Pawn pawn, bool tryNotToKillPawn
select x;
if (source.Any<BodyPartRecord>()) {
BodyPartRecord bodyPartRecord = source.RandomElementByWeight((BodyPartRecord x) => x.coverageAbs);
DamageDef dam = RandomOldInjuryDamageType(bodyPartRecord.def.frostbiteVulnerability > 0f && pawn.RaceProps.ToolUser);
DamageDef dam = AgeInjuryUtility.RandomOldInjuryDamageType(bodyPartRecord.def.frostbiteVulnerability > 0f && pawn.RaceProps.ToolUser);
HediffDef hediffDefFromDamage = HealthUtility.GetHediffDefFromDamage(dam, pawn, bodyPartRecord);
if (bodyPartRecord.def.oldInjuryBaseChance > 0f && hediffDefFromDamage.CompPropsFor(typeof(HediffComp_GetsOld)) != null) {
if (Rand.Chance(bodyPartRecord.def.amputateIfGeneratedInjuredChance)) {
Expand All @@ -44,7 +44,7 @@ public static void GenerateRandomOldAgeInjuries(Pawn pawn, bool tryNotToKillPawn
hediff_MissingPart.TryGetComp<HediffComp_GetsOld>().IsOld = true;
pawn.health.AddHediff(hediff_MissingPart, bodyPartRecord, null);
if (pawn.RaceProps.Humanlike && (bodyPartRecord.def == BodyPartDefOf.LeftLeg || bodyPartRecord.def == BodyPartDefOf.RightLeg) && Rand.Chance(0.5f)) {
RecipeDefOf.InstallPegLeg.Worker.ApplyOnPawn(pawn, bodyPartRecord, null, AgeInjuryUtility.emptyIngredientsList);
RecipeDefOf.InstallPegLeg.Worker.ApplyOnPawn(pawn, bodyPartRecord, null, AgeInjuryUtility.emptyIngredientsList, null);
}
}
else {
Expand Down Expand Up @@ -109,18 +109,17 @@ public static IEnumerable<HediffGiver_Birthday> RandomHediffsToGainOnBirthday(Pa
return AgeInjuryUtility.RandomHediffsToGainOnBirthday(pawn.def, age);
}


// EdB: Interpretation of bad decompilation
//[DebuggerHidden]
//private static IEnumerable<HediffGiver_Birthday> RandomHediffsToGainOnBirthday(ThingDef raceDef, int age)
//{
// AgeInjuryUtility.<RandomHediffsToGainOnBirthday>c__Iterator92 <RandomHediffsToGainOnBirthday>c__Iterator = new AgeInjuryUtility.<RandomHediffsToGainOnBirthday>c__Iterator92();
// <RandomHediffsToGainOnBirthday>c__Iterator.raceDef = raceDef;
// <RandomHediffsToGainOnBirthday>c__Iterator.age = age;
// <RandomHediffsToGainOnBirthday>c__Iterator.<$>raceDef = raceDef;
// <RandomHediffsToGainOnBirthday>c__Iterator.<$>age = age;
// AgeInjuryUtility.<RandomHediffsToGainOnBirthday>c__Iterator92 expr_23 = <RandomHediffsToGainOnBirthday>c__Iterator;
// expr_23.$PC = -2;
// return expr_23;
//private static IEnumerable<HediffGiver_Birthday> RandomHediffsToGainOnBirthday(ThingDef raceDef, int age) {
// AgeInjuryUtility.< RandomHediffsToGainOnBirthday > c__Iterator0 < RandomHediffsToGainOnBirthday > c__Iterator = new AgeInjuryUtility.< RandomHediffsToGainOnBirthday > c__Iterator0();
//
// < RandomHediffsToGainOnBirthday > c__Iterator.raceDef = raceDef;
// < RandomHediffsToGainOnBirthday > c__Iterator.age = age;
// AgeInjuryUtility.< RandomHediffsToGainOnBirthday > c__Iterator0 expr_15 = < RandomHediffsToGainOnBirthday > c__Iterator;
// expr_15.$PC = -2;
// return expr_15;
//}

private static IEnumerable<HediffGiver_Birthday> RandomHediffsToGainOnBirthday(ThingDef raceDef, int age) {
Expand Down
3 changes: 2 additions & 1 deletion Source/ColonistLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Reflection;
using Verse;
using Verse.Sound;

namespace EdB.PrepareCarefully {
public class ColonistLoader {
Expand All @@ -21,7 +22,7 @@ public static CustomPawn LoadFromFile(PrepareCarefully loadout, string name) {
}

if ("2".Equals(version)) {
Messages.Message("EdB.PC.Dialog.PawnPreset.Error.PreAlpha13NotSupported".Translate(), MessageSound.SeriousAlert);
Messages.Message("EdB.PC.Dialog.PawnPreset.Error.PreAlpha13NotSupported".Translate(), MessageTypeDefOf.ThreatBig);
return null;
}
else if ("3".Equals(version)) {
Expand Down
1 change: 1 addition & 0 deletions Source/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public void SavePreset(string name) {
public void PrepareGame() {
// Replace the pawns.
Find.GameInitData.startingPawns = PrepareCarefully.Instance.Colonists;
Find.GameInitData.startingPawnCount = PrepareCarefully.Instance.Colonists.Count;

// This needs some explaining. We need custom scenario parts to handle animal spawning
// and scattered things. However, we don't want the scenario that gets saved with a game
Expand Down
2 changes: 1 addition & 1 deletion Source/CostCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public double GetBaseThingCost(ThingDef def, ThingDef stuffDef) {
return def.BaseMarketValue;
}
else {
// TODO: Alpha 17
// TODO: Alpha 19
// Should look at ThingMaker.MakeThing() to decide which validations we need to do
// before calling that method. That method doesn't do null checks everywher, so we
// may need to do those validations ourselves to avoid null pointer exceptions.
Expand Down
2 changes: 1 addition & 1 deletion Source/DialogManageImplants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ public override void DoWindowContents(Rect inRect) {
if (Widgets.ButtonText(buttonRect, ConfirmButtonLabel.Translate(), true, true, true)) {
string validationMessage = ConfirmValidation();
if (validationMessage != null) {
Messages.Message(validationMessage.Translate(), MessageSound.RejectInput);
Messages.Message(validationMessage.Translate(), MessageTypeDefOf.RejectInput);
}
else {
this.Confirm();
Expand Down
2 changes: 1 addition & 1 deletion Source/DialogSelectParentChildPawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public override void DoWindowContents(Rect inRect) {
if (Widgets.ButtonText(buttonRect, ConfirmButtonLabel.Translate(), true, true, true)) {
string validationMessage = ConfirmValidation();
if (validationMessage != null) {
Messages.Message(validationMessage.Translate(), MessageSound.RejectInput);
Messages.Message(validationMessage.Translate(), MessageTypeDefOf.RejectInput);
}
else {
this.Confirm();
Expand Down
2 changes: 1 addition & 1 deletion Source/DialogSelectPawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public override void DoWindowContents(Rect inRect) {
if (Widgets.ButtonText(buttonRect, ConfirmButtonLabel.Translate(), true, true, true)) {
string validationMessage = ConfirmValidation();
if (validationMessage != null) {
Messages.Message(validationMessage.Translate(), MessageSound.RejectInput);
Messages.Message(validationMessage.Translate(), MessageTypeDefOf.RejectInput);
}
else {
this.Confirm();
Expand Down
2 changes: 1 addition & 1 deletion Source/Dialog_Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public override void DoWindowContents(Rect inRect) {
if (Widgets.ButtonText(buttonRect, ConfirmButtonLabel, true, true, true)) {
string validationMessage = ConfirmValidation();
if (validationMessage != null) {
Messages.Message(validationMessage.Translate(), MessageSound.RejectInput);
Messages.Message(validationMessage.Translate(), MessageTypeDefOf.RejectInput);
}
else {
this.Confirm();
Expand Down
2 changes: 1 addition & 1 deletion Source/Dialog_SaveColonist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override void DoSpecialSaveLoadGUI(Rect inRect) {
Rect butRect = new Rect(420, top, inRect.width - 400 - 20, 35);
if (Widgets.ButtonText(butRect, "EdB.PC.Dialog.PawnPreset.Button.Save".Translate(), true, false, true) || flag) {
if (Filename.Length == 0) {
Messages.Message("NeedAName".Translate(), MessageSound.RejectInput);
Messages.Message("NeedAName".Translate(), MessageTypeDefOf.RejectInput);
}
else {
if (action != null) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Dialog_SavePreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected override void DoSpecialSaveLoadGUI(Rect inRect) {
Rect butRect = new Rect(420, top, inRect.width - 400 - 20, 35);
if (Widgets.ButtonText(butRect, "EdB.PC.Dialog.Preset.Button.Save".Translate(), true, false, true) || flag) {
if (PrepareCarefully.Instance.Filename.Length == 0) {
Messages.Message("NeedAName".Translate(), MessageSound.RejectInput);
Messages.Message("NeedAName".Translate(), MessageTypeDefOf.RejectInput);
}
else {
if (action != null) {
Expand Down
Loading

0 comments on commit 8d02e45

Please sign in to comment.