-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict stacks by pattern and refactor comps
- Loading branch information
Showing
10 changed files
with
61 additions
and
54 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Verse; | ||
|
||
namespace NamedSubcores | ||
{ | ||
/// <summary> | ||
/// InspectPatternComp implements the common inspect method for pattern components. | ||
/// </summary> | ||
public class InspectPatternComp : BasePatternComp | ||
{ | ||
/// <summary> | ||
/// CompInspectStringExtra adds to the item inspection pane. | ||
/// </summary> | ||
/// <returns></returns> | ||
public override string CompInspectStringExtra() | ||
{ | ||
return "Pattern".Translate() + ": " + (PatternName?.ToStringShort ?? "Unknown".Translate()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,7 @@ | ||
using Verse; | ||
|
||
namespace NamedSubcores | ||
namespace NamedSubcores | ||
{ | ||
/// <summary> | ||
/// MechGestatorComp is added to mech gestators and allows us to track the subcore component during gestation. | ||
/// MechGestatorComp is added to mech gestators and allows us to track the subcore pattern during gestation. | ||
/// </summary> | ||
public class MechGestatorComp : ThingComp | ||
{ | ||
/// <summary> | ||
/// SubcoreComp tracks the subcore component. | ||
/// </summary> | ||
public SubcorePatternComp SubcoreComp; | ||
|
||
/// <summary> | ||
/// PostExposeData is used to save our component state. | ||
/// </summary> | ||
public override void PostExposeData() | ||
{ | ||
Scribe_Deep.Look(ref SubcoreComp, "subcoreComp"); | ||
base.PostExposeData(); | ||
} | ||
|
||
/// <summary> | ||
/// Reset allows the component to be reset for reuse. | ||
/// </summary> | ||
public void Reset() | ||
{ | ||
SubcoreComp = null; | ||
} | ||
} | ||
public class MechGestatorComp : BasePatternComp { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
namespace NamedSubcores | ||
using Verse; | ||
|
||
namespace NamedSubcores | ||
{ | ||
/// <summary> | ||
/// MechPatternComp is added to subcores and is used to track the pawn scanned into the subcore. | ||
/// </summary> | ||
public class SubcorePatternComp : BasePatternComp { } | ||
public class SubcorePatternComp : InspectPatternComp { | ||
/// <summary> | ||
/// AllowStackWith ensures that subcores can only be stacked with others of the same pattern. | ||
/// </summary> | ||
/// <param name="other"></param> | ||
/// <returns></returns> | ||
public override bool AllowStackWith(Thing other) | ||
{ | ||
if (base.AllowStackWith(other) == false) { return false; }; | ||
|
||
SubcorePatternComp otherComp = other?.TryGetComp<SubcorePatternComp>(); | ||
if (otherComp == null) { return false; } | ||
|
||
return PatternName == otherComp.PatternName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters