Skip to content

Commit

Permalink
updated to Rimworld 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed Oct 28, 2022
1 parent 1fd286d commit 3e0ff39
Show file tree
Hide file tree
Showing 83 changed files with 20,473 additions and 15 deletions.
Binary file added 1.4/Assemblies/0Harmony.dll
Binary file not shown.
Binary file added 1.4/Assemblies/DualWield.dll
Binary file not shown.
87 changes: 87 additions & 0 deletions 1.4/Source/DualWield/Alerts/Altert_SkillLow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;

namespace DualWield.Alerts
{
/**
* Disabled this: too annoying for players who know what they are doing. I might enable it again if too many non-readers get confused.
**/

/*
class Altert_SkillLow : Alert
{
public Altert_SkillLow()
{
this.defaultLabel = "DW_Alert_SkillTooLow_Label".Translate();
}
private IEnumerable<Pawn> SkillTooLowPawns
{
get
{
return from p in PawnsFinder.AllMaps_FreeColonists
where SkillTooLow(p)
select p;
}
}
public override AlertReport GetReport()
{
return AlertReport.CulpritIs(this.SkillTooLowPawns.FirstOrDefault<Pawn>());
}
public override string GetExplanation()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine();
stringBuilder.AppendLine();
foreach (Pawn current in this.SkillTooLowPawns)
{
stringBuilder.AppendLine(" " + current.Name);
}
stringBuilder.AppendLine();
return string.Format("WTH_Alert_Maintenance_Low_Description".Translate(), stringBuilder.ToString());
}
private bool SkillTooLow(Pawn pawn)
{
if (pawn.equipment != null && pawn.equipment.TryGetOffHandEquipment(out ThingWithComps offHand) && pawn.skills != null)
{
if (pawn.equipment.Primary is ThingWithComps primary)
{
if (SkillToLowForWeapon(pawn, primary))
{
return true;
}
}
if (SkillToLowForWeapon(pawn, offHand))
{
return true;
}
}
return false;
}
private static bool SkillToLowForWeapon(Pawn pawn, ThingWithComps primary)
{
int level = 0;
if (primary.def.IsMeleeWeapon)
{
level = pawn.skills.GetSkill(SkillDefOf.Melee).Level;
}
else
{
level = pawn.skills.GetSkill(SkillDefOf.Shooting).Level;
}
int levelsShort = 20 - level;
if (levelsShort * Base.dynamicCooldownP > 75f)
{
return true;
}
return false;
}
}
*/
}
322 changes: 322 additions & 0 deletions 1.4/Source/DualWield/Base.cs

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions 1.4/Source/DualWield/Command_DualWield.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Verse;
using Verse.Sound;

namespace DualWield
{
public class Command_DualWield : Command_VerbTarget
{
private Thing offHandThing;
private Verb offHandVerb;
public Command_DualWield(Thing offHandThing)
{
this.offHandThing = offHandThing;
if (this.offHandThing.TryGetComp<CompEquippable>() is CompEquippable ce)
{
offHandVerb = ce.PrimaryVerb;
}
}

public override float GetWidth(float maxWidth)
{
return base.GetWidth(maxWidth);
}
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
{
GizmoResult res = base.GizmoOnGUI(topLeft, maxWidth, parms);
GUI.color = offHandThing.DrawColor;
Material material = (!this.disabled) ? null : TexUI.GrayscaleGUI;
Texture2D tex = offHandThing.def.uiIcon;
if (tex == null)
{
tex = BaseContent.BadTex;
}
Rect rect = new Rect(topLeft.x, topLeft.y + 10, this.GetWidth(maxWidth), 75f);
Widgets.DrawTextureFitted(rect, tex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, material);
GUI.color = Color.white;
return res;
}

public override void GizmoUpdateOnMouseover()
{
base.GizmoUpdateOnMouseover();
this.offHandVerb.verbProps.DrawRadiusRing(this.offHandVerb.caster.Position);
}
public override void ProcessInput(Event ev)
{
base.ProcessInput(ev);
if (offHandVerb.IsMeleeAttack)
{
return;
}
Targeter targeter = Find.Targeter;
if (this.offHandVerb.CasterIsPawn && targeter.targetingSource != null && targeter.targetingSource.GetVerb.verbProps == this.offHandVerb.verbProps)
{
Pawn casterPawn = this.offHandVerb.CasterPawn;
if (!targeter.IsPawnTargeting(casterPawn))
{
targeter.targetingSourceAdditionalPawns.Add(casterPawn);
}
}
else
{
Find.Targeter.BeginTargeting(this.offHandVerb);
}
}
}
}
17 changes: 17 additions & 0 deletions 1.4/Source/DualWield/DW_DefOff.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;

