Skip to content

Commit

Permalink
2.9.0 (#52)
Browse files Browse the repository at this point in the history
* mid work commit

* update to 1.5 rimworld

* fixes

* update changelog

* fixes

* another fixes
  • Loading branch information
Hazzer authored Apr 21, 2024
1 parent 5ccfd84 commit 24dece4
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 163 deletions.
Binary file modified 1.4/Assemblies/0MultiplayerAPI.dll
Binary file not shown.
Binary file modified 1.4/Assemblies/Locks.dll
Binary file not shown.
53 changes: 27 additions & 26 deletions About/About.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>Locks</name>
<author>Avius, Hazzer</author>
<supportedVersions>
<li>1.0</li>
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
<li>1.4</li>
</supportedVersions>
<packageId>avius.locks</packageId>
<loadAfter>
<li>brrainz.harmony</li>
<li>haplo.miscellaneous.robots</li>
<li>kentington.saveourship2</li>
<li>linkolas.linkabledoors</li>
<li>jecrell.doorsexpanded</li>
</loadAfter>
<modDependencies>
<li>
<packageId>brrainz.harmony</packageId>
<displayName>Harmony</displayName>
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
</li>
</modDependencies>
<description>Version 2.8.3\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>
<name>Locks</name>
<author>Avius, Hazzer</author>
<supportedVersions>
<li>1.0</li>
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
<li>1.4</li>
<li>1.5</li>
</supportedVersions>
<packageId>avius.locks</packageId>
<loadAfter>
<li>brrainz.harmony</li>
<li>haplo.miscellaneous.robots</li>
<li>kentington.saveourship2</li>
<li>linkolas.linkabledoors</li>
<li>jecrell.doorsexpanded</li>
</loadAfter>
<modDependencies>
<li>
<packageId>brrainz.harmony</packageId>
<displayName>Harmony</displayName>
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
</li>
</modDependencies>
<description>Version 2.9.0\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>
114 changes: 58 additions & 56 deletions Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
@@ -1,59 +1,61 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<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>

<Locks_PrisonBreak>Escaping prisoners respecting locks</Locks_PrisonBreak>
<Locks_SlaveRebel>Rebeling slaves respecting locks</Locks_SlaveRebel>

<Locks_StatePrefix>Door</Locks_StatePrefix>
<Locks_StateLocked>locked</Locks_StateLocked>
<Locks_StateUnlocked>unlocked</Locks_StateUnlocked>
<Locks_StateChanging>changing...</Locks_StateChanging>

<Locks_ITabLocked>Locked</Locks_ITabLocked>
<Locks_ITabLockedDesc>When unlocked door settings do not apply, therefore all humanoids capable of opening doors can pass.</Locks_ITabLockedDesc>
<Locks_ITabVisitorsAllowed>Visitors allowed</Locks_ITabVisitorsAllowed>
<Locks_ITabVisitorsAllowedDesc>When disabled, allies and traders will not be allowed to pass through this door. This setting do not apply when owners are set.</Locks_ITabVisitorsAllowedDesc>
<Locks_ITabPetDoor>Pet door</Locks_ITabPetDoor>
<Locks_ITabPetDoorDesc>When enabled small animals, like dogs can pass through door. This setting is not required for doors without owners.</Locks_ITabPetDoorDesc>
<Locks_ITabPensDoor>Pens door</Locks_ITabPensDoor>
<Locks_ITabPensDoorDesc>When enabled, pens animals can't pass through the door. Some doors may not block animals (e.g. Animal Flap). Check "roamerCanOpen" in defs.</Locks_ITabPensDoorDesc>
<Locks_ITabSlaveDoors>Slaves allowed</Locks_ITabSlaveDoors>
<Locks_ITabSlaveDoorsDesc>When disabled slaves are not allowed to pass through this door. This setting do not apply when owners are set.</Locks_ITabSlaveDoorsDesc>
<Locks_ITabAnimalAllowed>Animals allowed</Locks_ITabAnimalAllowed>
<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>

<Locks_LockToggle>Lock</Locks_LockToggle>
<Locks_UnlockToggle>Unlock</Locks_UnlockToggle>
<Locks_AllowVisitors>Allow visitors to use</Locks_AllowVisitors>
<Locks_ForbidVisitors>Forbid visitors from using</Locks_ForbidVisitors>
<Locks_AddPetDoor>Add pet door</Locks_AddPetDoor>
<Locks_RemovePetDoor>Remove pet door</Locks_RemovePetDoor>
<Locks_AddPensDoor>Set as pens door</Locks_AddPensDoor>
<Locks_RemovePensDoor>Remove pens door</Locks_RemovePensDoor>
<Locks_SetOwners>Set owners</Locks_SetOwners>
<Locks_ClearOwners>Clear owners</Locks_ClearOwners>

<Locks_FailOnWrongUser>Lock does not belong to {0}</Locks_FailOnWrongUser>

<Locks_AlertLocksCantBeChanged>Locks can't be changed</Locks_AlertLocksCantBeChanged>
<Locks_AlertLocksCantBeChangedDesc>Some locks can't be changed, because owners of those locks do not perform flick jobs:\n\n{0}</Locks_AlertLocksCantBeChangedDesc>
<Locks_AlertLocksCantBeChangedDefaultDesc>Some locks can't be changed, because owners of those locks do not perform flick jobs.</Locks_AlertLocksCantBeChangedDefaultDesc>

<Locks_Cancel>Cancel</Locks_Cancel>
<Locks_Copy>Copy</Locks_Copy>
<Locks_Paste>Paste</Locks_Paste>
<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_AnomaliesIgnoreLocks>Anomalies ignore locks</Locks_AnomaliesIgnoreLocks>
<Locks_AnomaliesIgnoreLocks_Description>When disables anomalies will respects door locks settings.</Locks_AnomaliesIgnoreLocks_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>

<Locks_PrisonBreak>Escaping prisoners respecting locks</Locks_PrisonBreak>
<Locks_SlaveRebel>Rebeling slaves respecting locks</Locks_SlaveRebel>

<Locks_StatePrefix>Door</Locks_StatePrefix>
<Locks_StateLocked>locked</Locks_StateLocked>
<Locks_StateUnlocked>unlocked</Locks_StateUnlocked>
<Locks_StateChanging>changing...</Locks_StateChanging>

<Locks_ITabLocked>Locked</Locks_ITabLocked>
<Locks_ITabLockedDesc>When unlocked door settings do not apply, therefore all humanoids capable of opening doors can pass.</Locks_ITabLockedDesc>
<Locks_ITabVisitorsAllowed>Visitors allowed</Locks_ITabVisitorsAllowed>
<Locks_ITabVisitorsAllowedDesc>When disabled, allies and traders will not be allowed to pass through this door. This setting do not apply when owners are set.</Locks_ITabVisitorsAllowedDesc>
<Locks_ITabPetDoor>Pet door</Locks_ITabPetDoor>
<Locks_ITabPetDoorDesc>When enabled small animals, like dogs can pass through door. This setting is not required for doors without owners.</Locks_ITabPetDoorDesc>
<Locks_ITabPensDoor>Pens door</Locks_ITabPensDoor>
<Locks_ITabPensDoorDesc>When enabled, pens animals can't pass through the door. Some doors may not block animals (e.g. Animal Flap). Check "roamerCanOpen" in defs.</Locks_ITabPensDoorDesc>
<Locks_ITabSlaveDoors>Slaves allowed</Locks_ITabSlaveDoors>
<Locks_ITabSlaveDoorsDesc>When disabled slaves are not allowed to pass through this door. This setting do not apply when owners are set.</Locks_ITabSlaveDoorsDesc>
<Locks_ITabAnimalAllowed>Animals allowed</Locks_ITabAnimalAllowed>
<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>

<Locks_LockToggle>Lock</Locks_LockToggle>
<Locks_UnlockToggle>Unlock</Locks_UnlockToggle>
<Locks_AllowVisitors>Allow visitors to use</Locks_AllowVisitors>
<Locks_ForbidVisitors>Forbid visitors from using</Locks_ForbidVisitors>
<Locks_AddPetDoor>Add pet door</Locks_AddPetDoor>
<Locks_RemovePetDoor>Remove pet door</Locks_RemovePetDoor>
<Locks_AddPensDoor>Set as pens door</Locks_AddPensDoor>
<Locks_RemovePensDoor>Remove pens door</Locks_RemovePensDoor>
<Locks_SetOwners>Set owners</Locks_SetOwners>
<Locks_ClearOwners>Clear owners</Locks_ClearOwners>

<Locks_FailOnWrongUser>Lock does not belong to {0}</Locks_FailOnWrongUser>

<Locks_AlertLocksCantBeChanged>Locks can't be changed</Locks_AlertLocksCantBeChanged>
<Locks_AlertLocksCantBeChangedDesc>Some locks can't be changed, because owners of those locks do not perform flick jobs:\n\n{0}</Locks_AlertLocksCantBeChangedDesc>
<Locks_AlertLocksCantBeChangedDefaultDesc>Some locks can't be changed, because owners of those locks do not perform flick jobs.</Locks_AlertLocksCantBeChangedDefaultDesc>

<Locks_Cancel>Cancel</Locks_Cancel>
<Locks_Copy>Copy</Locks_Copy>
<Locks_Paste>Paste</Locks_Paste>
</LanguageData>
4 changes: 4 additions & 0 deletions LoadFolders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
<li>/</li>
<li>1.4</li>
</v1.4>
<v1.5>
<li>/</li>
<li>1.4</li>
</v1.5>
</loadFolders>
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.8.3-blue.svg?style=flat" alt="v2.8.3" />
<img src="https://img.shields.io/badge/version-2.9.0-blue.svg?style=flat" alt="v2.9.0" />
</a>
</p>

Expand Down
9 changes: 9 additions & 0 deletions Source/HarmonyPatches/RespectLockPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,13 @@ static bool Postfix(bool __result)
return !LocksSettings.revoltRespectsLocks;
}
}

