initial commit

first working version
a little late since i didn't expect this to be big enough to require source control 😵‍💫
This commit is contained in:
Maciej Pawłowski 2025-02-27 19:28:40 +01:00
commit f390de6ce3
Signed by: maciek
GPG key ID: 9FC186633565C9C7
14 changed files with 1117 additions and 0 deletions

View file

@ -0,0 +1,29 @@
/*
Copyright 2025 Maciej Pawłowski
This file is part of "Maciek's Big and Small unofficial addon - Anomaly".
"Maciek's Big and Small unofficial addon - Anomaly" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
"Maciek's Big and Small unofficial addon - Anomaly" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with "Maciek's Big and Small unofficial addon - Anomaly". If not, see <https://www.gnu.org/licenses/>.
*/
using RimWorld;
using Verse;
namespace MBS_Anomaly;
[DefOf]
public static class MBSADefs
{
// public static StatDef MBSA_BodySizeTransferOffset;
public static PsychicRitualDef_Megaphagy Megaphagy;
public static HediffDef MBSA_BodySizeTransferred;
static MBSADefs()
{
DefOfHelper.EnsureInitializedInCtor(typeof(MBSADefs));
}
}

View file

@ -0,0 +1,51 @@
/*
Copyright 2025 Maciej Pawłowski
This file is part of "Maciek's Big and Small unofficial addon - Anomaly".
"Maciek's Big and Small unofficial addon - Anomaly" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
"Maciek's Big and Small unofficial addon - Anomaly" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with "Maciek's Big and Small unofficial addon - Anomaly". If not, see <https://www.gnu.org/licenses/>.
*/
using Verse;
namespace MBS_Anomaly;
public class HediffSizeOffset : Hediff
{
public float SizeOffset = 0f;
// public override void ExposeData()
// {
// Scribe_Values.Look(ref SizeOffset, "SizeOffset");
// }
public override void ExposeData()
{
if (Scribe.mode == LoadSaveMode.Saving && combatLogEntry != null)
{
LogEntry target = combatLogEntry.Target;
if (target == null || !Current.Game.battleLog.IsEntryActive(target))
{
combatLogEntry = null;
}
}
Scribe_Values.Look(ref SizeOffset, "SizeOffset");
Scribe_Values.Look(ref loadID, "loadID", 0);
Scribe_Values.Look(ref ageTicks, "ageTicks", 0);
Scribe_Values.Look(ref tickAdded, "tickAdded", 0);
Scribe_Values.Look(ref severityInt, "severity", 0f);
Scribe_Values.Look(ref causesNoPain, "causesNoPain", defaultValue: true);
Scribe_Values.Look(ref combatLogText, "combatLogText");
Scribe_Values.Look(ref canBeThreateningToPart, "canBeThreateningToPart", defaultValue: false);
Scribe_Defs.Look(ref def, "def");
Scribe_Defs.Look(ref sourceDef, "source");
Scribe_Defs.Look(ref sourceHediffDef, "sourceHediffDef");
Scribe_Defs.Look(ref sourceBodyPartGroup, "sourceBodyPartGroup");
Scribe_Values.Look(ref sourceLabel, "sourceLabel");
Scribe_Values.Look(ref sourceToolLabel, "sourceToolLabel");
Scribe_References.Look(ref combatLogEntry, "combatLogEntry");
BackCompatibility.PostExposeData(this);
}
}

View file

@ -0,0 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Copyright 2025 Maciej Pawłowski
This file is part of "Maciek's Big and Small unofficial addon - Anomaly".
"Maciek's Big and Small unofficial addon - Anomaly" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
"Maciek's Big and Small unofficial addon - Anomaly" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with "Maciek's Big and Small unofficial addon - Anomaly". If not, see <https://www.gnu.org/licenses/>.
-->
<PropertyGroup>
<OutputPath>../Assemblies</OutputPath>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<!-- <Nullable>enable</Nullable> -->
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>../../Assemblies</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp.dll">
<HintPath>../../../../RimWorldLinux_Data/Managed/Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule.dll">
<HintPath>../../../../RimWorldLinux_Data/Managed/UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BetterPrerequisites.dll">
<HintPath>../../../2925432336/1.5/Main/Assemblies/BetterPrerequisites.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>

View file

@ -0,0 +1,35 @@
/*
Copyright 2025 Maciej Pawłowski
This file is part of "Maciek's Big and Small unofficial addon - Anomaly".
"Maciek's Big and Small unofficial addon - Anomaly" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
"Maciek's Big and Small unofficial addon - Anomaly" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with "Maciek's Big and Small unofficial addon - Anomaly". If not, see <https://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
using Verse;
using Verse.AI.Group;
namespace RimWorld;
public class PsychicRitualDef_Megaphagy : PsychicRitualDef_InvocationCircle
{
public FloatRange sizeTransferredFromQualityRange;
public override List<PsychicRitualToil> CreateToils(PsychicRitual psychicRitual, PsychicRitualGraph parent)
{
List<PsychicRitualToil> list = base.CreateToils(psychicRitual, parent);
list.Add(new PsychicRitualToil_Megaphagy(InvokerRole, TargetRole, sizeTransferredFromQualityRange));
list.Add(new PsychicRitualToil_TargetCleanup(InvokerRole, TargetRole));
return list;
}
public override TaggedString OutcomeDescription(FloatRange qualityRange, string qualityNumber, PsychicRitualRoleAssignments assignments)
{
return outcomeDescription.Formatted(sizeTransferredFromQualityRange.ToString());
}
}

View file

@ -0,0 +1,96 @@
/*
Copyright 2025 Maciej Pawłowski
This file is part of "Maciek's Big and Small unofficial addon - Anomaly".
"Maciek's Big and Small unofficial addon - Anomaly" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
"Maciek's Big and Small unofficial addon - Anomaly" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with "Maciek's Big and Small unofficial addon - Anomaly". If not, see <https://www.gnu.org/licenses/>.
*/
using System.Linq;
using MBS_Anomaly;
using RimWorld;
namespace Verse.AI.Group;
public class PsychicRitualToil_Megaphagy : PsychicRitualToil
{
public PsychicRitualRoleDef targetRole;
public PsychicRitualRoleDef invokerRole;
public FloatRange sizeTransferredFromQualityRange;
protected PsychicRitualToil_Megaphagy()
{
}
public PsychicRitualToil_Megaphagy(PsychicRitualRoleDef invokerRole, PsychicRitualRoleDef targetRole, FloatRange sizeTransferredFromQualityRange)
{
this.invokerRole = invokerRole;
this.targetRole = targetRole;
this.sizeTransferredFromQualityRange = sizeTransferredFromQualityRange;
}
public override void Start(PsychicRitual psychicRitual, PsychicRitualGraph parent)
{
Pawn pawn = psychicRitual.assignments.FirstAssignedPawn(invokerRole);
Pawn pawn2 = psychicRitual.assignments.FirstAssignedPawn(targetRole);
float size = sizeTransferredFromQualityRange.LerpThroughRange(psychicRitual.PowerPercent) * psychicRitual.assignments.FirstAssignedPawn(targetRole).BodySize;
if (pawn != null && pawn2 != null)
{
ApplyOutcome(psychicRitual, pawn, pawn2, size);
}
}
private void ApplyOutcome(PsychicRitual psychicRitual, Pawn invoker, Pawn target, float size)
{
// ReverseAgePawn(invoker, years, out var removedHediffs, out var pawnAgeDelta);
// AgePawn(psychicRitual, target, years, out var gainedHediffs, out var diedOfOldAge, out var diedOfBrainDamage);
size *= target.BodySize;
HediffSizeOffset hediff;
if (invoker.health.hediffSet.TryGetHediff<HediffSizeOffset>(out hediff))
{
hediff.SizeOffset += size;
BigAndSmall.HumanoidPawnScaler.LazyGetCache(invoker);
} else
{
hediff = (HediffSizeOffset)HediffMaker.MakeHediff(MBSADefs.MBSA_BodySizeTransferred, invoker);
hediff.SizeOffset = size;
}
invoker.health.AddHediff(hediff);
if (target.health.hediffSet.TryGetHediff<HediffSizeOffset>(out hediff))
{
hediff.SizeOffset -= size;
BigAndSmall.HumanoidPawnScaler.LazyGetCache(target);
} else
{
hediff = (HediffSizeOffset)HediffMaker.MakeHediff(MBSADefs.MBSA_BodySizeTransferred, target);
hediff.SizeOffset = -size;
}
target.health.AddHediff(hediff);
Hediff shock = HediffMaker.MakeHediff(HediffDefOf.DarkPsychicShock, target);
target.health.AddHediff(shock);
target.needs?.mood?.thoughts?.memories?.TryGainMemory(ThoughtDefOf.PsychicRitualVictim);
foreach (Pawn item in psychicRitual.assignments.AllAssignedPawns.Except(target))
{
target.needs?.mood?.thoughts?.memories?.TryGainMemory(ThoughtDefOf.UsedMeForPsychicRitual, item);
}
if (target.Dead)
{
PsychicRitualUtility.RegisterAsExecutionIfPrisoner(target, invoker);
}
PsychicRitualUtility.AddPsychicRitualGuiltToPawns(psychicRitual.def, psychicRitual.Map.mapPawns.FreeColonistsSpawned.Where((p) => p != target));
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Defs.Look(ref invokerRole, "invokerRole");
Scribe_Defs.Look(ref targetRole, "targetRole");
Scribe_Values.Look(ref sizeTransferredFromQualityRange, "sizeTransferredFromQualityRange");
}
}

View file

@ -0,0 +1,41 @@
/*
Copyright 2025 Maciej Pawłowski
This file is part of "Maciek's Big and Small unofficial addon - Anomaly".
"Maciek's Big and Small unofficial addon - Anomaly" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
"Maciek's Big and Small unofficial addon - Anomaly" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with "Maciek's Big and Small unofficial addon - Anomaly". If not, see <https://www.gnu.org/licenses/>.
*/
using RimWorld;
using Verse;
namespace MBS_Anomaly;
public class StatPart_BodySizeTransferOffset : StatPart
{
public override void TransformValue(StatRequest req, ref float val)
{
if (req.Thing is Pawn pawn)
{
foreach (var hediff in pawn.health.hediffSet.hediffs)
{
if (hediff is HediffSizeOffset sizeHediff)
{
val += sizeHediff.SizeOffset;
Log.Message(val);
}
Log.Message("2");
}
}
Log.Message("1");
}
public override string ExplanationPart(StatRequest req)
{
return "test";
}
}