diff --git a/1.3/Assemblies/Locks.dll b/1.3/Assemblies/Locks.dll
index 6b702e3..c055e50 100644
Binary files a/1.3/Assemblies/Locks.dll and b/1.3/Assemblies/Locks.dll differ
diff --git a/About/About.xml b/About/About.xml
index b07752c..ecbbdc4 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -20,5 +20,5 @@
https://github.com/pardeike/HarmonyRimWorld/releases/latest
- Version 2.6.1\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.
+ Version 2.6.2\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.
diff --git a/README.md b/README.md
index 84e4866..7f7c00a 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
-
+
diff --git a/Source/LockData.cs b/Source/LockData.cs
index a39e138..cccd3f8 100644
--- a/Source/LockData.cs
+++ b/Source/LockData.cs
@@ -17,8 +17,8 @@ public class LockData : IExposable
public LockData()
{
- CurrentState = new LockState(LockMode.Allies, true, false, false, new List());
- WantedState = new LockState(LockMode.Allies, true, false, false, new List());
+ CurrentState = new LockState(LockMode.Allies, true, false, true, new List());
+ WantedState = new LockState(LockMode.Allies, true, false, true, new List());
}
// Utilities
diff --git a/Source/LockState.cs b/Source/LockState.cs
index baaee2c..0ccb830 100644
--- a/Source/LockState.cs
+++ b/Source/LockState.cs
@@ -61,19 +61,35 @@ public void CopyFrom(LockState copy)
public static bool operator !=(LockState a, LockState b)
{
if (a.mode != b.mode)
+ {
return true;
+ }
if (a.locked != b.locked)
+ {
return true;
+ }
if (a.petDoor != b.petDoor)
+ {
return true;
+ }
if (a.pensDoor != b.pensDoor)
+ {
return true;
+ }
foreach (var p in a.owners)
+ {
if (!b.owners.Contains(p))
+ {
return true;
+ }
+ }
foreach (var p in b.owners)
+ {
if (!a.owners.Contains(p))
+ {
return true;
+ }
+ }
return false;
}
diff --git a/Source/LockUtility.cs b/Source/LockUtility.cs
index 670ab57..8985bbe 100644
--- a/Source/LockUtility.cs
+++ b/Source/LockUtility.cs
@@ -60,34 +60,42 @@ public static bool PawnCanOpen(Building_Door door, Pawn p)
else
respectedState = GetData(door).CurrentState;
+
if (GetData(door).CurrentState.locked == false && p.RaceProps != null && p.RaceProps.intelligence >= Intelligence.Humanlike)
+ {
return true;
+ }
- if (p.Faction == null || p.Faction.HostileTo(door.Faction))
- return false;
- Log.Message($"State check: {respectedState.pensDoor}, { p.RaceProps.FenceBlocked} {!door.def.building.roamerCanOpen} {!p.roping.IsRopedByPawn}");
- if( p.roping.RopedByPawn != null)
+ if (respectedState.pensDoor && p.RaceProps.FenceBlocked && !door.def.building.roamerCanOpen && (!p.roping.IsRopedByPawn || !PawnCanOpen(door, p.roping.RopedByPawn)))
{
- Log.Message($"{!PawnCanOpen(door, p.roping.RopedByPawn)}");
+ return false;
}
- if (respectedState.pensDoor && p.RaceProps.FenceBlocked && !door.def.building.roamerCanOpen && (!p.roping.IsRopedByPawn || !PawnCanOpen(door, p.roping.RopedByPawn)))
+ if (p.Faction == null || p.Faction.HostileTo(door.Faction))
{
return false;
}
-
if (respectedState.Private && respectedState.petDoor && p.RaceProps != null && p.RaceProps.Animal && p.RaceProps.baseBodySize <= MaxPetSize && p.Faction == door.Faction)
+ {
return true;
+ }
if (respectedState.Private && !respectedState.owners.Contains(p))
- return false;
+ { return false; }
if (p.Faction == door.Faction && !p.IsPrisoner)
+ {
return true;
-
+ }
bool guestCondition = !p.IsPrisoner || p.HostFaction != door.Faction;
if (respectedState.mode == LockMode.Allies && guestCondition)
+ {
return true;
+ }
+ if (door.Map != null && door.Map.Parent.doorsAlwaysOpenForPlayerPawns && p.Faction == Faction.OfPlayer && !p.IsPrisonerOfColony)
+ {
+ return true;
+ }
return false;
}
@@ -135,7 +143,7 @@ public static bool IsVisible(this LockState state, string propertyName)
case nameof(LockState.petDoor):
return state.locked;
case nameof(LockState.pensDoor):
- return state.locked;
+ return true;
case nameof(LockState.owners):
return state.locked;
default:
diff --git a/changelog.txt b/changelog.txt
index c52d54a..2a9596c 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,8 @@
Changelog:
+2.6.2
+- Pens door are turned on by default
+- Doors can be unlocked and still works as pens door
+- Varius fixes
2.6.1
- Add option to set door as pens door. Animals should not leave pens now.
2.6.0