Skip to content

Commit

Permalink
Merge pull request #42 from Aviuz/2.7.7
Browse files Browse the repository at this point in the history
2.7.7
  • Loading branch information
Hazzer authored Aug 1, 2022
2 parents 8bf0151 + 1875028 commit 0b9a29b
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 22 deletions.
Binary file modified 1.3/Assemblies/Locks.dll
Binary file not shown.
26 changes: 26 additions & 0 deletions 1.3/Patches/AddCompLockArchitectExpandedFences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationFindMod">
<mods>
<li>Architect Expanded - Fences (Continued)</li>
</mods>
<match Class="PatchOperationConditional">
<xpath>/Defs/ThingDef[thingClass = "BuildLib.Building_Gate"]/comps</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[thingClass = "BuildLib.Building_Gate"]</xpath>
<value>
<comps>
<li Class="Locks.CompProperties_Lock"/>
</comps>
</value>
</nomatch>
<match Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[thingClass = "BuildLib.Building_Gate"]/comps</xpath>
<value>
<li Class="Locks.CompProperties_Lock"/>
</value>
</match>
</match>
</Operation>

</Patch>
26 changes: 26 additions & 0 deletions 1.3/Patches/AddInspectTabLockArchitectExpandedFences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationFindMod">
<mods>
<li>Architect Expanded - Fences (Continued)</li>
</mods>
<match Class="PatchOperationConditional">
<xpath>/Defs/ThingDef[thingClass = "BuildLib.Building_Gate"]/inspectorTabs</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[thingClass = "BuildLib.Building_Gate"]</xpath>
<value>
<inspectorTabs>
<li>Locks.ITab_Lock</li>
</inspectorTabs>
</value>
</nomatch>
<match Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[thingClass = "BuildLib.Building_Gate"]/inspectorTabs</xpath>
<value>
<li>Locks.ITab_Lock</li>
</value>
</match>
</match>
</Operation>

</Patch>
39 changes: 22 additions & 17 deletions 1.3/Patches/AddInspectTabLts.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationConditional">
<xpath>/Defs/ThingDef[@ParentName = "LTS_MedievalDoor" or @ParentName = "LTS_FuturisticDoor" or @ParentName = "LTS_SimpleDoor" or @ParentName = "LTS_SingleDoor" or @ParentName = "LTS_FancyDoor" or (@ParentName = "LTS_DoorBase" and not(@Abstract="True"))]/inspectorTabs</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[@ParentName = "LTS_MedievalDoor" or @ParentName = "LTS_FuturisticDoor" or @ParentName = "LTS_SimpleDoor" or @ParentName = "LTS_SingleDoor" or @ParentName = "LTS_FancyDoor" or (@ParentName = "LTS_DoorBase" and not(@Abstract="True"))]</xpath>
<value>
<inspectorTabs>
<li>Locks.ITab_Lock</li>
</inspectorTabs>
</value>
</nomatch>
<match Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[@ParentName = "LTS_MedievalDoor" or @ParentName = "LTS_FuturisticDoor" or @ParentName = "LTS_SimpleDoor" or @ParentName = "LTS_SingleDoor" or @ParentName = "LTS_FancyDoor" or (@ParentName = "LTS_DoorBase" and not(@Abstract="True"))]/inspectorTabs</xpath>
<value>
<li>Locks.ITab_Lock</li>
</value>
</match>
</Operation>
<Operation Class="PatchOperationFindMod">
<mods>
<li>[LTS]Furnishing</li>
</mods>
<match Class="PatchOperationConditional">
<xpath>/Defs/ThingDef[@ParentName = "LTS_MedievalDoor" or @ParentName = "LTS_FuturisticDoor" or @ParentName = "LTS_SimpleDoor" or @ParentName = "LTS_SingleDoor" or @ParentName = "LTS_FancyDoor" or @ParentName = "LTS_ArchedDoor" or (@ParentName = "LTS_DoorBase" and not(@Abstract="True"))]/inspectorTabs</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[@ParentName = "LTS_MedievalDoor" or @ParentName = "LTS_FuturisticDoor" or @ParentName = "LTS_SimpleDoor" or @ParentName = "LTS_SingleDoor" or @ParentName = "LTS_FancyDoor" or @ParentName = "LTS_ArchedDoor" or (@ParentName = "LTS_DoorBase" and not(@Abstract="True"))]</xpath>
<value>
<inspectorTabs>
<li>Locks.ITab_Lock</li>
</inspectorTabs>
</value>
</nomatch>
<match Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[@ParentName = "LTS_MedievalDoor" or @ParentName = "LTS_FuturisticDoor" or @ParentName = "LTS_SimpleDoor" or @ParentName = "LTS_SingleDoor" or @ParentName = "LTS_FancyDoor" or @ParentName = "LTS_ArchedDoor" or (@ParentName = "LTS_DoorBase" and not(@Abstract="True"))]/inspectorTabs</xpath>
<value>
<li>Locks.ITab_Lock</li>
</value>
</match>
</match>
</Operation>

</Patch>
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
</li>
</modDependencies>
<description>Version 2.7.6\nThis addon adds Lock command on every door.\n - Left-click to lock toggle.\n - Right click for more options\n - Alternatively you can use "Lock" inspector tab\n\nNote: Door lock must be flicked by colonist.</description>
<description>Version 2.7.7\nThis addon adds Lock command on every door.\n - Left-click to lock toggle.\n - Right click for more options\n - Alternatively you can use "Lock" inspector tab\n\nNote: Door lock must be flicked by colonist.</description>
</ModMetaData>
4 changes: 3 additions & 1 deletion Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<Locks_ModName>Locks</Locks_ModName>
<Locks_ChildrenLock>Child lock minimal age: {0}</Locks_ChildrenLock>
<Lock_ChildrenLock_Description>Minimal age needed for humanlike pawn to open doors</Lock_ChildrenLock_Description>
<Locks_AlwaysPensDoor>Always pens door</Locks_AlwaysPensDoor>
<Locks_AlwaysPensDoor_Description>When enabled every door will has "pens door" option turn on after construction.</Locks_AlwaysPensDoor_Description>

