Skip to content

Commit

Permalink
Trying to get roads on water
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoNeko committed Apr 28, 2020
1 parent 3ef3460 commit 0ef0a7d
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 51 deletions.
57 changes: 6 additions & 51 deletions Source/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,60 +291,10 @@ public static void Prefix()
}
}

// Pure debug
/*
[HarmonyPatch(typeof(Dialog_FormCaravan), "AddToTransferables")]
public static class Patch_Dialog_FormCaravan_AddToTransferables
{
[HarmonyPostfix]
public static void Postfix(Thing t)
{
RoadsOfTheRim.DebugLog("Forming caravan, adding to transferable: " + t.Label);
}
}
*/

// Pure debug
/*
[HarmonyPatch(typeof(Dialog_FormCaravan), "CalculateAndRecacheTransferables")]
public static class Patch_Dialog_FormCaravan_CalculateAndRecacheTransferables
{
[HarmonyPostfix]
public static void Postfix(Dialog_FormCaravan __instance)
{
RoadsOfTheRim.DebugLog("debugging calcualting transferables");
foreach (TransferableOneWay tow in __instance.transferables)
{
foreach (Thing t in tow.things)
{
RoadsOfTheRim.DebugLog("Transferable "+tow.Label+", AnyThing "+tow.AnyThing.Label+", Thing "+t.Label);
}
}
}
}
*/

// Pure debug
/*
[HarmonyPatch(typeof(TabDrawer), "DrawTabs" , new Type[] { typeof(Rect) , typeof(List<TabRecord>) , typeof(float) })]
public static class Patch_TabDrawer_DrawTabs
{
[HarmonyPostfix]
public static void Postfix(Rect baseRect , List<TabRecord> tabs)
{
List<TabRecord> list = tabs.ListFullCopy();
foreach (TabRecord item in list)
{
RoadsOfTheRim.DebugLog("Forming caravan, adding to transferable: " + item.label + "Action = " +item.clickedAction.ToString());
}
}
}
*/

[HarmonyPatch(typeof(CaravanUIUtility), "AddPawnsSections")]
/*
* Adds a Road equipment section to pawns & animals
*/
[HarmonyPatch(typeof(CaravanUIUtility), "AddPawnsSections")]
public static class Patch_CaravanUIUtility_AddPawnsSections
{
[HarmonyPostfix]
Expand All @@ -364,7 +314,12 @@ public static void Postfix(ref TransferableOneWayWidget widget, List<Transferabl
}
}


[HarmonyPatch(typeof(CaravanUIUtility), "CreateCaravanTransferableWidgets")]

