MSchmoecker-PressurePlate icon

PressurePlate

A pressure plate for opening and closing doors

Last updated 2 weeks ago
Total downloads 3631
Total rating 3 
Categories Mods Misc
Dependency string MSchmoecker-PressurePlate-0.2.1
Dependants 9 other mods depend on this mod

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.1001 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.1001
ValheimModding-Jotunn-2.0.12 icon
ValheimModding-Jotunn

Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.

Preferred version: 2.0.12

README

Pressure-Plate

About

Adds a pressure plate, which opens and closes doors within a range if a player stands on it.
- Wooden pressure plate: 3 wood, 1 surtling core with the hammer. Requires a workbench in range
- Stone pressure plate: 3 stone, 1 surtling core with the hammer. Requires a stonecutter in range

Triggering range is configurable.

Installation

Extract the content of Pressure-Plate into the BepInEx/plugins folder.

Development

Setup

Inside the repo are two folders, PressurePlate for the mod and UnityAssets for the unity files.

Place all Unity, Valheim and dependencies assemblies in the PressurePlate/libs folder (create the folder if it doesn't exist) and add them as references to the visual studio project.

Place the same assemblies in UnityAssets/Assets/Assemblies (create the folder if it doesn't exist) if you want to edit the AssetBundle.
Build the AssetBundle with the Unity toolbar "Assets/Build AssetBundles" to automatically copy the resulting file to the mod folder.

Adding custom door config

Custom door settings can be applied for every door type. This can only be done with code and is an optional for other mods. Vanilla items are configurable, too.

Here is a quick instruction:

  1. Add this mod .dll to your assembly references. The next step ensures that everything works if a user doesn't have pressure plate installed.

  2. Check if the mod is loaded:
    const string pressurePlateGUID = "com.maxsch.valheim.pressure_plate"; if (Chainloader.PluginInfos.ContainsKey(pressurePlateGUID)) { // next steps... }

    This should be done at your plugins Start(). If you use Awake() and your mod is loaded first it may not detect it properly. Any following steps can be done whenever you like, even after the loading phase.

  3. Create the config: DoorConfig config = new DoorConfig();

    It takes two optional parameters:
    - bool openClosedInverted, default: false
    - float openTime, default: 1

    This may requires using PressurePlate;

  4. Add the config to the gameobject:
    const prefabName = "your_door_piece_name" DoorConfig.AddDoorConfig(prefabName, config);
    or directly with your prefab
    GameObject door = myDoorPrefab; DoorConfig.AddDoorConfig(door.GetComponent<Door>(), config);

Changelog

0.2.1
- Fixed null error when placing a new door, as no ZNetView exists yet
- Fixed not opening a door if the player presses the plate while the door is closing

0.2.0
- Reworked internally how a pressure plate opens doors
- Modders can now set custom configurations for doors. This includes if the open/close is reversed and opening time
- A pressure plate no longer interrupts a open or close animation

0.1.0
- Replaced ValheimLib with Jotunn, everything is backwards compatible

0.0.6
- Added configuration: PressurePlateRadiusHorizontal
- Added configuration: PressurePlateRadiusVertical
- Added configuration: PressurePlatePlayerRadiusHorizontal
- Added configuration: PressurePlatePlayerRadiusVertical
- Added configuration: PressurePlateOpenDelay

0.0.5
- Added stone pressure plate
- Updated wood pressure plate icon
- Changed Language tokens: $pressure_plate -> $pressure_plate_wood, added $pressure_plate_stone

0.0.4
- Updated ValheimLib to 0.0.15
- Reverted last fix as it was fixed in ValheimLib
- Removed unnecessary 'valheim.exe' restriction
- Removed HookGenPatcher dependency

0.0.3
- Fixed "Destroyed invalid prefab ZDO..."-bug when moving through portals

0.0.2
- Added sound effects for pressing and releasing pressure plate

0.0.1
- Release

Nexusmods: https://www.nexusmods.com/valheim/mods/498

Thunderstore: https://valheim.thunderstore.io/package/MSchmoecker/PressurePlate/

Github: https://github.com/MSchmoecker/Valheim-Pressure-Plate

Credits

Available versions

Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2021-6-6 0.2.1 616 Version 0.2.1 Install
2021-6-2 0.2.0 198 Version 0.2.0 Install
2021-5-13 0.1.0 686 Version 0.1.0 Install
2021-5-9 0.0.6 238 Version 0.0.6 Install
2021-5-4 0.0.5 259 Version 0.0.5 Install
2021-4-6 0.0.4 635 Version 0.0.4 Install
2021-3-20 0.0.3 577 Version 0.0.3 Install
2021-3-15 0.0.2 299 Version 0.0.2 Install
2021-3-14 0.0.1 123 Version 0.0.1 Install