-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
600 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ModMetaData> | ||
<name>Zhentar's Fixes</name> | ||
<author>Zhentar</author> | ||
<url></url> | ||
<targetVersion>0.15.0</targetVersion> | ||
<description>Various Vanilla bug fixes</description> | ||
</ModMetaData> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<IncidentDefs> | ||
|
||
<!--=============== ShipChunkDrop =============--> | ||
|
||
<IncidentDef> | ||
<defName>ShipChunkDrop</defName> | ||
<label>ship chunk drop</label> | ||
<workerClass>IncidentWorker_ShipChunkDrop</workerClass> | ||
<category>ShipChunkDrop</category> | ||
<baseChance>1</baseChance> | ||
</IncidentDef> | ||
|
||
</IncidentDefs> |
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,198 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Buildings> | ||
|
||
<ThingDef Name="BuildingBase" Abstract="True"> | ||
<category>Building</category> | ||
<thingClass>Building</thingClass> | ||
<soundImpactDefault>BulletImpactMetal</soundImpactDefault> | ||
<selectable>true</selectable> | ||
<drawerType>MapMeshAndRealTime</drawerType> | ||
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded> | ||
<repairEffect>Repair</repairEffect> | ||
<leaveResourcesWhenKilled>true</leaveResourcesWhenKilled> | ||
<filthLeaving>BuildingRubble</filthLeaving> | ||
</ThingDef> | ||
|
||
<ThingDef Name="HighQualityFurnitureBase" ParentName="BuildingBase" Abstract="True"> | ||
<comps> | ||
<li> | ||
<compClass>CompQuality</compClass> | ||
</li> | ||
<li Class="CompProperties_Art"> | ||
<nameMaker>ArtName_Furniture</nameMaker> | ||
<descriptionMaker>ArtDescription_Furniture</descriptionMaker> | ||
<minQualityForArtistic>Excellent</minQualityForArtistic> | ||
</li> | ||
</comps> | ||
<inspectorTabs> | ||
<li>ITab_Art</li> | ||
</inspectorTabs> | ||
<DesignationCategory>Furniture</DesignationCategory> | ||
<minifiedDef>MinifiedFurniture</minifiedDef> | ||
<tradeTags> | ||
<li>Furniture</li> | ||
</tradeTags> | ||
</ThingDef> | ||
|
||
|
||
<!--============================== Beds ==============================--> | ||
|
||
<ThingDef ParentName="HighQualityFurnitureBase"> | ||
<defName>DoubleBed</defName> | ||
<label>double bed</label> | ||
<Description>A simple double-wide bed that fits two people.</Description> | ||
<ThingClass>Building_Bed</ThingClass> | ||
<graphicData> | ||
<texPath>Things/Building/Furniture/Bed/DoubleBed</texPath> | ||
<graphicClass>Graphic_Multi</graphicClass> | ||
<shaderType>CutoutComplex</shaderType> | ||
<drawSize>(4,4)</drawSize> | ||
<damageData> | ||
<rect>(0,0.05,2,1.95)</rect> | ||
</damageData> | ||
</graphicData> | ||
<AltitudeLayer>Building</AltitudeLayer> | ||
<statBases> | ||
<MaxHitPoints>200</MaxHitPoints> | ||
<Flammability>1.0</Flammability> | ||
<WorkToMake>1740</WorkToMake> | ||
<Comfort>0.75</Comfort> | ||
<Beauty>8</Beauty> | ||
<BedRestEffectiveness>1</BedRestEffectiveness> | ||
<ImmunityGainSpeedFactor>1.1</ImmunityGainSpeedFactor> | ||
</statBases> | ||
<Size>(2,2)</Size> | ||
<stuffCategories> | ||
<li>Metallic</li> | ||
<li>Woody</li> | ||
<li>Stony</li> | ||
</stuffCategories> | ||
<costStuffCount>70</costStuffCount> | ||
<building> | ||
<Bed_ShowSleeperBody>False</Bed_ShowSleeperBody> | ||
<Bed_HealTickInterval>2100</Bed_HealTickInterval> | ||
</building> | ||
<comps> | ||
<li Class="CompProperties_AffectedByFacilities"> | ||
<linkableFacilities> | ||
<li>VitalsMonitor</li> | ||
</linkableFacilities> | ||
</li> | ||
</comps> | ||
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded> | ||
<fillPercent>0.4</fillPercent> | ||
<PathCost>60</PathCost> | ||
<LeaveResourcesWhenKilled>True</LeaveResourcesWhenKilled> | ||
<StaticSunShadowHeight>0.17</StaticSunShadowHeight> | ||
<CastEdgeShadows>True</CastEdgeShadows> | ||
<designationHotKey>Misc3</designationHotKey> | ||
<Passability>PassThroughOnly</Passability> | ||
<DrawGUIOverlay>True</DrawGUIOverlay> | ||
<placeWorkers> | ||
<li>PlaceWorker_ShowFacilitiesConnections</li> | ||
</placeWorkers> | ||
</ThingDef> | ||
|
||
|
||
|
||
<ThingDef ParentName="HighQualityFurnitureBase"> | ||
<defName>RoyalBed</defName> | ||
<label>royal bed</label> | ||
<Description>A luxurious gold-inlaid bed fit for the highborn. Very comfy and beautiful. Fits two.</Description> | ||
<ThingClass>Building_Bed</ThingClass> | ||
<graphicData> | ||
<texPath>Things/Building/Furniture/Bed/RoyalBed</texPath> | ||
<graphicClass>Graphic_Multi</graphicClass> | ||
<shaderType>CutoutComplex</shaderType> | ||
<drawSize>(4,4)</drawSize> | ||
<damageData> | ||
<rect>(0,0.05,2,1.95)</rect> | ||
</damageData> | ||
</graphicData> | ||
<AltitudeLayer>Building</AltitudeLayer> | ||
<statBases> | ||
<MaxHitPoints>200</MaxHitPoints> | ||
<Flammability>1.0</Flammability> | ||
<WorkToMake>4500</WorkToMake> | ||
<Beauty>50</Beauty> | ||
<BedRestEffectiveness>1.05</BedRestEffectiveness> | ||
<Comfort>0.90</Comfort> | ||
<ImmunityGainSpeedFactor>1.1</ImmunityGainSpeedFactor> | ||
</statBases> | ||
<Size>(2,2)</Size> | ||
<stuffCategories> | ||
<li>Metallic</li> | ||
<li>Woody</li> | ||
<li>Stony</li> | ||
</stuffCategories> | ||
<costStuffCount>110</costStuffCount> | ||
<costList> | ||
<Gold>50</Gold> | ||
</costList> | ||
<building> | ||
<Bed_ShowSleeperBody>False</Bed_ShowSleeperBody> | ||
<Bed_HealTickInterval>2000</Bed_HealTickInterval> | ||
</building> | ||
<comps> | ||
<li Class="CompProperties_AffectedByFacilities"> | ||
<linkableFacilities> | ||
<li>VitalsMonitor</li> | ||
</linkableFacilities> | ||
</li> | ||
</comps> | ||
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded> | ||
<fillPercent>0.4</fillPercent> | ||
<PathCost>60</PathCost> | ||
<LeaveResourcesWhenKilled>True</LeaveResourcesWhenKilled> | ||
<StaticSunShadowHeight>0.17</StaticSunShadowHeight> | ||
<CastEdgeShadows>True</CastEdgeShadows> | ||
<designationHotKey>Misc4</designationHotKey> | ||
<Passability>PassThroughOnly</Passability> | ||
<DrawGUIOverlay>True</DrawGUIOverlay> | ||
<placeWorkers> | ||
<li>PlaceWorker_ShowFacilitiesConnections</li> | ||
</placeWorkers> | ||
</ThingDef> | ||
|
||
|
||
<ThingDef ParentName="HighQualityFurnitureBase"> | ||
<defName>DiningChair</defName> | ||
<label>dining chair</label> | ||
<graphicData> | ||
<texPath>Things/Building/Furniture/DiningChair</texPath> | ||
<graphicClass>Graphic_Multi</graphicClass> | ||
<drawSize>(3,3)</drawSize> | ||
<shadowData> | ||
<volume>(0.3, 0.6, 0.3)</volume> | ||
</shadowData> | ||
<damageData> | ||
<rectN>(0.25,0.234375,0.5,0.28125)</rectN> | ||
<rectS>(0.25,0.234375,0.5,0.28125)</rectS> | ||
<rectE>(0.28125,0.25,0.453125,0.25)</rectE> | ||
<rectW>(0.28125,0.25,0.453125,0.25)</rectW> | ||
</damageData> | ||
</graphicData> | ||
<altitudeLayer>Building</altitudeLayer> | ||
<statBases> | ||
<MaxHitPoints>170</MaxHitPoints> | ||
<WorkToMake>6000</WorkToMake> | ||
<Flammability>1.0</Flammability> | ||
<Beauty>7</Beauty> | ||
<Comfort>0.70</Comfort> | ||
</statBases> | ||
<description>A comfortable and attractive chair for sitting at a table.</description> | ||
<socialPropernessMatters>true</socialPropernessMatters> | ||
<stuffCategories> | ||
<li>Metallic</li> | ||
<li>Woody</li> | ||
</stuffCategories> | ||
<costStuffCount>60</costStuffCount> | ||
<pathCost>30</pathCost> | ||
<designationHotKey>Misc7</designationHotKey> | ||
<fillPercent>0.35</fillPercent> | ||
<building> | ||
<isSittable>true</isSittable> | ||
</building> | ||
</ThingDef> | ||
|
||
</Buildings> |
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,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using RimWorld; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace ZhentarFix | ||
{ | ||
public class AnimalHaulFix | ||
{ | ||
protected Job TryGiveJob(Pawn pawn) | ||
{ | ||
Predicate<Thing> validator = t => !t.IsForbidden(pawn) && HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, t) && IsPlaceToPutThing(pawn, t); | ||
Thing thing = GenClosest.ClosestThing_Global_Reachable(pawn.Position, ListerHaulables.ThingsPotentiallyNeedingHauling(), PathEndMode.OnCell, TraverseParms.For(pawn), 9999f, validator); | ||
if (thing != null) | ||
{ | ||
return HaulAIUtility.HaulToStorageJob(pawn, thing); | ||
} | ||
return null; | ||
} | ||
|
||
private bool IsPlaceToPutThing(Pawn p, Thing t) | ||
{ | ||
StoragePriority currentPriority = HaulAIUtility.StoragePriorityAtFor(t.Position, t); | ||
IntVec3 storeCell; | ||
if (!StoreUtility.TryFindBestBetterStoreCellFor(t, p, currentPriority, p.Faction, out storeCell)) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} | ||
} |
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 System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using RimWorld; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace ZhentarFix | ||
{ | ||
[StaticConstructorOnStartup] | ||
internal static class DetourInjector | ||
{ | ||
private static bool DoInject() | ||
{ | ||
if (!DoDetour(typeof(JobGiver_Haul), typeof(AnimalHaulFix), "TryGiveJob")) return false; | ||
|
||
if (!DoDetour(typeof(Hediff_Injury), typeof(ScarringFix), "DirectHeal")) return false; | ||
|
||
if (!DoDetour(typeof(SpecialThingFilterWorker_NonSmeltableWeapon), typeof(SmeltingFix), "Matches")) return false; | ||
if (!DoDetour(typeof(SpecialThingFilterWorker_NonSmeltableWeapon), typeof(SmeltingFix), "AlwaysMatches")) return false; | ||
|
||
return true; | ||
} | ||
|
||
#region guts | ||
private static Assembly Assembly => Assembly.GetAssembly(typeof(DetourInjector)); | ||
|
||
private static string AssemblyName => Assembly.FullName.Split(',').First(); | ||
|
||
static DetourInjector() | ||
{ | ||
LongEventHandler.QueueLongEvent(Inject, "Initializing", true, null); | ||
} | ||
|
||
private static void Inject() | ||
{ | ||
if (DoInject()) | ||
Log.Message(AssemblyName + " injected."); | ||
else | ||
Log.Error(AssemblyName + " failed to get injected properly."); | ||
} | ||
|
||
private const BindingFlags UniversalBindingFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; | ||
|
||
private static bool DoDetour(Type rimworld, Type mod, string method) | ||
{ | ||
MethodInfo RimWorld_A = rimworld.GetMethod(method, UniversalBindingFlags); | ||
MethodInfo ModTest_A = mod.GetMethod(method, UniversalBindingFlags); | ||
if (!Detours.TryDetourFromTo(RimWorld_A, ModTest_A)) | ||
return false; | ||
return true; | ||
} | ||
#endregion | ||
} | ||
} |
Oops, something went wrong.