<Locks_Label>Lock</Locks_Label>
<Locks_Description>When unlocked all pawn will be allowed to use this door.\n[Right click for more options]</Locks_Description>
Expand All @@ -29,7 +31,7 @@
<Locks_ITabAnimalAllowedDesc>When disabled all animals will not be allowed to pass through this door. This setting is checked after pens and pet door settings.</Locks_ITabAnimalAllowedDesc>
<Locks_ITabChildrenLock>Children lock</Locks_ITabChildrenLock>
<Locks_ITabChildrenLockDesc>When enabled only humanlike pawn over age (check options) are allowed to pass through this door. Works only on pawn from that same faction as door.</Locks_ITabChildrenLockDesc>


<Locks_ITabOwners>Owners</Locks_ITabOwners>
<Locks_ITabChangeLocksNotification>Change lock in order to apply settings!</Locks_ITabChangeLocksNotification>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<p align="center">
<a href="https://github.com/Aviuz/Locks/releases">
<img src="https://img.shields.io/badge/version-2.7.6-blue.svg?style=flat" alt="v2.7.6" />
<img src="https://img.shields.io/badge/version-2.7.7-blue.svg?style=flat" alt="v2.7.7" />
</a>
</p>

Expand Down
5 changes: 3 additions & 2 deletions Source/CompLock.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RimWorld;
using Locks.Options;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -49,7 +50,7 @@ public override IEnumerable<Gizmo> CompGetGizmosExtra()

public override void PostSpawnSetup(bool respawningAfterLoad)
{
if (this.parent.def.defName == FENCE && !respawningAfterLoad)
if ((this.parent.def.defName == FENCE || LocksSettings.alwaysPensDoor) && !respawningAfterLoad)
{
LockUtility.GetData(this.parent).CurrentState.pensDoor = true;
LockUtility.GetData(this.parent).WantedState.pensDoor = true;
Expand Down
9 changes: 9 additions & 0 deletions Source/Locks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
<Content Include="..\1.3\Patches\AddCompLock.xml">
<Link>Patches\AddCompLock.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLockArchitectExpandedFences.xml">
<Link>Patches\AddCompLockArchitectExpandedFences.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLockDoorsExpanded.xml">
<Link>Patches\AddCompLockDoorsExpanded.xml</Link>
</Content>
Expand All @@ -117,12 +120,18 @@
<Content Include="..\1.3\Patches\AddInspectTab.xml">
<Link>Patches\AddInspectTab.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLockArchitectExpandedFences.xml">
<Link>Patches\AddInspectTabLockArchitectExpandedFences.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLockDoorsExpanded.xml">
<Link>Patches\AddInspectTabLockDoorsExpanded.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLockLinkableDoors.xml">
<Link>Patches\AddInspectTabLockLinkableDoors.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLts.xml">
<Link>Patches\AddInspectTabLts.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabSoS2.xml">
<Link>Patches\AddInspectTabSoS2.xml</Link>
</Content>
Expand Down
5 changes: 5 additions & 0 deletions Source/Options/LocksMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class LocksMod : Mod
private const string CHILD_LOCK_DESC = "Lock_ChildrenLock_Description";
private const string PRISON_BREAK= "Locks_PrisonBreak";
private const string SLAVE_REBELION ="Locks_SlaveRebel";
private const string ALWAYS_PENS_DOOR = "Locks_AlwaysPensDoor";
private const string ALWAYS_PENS_DOOR_DESC = "Locks_AlwaysPensDoor_Description";

public LocksMod(ModContentPack content) : base(content)
{
Expand All @@ -38,6 +40,9 @@ public override void DoSettingsWindowContents(Rect inRect)
listingStandard.CheckboxLabeled(SLAVE_REBELION.Translate(), ref LocksSettings.revoltRespectsLocks);
listingStandard.Gap(12f);

listingStandard.CheckboxLabeled(ALWAYS_PENS_DOOR.Translate(), ref LocksSettings.alwaysPensDoor, ALWAYS_PENS_DOOR_DESC.Translate());
listingStandard.Gap(12f);

listingStandard.End();
}

Expand Down
3 changes: 3 additions & 0 deletions Source/Options/LocksSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ public class LocksSettings : ModSettings
public static int childLockAge = 6;
public static bool prisonerBreakRespectsLock = true;
public static bool revoltRespectsLocks = true;
public static bool alwaysPensDoor = false;

public override void ExposeData()
{
Scribe_Values.Look<int>(ref childLockAge, "Locks_childLockAge", 6, true);

Scribe_Values.Look<bool>(ref prisonerBreakRespectsLock, "Locks_BreakRespectsLocks", true, true);
Scribe_Values.Look<bool>(ref revoltRespectsLocks, "Locks_RevoltRespectLocks", true, true);

Scribe_Values.Look<bool>(ref alwaysPensDoor, "Locks_AlwaysPensDoor", false, true);
}
}
}
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Changelog:
2.7.7
- Fixes for patch [LTS]Furnitures.
- Compatibility patches for Architect Expanded - Fences (Continued).
- Added option to auto turn on pens door after construction.
2.7.6
- Fence gate force turn on pens doors option after load fixed
- Compatibility patches for [LTS]Furnitures. Hope it works fine.
Expand Down

0 comments on commit 0b9a29b

Please sign in to comment.