Survivalist: Invisible Strain

Survivalist: Invisible Strain

Not enough ratings
SIS Locked Buildings
   
Award
Favorite
Favorited
Unfavorite
Tags: IsMod
File Size
Posted
Updated
8.199 MB
2 Jun, 2024 @ 5:59am
16 Nov, 2024 @ 3:44pm
10 Change Notes ( view )

Subscribe to download
SIS Locked Buildings

Description
Patch notes
  • Fixed bug not allowing to craft from inventory.
  • Rewrote GetAvailableActions patch. Possible fix to crash.
  • Character now walks to closest building entrance to unlock.
  • Fixed crash on locking buildings.
  • Fixed crash.

What is this?
This mod makes it possible to have buildings and vehicles in towns and/or communities locked on map generation. To open them you will need either a lockpick or that building's key. You can also break into buildings by force using tools (this will attract enemies), and lock them using padlocks/ropes found in the world.

You can find lockpicks, but you can also craft makeshift lockpicks. These can fail when trying to unlock a building so make sure to have a couple in your inventory. If you find a building's key, you will be able to directly unlock the building by pressing the "Enter" action. There's also a key spawning system which checks to spawn keys around buildings that are locked, adding the key either on zombies/characters, in buildings or vehicles.

Can be added to current saves, but will need to Hit the road to generate a new map with the locked buildings.

Features
  • Buildings and/or vehicles can now spawn locked! You will need either a lockpick or that building's key to open it.
  • Break into buildings using tools. This makes noise and will attract zombies/bandits, and consumes the tool used. Can be configured to only allow the tools you want.
  • You can lock buildings using padlocks and ropes found around the world.
  • Find lockpicks and keys around the world. Craft makeshift lockpicks that can fail to unlock a building and break.
  • Dynamic building key spawning in the world for the locked buildings/vehicles. Keys will be spawned around the buildings that are locked, and you can choose where they can spawn (humans/zombies, props, vehicles, buildings)
  • Exclude buildings from being lockable, or exclude buildings from having their keys spawned. You can also set a building's specific chances to be locked, for example a HumVee or an ambulance will have a higher chance to be locked.
  • Everything can be configured to your liking!

Settings
The settings file can be found inside the mods folder under "Settings_SISLockedBuildings.xml".
  • EnableForTownBuildings. Whether to enable the mod for town buildings. (default true)
  • EnableForVehicles. Whether to enable the mod for vehicles. (default true)
  • EnableForCommunityBuildings. Whether to enable the mod for community buildings. (default true)
  • CanPlayerLockBuildings. Whether the player can lock buildings using padlocks or ropes. (default true)
  • AlwaysShowLockRecipes. Whether to show the lock recipes all the time. (default false)
  • AlwaysShowUnlockRecipes. Whether to show the unlock recipes all the time. (default true)
  • ChanceLockedBuildings. Chance for buildings to spawn locked. Between 0-1. (default 0.4)
  • ChanceLockedVehicles. Chance for vehicles to spawn locked. Between 0-1. (default 0.3)
  • LockpickingTime. Time taken to lockpick a building in seconds. (default 3)
  • ChanceMakeshiftLockpickBreaks. Chance for a makeshift lockpick to fail and not unlock a building. (default 0.7)
  • EnableKeySpawningForBuildings. Whether keys will spawn around locked buildings. (default true)
  • EnableKeySpawningForVehicles. Whether keys will spawn around locked vehicles. (default false)
  • ChanceSpawnKeyAroundBuilding. Chance for a key to spawn around a locked building. Between 0-1. (default 0.3)
  • ChanceSpawnKeyAroundVehicle. Chance for a key to spawn aroud a locked vehicle. Between 0-1. (default 0)
  • EnableDynamicKeySpawning. Whether to enable dynamic key spawning around locked buildings. Keys will spawn in zombies, characters (of other communities), buildings, vehicles or props. (default true)
  • DynamicKeySpawnIntervalInSecs. Interval to check for key spawning in seconds. (default 30)
  • CanKeySpawnInBodies. Whether keys can spawn in bodies (dead/alive characters, zombies..) (default true)
  • CanKeySpawnInVehicles. Whether keys can spawn inside vehicles. (default true)
  • CanKeySpawnInProps. Whether keys can spawn inside props (trash cans, mailboxes etc). (default true)
  • CanKeySpawnInBuildings. Whether keys can spawn inside buildings. (default true)
  • EnableBreakIntoBuildings. Whether to enable breaking into buildings. This consumes a tool and can attract enemies. (default true)
  • BreakIntoBuildingsTime. Time taken to break into a building in seconds. (default 10)
  • BreakIntoBuildingMakesNoise. Whether breaking into a building makes noise attracting enemies. (default true)
  • BreakIntoBuildingMakesSound. Whether breaking into a building makes custom sounds for immersion purposes. (default true)
  • BreakIntoNoise. The amount of noise breaking into a building makes. (default 40.0)
  • ExcludedLockBuildings. List of buildings that cant be locked.
  • ExcludedBuildingsSpawnKeys. List of buildings for which keys cant spawn for.
  • ExcludedBuildingsBreakInto. List of buildings that cant be broken into.
  • LockedBuildingChances. List in which you can specify the building and their chance to be locked on spawn.
  • ToolsCantBreakIntoBuilding. List of tools that can't be used to break into a building.

