-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Aviuz/2.7.3
2.7.3 release candidate
- Loading branch information
Showing
13 changed files
with
250 additions
and
69 deletions.
There are no files selected for viewing
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,26 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Patch> | ||
<Operation Class="PatchOperationFindMod"> | ||
<mods> | ||
<li>Save Our Ship 2</li> | ||
</mods> | ||
<match Class="PatchOperationConditional"> | ||
<xpath>/Defs/ThingDef[thingClass = "Building_ShipAirlock"]/comps</xpath> | ||
<nomatch Class="PatchOperationAdd"> | ||
<xpath>/Defs/ThingDef[thingClass = "Building_ShipAirlock"]</xpath> | ||
<value> | ||
<comps> | ||
<li Class="Locks.CompProperties_Lock"/> | ||
</comps> | ||
</value> | ||
</nomatch> | ||
<match Class="PatchOperationAdd"> | ||
<xpath>/Defs/ThingDef[thingClass = "Building_ShipAirlock"]/comps</xpath> | ||
<value> | ||
<li Class="Locks.CompProperties_Lock"/> | ||
</value> | ||
</match> | ||
</match> | ||
</Operation> | ||
|
||
</Patch> |
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,26 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Patch> | ||
<Operation Class="PatchOperationFindMod"> | ||
<mods> | ||
<li>Save Our Ship 2</li> | ||
</mods> | ||
<match Class="PatchOperationConditional"> | ||
<xpath>/Defs/ThingDef[thingClass = "Building_ShipAirlock"]/inspectorTabs</xpath> | ||
<nomatch Class="PatchOperationAdd"> | ||
<xpath>/Defs/ThingDef[thingClass = "Building_ShipAirlock"]</xpath> | ||
<value> | ||
<inspectorTabs> | ||
<li>Locks.ITab_Lock</li> | ||
</inspectorTabs> | ||
</value> | ||
</nomatch> | ||
<match Class="PatchOperationAdd"> | ||
<xpath>/Defs/ThingDef[thingClass = "Building_ShipAirlock"]/inspectorTabs</xpath> | ||
<value> | ||
<li>Locks.ITab_Lock</li> | ||
</value> | ||
</match> | ||
</match> | ||
</Operation> | ||
|
||
</Patch> |
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
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 |
---|---|---|
@@ -1,42 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<LanguageData> | ||
<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_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_StatePrefix>Door</Locks_StatePrefix> | ||
<Locks_StateLocked>locked</Locks_StateLocked> | ||
<Locks_StateUnlocked>unlocked</Locks_StateUnlocked> | ||
<Locks_StateChanging>changing...</Locks_StateChanging> | ||
<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_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_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_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_ITabOwners>Owners</Locks_ITabOwners> | ||
<Locks_ITabChangeLocksNotification>Change lock in order to apply settings!</Locks_ITabChangeLocksNotification> | ||
|
||
<Locks_Cancel>Cancel</Locks_Cancel> | ||
<Locks_Copy>Copy</Locks_Copy> | ||
<Locks_Paste>Paste</Locks_Paste> | ||
<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> |
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
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,71 @@ | ||
using HarmonyLib; | ||
using Locks.HarmonyPatches; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Reflection.Emit; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
|
||
namespace Locks.CompatibilityPatches | ||
{ | ||
class SoS2 | ||
{ | ||
public static void Init() | ||
{ | ||
var mod = LoadedModManager.RunningMods.FirstOrDefault(m => m.Name == "Save Our Ship 2"); | ||
if (mod != null) | ||
{ | ||
var doorDef = AccessTools.Method("Building_ShipAirlock:PawnCanOpen"); | ||
if (doorDef != null) | ||
{ | ||
var harmony = new Harmony("Harmony_Locks_SoS2"); | ||
harmony.Patch(doorDef, transpiler: new HarmonyMethod(typeof(SoS2).GetMethod("AirLockTranspiler"))); | ||
Log.Message("Locks: SoS2 patched"); | ||
} | ||
else | ||
{ | ||
Log.Error("Locks: mod SoS2 found but cant find airlock to patch"); | ||
} | ||
} | ||
else | ||
{ | ||
Log.Message("Locks: SoS2 not found "); | ||
} | ||
} | ||
|
||
public static IEnumerable<CodeInstruction> AirLockTranspiler(ILGenerator gen, MethodBase mBase, IEnumerable<CodeInstruction> instr) | ||
{ | ||
OpCode[] codeToFind = | ||
{ | ||
OpCodes.Ldarg_1, | ||
OpCodes.Call, | ||
OpCodes.Stloc_0 | ||
|
||
}; | ||
|
||
string[] labelToFind = | ||
{ | ||
"", | ||
"Verse.AI.Group.Lord GetLord(Verse.Pawn)", | ||
"" | ||
}; | ||
int step = 0; | ||
foreach (CodeInstruction codeInst in instr) | ||
{ | ||
yield return codeInst; | ||
if (HPatcher.IsFragment(codeToFind, labelToFind, codeInst, ref step)) | ||
{ | ||
yield return new CodeInstruction(OpCodes.Ldarg_0); | ||
yield return new CodeInstruction(OpCodes.Ldarg_1); | ||
yield return new CodeInstruction(OpCodes.Call, typeof(LockUtility).GetMethod("PawnCanOpen")); | ||
yield return new CodeInstruction(OpCodes.Ret); | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
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
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
Oops, something went wrong.