-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from cyinghan/master
update for 1.4
- Loading branch information
Showing
67 changed files
with
18,575 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
<li>1.1</li> | ||
<li>1.2</li> | ||
<li>1.3</li> | ||
<li>1.4</li> | ||
</supportedVersions> | ||
<modDependencies> | ||
<li> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,8 @@ | |
<li>/</li> | ||
<li>v1.3</li> | ||
</v1.3> | ||
<v1.4> | ||
<li>/</li> | ||
<li>v1.4</li> | ||
</v1.4> | ||
</loadFolders> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using GiddyUpCore.Storage; | ||
using HugsLib; | ||
using HugsLib.Settings; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Verse; | ||
using static RimWorld.Planet.CaravanTicksPerMoveUtility; | ||
|
||
namespace GiddyUpCaravan | ||
{ | ||
public class Base : ModBase | ||
{ | ||
internal const string DropAnimal_NPC_LABEL = "GU_Car_Area_GU_DropAnimal_NPC"; | ||
|
||
internal static SettingHandle<int> completeCaravanBonus; | ||
internal static SettingHandle<int> incompleteCaravanBonusCap; | ||
|
||
internal static SettingHandle<int> visitorMountChance; | ||
internal static SettingHandle<int> visitorMountChanceTribal; | ||
|
||
internal static SettingHandle<int> inBiomeWeight; | ||
internal static SettingHandle<int> outBiomeWeight; | ||
internal static SettingHandle<int> nonWildWeight; | ||
|
||
internal List<Pawn> curCaravanPawns; | ||
|
||
private int minPercentage = 0; | ||
private int maxPercentage = 100; | ||
public static Base Instance { get; private set; } | ||
|
||
public Base() | ||
{ | ||
Instance = this; | ||
} | ||
public override string ModIdentifier | ||
{ | ||
get { return "GiddyUpCaravan"; } | ||
} | ||
|
||
public static ExtendedDataStorage GetExtendedDataStorage() | ||
{ | ||
return GiddyUpCore.Base.Instance.GetExtendedDataStorage(); | ||
} | ||
public override void DefsLoaded() | ||
{ | ||
completeCaravanBonus = Settings.GetHandle<int>("completeCaravanBonus", "GU_Car_CompleteCaravanBonus_Title".Translate(), "GU_Car_CompleteCaravanBonus_Description".Translate(), 60, Validators.IntRangeValidator(0, 200)); | ||
incompleteCaravanBonusCap = Settings.GetHandle<int>("incompleteCaravanBonusCap", "GU_Car_incompleteCaravanBonusCap_Title".Translate(), "GU_Car_incompleteCaravanBonusCap_Description".Translate(), 25, Validators.IntRangeValidator(0, 200)); | ||
|
||
visitorMountChance = Settings.GetHandle<int>("visitorMountChance", "GU_Car_visitorMountChance_Title".Translate(), "GU_Car_visitorMountChance_Description".Translate(), 20, Validators.IntRangeValidator(minPercentage, maxPercentage)); | ||
visitorMountChanceTribal = Settings.GetHandle<int>("visitorMountChanceTribal", "GU_Car_visitorMountChanceTribal_Title".Translate(), "GU_Car_visitorMountChanceTribal_Description".Translate(), 40, Validators.IntRangeValidator(minPercentage, maxPercentage)); | ||
|
||
inBiomeWeight = Settings.GetHandle<int>("inBiomeWeight", "GU_Car_InBiomeWeight_Title".Translate(), "GU_Car_InBiomeWeight_Description".Translate(), 70, Validators.IntRangeValidator(minPercentage, maxPercentage)); | ||
outBiomeWeight = Settings.GetHandle<int>("outBiomeWeight", "GU_Car_OutBiomeWeight_Title".Translate(), "GU_Car_OutBiomeWeight_Description".Translate(), 15, Validators.IntRangeValidator(minPercentage, maxPercentage)); | ||
nonWildWeight = Settings.GetHandle<int>("nonWildWeight", "GU_Car_NonWildWeight_Title".Translate(), "GU_Car_NonWildWeight_Description".Translate(), 15, Validators.IntRangeValidator(minPercentage, maxPercentage)); | ||
|
||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{410AAB1A-90ED-4B8C-8263-0E55D5D35B23}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>GiddyUpCaravan</RootNamespace> | ||
<AssemblyName>GiddyUpCaravan</AssemblyName> | ||
<TargetFramework>net472</TargetFramework> | ||
<FileAlignment>512</FileAlignment> | ||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <FileAlignment>512</FileAlignment> | ||
<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> | ||
<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> | ||
<ItemGroup> | ||
<EmbeddedResource Remove="Harmony\GiddyUpCore\**" /> | ||
<None Remove="Harmony\GiddyUpCore\**" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="0MultiplayerAPI"> | ||
<HintPath>packages\0MultiplayerAPI.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="GiddyUpCore"> | ||
<HintPath>..\..\..\..\GiddyUpCore\1.4\Assemblies\GiddyUpCore.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Base.cs" /> | ||
<Compile Include="Harmony\AnimalPenUtility.cs" /> | ||
<Compile Include="Harmony\CaravanArrivalTimeEstimator.cs" /> | ||
<Compile Include="Harmony\CaravanRideableUtility.cs" /> | ||
<Compile Include="Harmony\CaravanTicksPerMoveUtility.cs" /> | ||
<Compile Include="Harmony\Caravan_PathFollower.cs" /> | ||
<Compile Include="Harmony\IncidentWorker_TraderCaravanArrival.cs" /> | ||
<Compile Include="Harmony\IncidentWorker_TravelerGroup.cs" /> | ||
<Compile Include="Harmony\IncidentWorker_VisitorGroup.cs" /> | ||
<Compile Include="Harmony\Lordtoil_PrepareCaravan_Leave.cs" /> | ||
<Compile Include="Harmony\MassUtility_Capacity.cs" /> | ||
<Compile Include="Harmony\Pawn_JobTracker.cs" /> | ||
<Compile Include="Harmony\Pawn_TicksPerMove.cs" /> | ||
<Compile Include="Harmony\TraderCaravanUtility.cs" /> | ||
<Compile Include="Harmony\TransferableOneWayWidget.cs" /> | ||
<Compile Include="Harmony\TransferableUtility.cs" /> | ||
<Compile Include="Harmony\WorldRoutePlanner.cs" /> | ||
<Compile Include="ModExtensions\MultiplayerPatch.cs" /> | ||
<Compile Include="Utilities\CaravanUtility.cs" /> | ||
<Compile Include="Zones\Designator_GU_DropAnimal_NPC_Clear.cs" /> | ||
<Compile Include="Zones\Designator_GU_DropAnimal_NPC_Expand.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.4.3531" /> | ||
<PackageReference Include="Lib.Harmony"> | ||
<Version>2.2.2</Version> | ||
</PackageReference> | ||
<PackageReference Include="TaskPubliciser"> | ||
<Version>1.0.3</Version> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="UnlimitedHugs.Rimworld.HugsLib"> | ||
<Version>10.0.1</Version> | ||
<ExcludeAssets>runtime</ExcludeAssets> | ||
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</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> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") = "GiddyUpCaravan", "GiddyUpCaravan.csproj", "{410AAB1A-90ED-4B8C-8263-0E55D5D35B23}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{410AAB1A-90ED-4B8C-8263-0E55D5D35B23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{410AAB1A-90ED-4B8C-8263-0E55D5D35B23}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{410AAB1A-90ED-4B8C-8263-0E55D5D35B23}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{410AAB1A-90ED-4B8C-8263-0E55D5D35B23}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {89F51EBF-A982-4CF6-AD04-1C1A92F39D74} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using GiddyUpCore.Storage; | ||
using HarmonyLib; | ||
using RimWorld.Planet; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
|
||
namespace GiddyUpCaravan.Harmony | ||
{ | ||
[HarmonyPatch(typeof(AnimalPenUtility), "NeedsToBeManagedByRope")] | ||
class AnimalPenUtility_NeedsToBeManagedByRope | ||
{ | ||
static void Postfix(Pawn pawn, ref bool __result) | ||
{ | ||
if (__result && pawn.IsFormingCaravan()) | ||
{ | ||
ExtendedDataStorage store = GiddyUpCore.Base.Instance.GetExtendedDataStorage(); | ||
var caravanRider = store.GetExtendedDataFor(pawn).caravanRider; | ||
__result = caravanRider == null; | ||
return; | ||
} | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
v1.4/Source/Giddy-up-Caravan/Harmony/CaravanArrivalAction_Enter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using GiddyUpCore.Jobs; | ||
using GiddyUpCore.Storage; | ||
using HarmonyLib; | ||
using Multiplayer.API; | ||
using RimWorld.Planet; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection.Emit; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace GiddyUpCaravan.Harmony | ||
{ | ||
[HarmonyPatch(typeof(CaravanEnterMapUtility), "Enter")] | ||
[HarmonyPatch(new Type[] { typeof(Caravan), typeof(Map), typeof(Func<Pawn, IntVec3>), typeof(CaravanDropInventoryMode), typeof(bool) })] | ||
class CaravanEnterMapUtility_Enter | ||
{ | ||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) | ||
{ | ||
var instructionsList = new List<CodeInstruction>(instructions); | ||
foreach (CodeInstruction instruction in instructionsList) | ||
{ | ||
yield return instruction; | ||
if (instruction.operand == typeof(Caravan).GetMethod("RemoveAllPawns")) | ||
{ | ||
yield return new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(CaravanEnterMapUtility), "tmpPawns")); | ||
yield return new CodeInstruction(OpCodes.Call, typeof(CaravanEnterMapUtility_Enter).GetMethod("MountCaravanMounts")); | ||
} | ||
} | ||
|
||
} | ||
[SyncMethod] | ||
public static void MountCaravanMounts(List<Pawn> pawns) | ||
{ | ||
|
||
foreach (Pawn pawn in pawns) | ||
{ | ||
if (pawn.IsColonist && Base.Instance.GetExtendedDataStorage() is ExtendedDataStorage store && pawn.Spawned) | ||
{ | ||
ExtendedPawnData pawnData = store.GetExtendedDataFor(pawn); | ||
if (pawnData.caravanMount is Pawn animal) | ||
{ | ||
ExtendedPawnData animalData = store.GetExtendedDataFor(animal); | ||
pawnData.mount = animal; | ||
Job jobAnimal = new Job(GUC_JobDefOf.Mounted, pawn); | ||
jobAnimal.count = 1; | ||
animal.jobs.TryTakeOrderedJob(jobAnimal); | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
v1.4/Source/Giddy-up-Caravan/Harmony/CaravanArrivalTimeEstimator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using HarmonyLib; | ||
using RimWorld.Planet; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection.Emit; | ||
using System.Text; | ||
using Verse; | ||
|
||
namespace GiddyUpCaravan.Harmony | ||
{ | ||
|
||
/* | ||
[HarmonyPatch(typeof(CaravanArrivalTimeEstimator), "EstimatedTicksToArrive")] | ||
[HarmonyPatch(new Type[] { typeof(Caravan), typeof(bool)})] | ||
static class CaravanArrivalTimeEstimator_EstimatedTicksToArrive | ||
{ | ||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) | ||
{ | ||
var instructionsList = new List<CodeInstruction>(instructions); | ||
for (var i = 0; i < instructionsList.Count; i++) | ||
{ | ||
CodeInstruction instruction = instructionsList[i]; | ||
if (instructionsList[i].operand == typeof(Caravan).GetMethod("get_TicksPerMove")) | ||
{ | ||
continue; | ||
} | ||
if (instructionsList[i].operand == typeof(CaravanArrivalTimeEstimator).GetMethod("EstimatedTicksToArrive", new Type[] { typeof(int), typeof(int), typeof(WorldPath), typeof(float), typeof(int), typeof(int)})) | ||
{ | ||
yield return new CodeInstruction(OpCodes.Call, typeof(Utilities.CaravanUtility).GetMethod("EstimatedTicksToArriveToEvery", new Type[] { typeof(int), typeof(int), typeof(WorldPath), typeof(float), typeof(Caravan), typeof(int) }));//Injected code | ||
} | ||
else | ||
{ | ||
yield return instruction; | ||
} | ||
} | ||
} | ||
} | ||
*/ | ||
/* | ||
[HarmonyPatch(typeof(CaravanArrivalTimeEstimator), "EstimatedTicksToArrive")] | ||
[HarmonyPatch(new Type[] { typeof(int), typeof(int), typeof(Caravan) })] | ||
static class CaravanArrivalTimeEstimator_EstimatedTicksToArrive2 | ||
{ | ||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) | ||
{ | ||
var instructionsList = new List<CodeInstruction>(instructions); | ||
for (var i = 0; i < instructionsList.Count; i++) | ||
{ | ||
CodeInstruction instruction = instructionsList[i]; | ||
if (instructionsList[i].operand == typeof(CaravanTicksPerMoveUtility).GetMethod("GetTicksPerMove", new Type[] {typeof(Caravan)})) | ||
{ | ||
continue; | ||
} | ||
if (instructionsList[i].operand == typeof(CaravanArrivalTimeEstimator).GetMethod("EstimatedTicksToArriveToEvery", new Type[] { typeof(int), typeof(int), typeof(WorldPath), typeof(float), typeof(int), typeof(int) })) | ||
{ | ||
yield return new CodeInstruction(OpCodes.Call, typeof(Utilities.CaravanUtility).GetMethod("EstimatedTicksToArriveToEvery", new Type[] { typeof(int), typeof(int), typeof(WorldPath), typeof(float), typeof(Caravan), typeof(int) }));//Injected code | ||
} | ||
else | ||
{ | ||
yield return instruction; | ||
} | ||
} | ||
} | ||
} | ||
*/ | ||
|
||
} |
Oops, something went wrong.