/*
* Remove Road equipment (TO DO : only ISR2G at the moment) from Item tab when forming caravans
*/
public static class Patch_CaravanUIUtility_CreateCaravanTransferableWidgets
{
[HarmonyPostfix]
Expand Down
Binary file modified v1.1/Assemblies/RoadsOfTheRim.dll
Binary file not shown.
186 changes: 186 additions & 0 deletions v1.1/Patches/patches.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationAddModExtension">
<xpath>/Defs/RoadDef</xpath>
<value>
<li Class="RoadsOfTheRim.DefModExtension_RotR_RoadDef">
<built>false</built>
</li>
</value>
</Operation>
<Operation Class="PatchOperationAdd">
<xpath>/Defs/RoadDef[defName = "DirtPath"]/modExtensions/li[@Class = "RoadsOfTheRim.DefModExtension_RotR_RoadDef"]</xpath>
<value>
<costs>
<Work>600</Work>
</costs>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>/Defs/RoadDef[defName = "DirtRoad"]/modExtensions/li[@Class = "RoadsOfTheRim.DefModExtension_RotR_RoadDef"]</xpath>
<value>
<biomeModifier>0.25</biomeModifier>
<hillinessModifier>0.2</hillinessModifier>
<winterModifier>0</winterModifier>
<costs>
<Work>1200</Work>
<Wood>120</Wood>
</costs>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>/Defs/RoadDef[defName = "StoneRoad"]/modExtensions/li[@Class = "RoadsOfTheRim.DefModExtension_RotR_RoadDef"]</xpath>
<value>
<biomeModifier>0.75</biomeModifier>
<hillinessModifier>0.4</hillinessModifier>
<winterModifier>0</winterModifier>
<costs>
<Work>3600</Work>
<Wood>240</Wood>
<Stone>1800</Stone>
<Steel>300</Steel>
</costs>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>/Defs/RoadDef[defName = "AncientAsphaltRoad"]/modExtensions/li[@Class = "RoadsOfTheRim.DefModExtension_RotR_RoadDef"]</xpath>
<value>
<biomeModifier>1</biomeModifier>
<hillinessModifier>0.6</hillinessModifier>
<winterModifier>0.2</winterModifier>
<costs>
<Work>5400</Work>
<Stone>3600</Stone>
<Steel>600</Steel>
<Chemfuel>300</Chemfuel>
</costs>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>/Defs/RoadDef[defName = "AncientAsphaltHighway"]/modExtensions/li[@Class = "RoadsOfTheRim.DefModExtension_RotR_RoadDef"]</xpath>
<value>
<biomeModifier>1</biomeModifier>
<hillinessModifier>0.6</hillinessModifier>
<winterModifier>0.2</winterModifier>
<costs>
<Work>5400</Work>
<Stone>3600</Stone>
<Steel>600</Steel>
<Chemfuel>300</Chemfuel>
</costs>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/RoadDef[defName = "DirtPath"]/movementCostMultiplier</xpath>
<value>
<movementCostMultiplier>0.75</movementCostMultiplier>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/RoadDef[defName = "DirtRoad"]/movementCostMultiplier</xpath>
<value>
<movementCostMultiplier>0.6</movementCostMultiplier>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/RoadDef[defName = "StoneRoad"]/movementCostMultiplier</xpath>
<value>
<movementCostMultiplier>0.5</movementCostMultiplier>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/RoadDef[defName = "AncientAsphaltRoad"]/movementCostMultiplier</xpath>
<value>
<movementCostMultiplier>0.4</movementCostMultiplier>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/RoadDef[defName = "AncientAsphaltHighway"]/movementCostMultiplier</xpath>
<value>
<movementCostMultiplier>0.4</movementCostMultiplier>
</value>
</Operation>

<Operation Class="PatchOperationConditional">
<xpath>/Defs/WorldObjectDef[defName="Caravan"]/comps</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/WorldObjectDef[defName="Caravan"]</xpath>
<value>
<comps>
<li>
<compClass>RoadsOfTheRim.WorldObjectComp_Caravan</compClass>
</li>
</comps>
</value>
</nomatch>
<match Class="PatchOperationAdd">
<xpath>/Defs/WorldObjectDef[defName="Caravan"]/comps</xpath>
<value>
<li>
<compClass>RoadsOfTheRim.WorldObjectComp_Caravan</compClass>
</li>
</value>
</match>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>/Defs/WorldObjectDef[defName="Caravan"]/inspectorTabs</xpath>
<value>
<li>RoadsOfTheRim.WITab_Caravan_Build</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>/Defs/MapGeneratorDef[@Name="MapCommonBase"]/genSteps</xpath>
<value>
<li>RotR_CleanBuiltRoads</li>
</value>
</Operation>

<Operation Class="PatchOperationRemove">
<success>Always</success>
<xpath>/Defs/TerrainDef[@Name="WaterDeepBase"]/changeable</xpath>
</Operation>

<Operation Class="PatchOperationConditional">
<xpath>/Defs/TerrainDef[@Name="WaterDeepBase"]/affordances</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/TerrainDef[@Name="WaterDeepBase"]</xpath>
<value>
<affordances>
<li>BridgeableAny</li>
</affordances>
</value>
</nomatch>
<match Class="PatchOperationAdd">
<xpath>/Defs/TerrainDef[@Name="WaterDeepBase"]/affordances</xpath>
<value>
<li>BridgeableAny</li>
</value>
</match>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/BiomeDef[defName = "Ocean"]/allowRoads</xpath>
<value>
<allowRoads>true</allowRoads>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>/Defs/BiomeDef[defName = "Lake"]/allowRoads</xpath>
<value>
<allowRoads>true</allowRoads>
</value>
</Operation>

</Patch>

0 comments on commit 0ef0a7d

Please sign in to comment.