mirror of
https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
synced 2024-08-14 23:57:25 +00:00
Compare commits
2 commits
a0d21d10d9
...
f31db7f526
Author | SHA1 | Date | |
---|---|---|---|
|
f31db7f526 | ||
|
aaa7e8897a |
9 changed files with 166 additions and 10 deletions
Binary file not shown.
Binary file not shown.
BIN
1.5/Assemblies/RJW_PlasticSurgeries.dll
Normal file
BIN
1.5/Assemblies/RJW_PlasticSurgeries.dll
Normal file
Binary file not shown.
61
Source/RJW_PlasticSurgeries/1.5/Recipe_Plastic_Surgery.cs
Normal file
61
Source/RJW_PlasticSurgeries/1.5/Recipe_Plastic_Surgery.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using RimWorld;
|
||||||
|
using rjw;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace RJW_PlasticSurgeries
|
||||||
|
{
|
||||||
|
public abstract class Recipe_Plastic_Surgery : Recipe_Surgery
|
||||||
|
{
|
||||||
|
protected readonly bool HasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
||||||
|
protected readonly bool HasLicentia = ModLister.HasActiveModWithName("RimJobWorld - Licentia Labs");
|
||||||
|
|
||||||
|
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||||
|
{
|
||||||
|
var part = GetPartCandidate(pawn);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
|
||||||
|
if (HasPart(pawn, hediffs)) yield return part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract BodyPartRecord GetPartCandidate(Pawn pawn);
|
||||||
|
protected abstract bool HasPart(Pawn pawn, List<Hediff> hediffs);
|
||||||
|
|
||||||
|
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||||
|
Bill bill)
|
||||||
|
{
|
||||||
|
if (billDoer != null)
|
||||||
|
{
|
||||||
|
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||||
|
SurgeryResult(pawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void SurgeryResult(Pawn pawn);
|
||||||
|
|
||||||
|
|
||||||
|
/// <Compatibility />
|
||||||
|
private static void DamageHediff(Hediff hed)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SurgeryX(Pawn pawn, float severity, bool damagePart = false)
|
||||||
|
{
|
||||||
|
GetHediffs(pawn).ForEach(hed =>
|
||||||
|
{
|
||||||
|
hed.Severity = severity;
|
||||||
|
if (damagePart && HasDyspareunia) DamageHediff(hed);
|
||||||
|
if (damagePart && HasLicentia)
|
||||||
|
{
|
||||||
|
var (type, damage) = GetLicentiaDamage();
|
||||||
|
LicentiaLabs.DamageHelper.ApplyDamage(pawn, hed.Part, type, damage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract List<Hediff> GetHediffs(Pawn pawn);
|
||||||
|
protected abstract (HediffDef, float) GetLicentiaDamage();
|
||||||
|
}
|
||||||
|
}
|
61
Source/RJW_PlasticSurgeries/1.5/Recipe_Surgery_Beautify.cs
Normal file
61
Source/RJW_PlasticSurgeries/1.5/Recipe_Surgery_Beautify.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using RimWorld;
|
||||||
|
using Verse;
|
||||||
|
using static rjw.VanillaTraitDefOf;
|
||||||
|
|
||||||
|
namespace RJW_PlasticSurgeries
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public abstract class Recipe_Surgery_Beautify : Recipe_Surgery
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||||
|
{
|
||||||
|
if (!pawn.story.traits.HasTrait(Beauty) ||
|
||||||
|
pawn.story.traits.HasTrait(Beauty) && pawn.story.traits.GetTrait(Beauty).Degree < 2)
|
||||||
|
yield return pawn.RaceProps.body.corePart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||||
|
Bill bill)
|
||||||
|
{
|
||||||
|
if (billDoer != null)
|
||||||
|
{
|
||||||
|
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||||
|
SurgeryResult(pawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pawn"></param>
|
||||||
|
public abstract void SurgeryResult(Pawn pawn);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Setts the severity of the Beautiful trait for the selected pawn.
|
||||||
|
/// If the trait doesn't exist in the pawns traits, it will be added.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pawn">the pawn to modify</param>
|
||||||
|
/// <param name="severity">the new severity of the pawn's Beautiful trait</param>
|
||||||
|
protected void SurgeryX(Pawn pawn, int severity)
|
||||||
|
{
|
||||||
|
if (pawn.story.traits.HasTrait(Beauty))
|
||||||
|
{
|
||||||
|
pawn.story.traits.allTraits.FindAll(t => Beauty.ConflictsWith(t))
|
||||||
|
.ForEach(t => pawn.story.traits.RemoveTrait(t));
|
||||||
|
pawn.story.traits.RemoveTrait(pawn.story.traits.allTraits.Find(t => t.def == Beauty));
|
||||||
|
}
|
||||||
|
|
||||||
|
pawn.story.traits.GainTrait(new Trait(Beauty, severity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public class Recipe_Surgery_Beautify_Beautiful : Recipe_Surgery_Beautify
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 2);
|
||||||
|
}
|
||||||
|
}
|
26
Source/RJW_PlasticSurgeries/1.5/VanillaTraitDefOf.cs
Normal file
26
Source/RJW_PlasticSurgeries/1.5/VanillaTraitDefOf.cs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
using Verse;
|
||||||
|
using RimWorld;
|
||||||
|
|
||||||
|
namespace rjw
|
||||||
|
{
|
||||||
|
[DefOf]
|
||||||
|
public static class VanillaTraitDefOf
|
||||||
|
{
|
||||||
|
public static TraitDef Tough;
|
||||||
|
|
||||||
|
public static TraitDef Nerves;
|
||||||
|
|
||||||
|
public static TraitDef Beauty;
|
||||||
|
|
||||||
|
public static TraitDef TooSmart;
|
||||||
|
|
||||||
|
public static TraitDef NaturalMood;
|
||||||
|
|
||||||
|
public static TraitDef Cannibal;
|
||||||
|
|
||||||
|
static VanillaTraitDefOf()
|
||||||
|
{
|
||||||
|
DefOfHelper.EnsureInitializedInCtor(typeof(VanillaTraitDefOf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,7 @@
|
||||||
<Description>Surgically alter pawn's genitals.</Description>
|
<Description>Surgically alter pawn's genitals.</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<OutputPath>bin\Release\1.4\</OutputPath>
|
<OutputPath>bin\Release\1.5\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="RJW_PlasticSurgeries.snk" />
|
<None Include="RJW_PlasticSurgeries.snk" />
|
||||||
|
@ -32,23 +32,25 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
|
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4055-beta" />
|
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4063" />
|
||||||
<PackageReference Include="UnlimitedHugs.Rimworld.HugsLib" Version="11.0.3" />
|
<PackageReference Include="UnlimitedHugs.Rimworld.HugsLib" Version="11.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Dyspareunia">
|
<!--<Reference Include="Dyspareunia">
|
||||||
<HintPath>..\..\..\dyspareunia\1.5\Assemblies\Dyspareunia.dll</HintPath>
|
<HintPath>..\..\..\dyspareunia\1.5\Assemblies\Dyspareunia.dll</HintPath>
|
||||||
</Reference>
|
</Reference>-->
|
||||||
<Reference Include="LicentiaLabs">
|
<Reference Include="LicentiaLabs">
|
||||||
<HintPath>..\..\..\licentia-labs\Assemblies\LicentiaLabs.dll</HintPath>
|
<HintPath>..\..\..\licentia-labs\Assemblies\LicentiaLabs.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RJW">
|
<Reference Include="RJW">
|
||||||
<HintPath>..\..\..\rjw-base\1.5\Assemblies\RJW.dll</HintPath>
|
<HintPath>..\..\..\rjw-beta\1.5\Assemblies\RJW.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="1.3\**" />
|
<Compile Remove="1.3\**" />
|
||||||
<Compile Remove="1.4\**" />
|
<Compile Remove="1.4\**" />
|
||||||
|
<Compile Remove="Recipe_Plastic_Surgery.cs" />
|
||||||
|
<Compile Remove="Recipe_Surgery_Beautify.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Remove="1.3\**" />
|
<EmbeddedResource Remove="1.3\**" />
|
||||||
|
|
|
@ -105,7 +105,7 @@ tasks.register<Exec>("sign_1.5") {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("copy") {
|
tasks.register("copy") {
|
||||||
dependsOn("copy_1.3", "copy_1.4", "copy_about")
|
dependsOn("copy_1.3", "copy_1.4", "copy_1.5", "copy_about")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Copy>("copy_about") {
|
tasks.register<Copy>("copy_about") {
|
||||||
|
@ -115,19 +115,25 @@ tasks.register<Copy>("copy_about") {
|
||||||
|
|
||||||
tasks.register<Copy>("copy_1.3") {
|
tasks.register<Copy>("copy_1.3") {
|
||||||
dependsOn("copyDll_1.3")
|
dependsOn("copyDll_1.3")
|
||||||
from(project.projectDir.resolve("${rootProject.name}/1.3"))
|
from(project.projectDir.resolve("${rootProject.name}/1.3")){
|
||||||
|
exclude("**/*.cs")
|
||||||
|
}
|
||||||
into(project.projectDir.parentFile.resolve("1.3"))
|
into(project.projectDir.parentFile.resolve("1.3"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Copy>("copy_1.4") {
|
tasks.register<Copy>("copy_1.4") {
|
||||||
dependsOn("copyDll_1.4")
|
dependsOn("copyDll_1.4")
|
||||||
from(project.projectDir.resolve("${rootProject.name}/1.4"))
|
from(project.projectDir.resolve("${rootProject.name}/1.4")){
|
||||||
|
exclude("**/*.cs")
|
||||||
|
}
|
||||||
into(project.projectDir.parentFile.resolve("1.4"))
|
into(project.projectDir.parentFile.resolve("1.4"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Copy>("copy_1.5") {
|
tasks.register<Copy>("copy_1.5") {
|
||||||
dependsOn("copyDll_1.5")
|
dependsOn("copyDll_1.5")
|
||||||
from(project.projectDir.resolve("${rootProject.name}/1.5"))
|
from(project.projectDir.resolve("${rootProject.name}/1.5")){
|
||||||
|
exclude("**/*.cs")
|
||||||
|
}
|
||||||
into(project.projectDir.parentFile.resolve("1.5"))
|
into(project.projectDir.parentFile.resolve("1.5"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "6.0.0",
|
"version": "8.0.0",
|
||||||
"rollForward": "latestMinor",
|
"rollForward": "latestMinor",
|
||||||
"allowPrerelease": false
|
"allowPrerelease": false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue