code
stringlengths
0
56.1M
repo_name
stringclasses
515 values
path
stringlengths
2
147
language
stringclasses
447 values
license
stringclasses
7 values
size
int64
0
56.8M
<?xml version="1.0" encoding="utf-8" ?> <Defs> <!-- <Rimworld_Animations.VoiceDef> <defName>Voice_Orassan</defName> <races> <li>Alien_Orassan</li> </races> <gender>Male</gender> <traitDefs> <li>Wimpy</li> </traitDefs> <sounds> <li><key>Moan</key><value>CatMoans</value></li> </sounds> </Rimworld_Animations.VoiceDef> --> </Defs>
donkey1919/rimworld
1.5/Defs/VoiceDefs/VoiceDef_Orassan.xml
XML
unknown
360
<?xml version="1.0" encoding="utf-8" ?> <Defs> <Rimworld_Animations.VoiceTagDef> <defName>Moan</defName> <probability>0.2</probability> </Rimworld_Animations.VoiceTagDef> <Rimworld_Animations.VoiceTagDef> <defName>MoanShort</defName> <probability>0.1</probability> </Rimworld_Animations.VoiceTagDef> <Rimworld_Animations.VoiceTagDef> <defName>Grunt</defName> <probability>0.1</probability> </Rimworld_Animations.VoiceTagDef> <!-- Screams are guaranteed --> <!-- Play once during orgasm --> <Rimworld_Animations.VoiceTagDef> <defName>Scream</defName> <probability>1</probability> </Rimworld_Animations.VoiceTagDef> </Defs>
donkey1919/rimworld
1.5/Defs/VoiceDefs/VoiceTagDef.xml
XML
unknown
660
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{BA766964-1716-422D-A09E-29426F8EB9D5}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Patch_HatsDisplaySelection</RootNamespace> <AssemblyName>Patch_HatsDisplaySelection</AssemblyName> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <Deterministic>true</Deterministic> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>false</DebugSymbols> <DebugType>none</DebugType> <Optimize>false</Optimize> <OutputPath>1.2\Assemblies\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="0Harmony"> <HintPath>..\..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Assembly-CSharp"> <HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="HatDisplaySelection"> <HintPath>..\..\..\..\..\workshop\content\294100\1542291825\1.2\Assemblies\HatDisplaySelection.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Rimworld-Animations"> <HintPath>..\1.2\Assemblies\Rimworld-Animations.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Xml" /> <Reference Include="UnityEngine"> <HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="UnityEngine.CoreModule"> <HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Source\Patches\Patch_HatsDisplaySelection.cs" /> </ItemGroup> <ItemGroup> <Folder Include="1.2\Assemblies\" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
donkey1919/rimworld
1.5/Patch_HatsDisplaySelection/Patch_HatsDisplaySelection.csproj
csproj
unknown
3,387
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{0AD4F9B2-AE28-4E42-86D6-611FB93B7FF0}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Patch_HumanoidAlienRaces</RootNamespace> <AssemblyName>Patch_HumanoidAlienRaces</AssemblyName> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <Deterministic>true</Deterministic> <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>false</DebugSymbols> <DebugType>none</DebugType> <Optimize>false</Optimize> <OutputPath>Assemblies\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="0Harmony"> <HintPath>..\..\..\..\..\..\workshop\content\294100\839005762\1.4\Assemblies\0Harmony.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="AlienRace"> <HintPath>..\..\..\..\..\..\workshop\content\294100\839005762\1.4\Assemblies\AlienRace.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Assembly-CSharp"> <HintPath>..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="HugsLib"> <HintPath>..\..\..\..\..\..\workshop\content\294100\818773962\v1.4\Assemblies\HugsLib.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Rimworld-Animations"> <HintPath>..\Assemblies\Rimworld-Animations.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="RJW"> <HintPath>..\..\..\rjw\1.4\Assemblies\RJW.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Xml" /> <Reference Include="UnityEngine"> <HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="UnityEngine.CoreModule"> <HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup> <ItemGroup> <Compile Include="HarmonyPatch_AlienRace.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
donkey1919/rimworld
1.5/Patch_HumanoidAlienRaces/Patch_HumanoidAlienRaces.csproj
csproj
unknown
3,709
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Patch_HumanoidAlienRaces")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Patch_HumanoidAlienRaces")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("0ad4f9b2-ae28-4e42-86d6-611fb93b7ff0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
donkey1919/rimworld
1.5/Patch_HumanoidAlienRaces/Properties/AssemblyInfo.cs
C#
unknown
1,419
<?xml version="1.0" encoding="utf-8" ?> <Patch> <Operation Class="PatchOperationFindMod"> <mods> <li>Core SK</li> </mods> <match Class="PatchOperationSequence"> <operations> <li Class="PatchOperationConditional"> <xpath>Defs/ThingDef/comps</xpath> <success>Always</success> <nomatch Class="PatchOperationAdd"> <xpath>Defs/ThingDef</xpath> <value> <comps /> </value> </nomatch> </li> <li Class="PatchOperationAdd"> <xpath>Defs/ThingDef[@Name="BaseAnimalPawn" or @Name="SK_BasePawn" or @Name="BasePawnSkynet"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </li> </operations> </match> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/AnimationPatchHSK.xml
XML
unknown
772
<?xml version="1.0" encoding="utf-8" ?> <Patch> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationAdd"> <success>Always</success> <xpath>Defs/ThingDef[race][not(comps)]</xpath> <value> <comps /> </value> </li> <li Class="PatchOperationAdd"> <success>Always</success> <xpath>Defs/AlienRace.ThingDef_AlienRace[not(comps)]</xpath> <value> <comps /> </value> </li> <li Class="PatchOperationAdd"> <xpath>Defs/ThingDef[@Name="BasePawn"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </li> <li Class="PatchOperationAdd"> <xpath>Defs/AlienRace.ThingDef_AlienRace/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </li> </operations> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/AnimationPatch_CompExtendedAnimator.xml
XML
unknown
946
<?xml version="1.0" encoding="utf-8" ?> <Patch> <!-- add offset rendersubworker to all pawn render tree defs --> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationConditional"> <xpath>/Defs/PawnRenderTreeDef/root/subworkerClasses</xpath> <success>Always</success> <nomatch Class="PatchOperationAdd"> <xpath>/Defs/PawnRenderTreeDef/root</xpath> <value> <subworkerClasses /> </value> </nomatch> </li> <li Class="PatchOperationAdd"> <xpath>/Defs/PawnRenderTreeDef/root/subworkerClasses</xpath> <value> <li>Rimworld_Animations.PawnRenderSubWorker_ChangeOffset</li> </value> </li> </operations> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/AnimationPatch_PawnRenderTree_OffsetSubWorker.xml
XML
unknown
748
<?xml version="1.0" encoding="utf-8" ?> <Patch> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationConditional"> <xpath>/Defs/ThingDef[@Name="BaseBaseAutocleaner"]/comps</xpath> <success>Always</success> <match Class="PatchOperationAdd"> <xpath>/Defs/ThingDef[@Name="BaseBaseAutocleaner"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </match> </li> </operations> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/CompPatches/AutoCleaner.xml
XML
unknown
567
<?xml version="1.0" encoding="utf-8" ?> <Patch> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationConditional"> <xpath>/Defs/ThingDef[@Name="BasePawnSimple"]/comps</xpath> <success>Always</success> <match Class="PatchOperationAdd"> <xpath>/Defs/ThingDef[@Name="BasePawnSimple"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </match> </li> </operations> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/CompPatches/CombatExtended.xml
XML
unknown
556
<?xml version="1.0" encoding="utf-8" ?> <Patch> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationConditional"> <xpath>/Defs/ThingDef[@Name="BaseZombie"]/comps</xpath> <success>Always</success> <match Class="PatchOperationAdd"> <xpath>/Defs/ThingDef[@Name="BaseZombie"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </match> </li> </operations> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/CompPatches/ZombieLand.xml
XML
unknown
548
<?xml version="1.0" encoding="utf-8"?> <Patch> <Operation Class="PatchOperationFindMod"> <mods> <li>[NL] Facial Animation - WIP</li> </mods> <match Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationAdd"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/targetJobs</xpath> <success>Always</success> <value> <li>JoinInBedAnimation</li> <li>GettinLovedAnimation</li> </value> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[1]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin"]/animationFrames/li[2]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin"]/animationFrames/li[3]/headOffset</xpath> <success>Always</success> </li> </operations> </match> </Operation> </Patch> <!-- OLD PATCH <?xml version="1.0" encoding="utf-8"?> <Patch> <Operation Class="PatchOperationFindMod"> <mods> <li>[NL] Facial Animation - WIP</li> </mods> <match Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[1]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[2]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[3]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[4]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[5]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[6]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[7]/headOffset</xpath> <success>Always</success> </li> <li Class="PatchOperationRemove"> <xpath>/Defs/FacialAnimation.FaceAnimationDef[defName="Lovin" or defName="Lovin2"]/animationFrames/li[8]/headOffset</xpath> <success>Always</success> </li> </operations> </match> </Operation> </Patch> -->
donkey1919/rimworld
1.5/Patches/CompatibilityPatch_FacialAnimation.xml
XML
unknown
3,236
<?xml version="1.0" encoding="utf-8" ?> <Patch> <!-- Patch for HCSK, to attach to differently written thingdefs --> <Operation Class="PatchOperationFindMod"> <mods> <li>Core SK</li> </mods> <match Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationConditional"> <xpath>/Defs/ThingDef/comps</xpath> <success>Always</success> <nomatch Class="PatchOperationAdd"> <xpath>/Defs/ThingDef</xpath> <value> <comps /> </value> </nomatch> </li> <li Class="PatchOperationAdd"> <xpath>/Defs/ThingDef[@Name="SK_BasePawn"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </li> <li Class="PatchOperationAdd"> <xpath>/Defs/ThingDef[@Name="BaseAnimalPawn"]/comps</xpath> <value> <li Class="Rimworld_Animations.CompProperties_ExtendedAnimator" /> </value> </li> </operations> </match> </Operation> </Patch>
donkey1919/rimworld
1.5/Patches/CompatibilityPatch_HCSK.xml
XML
unknown
1,386
<?xml version="1.0" encoding="utf-8" ?> <Patch> <!-- <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationRemove"> <success>Always</success> <xpath>Defs/OffsetDef[defName="OffsetDefNameHere"]/offsets/li[@races/li="YourAlienRace"]</xpath> </li> <li Class="PatchOperationAdd"> <success>Always</success> <xpath>Defs/OffsetDef[defName="OffsetDefNameHere"]/offsets</xpath> <value> <li Class="Rimworld_Animations.AnimationOffset_BodyType"> <races> <li>YourAlienRace</li> </races> <offsets> <li> <bodyType>Thin</bodyType> <offset>(0, 0, 0)</offset> </li> </offsets> </li> </value> </li> </operations> </Operation> --> </Patch>
donkey1919/rimworld
1.5/Patches/OffsetDefPatchTemplate/AnimationPatch_OffsetDef.xml
XML
unknown
796
<?xml version="1.0" encoding="utf-8" ?> <Patch> <!-- Add genitalia rendernode to pawns, body is parent <Operation Class="PatchOperationAdd"> <xpath>Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Body"]/children</xpath> <value> <li Class="PawnRenderNodeProperties_Overlay"> <debugLabel>Genitalia</debugLabel> <workerClass>PawnRenderNodeWorker_OverlayWounds</workerClass> <overlayLayer>Body</overlayLayer> <baseLayer>3</baseLayer> </li> </value> </Operation> --> </Patch>
donkey1919/rimworld
1.5/Patches/Patch_GenitaliaRenderNode.xml
XML
unknown
532
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class Actor { public List<string> defNames; public List<string> requiredGenitals; public List<AlienRaceOffset> raceOffsets; public List<string> blacklistedRaces; public bool initiator = false; public string gender; public bool isFucking = false; public bool isFucked = false; public bool controlGenitalAngle = false; public List<BodyDef> bodyDefTypes = new List<BodyDef>(); public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset(); public Vector3 offset = new Vector2(0, 0); public List<string> requiredGender; public List<string> tags = new List<string>(); } }
donkey1919/rimworld
1.5/Source/Actors/Actor.cs
C#
unknown
870
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace Rimworld_Animations { public class AlienRaceOffset { public string defName; public Vector2 offset; } }
donkey1919/rimworld
1.5/Source/Actors/AlienRaceOffset.cs
C#
unknown
278
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class AnimationOffsetDef : Def { public List<BaseAnimationOffset> offsets; public bool FindOffset(Pawn pawn, out BaseAnimationOffset offset) { foreach (BaseAnimationOffset animOffset in offsets) { if (animOffset.appliesToPawn(pawn)) { offset = animOffset; return true; } } offset = null; return false; } } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/AnimationOffsetDef.cs
C#
unknown
680
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class AnimationOffset_AgeRange : BaseAnimationOffset { public List<BodyTypeOffset_AgeRange> offsetsMale; public List<BodyTypeOffset_AgeRange> offsetsFemale; public override Vector3? getOffset(Pawn pawn) { List<BodyTypeOffset_AgeRange> pawnOffsets = (pawn.gender == Gender.Male ? offsetsMale : offsetsFemale); return pawnOffsets.Find(x => x.bodyType == pawn.story.bodyType && x.ageRange.Includes(pawn.ageTracker.AgeBiologicalYears))?.offset ?? pawnOffsets.Last().offset; } public override int? getRotation(Pawn pawn) { List<BodyTypeOffset_AgeRange> pawnOffsets = (pawn.gender == Gender.Male ? offsetsMale : offsetsFemale); return pawnOffsets.Find(x => x.bodyType == pawn.story.bodyType && x.ageRange.Includes(pawn.ageTracker.AgeBiologicalYears))?.rotation ?? pawnOffsets.Last().rotation; } public override Vector3? getScale(Pawn pawn) { List<BodyTypeOffset_AgeRange> pawnOffsets = (pawn.gender == Gender.Male ? offsetsMale : offsetsFemale); return pawnOffsets.Find(x => x.bodyType == pawn.story.bodyType && x.ageRange.Includes(pawn.ageTracker.AgeBiologicalYears))?.scale ?? pawnOffsets.Last().scale; } } public class BodyTypeOffset_AgeRange : BodyTypeOffset { public FloatRange ageRange; } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_AgeRange.cs
C#
unknown
1,579
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class AnimationOffset_BodyType : BaseAnimationOffset { public List<BodyTypeOffset> offsets; public override Vector3? getOffset(Pawn pawn) { return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.offset; } public override int? getRotation(Pawn pawn) { return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.rotation; } public override Vector3? getScale(Pawn pawn) { return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.scale; } } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyType.cs
C#
unknown
791
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class AnimationOffset_BodyTypeGendered : BaseAnimationOffset { public List<BodyTypeOffset> offsetsMale; public List<BodyTypeOffset> offsetsFemale; public override Vector3? getOffset(Pawn pawn) { if (pawn.gender == Gender.Female) { return offsetsFemale.Find(x => x.bodyType == pawn.story.bodyType)?.offset; } else { return offsetsMale.Find(x => x.bodyType == pawn.story.bodyType)?.offset; } } public override int? getRotation(Pawn pawn) { if (pawn.gender == Gender.Female) { return offsetsFemale.Find(x => x.bodyType == pawn.story.bodyType)?.rotation; } else { return offsetsMale.Find(x => x.bodyType == pawn.story.bodyType)?.rotation; } } public override Vector3? getScale(Pawn pawn) { if (pawn.gender == Gender.Female) { return offsetsFemale.Find(x => x.bodyType == pawn.story.bodyType)?.scale; } else { return offsetsMale.Find(x => x.bodyType == pawn.story.bodyType)?.scale; } } } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyTypeGendered.cs
C#
unknown
1,509
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class AnimationOffset_Single : BaseAnimationOffset { public Vector3 offset; public int? rotation; public Vector3? scale = Vector3.one; public override Vector3? getOffset(Pawn pawn) { return offset; } public override int? getRotation(Pawn pawn) { return rotation; } public override Vector3? getScale(Pawn pawn) { return scale; } } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_Single.cs
C#
unknown
671
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public abstract class BaseAnimationOffset { public List<ThingDef> races; public abstract Vector3? getOffset(Pawn pawn); public abstract int? getRotation(Pawn pawn); public abstract Vector3? getScale(Pawn pawn); public bool appliesToPawn(Pawn pawn) { return races.Contains(pawn.def); } } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/Offsets/BaseAnimationOffset.cs
C#
unknown
575
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace Rimworld_Animations { public class BodyTypeOffset { public BodyTypeDef bodyType; public int rotation = 0; public Vector3 offset; public Vector3 scale = Vector3.one; } }
donkey1919/rimworld
1.5/Source/Animations/AnimationOffsets/Offsets/BodyTypeOffset.cs
C#
unknown
379
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class AnimationPropDef : Def { public PawnRenderNodeProperties animPropProperties; } }
donkey1919/rimworld
1.5/Source/Animations/AnimationProps/AnimationPropDef.cs
C#
unknown
281
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class AnimationWorker_KeyframesExtended : AnimationWorker_Keyframes { public AnimationWorker_KeyframesExtended(AnimationDef def, Pawn pawn, AnimationPart part, PawnRenderNode node) : base(def, pawn, part, node) { } public override bool Enabled() { return true; } public override Vector3 OffsetAtTick(int tick, PawnDrawParms parms) { //Todo: Use this for bodyoffsets //or maybe make a rendersubworker for it instead return base.OffsetAtTick(tick, parms); } public VoiceTagDef voiceAtTick(int tick) { Verse.Keyframe keyframe2 = this.part.keyframes[this.part.keyframes.Count - 1]; foreach (Verse.Keyframe keyframe in this.part.keyframes) { if (tick == keyframe.tick) { VoiceTagDef voiceTag = (keyframe as ExtendedKeyframe).voice; //probability checking null fix if (voiceTag != null && Rand.Chance(voiceTag.probability)) { return voiceTag; } return null; } } return null; } public SoundDef soundAtTick(int tick) { //Verse.Keyframe keyframe = this.part.keyframes[0]; Verse.Keyframe keyframe2 = this.part.keyframes[this.part.keyframes.Count - 1]; foreach (Verse.Keyframe keyframe in this.part.keyframes) { if (tick == keyframe.tick) { return (keyframe as ExtendedKeyframe).sound; } } return null; } //use extendedkeyframes to determine addon facing public Rot4 facingAtTick(int tick) { //if ticks are < first keyframe tick, just be stuck to first keyframe rot if (tick <= this.part.keyframes[0].tick) { return (this.part.keyframes[0] as ExtendedKeyframe).rotation; } //if ticks are > last keyframe tick, just be stuck to last keyframe rot if (tick >= this.part.keyframes[this.part.keyframes.Count - 1].tick) { return (this.part.keyframes[this.part.keyframes.Count - 1] as ExtendedKeyframe).rotation; } Verse.Keyframe keyframe = this.part.keyframes[0]; Verse.Keyframe keyframe2 = this.part.keyframes[this.part.keyframes.Count - 1]; int i = 0; while (i < this.part.keyframes.Count) { if (tick <= this.part.keyframes[i].tick) { keyframe2 = this.part.keyframes[i]; if (i > 0) { keyframe = this.part.keyframes[i - 1]; break; } break; } else { i++; } } return (keyframe as ExtendedKeyframe).rotation; } public bool visibleAtTick(int tick) { //if ticks are < first keyframe tick, just be stuck to first keyframe rot if (tick <= this.part.keyframes[0].tick) { return (this.part.keyframes[0] as ExtendedKeyframe).visible; } //if ticks are > last keyframe tick, just be stuck to last keyframe rot if (tick >= this.part.keyframes[this.part.keyframes.Count - 1].tick) { return (this.part.keyframes[this.part.keyframes.Count - 1] as ExtendedKeyframe).visible; } Verse.Keyframe keyframe = this.part.keyframes[0]; Verse.Keyframe keyframe2 = this.part.keyframes[this.part.keyframes.Count - 1]; int i = 0; while (i < this.part.keyframes.Count) { if (tick <= this.part.keyframes[i].tick) { keyframe2 = this.part.keyframes[i]; if (i > 0) { keyframe = this.part.keyframes[i - 1]; break; } break; } else { i++; } } return (keyframe as ExtendedKeyframe).visible; } public virtual bool shouldRecache(int tick) { if (facingAtTick(tick) != facingAtTick(tick - 1) || visibleAtTick(tick) != visibleAtTick(tick - 1) || TexPathVariantAtTick(tick) != TexPathVariantAtTick(tick - 1)) { return true; } return true; } public int? TexPathVariantAtTick(int tick) { //if ticks are < first keyframe tick, just be stuck to first keyframe rot if (tick <= this.part.keyframes[0].tick) { return (this.part.keyframes[0] as ExtendedKeyframe).variant; } //if ticks are > last keyframe tick, just be stuck to last keyframe rot if (tick >= this.part.keyframes[this.part.keyframes.Count - 1].tick) { return (this.part.keyframes[this.part.keyframes.Count - 1] as ExtendedKeyframe).variant; } Verse.Keyframe keyframe = this.part.keyframes[0]; Verse.Keyframe keyframe2 = this.part.keyframes[this.part.keyframes.Count - 1]; int i = 0; while (i < this.part.keyframes.Count) { if (tick <= this.part.keyframes[i].tick) { keyframe2 = this.part.keyframes[i]; if (i > 0) { keyframe = this.part.keyframes[i - 1]; break; } break; } else { i++; } } return (keyframe as ExtendedKeyframe).variant; } } }
donkey1919/rimworld
1.5/Source/Animations/AnimationWorkers/AnimationWorker_KeyframesExtended.cs
C#
unknown
6,481
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public abstract class BaseGroupAnimationContext { public int actorShift = 0; public int priority = 0; public List<BasePawnTest> whitelist; public List<BasePawnTest> blacklist; public virtual bool CanAnimationBeUsed(List<Pawn> actors, int numActors) { if (numActors != actors.Count) { return false; } if (!whitelist.NullOrEmpty()) { for (int i = 0; i < whitelist.Count; i++) { // check whitelist to make sure pawn can be in this act //for each whitelist item, pawntest must hold true for that pawn if (!whitelist[i].PawnTest(actors[i])) { return false; } } } if (!blacklist.NullOrEmpty()) { for (int i = 0; i < blacklist.Count; i++) { // check blacklist to make sure pawn can be in this act // for each blacklist item, pawntest must hold false for that pawn if (blacklist[i].PawnTest(actors[i])) { return false; } } } return true; } public virtual int AnimationReorder() { return actorShift; } public virtual int AnimationPriority() { return priority; } public abstract string DebugMessage(); //cool class for designating contexts for animations // configure CanAnimationBeUsed to test whether it can be used } }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs
C#
unknown
1,930
using RimWorld; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using static rjw.xxx; namespace Rimworld_Animations { public class GroupAnimationContext_RJWSex : BaseGroupAnimationContext { public List<InteractionDef> interactionDefs; public override bool CanAnimationBeUsed(List<Pawn> actors, int numActors) { JobDriver_SexBaseInitiator latestSexBaseInitiator = (actors.FindLast(x => x.jobs?.curDriver is JobDriver_SexBaseInitiator).jobs.curDriver as JobDriver_SexBaseInitiator); if (!interactionDefs.Contains(latestSexBaseInitiator.Sexprops.dictionaryKey)) { return false; } return base.CanAnimationBeUsed(actors, numActors); } public override string DebugMessage() { return "Checking for RJWSex AnimationContext\n" + "InteractionDefs: " + interactionDefs; } } }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs
C#
unknown
1,028
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class GroupAnimationDef : Def { public int numActors; public List<AnimationStage> animationStages; public List<BaseGroupAnimationContext> contexts; public List<AnimationOffsetDef> offsetDefs; public bool canAnimationBeUsed(List<Pawn> actors) { if (!contexts.NullOrEmpty()) { foreach (BaseGroupAnimationContext context in contexts) { if (context.CanAnimationBeUsed(actors, numActors)) { //find all where context matches actors return true; } } } return false; } public int Priority(List<Pawn> actors) { int priority = -999999999; foreach (BaseGroupAnimationContext context in contexts) { if (context.CanAnimationBeUsed(actors, numActors)) { if (context.AnimationPriority() > priority) { //get highest priority context for fitting animation priority = context.AnimationPriority(); } } } return priority; } public int Reorder(List<Pawn> actors) { int priority = -999999999; int reorder = 0; foreach (BaseGroupAnimationContext context in contexts) { if (context.CanAnimationBeUsed(actors, numActors)) { if (context.AnimationPriority() > priority) { //get the reorder for highest priority context for fitting animation priority = context.AnimationPriority(); reorder = context.AnimationReorder(); } } } return reorder; } public List<AnimationDef> GetAllAnimationsForActor(int actor, int seed, int reorder = 0) { List<AnimationDef> animations = new List<AnimationDef>(); int actorNumber = (actor + reorder) % numActors; foreach (AnimationStage stage in animationStages) { //add all new animations to list of animations animations.AddRange(stage.GetAnimations(actorNumber, seed)); } return animations; } public bool GetOffset(int actor, Pawn pawn, out Vector3? position, out int? rotation, int reorder = 0) { position = null; rotation = null; //element at or default to stop errors if (offsetDefs == null) return false; if ((actor + reorder) % numActors >= offsetDefs.Count) return false; if (offsetDefs[(actor + reorder) % numActors].FindOffset(pawn, out BaseAnimationOffset animationOffset)) { position = animationOffset.getOffset(pawn); rotation = animationOffset.getRotation(pawn); return true; } return false; } } }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs
C#
unknown
3,439
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public abstract class AnimationStage { //Return a list containing a tuple; int for how long the animation should play for public int loops; public abstract List<AnimationDef> GetAnimations(int actorNumber, int seed); } }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationStages/AnimationStage.cs
C#
unknown
424
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class AnimationStage_Branch : AnimationStage { public List<GroupAnimationDef> paths; public override List<AnimationDef> GetAnimations(int actorNumber, int seed) { List<AnimationDef> animationDefs = new List<AnimationDef>(); for (int i = 0; i < loops; i++) { GroupAnimationDef selectedDef = paths[Rand.RangeSeeded(0, paths.Count, seed + i)]; animationDefs.AddRange(selectedDef.GetAllAnimationsForActor(actorNumber, seed)); } return animationDefs; } } }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs
C#
unknown
764
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class AnimationStage_LoopRandomSelectChance : AnimationStage { public List<AnimationLoopOption> loopOptions; public override List<AnimationDef> GetAnimations(int actorNumber, int seed) { int numberOfActors = loopOptions[0].animationDefs.Count; List<AnimationDef> animations = new List<AnimationDef>(); for (int i = 0; i < loops; i++) { AnimationLoopOption option = getAnimationLoopOptionByWeight(seed + i); animations.Add(option.animationDefs[actorNumber]); } return animations; } //select random element from loop options by weight; also calculate the longest anim length private AnimationLoopOption getAnimationLoopOptionByWeight(int seed) { int totalWeight = loopOptions.Sum(x => x.probability); int randomNumber = Rand.RangeInclusiveSeeded(0, loopOptions.Count - 1, seed); int cumulativeWeight = 0; for (int i = 0; i < loopOptions.Count; i++) { cumulativeWeight += loopOptions[i].probability; //random number is same for all pawns because they all have the same seed if (randomNumber <= cumulativeWeight) { return loopOptions[i]; } } //default return loopOptions.Last(); } } public class AnimationLoopOption { public int probability; public List<AnimationDef> animationDefs; } }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs
C#
unknown
1,792
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { /* don't use? just use looprandomselect once public class AnimationStage_TicksDuration : AnimationStage { public int ticks; public List<AnimationDef> animationDefs; public override List<Tuple<int, AnimationDef>> GetAnimations(int actor, int seed) { return new List<Tuple<int, AnimationDef>>() { Tuple.Create(ticks, animationDefs[actor]) }; } } */ }
donkey1919/rimworld
1.5/Source/Animations/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs
C#
unknown
588
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class ExtendedKeyframe : Verse.Keyframe { public int? variant; public Rot4 rotation = Rot4.North; public SoundDef sound = null; public VoiceTagDef voice = null; public bool visible = false; } }
donkey1919/rimworld
1.5/Source/Animations/Keyframes/ExtendedKeyframe.cs
C#
unknown
437
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public abstract class BasePawnTest { public abstract bool PawnTest(Pawn pawn); } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/BasePawnTest.cs
C#
unknown
269
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Always : BasePawnTest { public override bool PawnTest(Pawn pawn) { return true; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Always.cs
C#
unknown
321
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_BodyType : BasePawnTest { public BodyTypeDef bodyType = null; public List<BodyTypeDef> bodyTypes = null; public override bool PawnTest(Pawn pawn) { if (pawn.story.bodyType == bodyType) { return true; } else if(bodyTypes != null && bodyTypes.Contains(pawn.story.bodyType)) { return true; } return false; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_BodyType.cs
C#
unknown
700
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Dead : BasePawnTest { public override bool PawnTest(Pawn pawn) { return pawn.health.State == PawnHealthState.Dead; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Dead.cs
C#
unknown
357
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_DeadOrDown : BasePawnTest { public override bool PawnTest(Pawn pawn) { return pawn.health.State != PawnHealthState.Mobile; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_DeadOrDown.cs
C#
unknown
364
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Down : BasePawnTest { public override bool PawnTest(Pawn pawn) { return pawn.health.State == PawnHealthState.Down; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Down.cs
C#
unknown
357
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Hediff : BasePawnTest { public HediffDef hediffDef; //hediff you want to check for float minSeverity = -1; //optional param; min severity the hediff needs to be public override bool PawnTest(Pawn pawn) { Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(hediffDef); if (hediff != null) { if (minSeverity != -1) { return hediff.Severity > minSeverity; } return true; } return false; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Hediff.cs
C#
unknown
784
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Humanlike : BasePawnTest { public override bool PawnTest(Pawn pawn) { return pawn.RaceProps.Humanlike; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Humanlike.cs
C#
unknown
344
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_JobDef : BasePawnTest { public JobDef jobDef; public override bool PawnTest(Pawn pawn) { if (pawn.CurJobDef == jobDef) { return true; } return false; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_JobDef.cs
C#
unknown
452
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Multi : BasePawnTest { public List<BasePawnTest> tests = new List<BasePawnTest>(); public override bool PawnTest(Pawn pawn) { //check all different pawn tests in list for pawn foreach (BasePawnTest test in tests) { if (!test.PawnTest(pawn)) { return false; } } return true; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Multi.cs
C#
unknown
640
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Never : BasePawnTest { public override bool PawnTest(Pawn pawn) { return false; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Never.cs
C#
unknown
321
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { class PawnTest_PrisonerOfColony : BasePawnTest { public override bool PawnTest(Pawn pawn) { return pawn.IsPrisonerOfColony; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_PrisonerOfColony.cs
C#
unknown
343
using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_RJWCanBeFucked : BasePawnTest { public override bool PawnTest(Pawn pawn) { return xxx.can_be_fucked(pawn); } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_RJWCanBeFucked.cs
C#
unknown
359
using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_RJWCanFuck : BasePawnTest { public override bool PawnTest(Pawn pawn) { return xxx.can_fuck(pawn); } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_RJWCanFuck.cs
C#
unknown
350
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Race : BasePawnTest { public List<ThingDef> races = new List<ThingDef>(); public override bool PawnTest(Pawn pawn) { foreach (ThingDef race in races) { if (pawn.def == race) { return true; } } return false; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Race.cs
C#
unknown
565
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { class PawnTest_SlaveOfColony : BasePawnTest { public override bool PawnTest(Pawn pawn) { return pawn.IsSlaveOfColony; } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_SlaveOfColony.cs
C#
unknown
337
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnTest_Trait : BasePawnTest { TraitDef traitDef; int? degree; public override bool PawnTest(Pawn pawn) { if (degree != null) { return pawn.story.traits.HasTrait(traitDef, (int)degree); } return pawn.story.traits.HasTrait(traitDef); } } }
donkey1919/rimworld
1.5/Source/Animations/PawnTests/PawnTest_Trait.cs
C#
unknown
553
using System; using System.Collections.Generic; using System.Linq; using RimWorld; using rjw; using UnityEngine; using Verse; using Verse.AI; using Verse.Sound; namespace Rimworld_Animations { public class CompExtendedAnimator : ThingComp { // CompExtendedAnimator // Helps manage AnimationQueue, AbsolutePosition //ticks of current animation private int animationTicks; private List<AnimationDef> animationQueue; private BaseExtendedAnimatorAnchor anchor; private VoiceDef voice; private bool isAnimating = false; public bool IsAnimating { get { return isAnimating; } } public bool IsAnchored { get { return anchor != null; } } private Vector3? offset; public Vector3? Offset { get { return offset; } set { this.offset = value; } } private int? rotation; public int? Rotation { get { return rotation; } set { this.rotation = value; } } public int AnimationLength { get { if (!IsAnimating) return 0; int groupAnimLength = 0; foreach(AnimationDef anim in animationQueue) { groupAnimLength += anim.durationTicks; } return groupAnimLength; } } public AnimationDef CurrentAnimation { get { return IsAnimating ? animationQueue[0] : null; } } public override void PostSpawnSetup(bool respawningAfterLoad) { if (voice == null) { AssignNewVoice(); } } public Vector3 getAnchor() { return anchor.getDrawPos(); } public override void CompTick() { if (isAnimating) { animationTicks++; //if animationticks is equal to cur. anim duration, if (animationTicks >= animationQueue[0].durationTicks) { //dequeue; returns false if more animations if (!PopAnimationQueue()) { //play next if more anims still PlayNextAnimation(); } else { StopAnimating(); } } CheckAndPlaySounds(); } base.CompTick(); } //returns false if still more animations public bool PopAnimationQueue() { if (!animationQueue.Empty()) { //pop queue animationQueue.RemoveAt(0); } return animationQueue.Empty(); } public void PlayNextAnimation() { if (!animationQueue.Empty()) { isAnimating = true; animationTicks = 0; pawn.Drawer.renderer.SetAnimation(animationQueue[0]); } } public void StopAnimating() { isAnimating = false; animationQueue = null; anchor = null; offset = null; pawn.Drawer.renderer.SetAnimation(null); pawn.Drawer.renderer.SetAllGraphicsDirty(); } public void PlayGroupAnimation(List<AnimationDef> groupAnimation, Vector3? positionOffset, int? rotationOffset) { this.Offset = positionOffset; this.Rotation = rotationOffset; animationQueue = groupAnimation; //set all graphics dirty; necessary because sometimes rjw doesn't call during threesomes pawn.Drawer.renderer.SetAllGraphicsDirty(); PlayNextAnimation(); } public void PlayGroupAnimation(List<AnimationDef> groupAnimation, Vector3? positionOffset, int? rotationOffset, BaseExtendedAnimatorAnchor anchor) { this.anchor = anchor; PlayGroupAnimation(groupAnimation, positionOffset, rotationOffset); } public override void PostExposeData() { base.PostExposeData(); Scribe_Values.Look<bool>(ref this.isAnimating, "animations_isAnimating", false); Scribe_Values.Look<int>(ref this.animationTicks, "animations_ticks", 0); Scribe_Collections.Look<AnimationDef>(ref animationQueue, "animations_queue"); Scribe_Deep.Look<BaseExtendedAnimatorAnchor>(ref this.anchor, "animations_anchor"); Scribe_Defs.Look<VoiceDef>(ref this.voice, "animations_voice"); } public override List<PawnRenderNode> CompRenderNodes() { //only if pawn is animating for performance if (IsAnimating) { List<PawnRenderNode> animRenderNodes = new List<PawnRenderNode>(); // for all animationpropdefs, foreach (AnimationPropDef animationProp in DefDatabase<AnimationPropDef>.AllDefsListForReading) { //if animation makes use of prop, if (AnimationMakesUseOfProp(animationProp)) { PawnRenderNodeProperties props = animationProp.animPropProperties; if (props.texPath.NullOrEmpty()) { props.texPath = "AnimationProps/MissingTexture/MissingTexture"; } //create new render node PawnRenderNode animRenderNode = (PawnRenderNode)Activator.CreateInstance(props.nodeClass, new object[] { this.pawn, props, pawn.Drawer.renderer.renderTree }); animRenderNodes.Add(animRenderNode); } } //return list of rendernodes that should animate return animRenderNodes; } else { return null; } } public void AssignNewVoice() { //all voice options List<VoiceDef> voiceOptions = DefDatabase<VoiceDef>.AllDefsListForReading .FindAll(voiceDef => voiceDef.VoiceFitsPawn(pawn)); //all voice options, with priority (for traitdef specific voices) List<VoiceDef> voiceOptionsWithPriority = voiceOptions.FindAll(voiceDef => voiceDef.takesPriority); if (!voiceOptionsWithPriority.NullOrEmpty()) { voice = voiceOptionsWithPriority.RandomElementByWeight(x => x.randomChanceFactor); } else if (!voiceOptions.NullOrEmpty()) { voice = voiceOptions.RandomElementByWeight(x => x.randomChanceFactor); } } public void CheckAndPlaySounds() { PawnRenderNode rootNode = pawn.Drawer?.renderer?.renderTree?.rootNode; //check if the rootnode has sounds; if so play it if (rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended animWorker) { SoundDef sound = animWorker.soundAtTick(rootNode.tree.AnimationTick); if (sound != null) { SoundInfo soundInfo = new TargetInfo(pawn.Position, pawn.Map); //temp; does not consider non-rjw animations //todo: replace with value stored in comp or somewhere else? soundInfo.volumeFactor = RJWSettings.sounds_sex_volume; sound.PlayOneShot(soundInfo); } if (RJWAnimationSettings.playVoices) { SoundInfo voiceInfo = new TargetInfo(pawn.Position, pawn.Map); voiceInfo.volumeFactor = RJWSettings.sounds_voice_volume; //play voice sounds VoiceTagDef voiceTag = animWorker.voiceAtTick(rootNode.tree.AnimationTick); if (voiceTag != null) { if (voice != null && voice.sounds.ContainsKey(voiceTag)) { voice.sounds[voiceTag].PlayOneShot(voiceInfo); } else if (pawn.RaceProps.Humanlike && RJWAnimationSettings.playHumanlikeVoicesAsDefault) { //play default voice VoiceDef pawnDefaultVoice = (pawn.gender == Gender.Male ? VoiceDefOf.Voice_HumanMale : VoiceDefOf.Voice_HumanFemale); if (pawnDefaultVoice.sounds.ContainsKey(voiceTag)) { pawnDefaultVoice.sounds[voiceTag].PlayOneShot(voiceInfo); } } } } } //check rootnodes and children if (rootNode?.children != null) { foreach (PawnRenderNode node in rootNode?.children) { if (node?.AnimationWorker is AnimationWorker_KeyframesExtended childrenAnimWorker) { SoundDef sound = childrenAnimWorker.soundAtTick(node.tree.AnimationTick); if (sound != null) { SoundInfo soundInfo = new TargetInfo(pawn.Position, pawn.Map); soundInfo.volumeFactor = RJWSettings.sounds_sex_volume; sound.PlayOneShot(soundInfo); } if (RJWAnimationSettings.playVoices) { SoundInfo voiceInfo = new TargetInfo(pawn.Position, pawn.Map); voiceInfo.volumeFactor = RJWSettings.sounds_voice_volume; //play voice sounds VoiceTagDef voiceTag = childrenAnimWorker.voiceAtTick(rootNode.tree.AnimationTick); if (voiceTag != null) { if (voice != null && voice.sounds.ContainsKey(voiceTag)) { voice.sounds[voiceTag].PlayOneShot(voiceInfo); } else if (pawn.RaceProps.Humanlike && RJWAnimationSettings.playHumanlikeVoicesAsDefault) { VoiceDef pawnDefaultVoice = (pawn.gender == Gender.Male ? VoiceDefOf.Voice_HumanMale : VoiceDefOf.Voice_HumanFemale); if (pawnDefaultVoice.sounds.ContainsKey(voiceTag)) { pawnDefaultVoice.sounds[voiceTag].PlayOneShot(voiceInfo); } } } } } } } //do the same for all the child nodes } public bool AnimationMakesUseOfProp(AnimationPropDef animationProp) { // never true if not animating; anim props shouldn't be attached if (!IsAnimating) return false; //for all anims in queue (because it's only recached at start) foreach (AnimationDef animation in animationQueue) { foreach (PawnRenderNodeTagDef propTag in animation.animationParts.Keys) { // if that proptag is the same as the one for animationProp, if (propTag == animationProp.animPropProperties.tagDef) { //that prop is being used in the animation return true; } } } return false; } private Pawn pawn => base.parent as Pawn; } }
donkey1919/rimworld
1.5/Source/Comps/CompExtendedAnimator.cs
C#
unknown
12,913
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using RimWorld; namespace Rimworld_Animations { public class CompProperties_ExtendedAnimator : CompProperties { public CompProperties_ExtendedAnimator() { base.compClass = typeof(CompExtendedAnimator); } } }
donkey1919/rimworld
1.5/Source/Comps/CompProperties_ExtendedAnimator.cs
C#
unknown
390
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class CompProperties_ThingAnimator : CompProperties { public CompProperties_ThingAnimator() { base.compClass = typeof(CompThingAnimator); } } }
donkey1919/rimworld
1.5/Source/Comps/CompProperties_ThingAnimator.cs
C#
unknown
365
using RimWorld; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class CompThingAnimator : ThingComp { public override void CompTick() { //todo: If item is held by pawn, and pawn is doing thingcomp animation, //animate thingcomp; see CompPowerPlantWind for how thingcomps are animated return; } } }
donkey1919/rimworld
1.5/Source/Comps/CompThingAnimator.cs
C#
unknown
526
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public abstract class BaseExtendedAnimatorAnchor : IExposable { public BaseExtendedAnimatorAnchor() { } public virtual void ExposeData() { } public abstract Vector3 getDrawPos(); public string GetUniqueLoadID() { throw new NotImplementedException(); } } }
donkey1919/rimworld
1.5/Source/Comps/ExtendedAnimatorAnchor/BaseExtendedAnimatorAnchor.cs
C#
unknown
514
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class ExtendedAnimatorAnchor_Thing : BaseExtendedAnimatorAnchor { private Thing thing; public ExtendedAnimatorAnchor_Thing() : base() { } public ExtendedAnimatorAnchor_Thing(Thing thing) : base() { this.thing = thing; } public override Vector3 getDrawPos() { //x and z position, regular altitude for pawns return new Vector3(thing.DrawPos.x, AltitudeLayer.Pawn.AltitudeFor(), thing.DrawPos.z); } public override void ExposeData() { base.ExposeData(); Scribe_References.Look<Thing>(ref this.thing, "animations_anchor_thing", false); } } }
donkey1919/rimworld
1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs
C#
unknown
894
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class ExtendedAnimatorAnchor_Vector3 : BaseExtendedAnimatorAnchor { public ExtendedAnimatorAnchor_Vector3() : base() { } private Vector3 position; public ExtendedAnimatorAnchor_Vector3(Vector3 position) : base() { //default to altitude for layer for y this.position = new Vector3(position.x, AltitudeLayer.Pawn.AltitudeFor(), position.z); } public override Vector3 getDrawPos() { return position; } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look<Vector3>(ref position, "animations_anchor_position", Vector3.zero); } } }
donkey1919/rimworld
1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs
C#
unknown
902
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { [DefOf] public static class AnimationDefOf { static AnimationDefOf() { DefOfHelper.EnsureInitializedInCtor(typeof(AnimationDefOf)); } public static AnimationDef TestAnimation1; public static AnimationDef TestAnimation2; } }
donkey1919/rimworld
1.5/Source/Defs/AnimationDefOf.cs
C#
unknown
474
using System.Collections.Generic; using Verse; using RimWorld; using UnityEngine; using System.Windows; namespace Rimworld_Animations { class MainTabWindow_OffsetConfigure : MainTabWindow { public override Vector2 RequestedTabSize => new Vector2(505, 500); public override void DoWindowContents(Rect inRect) { Rect position = new Rect(inRect.x, inRect.y, inRect.width, inRect.height); Listing_Standard listingStandard = new Listing_Standard(); listingStandard.Begin(position); listingStandard.Label("RimAnims_AnimManager".Translate()); listingStandard.GapLine(); if (Find.Selector.SingleSelectedThing is Pawn curPawn && curPawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator) && extendedAnimator.IsAnimating) { //Pawn info about their body, race Vector3 offsetPosition = extendedAnimator.Offset != null ? (Vector3)extendedAnimator.Offset : Vector3.zero; int offsetRotation = extendedAnimator.Rotation != null ? (int)extendedAnimator.Rotation : 0; string pawnDef = curPawn.def.defName; string bodyTypeDef = (curPawn.story?.bodyType != null) ? curPawn.story.bodyType.ToString() : "None"; string genderDef = curPawn.gender.ToString(); string currentAnimation = extendedAnimator.CurrentAnimation != null ? extendedAnimator.CurrentAnimation.defName : "None"; listingStandard.Label(curPawn.Name + ": " + curPawn.def.defName + ", " + bodyTypeDef + ", " + genderDef + ", Animation: " + currentAnimation); if (curPawn.def.defName == "Human") { listingStandard.Label("RimAnims_Warning".Translate()); } float posX = offsetPosition.x, posY = offsetPosition.y, posZ = offsetPosition.z; int rot = offsetRotation; float.TryParse(listingStandard.TextEntryLabeled("X: ", posX.ToString()), out posX); posX = listingStandard.Slider(posX, -2, 2); float.TryParse(listingStandard.TextEntryLabeled("Y: ", offsetPosition.y.ToString()), out posY); posY = listingStandard.Slider(posY, -2, 2); float.TryParse(listingStandard.TextEntryLabeled("Z: ", posZ.ToString()), out posZ); posZ = listingStandard.Slider(posZ, -2, 2); int.TryParse(listingStandard.TextEntryLabeled("Rotation: ", rot.ToString()), out rot); rot = (int)listingStandard.Slider(rot, -180, 180); listingStandard.GapLine(); Vector3 newOffsetVector = new Vector3(posX, posY, posZ); string offset = "<li>"; offset += bodyTypeDef != "None" ? "<bodyType>" + bodyTypeDef + "</bodyType>" : ""; offset += newOffsetVector != Vector3.zero ? "<offset>(" + posX + ", " + posY + ", " + posZ + ")</offset>" : ""; offset += rot != 0 ? "<rotation>" + rot + "</rotation>" : ""; offset += "</li>"; listingStandard.Label("Appropriate Offset value for " + currentAnimation + ", " + pawnDef + ", " + bodyTypeDef + ", " + genderDef + ": "); listingStandard.Label(offset); if (listingStandard.ButtonText("RimAnims_CopyToClipboard".Translate())) { GUIUtility.systemCopyBuffer = offset; } listingStandard.Label("RimAnims_ShareSettings".Translate()); extendedAnimator.Offset = newOffsetVector; extendedAnimator.Rotation = rot; } else { listingStandard.Label("Select a pawn currently in an animation to change their offsets"); } listingStandard.End(); } } } /** if (curPawn.TryGetComp<CompExtendedAnimator> animator) { /* CompBodyAnimator compBodyAnimator = curPawn.TryGetComp<CompBodyAnimator>(); AnimationDef def = compBodyAnimator.CurrentAnimation; int ActorIndex = compBodyAnimator.ActorIndex; float offsetX = 0, offsetZ = 0, rotation = 0; string bodyTypeDef = (curPawn.story?.bodyType != null) ? curPawn.story.bodyType.ToString() : ""; if (AnimationSettings.offsets.ContainsKey(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex)) { offsetX = AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].x; offsetZ = AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].y; } else { AnimationSettings.offsets.Add(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex, new Vector2(0, 0)); } if (AnimationSettings.rotation.ContainsKey(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex)) { rotation = AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex]; } else { AnimationSettings.rotation.Add(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex, 0); } listingStandard.Label("Name: " + curPawn.Name + " Race: " + curPawn.def.defName + " Actor Index: " + curPawn.TryGetComp<CompBodyAnimator>().ActorIndex + " Body Type (if any): " + bodyTypeDef + " Animation: " + def.label + (curPawn.TryGetComp<CompBodyAnimator>().Mirror ? " mirrored" : "")); if(curPawn.def.defName == "Human") { listingStandard.Label("Warning--You generally don't want to change human offsets, only alien offsets"); } float.TryParse(listingStandard.TextEntryLabeled("X Offset: ", offsetX.ToString()), out offsetX); offsetX = listingStandard.Slider(offsetX, -2, 2); float.TryParse(listingStandard.TextEntryLabeled("Z Offset: ", offsetZ.ToString()), out offsetZ); offsetZ = listingStandard.Slider(offsetZ, -2, 2); float.TryParse(listingStandard.TextEntryLabeled("Rotation: ", rotation.ToString()), out rotation); rotation = listingStandard.Slider(rotation, -180, 180); if(listingStandard.ButtonText("Reset All")) { offsetX = 0; offsetZ = 0; rotation = 0; } listingStandard.GapLine(); if(listingStandard.ButtonText("Shift Actors")) { if(AnimationSettings.debugMode) { Log.Message("Shifting actors in animation..."); } for(int i = 0; i < curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation.Count; i++) { Pawn actor = curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i]; actor.TryGetComp<CompBodyAnimator>()?.shiftActorPositionAndRestartAnimation(); //reset the clock time of every pawn in animation if(actor.jobs.curDriver is rjw.JobDriver_Sex) { (actor.jobs.curDriver as rjw.JobDriver_Sex).ticks_left = def.animationTimeTicks; (actor.jobs.curDriver as rjw.JobDriver_Sex).ticksLeftThisToil = def.animationTimeTicks; (actor.jobs.curDriver as rjw.JobDriver_Sex).duration = def.animationTimeTicks; } } } if (offsetX != AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].x || offsetZ != AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].y) { AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex] = new Vector2(offsetX, offsetZ); } if(rotation != AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex]) { AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex] = rotation; } } } */
donkey1919/rimworld
1.5/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
C#
unknown
8,046
using RimWorld; using Verse; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rimworld_Animations { [DefOf] public static class OffsetMainButtonDefOf { public static MainButtonDef OffsetManager; static OffsetMainButtonDefOf() { DefOfHelper.EnsureInitializedInCtor(typeof(OffsetMainButtonDefOf)); } } }
donkey1919/rimworld
1.5/Source/MainTabWindows/OffsetMainButtonDefOf.cs
C#
unknown
436
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using RimWorld.Planet; using Verse; namespace Rimworld_Animations { public class WorldComponent_UpdateMainTab : WorldComponent { public WorldComponent_UpdateMainTab(World world) : base(world) { } public override void FinalizeInit() { base.FinalizeInit(); OffsetMainButtonDefOf.OffsetManager.buttonVisible = RJWAnimationSettings.offsetTab; } } }
donkey1919/rimworld
1.5/Source/MainTabWindows/WorldComponent_UpdateMainTab.cs
C#
unknown
550
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using HarmonyLib; using System.Reflection; namespace Rimworld_Animations { [StaticConstructorOnStartup] public static class Harmony_PatchAll { static Harmony_PatchAll() { Harmony val = new Harmony("rjwanim"); val.PatchAll(Assembly.GetExecutingAssembly()); } } }
donkey1919/rimworld
1.5/Source/Patches/Harmony_PatchAll.cs
C#
unknown
451
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using rjw; using HarmonyLib; using Verse; using RimWorld; using Verse.AI; namespace Rimworld_Animations { /* [HarmonyPatch(typeof(WorkGiver_Sex), "JobOnThing")] public static class HarmonyPatch_WorkGiverSex { public static bool Prefix(ref Job __result, ref Thing t) { Building_Bed bed = RestUtility.CurrentBed(t as Pawn); if (bed == null) { return false; } __result = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("JoinInBedAnimation", true), t as Pawn, bed); return false; } } */ }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/HarmonyPatch_WorkGiverSex.cs
C#
unknown
720
using System.Collections.Generic; using System.Linq; using HarmonyLib; using RimWorld; using Verse; using rjw; using Verse.AI; namespace Rimworld_Animations { [HarmonyPatch(typeof(Bed_Utility), "in_same_bed")] public static class HarmonyPatch_JobDriver_InSameBedPatch { public static bool Prefix(Pawn partner, ref bool __result) { if(partner != null && partner.CurJobDef == xxx.casual_sex) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(JobDriver_JoinInBed), "MakeNewToils")] public static class HarmonyPatch_JobDriver_JoinInBed { public static void Postfix(JobDriver_JoinInBed __instance, ref IEnumerable<Toil> __result) { var toils = __result.ToList(); Toil goToPawnInBed = Toils_Goto.GotoThing(__instance.iTarget, PathEndMode.OnCell); goToPawnInBed.FailOn(() => !RestUtility.InBed(__instance.Partner) && __instance.Partner.CurJobDef != xxx.gettin_loved && !Bed_Utility.in_same_bed(__instance.Partner, __instance.pawn)); toils[1] = goToPawnInBed; Toil startPartnerSex = new Toil(); startPartnerSex.initAction = delegate { if (!(__instance.Partner.jobs.curDriver is JobDriver_SexBaseReciever)) // allows threesomes { Job gettinLovedJob = JobMaker.MakeJob(xxx.gettin_loved, __instance.pawn, __instance.Bed); // new gettin loved toil that wakes up the pawn goes here __instance.Partner.jobs.jobQueue.EnqueueFirst(gettinLovedJob); __instance.Partner.jobs.EndCurrentJob(JobCondition.InterruptForced); } }; toils[2] = startPartnerSex; __result = toils.AsEnumerable(); } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_JoinInBed.cs
C#
unknown
1,892
using HarmonyLib; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using Verse.AI; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_Masturbate), "SetupDurationTicks")] public class HarmonyPatch_JobDriver_Masturbate { public static void Postfix(JobDriver_Masturbate __instance) { //prevent early stoppage of masturbate jobdriver during animation /* not needed anymore? Ticks are assigned during animation __instance.duration = 10000000; __instance.ticks_left = __instance.duration; */ } } [HarmonyPatch(typeof(JobDriver_Masturbate), "MakeNewToils")] public class HarmonyPatch_JobDriver_Masturbate2 { public static void Postfix(JobDriver_Masturbate __instance, ref IEnumerable<Toil> __result) { var toils = __result.ToList(); //sex toil toils[1].initAction += delegate () { CompExtendedAnimator pawnAnimator = __instance.pawn.TryGetComp<CompExtendedAnimator>(); // if pawn was given an animation to play, if (pawnAnimator.IsAnimating) { //set duration of masturbate toil to anim length toils[1].defaultDuration = pawnAnimator.AnimationLength; } }; __result = toils.AsEnumerable(); } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_Masturbate.cs
C#
unknown
1,536
using HarmonyLib; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_Sex), "setup_ticks")] public class HarmonyPatch_JobDriver_Sex { public static void Postfix(JobDriver_Sex __instance) { if (!RJWAnimationSettings.hearts) { __instance.ticks_between_hearts = int.MaxValue; } } } [HarmonyPatch(typeof(JobDriver_Sex), "SexTick")] public class HarmonyPatch_JobDriver_Sex2 { public static void Postfix(JobDriver_Sex __instance, Pawn pawn, Thing target) { //if neverending sex and pawn doesn't have an animation, if (__instance.neverendingsex && !pawn.TryGetComp<CompExtendedAnimator>().IsAnimating) { //start a new animation for all the pawns paired with receiver job driver List<Pawn> participants; if (target is Pawn receiverPawn) { participants = (receiverPawn?.jobs?.curDriver as JobDriver_SexBaseReciever)?.parteners.Append(receiverPawn).ToList(); } else { participants = new List<Pawn> { pawn }; } GroupAnimationDef animation = AnimationUtility.FindGroupAnimation(participants, out int reorder); if (animation != null) { Thing anchor = (Thing)__instance.Bed ?? pawn; AnimationUtility.StartGroupAnimation(participants, animation, reorder, anchor); } } } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_Sex.cs
C#
unknown
1,843
using System; using System.Collections.Generic; using System.Linq; using HarmonyLib; using RimWorld; using Verse; using rjw; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")] static class HarmonyPatch_JobDriver_SexBaseInitiator_Start { public static void Postfix(ref JobDriver_SexBaseInitiator __instance) { Pawn pawn = __instance.pawn; Pawn partner = (__instance.Target as Corpse)?.InnerPawn ?? __instance.Target as Pawn; List<Pawn> participants; if (__instance is JobDriver_Masturbate) { participants = new List<Pawn>() { pawn }; } else if (__instance is JobDriver_ViolateCorpse) { participants = new List<Pawn>() { pawn, partner }; } else { participants = (partner?.jobs?.curDriver as JobDriver_SexBaseReciever)?.parteners.Append(partner).ToList(); } GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder); if (groupAnimation != null) { Thing anchor = (Thing)__instance.Bed ?? partner; AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, anchor); int animTicks = AnimationUtility.GetAnimationLength(pawn); foreach (Pawn participant in participants) { if (RJWAnimationSettings.debugMode) { Log.Message("Participant: " + participant.Name); Log.Message("JobDriver: " + participant.CurJobDef.defName); } //null ref check for pawns that might have lost their jobs or become null for some reason if (participant?.jobs?.curDriver is JobDriver_Sex participantJobDriver) { participantJobDriver.ticks_left = animTicks; participantJobDriver.sex_ticks = animTicks; participantJobDriver.orgasmStartTick = animTicks; participantJobDriver.duration = animTicks; } } } /* * not necessary anymore because removed masturbate infinite ticks * else { //backup check for if masturbation doesn't have anim //reset duration and ticks_left to the regular RJW values //because of HarmonyPatch_JobDriver_Masturbate setting the values large to prevent early stoppage foreach (Pawn participant in participants) { if (participant?.jobs?.curDriver is JobDriver_Sex participantJobDriver) { participantJobDriver.duration = (int)(xxx.is_frustrated(participant) ? (2500f * Rand.Range(0.2f, 0.7f)) : (2500f * Rand.Range(0.2f, 0.4f))); participantJobDriver.ticks_left = participantJobDriver.duration; } } } */ } static IEnumerable<String> NonSexActRulePackDefNames = new String[] { "MutualHandholdingRP", "MutualMakeoutRP", }; public static bool NonSexualAct(JobDriver_SexBaseInitiator sexBaseInitiator) { if (NonSexActRulePackDefNames.Contains(sexBaseInitiator.Sexprops.rulePack)) { return true; } return false; } } [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "End")] static class HarmonyPatch_JobDriver_SexBaseInitiator_End { public static void Prefix(ref JobDriver_SexBaseInitiator __instance) { //stop pawn animating AnimationUtility.StopGroupAnimation(__instance.pawn); //stop partner animating if (__instance.Partner is Pawn partner) { AnimationUtility.StopGroupAnimation(partner); } //stop partner's other partners (threesome pawns) animating //added null ref checks for instances when pawns get nulled or lose their jobs if (__instance.Partner?.jobs?.curDriver is JobDriver_SexBaseReciever partnerReceiverJob) { foreach (Pawn pawn in partnerReceiverJob.parteners) { if (pawn != null) AnimationUtility.StopGroupAnimation(pawn); } } } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs
C#
unknown
4,698
using HarmonyLib; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_Sex), "Animate")] public class HarmonyPatch_Animate { public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target) { //remove all bumping stuff in animations; keep draw nude code __instance.RotatePawns(pawn, __instance.Partner); if (target != null) { Pawn pawn2 = target as Pawn; if (pawn2 != null && !__instance.Sexprops.isRapist) { // if not (pawn has root node and rootnode is animating) if (!(pawn2?.Drawer?.renderer?.renderTree?.rootNode is PawnRenderNode rootNode && (rootNode.AnimationWorker is AnimationWorker_KeyframesExtended || rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended)))) { //play bumpin anim pawn.Drawer.Notify_MeleeAttackOn(target); } } if (!__instance.isEndytophile) { SexUtility.DrawNude(pawn, false); if (pawn2 != null) { SexUtility.DrawNude(pawn2, false); return false; } } } else if (!__instance.isEndytophile) { SexUtility.DrawNude(pawn, false); } return false; } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_Animate.cs
C#
unknown
1,369
using HarmonyLib; using rjw; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_Sex), "PlaySexSound")] class HarmonyPatch_PlaySexSounds { public static bool Prefix(JobDriver_Sex __instance) { return false; } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_PlaySexSounds.cs
C#
unknown
280
using HarmonyLib; using RimWorld; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using Verse.AI; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_Sex), "SexTick")] public class HarmonyPatch_SexTick { public static bool Prefix(JobDriver_Sex __instance, Pawn pawn, Thing target) { if ((target is Pawn) && !( (target as Pawn)?.jobs?.curDriver is JobDriver_SexBaseReciever && ((target as Pawn).jobs.curDriver as JobDriver_SexBaseReciever).parteners.Any() && ((target as Pawn).jobs.curDriver as JobDriver_SexBaseReciever).parteners[0] == pawn)) { __instance.ticks_left--; __instance.sex_ticks--; __instance.Orgasm(); if (pawn.IsHashIntervalTick(__instance.ticks_between_thrusts)) { __instance.ChangePsyfocus(pawn, target); __instance.Animate(pawn, target); __instance.PlaySexSound(); if (!__instance.Sexprops.isRape) { pawn.GainComfortFromCellIfPossible(false); if (target is Pawn) { (target as Pawn).GainComfortFromCellIfPossible(false); } } if(!__instance.isEndytophile) { SexUtility.DrawNude(pawn, false); } } return false; } return true; } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_SexTick.cs
C#
unknown
1,434
using HarmonyLib; using RimWorld; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using Verse.AI; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_SexBaseRecieverLoved), "MakeSexToil")] public class HarmonyPatch_JobDriver_SexBaseReceiverLoved { public static void Postfix(JobDriver_SexBaseRecieverLoved __instance, ref Toil __result) { //added for sudden end of jobdriver __result.AddFinishAction(delegate { AnimationUtility.StopGroupAnimation(__instance.pawn); }); } public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions) { var ins = codeInstructions.ToList(); for (int i = 0; i < ins.Count; i++) { if (i < ins.Count && ins[i].opcode == OpCodes.Call && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(Toils_LayDown), "LayDown"))) { ins[i].operand = AccessTools.DeclaredMethod(typeof(HarmonyPatch_JobDriver_SexBaseReceiverLoved), "DoNotLayDown"); yield return ins[i]; } else { yield return ins[i]; } } } public static Toil DoNotLayDown(TargetIndex bedOrRestSpotIndex, bool hasBed, bool lookForOtherJobs, bool canSleep = true, bool gainRestAndHealth = true, PawnPosture noBedLayingPosture = PawnPosture.LayingMask, bool deathrest = false) { return new Toil(); } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/SexBaseReceivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs
C#
unknown
1,704
using HarmonyLib; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse.AI; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_SexBaseRecieverRaped), "MakeNewToils")] public class HarmonyPatch_JobDriver_SexBaseReceiverRaped { /* * Doesn't work; ienumerables are read-only, can't modify toil * would need to harmonypatch; stopped partner animating in sexbaseinitiator instead * public static void Postfix(JobDriver_SexBaseRecieverRaped __instance, ref IEnumerable<Toil> __result) { //added for sudden end of jobdriver __result.Last().AddFinishAction(delegate { AnimationUtility.StopGroupAnimation(__instance.pawn); }); } */ } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/JobDrivers/SexBaseReceivers/HarmonyPatch_JobDriver_SexBaseReceiverRaped.cs
C#
unknown
865
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using UnityEngine; using RimWorld; namespace Rimworld_Animations { public class RJWAnimationSettings : ModSettings { public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false, PlayAnimForNonsexualActs = true; //probably move this setting to a different mod menu if moving rjw parts of code public static bool playVoices = true, playHumanlikeVoicesAsDefault = true; public static float floatRangeInRenderTreeMenu = 1f; public static bool offsetTab = false, debugMode = false; public static float shiverIntensity = 2f; public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref playVoices, "RJWAnimations_PlayVoices", true); Scribe_Values.Look(ref playHumanlikeVoicesAsDefault, "RJWAnimations-playHumanlikeVoicesAsDefault", true); Scribe_Values.Look(ref debugMode, "RJWAnimations-AnimsDebugMode", false); Scribe_Values.Look(ref offsetTab, "RJWAnimations-EnableOffsetTab", false); Scribe_Values.Look(ref controlGenitalRotation, "RJWAnimations-controlGenitalRotation", false); Scribe_Values.Look(ref orgasmQuiver, "RJWAnimations-orgasmQuiver"); Scribe_Values.Look(ref rapeShiver, "RJWAnimations-rapeShiver"); Scribe_Values.Look(ref hearts, "RJWAnimation-heartsOnLovin"); Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs"); Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true); Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f); Scribe_Values.Look(ref floatRangeInRenderTreeMenu, "RJWAnimations-FloatRangeRenderMenu", 1f); //todo: save offsetsByDefName } } public class RJW_Animations : Mod { public RJW_Animations(ModContentPack content) : base(content) { GetSettings<RJWAnimationSettings>(); } public override void DoSettingsWindowContents(Rect inRect) { Listing_Standard listingStandard = new Listing_Standard(); listingStandard.Begin(inRect); listingStandard.CheckboxLabeled("RimAnim_SoundOverride".Translate(), ref RJWAnimationSettings.soundOverride); listingStandard.CheckboxLabeled("RimAnim_GenitalRotation".Translate(), ref RJWAnimationSettings.controlGenitalRotation); listingStandard.CheckboxLabeled("RimAnim_OrgasmQuiver".Translate(), ref RJWAnimationSettings.orgasmQuiver); listingStandard.CheckboxLabeled("RimAnim_RapeShiver".Translate(), ref RJWAnimationSettings.rapeShiver); listingStandard.CheckboxLabeled("RimAnim_HeartsDuringLovin".Translate(), ref RJWAnimationSettings.hearts); listingStandard.CheckboxLabeled("RimAnim_PlayNonsexual".Translate(), ref RJWAnimationSettings.PlayAnimForNonsexualActs); listingStandard.CheckboxLabeled("RimAnim_AnimManagerTab".Translate(), ref RJWAnimationSettings.offsetTab); listingStandard.CheckboxLabeled("RimAnim_Voices".Translate(), ref RJWAnimationSettings.playVoices); if (RJWAnimationSettings.playVoices) { listingStandard.CheckboxLabeled("RimAnim_HumanlikeVoicesDefault".Translate(), ref RJWAnimationSettings.playHumanlikeVoicesAsDefault); } listingStandard.Label("RimAnim_ShiverIntensity".Translate() + RJWAnimationSettings.shiverIntensity); RJWAnimationSettings.shiverIntensity = listingStandard.Slider(RJWAnimationSettings.shiverIntensity, 0.0f, 12f); listingStandard.Label("RimAnim_FloatRangeRenderTree".Translate() + RJWAnimationSettings.floatRangeInRenderTreeMenu); RJWAnimationSettings.floatRangeInRenderTreeMenu = listingStandard.Slider(RJWAnimationSettings.floatRangeInRenderTreeMenu, 0.1f, 12f); listingStandard.CheckboxLabeled("RimAnim_DebugMode".Translate(), ref RJWAnimationSettings.debugMode); listingStandard.End(); base.DoSettingsWindowContents(inRect); } public override void WriteSettings() { base.WriteSettings(); OffsetMainButtonDefOf.OffsetManager.buttonVisible = RJWAnimationSettings.offsetTab; } public override string SettingsCategory() { return "RimAnim_ModSettings".Translate(); } } }
donkey1919/rimworld
1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs
C#
unknown
4,635
using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(Dialog_DebugRenderTree), "RightRect")] public static class HarmonyPatch_Dialog_DebugRenderTree { static MethodInfo replaceFloatRangeMethod = SymbolExtensions.GetMethodInfo(() => HarmonyPatch_Dialog_DebugRenderTree.ReplaceFloatValueRange()); public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { var codes = new List<CodeInstruction>(instructions); for (int i = 0; i < codes.Count; i++) { //increase granularity of x and z sliders to be 0.01 instead if (codes[i].opcode == OpCodes.Ldc_R4 && (float)codes[i].operand == 0.05f) { codes[i].operand = 0.001f; codes[i - 8].opcode = OpCodes.Call; codes[i - 8].operand = replaceFloatRangeMethod; } } return codes.AsEnumerable(); } public static FloatRange ReplaceFloatValueRange() { return new FloatRange(-RJWAnimationSettings.floatRangeInRenderTreeMenu, RJWAnimationSettings.floatRangeInRenderTreeMenu); } } }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_Dialog_DebugRenderTree.cs
C#
unknown
1,453
using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { // Head Rotation Code - Textures // it's fine to just edit each AppendRequests individually // because they all the parms are passed down to each child node recursively [HarmonyPatch(typeof(PawnRenderNode), "AppendRequests")] public static class HarmonyPatch_PawnRenderNode { //if rendernodetag is head, update PawnDrawParms so that head, and all children, are rotated for anim public static bool Prefix(ref PawnRenderNode __instance, ref PawnDrawParms parms) { if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker) { if (parms.Portrait) return true; // ADJUST FACING get rotated textures // compare the previous tick to the current tick; if the current tick rotation is different, recache parms.facing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick); //INVIS IF ANIM CALLS FOR IT //replace maybe? //cheaper call now comparing prev tick to cur tick //not necessary because of new rendernodeworker hiding props now //nvm, keep it because you can hide head and body too, if need be return extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick); } return true; } } /* * no longer needed; taken care of by graphic variants * // For changing texture path of thing to variant [HarmonyPatch(typeof(PawnRenderNode), "TexPathFor")] public static class HarmonyPatch_PawnRenderNode2 { public static void Postfix(ref PawnRenderNode __instance, ref string __result) { if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended animWorker) { __result += animWorker.TexPathVariantAtTick(__instance.tree.AnimationTick); } } } */ }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs
C#
unknown
2,176
using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(PawnRenderNodeWorker), "CanDrawNow")] public class HarmonyPatch_PawnRenderTreeWorker { public static bool Prefix(PawnRenderNode node, ref bool __result) { //switching to this system so that head or body can be hidden separate from other nodes //(hide head but not addons, etc) //in case someone wanted to do that if (node.AnimationWorker is AnimationWorker_KeyframesExtended animWorker) { if (!animWorker.visibleAtTick(node.tree.AnimationTick)) { __result = false; return false; } //visible when animating return true; } return true; } } }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs
C#
unknown
1,011
using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(PawnRenderTree), "TryGetMatrix")] public class HarmonyPatch_PawnRenderTree { public static bool Prefix(PawnRenderTree __instance, Dictionary<PawnRenderNodeTagDef, PawnRenderNode> ___nodesByTag, PawnRenderNode node, ref PawnDrawParms parms, ref Matrix4x4 matrix, ref bool __result) { /* * Facing offsets fix */ //find lowest parent that is animating, or nothing if not animating //don't do anything if portrait if (parms.Portrait) return true; PawnRenderNode animatingNode = node; while (animatingNode != null && !(animatingNode.AnimationWorker is AnimationWorker_KeyframesExtended)) { animatingNode = animatingNode.parent; } //if animating parent node found, if (animatingNode?.AnimationWorker is AnimationWorker_KeyframesExtended animatingNodeAnimationWorker) { //change parm to facing to animate correctly parms.facing = animatingNodeAnimationWorker.facingAtTick(__instance.AnimationTick); } /* * Set Render Node to absolute position */ if (node.Props is PawnRenderNodeProperties_GraphicVariants graphicVariantProp && graphicVariantProp.absoluteTransform) { matrix = parms.matrix; //absolute transform -- just use the node's transform, not its ancestors node.GetTransform(parms, out Vector3 offset, out Vector3 pivot, out Quaternion quaternion, out Vector3 scale); if (offset != Vector3.zero) matrix *= Matrix4x4.Translate(offset); if (pivot != Vector3.zero) matrix *= Matrix4x4.Translate(pivot); if (quaternion != Quaternion.identity) matrix *= Matrix4x4.Rotate(quaternion); if (scale != Vector3.one) matrix *= Matrix4x4.Scale(scale); if (pivot != Vector3.zero) matrix *= Matrix4x4.Translate(scale).inverse; float num = node.Worker.AltitudeFor(node, parms); if (num != 0f) { matrix *= Matrix4x4.Translate(Vector3.up * num); } __result = true; return false; } return true; } } //recaching //done here because changing parms causes recaching anyway, so might as well do it here [HarmonyPatch(typeof(PawnRenderTree), "AdjustParms")] public class HarmonyPatch_PawnRenderTree2 { public static void Prefix(PawnRenderTree __instance, ref PawnDrawParms parms) { int animationTick = __instance.AnimationTick; if (__instance.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended rootAnimWorkerExtended) { //recache during facing turn if (rootAnimWorkerExtended.shouldRecache(animationTick)) { __instance.rootNode.requestRecache = true; return; } } foreach (PawnRenderNode node in __instance.rootNode.children) { if (node.AnimationWorker is AnimationWorker_KeyframesExtended animWorkerExtended) { //recache during flicker on/off if (animWorkerExtended.shouldRecache(animationTick)) { node.requestRecache = true; return; } } } } } }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
C#
unknown
3,949
using HarmonyLib; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(PawnRenderer), "BodyAngle")] public class HarmonyPatch_PawnRenderer { public static bool Prefix(ref Pawn ___pawn, ref float __result) { //set body angle to zero, for when downed if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended) { __result = 0; return false; } return true; } } [HarmonyPatch(typeof(PawnRenderer), "GetBodyPos")] public class HarmonyPatch_PawnRenderer2 { //patch so that pawns appear at the same altitude layer, at layer Pawn public static void Postfix(PawnRenderer __instance, ref Vector3 __result) { if (__instance.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended || (__instance.renderTree?.rootNode?.children is PawnRenderNode[] childNodes && childNodes.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))) { __result.y = AltitudeLayer.Pawn.AltitudeFor(); } } } }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs
C#
unknown
1,358
using HarmonyLib; using rjw; using UnityEngine; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(Pawn_DrawTracker), "DrawPos", MethodType.Getter)] public static class HarmonyPatch_Pawn_DrawTracker { //switch to postfix to get pawn original height first public static void Postfix(ref Pawn ___pawn, ref Vector3 __result) { //align pos on top of partner, position, etc., based on animatoranchor if (___pawn.TryGetComp<CompExtendedAnimator>() is CompExtendedAnimator animator) { if (animator.IsAnchored) { Vector3 anchor = animator.getAnchor(); __result.x = anchor.x; __result.z = anchor.z; } } } } }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
C#
unknown
832
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using HarmonyLib; using RimWorld; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(Thing), "DrawAt")] public static class HarmonyPatch_Thing { /* public static bool Prefix(Thing __instance) { CompThingAnimator thingAnimator = __instance.TryGetComp<CompThingAnimator>(); if (thingAnimator != null && thingAnimator.isAnimating) { thingAnimator.AnimateThing(__instance); return false; } return true; } */ } }
donkey1919/rimworld
1.5/Source/Patches/RimworldPatches/HarmonyPatch_Thing.cs
C#
unknown
712
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNodeProperties_BodyTypeVariants : PawnRenderNodeProperties_GraphicVariants { public List<TexPathVariants_BodyType> bodyTypeVariantsDef; } public class TexPathVariants_BodyType { public BodyTypeDef bodyType; public TexPathVariantsDef texPathVariantsDef; } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicBodyTypeVariants/PawnRenderNodeProperties_GraphicBodyTypeVariants.cs
C#
unknown
516
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rimworld_Animations { public class PawnRenderNodeWorker_BodyTypeVariants : PawnRenderNodeWorker_GraphicVariants { //same functionality as graphicvariants worker //just here for readability } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicBodyTypeVariants/PawnRenderNodeWorker_GraphicBodyTypeVariants.cs
C#
unknown
352
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNode_BodyTypeVariants : PawnRenderNode_GraphicVariants { private BodyTypeDef bodyType; protected new PawnRenderNodeProperties_BodyTypeVariants props; public PawnRenderNode_BodyTypeVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree) { this.props = (PawnRenderNodeProperties_BodyTypeVariants)props; } protected Dictionary<int, Graphic> GraphicBodyTypeVariantsFor(Pawn pawn) { if (props.bodyTypeVariantsDef == null) { Log.Error("[Anims] Error: Tried to use BodyTypeVariants node, but bodyTypeVariants weren't given"); return null; } //for each different hediff-based texpathvariants, foreach (TexPathVariants_BodyType texPathVariant_BodyType in props.bodyTypeVariantsDef) { if (pawn.story?.bodyType == texPathVariant_BodyType.bodyType) { //return that specific variant bodyType = texPathVariant_BodyType.bodyType; return GenerateVariants(pawn, texPathVariant_BodyType.texPathVariantsDef); } } return null; } protected override void EnsureMaterialsInitialized() { if (variants == null || this.tree.pawn.story?.bodyType != bodyType) variants = GraphicBodyTypeVariantsFor(this.tree.pawn); //call this in case variants wasn't set, and there is no graphic bodytype variants appropriate; it'll set variants based on default base.EnsureMaterialsInitialized(); } } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicBodyTypeVariants/PawnRenderNode_GraphicBodyTypeVariants.cs
C#
unknown
1,936
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNodeProperties_GraphicHediffSeverityVariants : PawnRenderNodeProperties_GraphicVariants { public BodyPartDef bodyPart = null; public List<HediffWithSeverity> hediffSeverityVariants; } public class HediffWithSeverity { public HediffDef hediff; public List<TexPathVariants_Severity> severityVariants; } public class TexPathVariants_Severity { public int severity; public TexPathVariantsDef texPathVariantsDef; } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicHediffSeverityVariants/PawnRenderNodeProperties_GraphicHediffSeverityVariants.cs
C#
unknown
700
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rimworld_Animations { public class PawnRenderNodeWorker_GraphicHediffSeverityVariants : PawnRenderNodeWorker_GraphicVariants { //same functionality as graphicvariants worker //just here for readability } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicHediffSeverityVariants/PawnRenderNodeWorker_GraphicHediffSeverityVariants.cs
C#
unknown
365
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNode_GraphicHediffSeverityVariants : PawnRenderNode_GraphicVariants { protected HediffDef hediffWithSeverity; protected float curSeverity; protected new PawnRenderNodeProperties_GraphicHediffSeverityVariants props; private HediffDef curHediff; public PawnRenderNode_GraphicHediffSeverityVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree) { this.props = (PawnRenderNodeProperties_GraphicHediffSeverityVariants)props; } protected Dictionary<int, Graphic> GraphicHediffSeverityVariantsFor(Pawn pawn) { if (props.hediffSeverityVariants == null) { Log.Error("[Anims] Error: Tried to use GraphicBodyPartHediffSeverityVariants node, but hediffSeverityVariants weren't given"); } Hediff idealHediff = null; HediffWithSeverity idealHediffSeverity = null; if (props.bodyPart == null) { //search the entire body for the hediff because no bodypart was set for (int i = 0; i < props.hediffSeverityVariants.Count; i++) { idealHediff = pawn.health.hediffSet.hediffs.Find((Hediff hediffWithSeverity) => hediffWithSeverity.def == props.hediffSeverityVariants[i].hediff); if (idealHediff != null) { //get the ideal hediff severity variants, to iterate through and find the right one for the severity idealHediffSeverity = props.hediffSeverityVariants[i]; break; } } } else { //search for a hediff with a specific body part for (int i = 0; i < props.hediffSeverityVariants.Count; i++) { //right hediff with the right hediff and right body part idealHediff = pawn.health.hediffSet.hediffs.Find((Hediff hediffWithSeverity) => hediffWithSeverity.def == props.hediffSeverityVariants[i].hediff && hediffWithSeverity.Part.def == props.bodyPart); if (idealHediff != null) { //get the ideal hediff severity variants, to iterate through and find the right one for the severity idealHediffSeverity = props.hediffSeverityVariants[i]; break; } } } if (idealHediff != null) { //set severity so that recache when this is different curSeverity = idealHediff.Severity; //look for the right severity-based texpathvariants TexPathVariants_Severity texPathVariants_Severity = idealHediffSeverity.severityVariants.Find((TexPathVariants_Severity texPathVariants) => texPathVariants.severity < idealHediff.Severity); //if null, assume value is really too small if (texPathVariants_Severity == null) { //return largest value return GenerateVariants(pawn, idealHediffSeverity.severityVariants.First().texPathVariantsDef); } //return right severity variants return GenerateVariants(pawn, texPathVariants_Severity.texPathVariantsDef); } //there is no graphic hediff variants appropriate curHediff = null; return null; } protected override void EnsureMaterialsInitialized() { //if pawn no longer has the hediff, if (variants == null || !(this.tree.pawn.health?.hediffSet?.hediffs is List<Hediff> hediffs && hediffs.Any((Hediff hediff) => hediff.def == curHediff && hediff.Severity == curSeverity))) { //do graphicvariantsfor variants = GraphicHediffSeverityVariantsFor(this.tree.pawn); } //call this in case variants wasn't set, and there is no graphic hediff variants appropriate; it'll set variants based on default base.EnsureMaterialsInitialized(); } } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicHediffSeverityVariants/PawnRenderNode_GraphicHediffSeverityVariants.cs
C#
unknown
4,587
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNodeProperties_GraphicHediffVariants : PawnRenderNodeProperties_GraphicVariants { public List<TexPathVariants_Hediff> hediffVariants; } public class TexPathVariants_Hediff { public List<HediffDef> hediffs; public TexPathVariantsDef texPathVariantsDef; } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeProperties_GraphicHediffVariants.cs
C#
unknown
499
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rimworld_Animations { public class PawnRenderNodeWorker_GraphicHediffVariants : PawnRenderNodeWorker_GraphicVariants { //same functionality as graphicvariants worker //just here for readability } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeWorker_GraphicHediffVariants.cs
C#
unknown
357
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNode_GraphicHediffVariants : PawnRenderNode_GraphicVariants { protected new PawnRenderNodeProperties_GraphicHediffVariants props; private HediffDef curHediff; public PawnRenderNode_GraphicHediffVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree) { this.props = (PawnRenderNodeProperties_GraphicHediffVariants)props; } protected Dictionary<int, Graphic> GraphicHediffVariantsFor(Pawn pawn) { if (props.hediffVariants == null) { Log.Error("[Anims] Error: Tried to use GraphicHediffVariants node, but hediffVariants weren't given"); return null; } //for each different hediff-based texpathvariants, foreach (TexPathVariants_Hediff texPathVariant_Hediff in props.hediffVariants) { //for all the hediffs corresponding to that texpathvariant, foreach (HediffDef hediffDef in texPathVariant_Hediff.hediffs) { //if the pawn has that hediff, if (pawn?.health?.hediffSet?.hediffs is List<Hediff> pawnHediffs && pawnHediffs.Any((Hediff hediff) => hediff.def == hediffDef)) { //return that specific variant curHediff = hediffDef; return GenerateVariants(pawn, texPathVariant_Hediff.texPathVariantsDef); } } } //there is no graphic hediff variants appropriate curHediff = null; return null; } protected override void EnsureMaterialsInitialized() { //if pawn no longer has the hediff, if (variants == null || !(this.tree.pawn.health?.hediffSet?.hediffs is List<Hediff> hediffs && hediffs.Any((Hediff hediff) => hediff.def == curHediff))) { //do graphicvariantsfor variants = GraphicHediffVariantsFor(this.tree.pawn); } //call this in case variants wasn't set, and there is no graphic hediff variants appropriate; it'll set variants based on default base.EnsureMaterialsInitialized(); } } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNode_GraphicHediffVariants.cs
C#
unknown
2,539
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNodeProperties_GraphicVariants : PawnRenderNodeProperties { public AnimationOffsetDef propOffsetDef = null; public TexPathVariantsDef texPathVariantsDef = null; public bool absoluteTransform = false; } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs
C#
unknown
430
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class PawnRenderNodeWorker_GraphicVariants : PawnRenderNodeWorker { public override bool CanDrawNow(PawnRenderNode node, PawnDrawParms parms) { if (!base.CanDrawNow(node, parms)) return false; if (parms.Portrait) return false; //don't draw if not visible at tick if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator) { return extendedAnimator.visibleAtTick(node.tree.AnimationTick); } //don't draw at all if not animating return false; } protected override Material GetMaterial(PawnRenderNode node, PawnDrawParms parms) { //if node is animating, and is a graphic variant type of node //and node is one with graphic variants //and texpathvariant is set if ((node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker) && (node is PawnRenderNode_GraphicVariants nodeWithGraphicVariants) && extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null) { Material materialVariant = GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick)); if (materialVariant != null) { return materialVariant; } } //otherwise return original texture return base.GetMaterial(node, parms); } public virtual Material GetMaterialVariant(PawnRenderNode_GraphicVariants node, PawnDrawParms parms, int variant) { Material material = node.getGraphicVariant(variant)?.NodeGetMat(parms); if (material == null) return null; if (!parms.Portrait && parms.flags.FlagSet(PawnRenderFlags.Invisible)) { material = InvisibilityMatPool.GetInvisibleMat(material); } return material; } public override Vector3 OffsetFor(PawnRenderNode node, PawnDrawParms parms, out Vector3 pivot) { Vector3 regularOffsets = base.OffsetFor(node, parms, out pivot); if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List<BaseAnimationOffset> offsets) { foreach (BaseAnimationOffset offset in offsets) { if (offset.appliesToPawn(node.tree.pawn)) { //modify offset of prop for animationOffset position regularOffsets += offset.getOffset(node.tree.pawn) ?? Vector3.zero; return regularOffsets; } } } //unmodified; no offsets found return regularOffsets; } public override Vector3 ScaleFor(PawnRenderNode node, PawnDrawParms parms) { Vector3 regularScale = base.ScaleFor(node, parms); if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List<BaseAnimationOffset> offsets) { foreach (BaseAnimationOffset offset in offsets) { if (offset.appliesToPawn(node.tree.pawn)) { //modify scale of prop for animationOffset position regularScale = regularScale.MultipliedBy(offset.getScale(node.tree.pawn) ?? Vector3.one); return regularScale; } } } return regularScale; } public override Quaternion RotationFor(PawnRenderNode node, PawnDrawParms parms) { Quaternion rotation = base.RotationFor(node, parms); if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List<BaseAnimationOffset> offsets) { foreach (BaseAnimationOffset offset in offsets) { if (offset.appliesToPawn(node.tree.pawn)) { //modify offset of prop for animationOffset rotation rotation *= Quaternion.AngleAxis(offset.getRotation(node.tree.pawn) ?? 0, Vector3.up); return rotation; } } } //unmodified; no rotation offsets found return rotation; } } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs
C#
unknown
4,848
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class PawnRenderNode_GraphicVariants : PawnRenderNode { protected new PawnRenderNodeProperties_GraphicVariants props; protected Graphic missingTextureGraphic; protected Dictionary<int, Graphic> variants; public Graphic getGraphicVariant(int variant) { if (variants == null || !variants.ContainsKey(variant)) { return missingTextureGraphic; } return variants[variant]; } public PawnRenderNode_GraphicVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree) { this.props = (PawnRenderNodeProperties_GraphicVariants)props; } protected virtual Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn) { if (props.texPathVariantsDef == null) { return null; } return GenerateVariants(pawn, props.texPathVariantsDef); } protected override void EnsureMaterialsInitialized() { if (variants == null) { variants = GraphicVariantsFor(this.tree.pawn); } if (missingTextureGraphic == null) { missingTextureGraphic = GenerateMissingTextureGraphic(); } base.EnsureMaterialsInitialized(); } //used by all, including base classes, to create texPathVariants for pawn protected Dictionary<int, Graphic> GenerateVariants(Pawn pawn, TexPathVariantsDef texPathVariants) { Dictionary<int, Graphic> variantGraphics = new Dictionary<int, Graphic>(); //for each graphic variant for (int i = 0; i < texPathVariants.variants.Count; i++) { //get new graphic Graphic variant = GraphicDatabase.Get<Graphic_Multi>(texPathVariants.variants[i], this.ShaderFor(pawn), Vector2.one, this.ColorFor(pawn)); //add it to the variants dictionary; i + 1 for easier readability in logs variantGraphics.Add(i + 1, variant); } return variantGraphics; } protected Graphic GenerateMissingTextureGraphic() { return GraphicDatabase.Get<Graphic_Multi>("AnimationProps/MissingTexture/MissingTexture"); } } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs
C#
unknown
2,617
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class TexPathVariantsDef : Def { public List<string> variants; } }
donkey1919/rimworld
1.5/Source/PawnRenderNode/TexPathVariants.cs
C#
unknown
261
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class PawnRenderSubWorker_ChangeOffset : PawnRenderSubWorker { public override void TransformOffset(PawnRenderNode node, PawnDrawParms parms, ref Vector3 offset, ref Vector3 pivot) { if (parms.Portrait) return; if (node.AnimationWorker is AnimationWorker_KeyframesExtended && node.tree.pawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator)) { Vector3? pawnOffset = extendedAnimator.Offset; if (pawnOffset != null) { offset += (Vector3)pawnOffset; } } } public override void TransformRotation(PawnRenderNode node, PawnDrawParms parms, ref Quaternion rotation) { if (node.AnimationWorker is AnimationWorker_KeyframesExtended && node.tree.pawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator)) { int? pawnRotation = extendedAnimator.Rotation; if (pawnRotation != null) { Quaternion additionalRotation = Quaternion.AngleAxis((int)pawnRotation, Vector3.up); rotation *= additionalRotation; } } base.TransformRotation(node, parms, ref rotation); } } }
donkey1919/rimworld
1.5/Source/RenderSubWorkers/PawnRenderSubWorker_ChangeOffset.cs
C#
unknown
1,614
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { public class PawnRenderSubWorker_HideWhenAnimating : PawnRenderSubWorker { public override void EditMaterial(PawnRenderNode node, PawnDrawParms parms, ref Material material) { if (node.tree.pawn.def != ThingDefOf.Human) return; if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended || node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended)) { material.color = Color.clear; material.shader = ShaderTypeDefOf.Transparent.Shader; } } public override void TransformLayer(PawnRenderNode node, PawnDrawParms parms, ref float layer) { base.TransformLayer(node, parms, ref layer); if (node.tree.pawn.def != ThingDefOf.Human) return; layer -= 1000; } } }
donkey1919/rimworld
1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs
C#
unknown
1,105
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using rjw.Modules.Interactions.Helpers; using rjw.Modules.Interactions.Objects; using UnityEngine; using Verse; using Verse.AI; using rjw.Modules.Interactions.Enums; namespace Rimworld_Animations { public static class AnimationUtility { public static void StartAnimation(List<Pawn> participants) { participants[0].Drawer.renderer.SetAnimation(AnimationDefOf.TestAnimation1); participants[1].Drawer.renderer.SetAnimation(AnimationDefOf.TestAnimation2); } //startgroupanimator with anchor //don't anchor to self if anchor is self public static void StartGroupAnimation(List<Pawn> participants, GroupAnimationDef groupAnimationDef, int reorder, Thing anchor) { int seed = GenTicks.TicksGame; for (int i = 0; i < participants.Count; i++) { groupAnimationDef.GetOffset(i, participants[i], out Vector3? position, out int? rotation, reorder); if (anchor is Pawn pawn && pawn == participants[i]) { List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder); participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation); } else { //each participant gets their own unique extendedanimatoranchor, important for scribe_deep saving List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder); BaseExtendedAnimatorAnchor animatorAnchor = new ExtendedAnimatorAnchor_Thing(anchor); if (RJWAnimationSettings.debugMode) { Log.Message("Now playing animation: " + groupAnimationDef.defName + " Actor Shift: " + reorder); } participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation, animatorAnchor); } } } //startgroupanimation without anchor; just play where standing public static void StartGroupAnimation(List<Pawn> participants, GroupAnimationDef groupAnimationDef, int reorder) { int seed = GenTicks.TicksGame; for (int i = 0; i < participants.Count; i++) { List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder); groupAnimationDef.GetOffset(i, participants[i], out Vector3? position, out int? rotation, reorder); participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation); } } public static void StopGroupAnimation(List<Pawn> participants) { foreach(Pawn pawn in participants) { pawn.TryGetComp<CompExtendedAnimator>()?.StopAnimating(); } } public static void StopGroupAnimation(Pawn participant) { participant.TryGetComp<CompExtendedAnimator>()?.StopAnimating(); } public static GroupAnimationDef FindGroupAnimation(List<Pawn> participants, out int reorder) { // go through each context in each GroupAnimationDef // if you find one where it returns canAnimationBeUsed (and reorders), // return that animation //find all, reorder randomly, then find max priority context DefDatabase<GroupAnimationDef>.AllDefsListForReading .FindAll((GroupAnimationDef x) => x.canAnimationBeUsed(participants)) .OrderBy(_ => Rand.Int) .TryMaxBy((GroupAnimationDef x) => x.Priority(participants), out GroupAnimationDef result); reorder = result != null ? result.Reorder(participants) : 0; return result; } public static int GetAnimationLength(Pawn pawn) { return pawn.TryGetComp<CompExtendedAnimator>().AnimationLength; } } }
donkey1919/rimworld
1.5/Source/Utilities/AnimationUtility.cs
C#
unknown
4,380
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class VoiceDef : Def { public List<ThingDef> races = new List<ThingDef>(); public Gender gender = Gender.None; public List<TraitDef> traits = new List<TraitDef>(); public bool takesPriority = false; public float randomChanceFactor = 1; public Dictionary<VoiceTagDef, SoundDef> sounds = new Dictionary<VoiceTagDef, SoundDef>(); public bool VoiceFitsPawn(Pawn pawn) { //doesn't match any of the races if (!races.Exists(x => x == pawn.def)) return false; //doesn't match gender if (gender != Gender.None && pawn.gender != gender) return false; //if traits list is not empty, and pawn doesn't have any of the designated traits, doesn't match if (!traits.Empty() && !traits.Any(trait => pawn.story.traits.HasTrait(trait))) return false; return true; } } }
donkey1919/rimworld
1.5/Source/Voices/VoiceDef.cs
C#
unknown
1,116
using RimWorld; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rimworld_Animations { [DefOf] public static class VoiceDefOf { static VoiceDefOf() { DefOfHelper.EnsureInitializedInCtor(typeof(VoiceDefOf)); } public static VoiceDef Voice_HumanMale; public static VoiceDef Voice_HumanFemale; } }
donkey1919/rimworld
1.5/Source/Voices/VoiceDefOf.cs
C#
unknown
456
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class VoiceTagDef : Def { public float probability = 1; } }
donkey1919/rimworld
1.5/Source/Voices/VoiceTagDef.cs
C#
unknown
254