namespace DualWield
{
[DefOf]
public static class DW_DefOff
{
public static JobDef DW_EquipOffhand;
public static ConceptDef DW_Penalties;
public static ConceptDef DW_Settings;
}
}
128 changes: 128 additions & 0 deletions 1.4/Source/DualWield/DualWield.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6FD54C83-31D8-4465-B8BC-9EA2E6EBC1E6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DualWield</RootNamespace>
<AssemblyName>DualWield</AssemblyName>
<TargetFramework>net472</TargetFramework>
<FileAlignment>512</FileAlignment>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\DualWield\1.4\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</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>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Version>1.3.0</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="Alerts\Altert_SkillLow.cs" />
<Compile Include="Base.cs" />
<Compile Include="Command_DualWield.cs" />
<Compile Include="Harmony\Jobdriver_Wait.cs" />
<Compile Include="Harmony\Pawn_StanceTracker.cs" />
<Compile Include="Harmony\VerbTracker.cs" />
<Compile Include="ModExtension\DefModextension_CustomRotation.cs" />
<Compile Include="ModExtension\DefModextension_DefaultSettings.cs" />
<Compile Include="Settings\Dialog_Weapon_Rotation.cs" />
<Compile Include="DW_DefOff.cs" />
<Compile Include="Extensions\Ext_Pawn.cs" />
<Compile Include="Extensions\Ext_Pawn_EquipmentTracker.cs" />
<Compile Include="Extensions\Ext_ThingDef.cs" />
<Compile Include="Extensions\Ext_ThingWithComps.cs" />
<Compile Include="Extensions\Ext_Verb.cs" />
<Compile Include="Harmony\VerbProperties.cs" />
<Compile Include="Harmony\Verb_MeleeAttack.cs" />
<Compile Include="Settings\DictRecordHandler.cs" />
<Compile Include="Settings\GUIDrawUtility.cs" />
<Compile Include="Harmony\Pawn_PathFollower.cs" />
<Compile Include="Harmony\Pawn.cs" />
<Compile Include="Harmony\PawnComponentsUtility.cs" />
<Compile Include="Harmony\PawnRenderer.cs" />
<Compile Include="Harmony\FloatMenuMakerMap.cs" />
<Compile Include="Harmony\PawnWeaponGenerator.cs" />
<Compile Include="Harmony\Pawn_EquipmentTracker.cs" />
<Compile Include="Harmony\Pawn_MeleeVerbs.cs" />
<Compile Include="Harmony\Pawn_RotationTracker.cs" />
<Compile Include="Harmony\Projectile.cs" />
<Compile Include="Harmony\RunAndGun.cs" />
<Compile Include="Harmony\ThingOwner.cs" />
<Compile Include="Harmony\Verb.cs" />
<Compile Include="Jobs\JobDriver_EquipOffHand.cs" />
<Compile Include="Settings\Record.cs" />
<Compile Include="Stances\Stance_Cooldown_DW.cs" />
<Compile Include="Stances\Stance_Warmup_DW.cs" />
<Compile Include="Storage\ExtendedDataStorage.cs" />
<Compile Include="Storage\ExtendedPawnData.cs" />
<Compile Include="Storage\ExtendedThingWithCompsData.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.4.3530" GeneratePathProperty="true" />
<PackageReference Include="Lib.Harmony">
<Version>2.2.2</Version>
</PackageReference>
<PackageReference Include="UnlimitedHugs.Rimworld.HugsLib">
<Version>10.0.1</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="TaskPubliciser">
<Version>1.0.3</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Target Name="MyCode" BeforeTargets="UpdateReferences">
<PropertyGroup>
<AssemblyCSharp>$(PkgKrafs_Rimworld_Ref)\ref\net472\Assembly-CSharp.dll</AssemblyCSharp>
<PubliciseOutputPath>$(PkgKrafs_Rimworld_Ref)\ref\net472\</PubliciseOutputPath>
<AssemblyCSharp_Publicised>$(PubliciseOutputPath)Assembly-CSharp_publicised.dll</AssemblyCSharp_Publicised>
</PropertyGroup>
<Publicise TargetAssemblyPath="$(AssemblyCSharp)" OutputPath="$(PubliciseOutputPath)" Condition="Exists('$(AssemblyCSharp)')" />
<ItemGroup>
<Reference Include="$(AssemblyCSharp_Publicised)">
<SpecificVersion>false</SpecificVersion>
<HintPath>$(AssemblyCSharp_Publicised)</HintPath>
<Implicit>true</Implicit>
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>
<Target Name="UpdateReferences" AfterTargets="ResolveLockFileReferences">
<ItemGroup>
<Reference Remove="$(PkgKrafs_Rimworld_Ref)\ref\net472\Assembly-CSharp.dll" />
</ItemGroup>
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
25 changes: 25 additions & 0 deletions 1.4/Source/DualWield/DualWield.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DualWield", "DualWield.csproj", "{6FD54C83-31D8-4465-B8BC-9EA2E6EBC1E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6FD54C83-31D8-4465-B8BC-9EA2E6EBC1E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6FD54C83-31D8-4465-B8BC-9EA2E6EBC1E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FD54C83-31D8-4465-B8BC-9EA2E6EBC1E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FD54C83-31D8-4465-B8BC-9EA2E6EBC1E6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {77143D90-B94D-41E8-80F3-DD09C7B81C9D}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 3e0ff39

Please sign in to comment.