[HarmonyPatch(typeof(LordJob_TradeWithColony), "CanOpenAnyDoor")]
public class AnimalCaravanaRespectPatch
{
static bool Postfix(bool __result)
{
return false;
}
}
}
20 changes: 18 additions & 2 deletions Source/LockUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ public static bool PawnCanOpen(ThingWithComps door, Pawn p)
bool canOpenAnyDoor = lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p);
bool noFaction = door.Faction == null;
bool specialGuest = p.guest != null && p.guest.Released;
if (canOpenAnyDoor || noFaction || specialGuest)
if (canOpenAnyDoor || specialGuest)
return true;

if (noFaction)
{
return p.RaceProps.canOpenFactionlessDoors;
}

LockState respectedState;
if (!p.IsPrisoner && !door.Faction.HostileTo(p.Faction) && !p.InMentalState)
respectedState = GetData(door).WantedState;
Expand All @@ -70,7 +75,7 @@ public static bool PawnCanOpen(ThingWithComps door, Pawn p)

if (respectedState.pensDoor && p.RaceProps.FenceBlocked && !door.def.building.roamerCanOpen && (!p.roping.IsRopedByPawn || !PawnCanOpen(door, p.roping.RopedByPawn)))
{
return false;
return p.RaceProps.intelligence == Intelligence.Animal && p.GetLord()?.LordJob is LordJob_TradeWithColony;
}
if (respectedState.mode == LockMode.Allies && WildManUtility.WildManShouldReachOutsideNow(p))
{
Expand Down Expand Up @@ -118,6 +123,17 @@ public static bool PawnCanOpen(ThingWithComps door, Pawn p)
{
return true;
}
if (ModsConfig.AnomalyActive && LocksSettings.anomaliesIgnoreLocks)
{
if (p.kindDef == PawnKindDefOf.Revenant)
{
return true;
}
if (p.IsMutant && p.mutant.Def.canOpenAnyDoor)
{
return true;
}
}

return false;
}
Expand Down
37 changes: 18 additions & 19 deletions Source/Locks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.0.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Lib.Harmony.2.0.0.8\lib\net472\0Harmony.dll</HintPath>
<Reference Include="0Harmony, Version=2.3.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Lib.Harmony.2.3.3\lib\net472\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="0MultiplayerAPI, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\RimWorld.MultiplayerAPI.0.3.0\lib\net472\0MultiplayerAPI.dll</HintPath>
<Private>True</Private>
<Reference Include="0MultiplayerAPI, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\RimWorld.MultiplayerAPI.0.5.0\lib\net472\0MultiplayerAPI.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\Gry\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
Expand Down Expand Up @@ -95,46 +94,46 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\1.3\Defs\Designations.xml">
<Content Include="..\1.4\Defs\Designations.xml">
<Link>Defs\Designations.xml</Link>
</Content>
<Content Include="..\1.3\Defs\JobDefs.xml">
<Content Include="..\1.4\Defs\JobDefs.xml">
<Link>Defs\JobDefs.xml</Link>
</Content>
<Content Include="..\1.3\Defs\WorkGivers.xml">
<Content Include="..\1.4\Defs\WorkGivers.xml">
<Link>Defs\WorkGivers.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLock.xml">
<Content Include="..\1.4\Patches\AddCompLock.xml">
<Link>Patches\AddCompLock.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLockArchitectExpandedFences.xml">
<Content Include="..\1.4\Patches\AddCompLockArchitectExpandedFences.xml">
<Link>Patches\AddCompLockArchitectExpandedFences.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLockDoorsExpanded.xml">
<Content Include="..\1.4\Patches\AddCompLockDoorsExpanded.xml">
<Link>Patches\AddCompLockDoorsExpanded.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLockLinkableDoors.xml">
<Content Include="..\1.4\Patches\AddCompLockLinkableDoors.xml">
<Link>Patches\AddCompLockLinkableDoors.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddCompLockSoS2.xml">
<Content Include="..\1.4\Patches\AddCompLockSoS2.xml">
<Link>Patches\AddCompLockSoS2.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTab.xml">
<Content Include="..\1.4\Patches\AddInspectTab.xml">
<Link>Patches\AddInspectTab.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLockArchitectExpandedFences.xml">
<Content Include="..\1.4\Patches\AddInspectTabLockArchitectExpandedFences.xml">
<Link>Patches\AddInspectTabLockArchitectExpandedFences.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLockDoorsExpanded.xml">
<Content Include="..\1.4\Patches\AddInspectTabLockDoorsExpanded.xml">
<Link>Patches\AddInspectTabLockDoorsExpanded.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLockLinkableDoors.xml">
<Content Include="..\1.4\Patches\AddInspectTabLockLinkableDoors.xml">
<Link>Patches\AddInspectTabLockLinkableDoors.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabLts.xml">
<Content Include="..\1.4\Patches\AddInspectTabLts.xml">
<Link>Patches\AddInspectTabLts.xml</Link>
</Content>
<Content Include="..\1.3\Patches\AddInspectTabSoS2.xml">
<Content Include="..\1.4\Patches\AddInspectTabSoS2.xml">
<Link>Patches\AddInspectTabSoS2.xml</Link>
</Content>
<Content Include="..\About\About.xml">
Expand Down
Loading

0 comments on commit 24dece4

Please sign in to comment.