Rename source folder

This commit is contained in:
amevarashi 2022-09-08 19:59:25 +05:00
parent 0a412a0060
commit a4c046a841
55 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,13 @@
using RimWorld;
using Verse;
namespace RJWSexperienceCum
{
[DefOf]
public static class HediffDefOf
{
public static readonly HediffDef Hediff_CumController;
public static readonly HediffDef Hediff_Cum;
public static readonly HediffDef Hediff_InsectSpunk;
}
}

View file

@ -0,0 +1,11 @@
using RimWorld;
using Verse;
namespace RJWSexperienceCum
{
[DefOf]
public static class JobDefOf
{
public static readonly JobDef CleanSelfwithBucket;
}
}

View file

@ -0,0 +1,93 @@
using RJWSexperience;
using System.Collections.Generic;
using Verse;
using Verse.AI;
namespace RJWSexperienceCum
{
public class JobDriver_CleanSelfWithBucket : JobDriver
{
protected const int UNITTIME = 240;//ticks - 120 = 2 real seconds, 3 in-game minutes
protected float progress = 0;
protected float severitycache = 1;
protected Hediff hediffcache;
protected float CleaningTime
{
get
{
return severitycache * UNITTIME;
}
}
protected Building_CumBucket Bucket => TargetB.Thing as Building_CumBucket;
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOn(delegate
{
List<Hediff> hediffs = pawn.health.hediffSet.hediffs;
return !hediffs.Exists(x => x.def == HediffDefOf.Hediff_CumController);
});
yield return Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch);
Toil cleaning = new Toil
{
initAction = CleaningInit,
tickAction = CleaningTick,
defaultCompleteMode = ToilCompleteMode.Never
};
cleaning.AddFinishAction(Finish);
cleaning.WithProgressBar(TargetIndex.A, () => progress / CleaningTime);
yield return cleaning;
}
protected void CleaningInit()
{
hediffcache = pawn.health.hediffSet.hediffs.Find(x => x.def == HediffDefOf.Hediff_Cum || x.def == HediffDefOf.Hediff_InsectSpunk);
if (hediffcache == null)
{
pawn.jobs.EndCurrentJob(JobCondition.Succeeded);
}
else
{
progress = 0f;
severitycache = hediffcache.Severity;
if (float.IsNaN(severitycache)) //TODO: Figure out WHY NaN is here
severitycache = 0.1f;
}
}
protected void CleaningTick()
{
progress++;
if (progress > CleaningTime)
{
Cleaned();
}
}
protected void Cleaned()
{
if (hediffcache != null)
{
float cumamount = hediffcache.Severity * 10f;
hediffcache.Severity = 0f;
Bucket.AddCum(cumamount);
}
CleaningInit();
}
protected void Finish()
{
if (pawn.CurJobDef == RimWorld.JobDefOf.Wait_MaintainPosture)
{
pawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
}
}
}
}

View file

@ -0,0 +1,36 @@
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("RJWSexperienceCum")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RJWSexperienceCum")]
[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("73cb4597-22bd-4a3e-a3ce-6d65dd080f65")]
// 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")]

View file

@ -0,0 +1,61 @@
<?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>{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RJWSexperienceCum</RootNamespace>
<AssemblyName>RJWSexperienceCum</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</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>..\..\Mod Compatibility\RJW Cum\Assemblies\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Compile Include="JobDefOf.cs" />
<Compile Include="ThingDefOf.cs" />
<Compile Include="JobDriver_CleanSelfWithBucket.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="HediffDefOf.cs" />
<Compile Include="WorkGiver_CleanSelfWithBucket.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.3.3389</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RJWSexperience\RJWSexperience.csproj">
<Project>{9c728e06-573b-4b04-a07f-acbf60cb424d}</Project>
<Name>RJWSexperience</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,12 @@
using RimWorld;
using Verse;
namespace RJWSexperienceCum
{
[DefOf]
public static class ThingDefOf
{
public static readonly ThingDef GatheredCum;
public static readonly ThingDef CumBucket;
}
}

View file

@ -0,0 +1,30 @@
using RimWorld;
using RJWSexperience;
using Verse;
using Verse.AI;
namespace RJWSexperienceCum
{
public class WorkGiver_CleanSelfWithBucket : WorkGiver_Scanner
{
public override ThingRequest PotentialWorkThingRequest => ThingRequest.ForDef(ThingDefOf.CumBucket);
public override PathEndMode PathEndMode => PathEndMode.ClosestTouch;
public override bool ShouldSkip(Pawn pawn, bool forced = false)
{
return HediffDefOf.Hediff_CumController == null || !pawn.health.hediffSet.HasHediff(HediffDefOf.Hediff_CumController);
}
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
{
if (!(t is Building_CumBucket bucket))
return false;
return bucket.StoredStackCount < ThingDefOf.GatheredCum.stackLimit;
}
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
{
return JobMaker.MakeJob(JobDefOf.CleanSelfwithBucket, pawn, t);
}
}
}