Notes
This mod makes some important changes, so there might be some bugs or things that have been overlooked. Please make sure to report any issues in the comments section!

Not sure how it behaves in co-op

Compatibility
I've done my best to patch functions in a compatible way, but It always depends on what the mods edit. There could be some incompatibilities with mods changing the available actions with respect to entering buildings.

Credits
Erikem, Luo2430, and Bob!
32 Comments
reicou 8 May @ 7:52am 
That sounds good.
SweetCaptn  [author] 8 May @ 3:26am 
Yeah, I know.. I'm looking into rewritting the mod and re-releasing it separately, making some things simpler and less confusing, and just purging it from any bugs/crashes but not sure when that will be done
reicou 7 May @ 10:06pm 
This mod causes constant crashes when generating new maps. An error appears saying something like “object reference not found”. I know it's this mod because I tried one by one and only by removing this mod my game stopped crashing.

Too bad, it's a very immersive mod and I love it.
Bob  [developer] 8 Feb @ 7:40am 
Should now be fixed
Bob  [developer] 31 Jan @ 6:36am 
Sorry looks like I broke this in a recent patch - I'll fix it in the next one (v229).
SweetCaptn  [author] 16 Nov, 2024 @ 3:45pm 
Uploaded a patch fixing another crash.
SweetCaptn  [author] 23 Jul, 2024 @ 2:57am 
Rewrote GetAvailableActions patch, could be a fix to that crash but not sure. Also, character now walks to closest entrance of the building to lock/unlock.
SweetCaptn  [author] 23 Jul, 2024 @ 2:08am 
Thanks Bob! I'm rewriting the Locked Buildings GetAvailableActions patch, I think this must be the cause. Do you know how the exception occurred?
Bob  [developer] 22 Jul, 2024 @ 7:01am 
(continued from below) They are using these mods:

Water Collectors
Locked Building
Improvised Weapons
Crossbows
Clean Trash
Targetable Trash
Pick Mushrooms
Choose Backpack
XtraLargePAck

So the crash must be coming from Locked Buildings, Clean Trash or Choose Backpack. Having stared at the code for a while I'm not sure which though! Thought it might be because of my recent updates but in a quick test none of these 3 patches seem obviously broken, so it could be some more subtle issue that's been around for a while. Maybe you'll have more of an idea?
Bob  [developer] 22 Jul, 2024 @ 7:01am 
Hello, I've had someone reporting a crash with the following callstack:

Error in HandleInputOnThread (v209): Object reference not set to an instance of an object at GameCursor_GetAvailableActions__Patch.Postfix (GameCursor __instance, BaseObject& outTarget, System.Boolean& wantTargetHeader) [0x001a8] in <59749d9bbc8c4dcb84b105cfec99f211>:0
at (wrapper dynamic-method) GameCursor.GameCursor.GetAvailableActions_Patch3(GameCursor,BaseObject&,bool&)
at GameCursor.HandleInput (InputFrame inputFrame) [0x0047e] in C:\Survivalist2\Assets\Scripts\Hud\Cursor.cs:2229
at Hud.HandleInput (InputFrame inputFrame) [0x00d3e] in C:\Survivalist2\Assets\Scripts\Hud\Hud.cs:649
at Session.HandleInput (InputFrame inputFrame) [0x0018d] in C:\Survivalist2\Assets\Scripts\Game\Session.cs:856
at GameImpl.HandleInputOnThread (BaseTaskData data) [0x0008c] in C:\Survivalist2\Assets\Scripts\Game\GameImpl.cs:1583