Zenaug-Locked_Cargo icon

Locked Cargo

Lock your ships like a ward. Owners lock and unlock at the cargo or rudder; while a ship is locked, only the owner, players on the ship's list and admins can steer, open the cargo or take the ship apart. Every player and the server need the mod.

By Zenaug
Last updated 2 weeks ago
Total downloads 47
Total rating 0 
Categories Mods Tweaks AI Generated Vehicles
Dependency string Zenaug-Locked_Cargo-0.3.1
Dependants 0 other packages depend on this package

This mod requires the following mods to function

ValheimModding-Jotunn-2.30.2 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.30.2
denikson-BepInExPack_Valheim-5.4.2351 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2351

README

Locked Cargo

Lock your ships like a ward. A ship belongs to the player who built it. The owner can lock it anywhere on the map; while it is locked, only the owner, players on the ship's list and admins can steer it, open its cargo, use its parts or take it apart.

How to use it

  • The key: use the game's alternate-use key (AltPlace) together with the Use key. The hover text always shows the exact keys for your bindings.
  • Where: at the ship's cargo box, or at its rudder. Both work on every ship; the Raft has no cargo box, so on the Raft use the rudder.
  • The owner locks and unlocks the ship with that key.
  • Other players use the same key while the ship is unlocked to add themselves to the ship's list, or to remove themselves from it. This works like an inactive ward.
  • Ships from the ship construction site have no owner. The first player to use the key on one claims it, and it becomes locked.
  • New ships start locked. Ships built before the mod was installed start unlocked. Their hover shows "Unknown owner" until the builder interacts with the ship once.
  • The hover text on the cargo and the rudder shows whether the ship is locked, who owns it, which action the key will do for you, and the ship's list.

What a locked ship blocks

For anyone who is not the owner, on the ship's list, or an admin:

  • steering;
  • opening the cargo (including stack-all and take-all);
  • using anything else on the ship, including parts added by other mods, and using items on them;
  • deconstructing and repairing the ship with the hammer.

Refused actions show a message and the ward's flash, as a ward does. If someone has the cargo open when the ship becomes locked for them, the cargo window closes. Someone who is steering when the ship becomes locked for them is released from the helm.

What stays open

  • Seats and ladders, so passengers can always come aboard and sit.
  • Weapon damage is not blocked. A vanilla ward does not block it either.
  • An unlocked ship works as in vanilla.

Wards

  • Inside someone else's ward, the ship's owner, the players on the ship's list, and admins (while "Admins bypass ship locks" is on) can still steer, open the cargo, use the ship's parts, and deconstruct and repair the ship, with no ward refusal. The owner can also lock and unlock the ship there.
  • Everyone else is still stopped by both the ward and the lock. Inside someone else's ward a stranger cannot claim an ownerless ship or add themselves to a ship's list.
  • Nothing changes for things that are not part of a ship, such as chests on the shore.

Setting

"Admins bypass ship locks" (section "1 - General", default on), editable in the in-game Configuration Manager.

  • On: server admins, and the host of a locally hosted game, can use, lock and unlock every ship.
  • Off: admins are treated like every other player, which is handy for testing the lock yourself.
  • The setting is synced from the server and only admins can change it.

Works with

These mods were checked against their code, and Locked Cargo adds compatibility for them only when they are installed:

  • ProtectiveWards: ship ownership comes first inside a foreign ward (see Wards). Its other protections are unchanged.
  • LongshipUpgrades: its parts on the Longship (such as the Hull, the lantern, the trophy stand and turrets) follow the lock and show "No access" only to players without access.
  • MultiUserChest: multi-user opening still works for players with access, and never admits anyone else to locked cargo.
  • CraftFromContainers and EpicLoot craft-from-containers: a locked ship's cargo is not used for crafting by players without access.
  • ItemHopper: hoppers never take from or put into a locked ship's cargo, including the owner's hoppers.
  • GorilaChestMod: a locked ship's cargo is skipped for players without access.
  • Vikings_Village: villagers never take from or put into a locked ship's cargo, and use the next chest instead.

Requirements

  • Every player and the server need the mod. Jotunn refuses players who do not have it.
  • Players and the server must have the same minor version (for example 0.3.x).
  • Requires BepInExPack_Valheim and Jotunn.

Known limits

  • Clients: the lock relies on every player running the mod. A deliberately modified client can get around it, as with any Valheim protection.
  • Modded ships are covered only if they use the game's normal ship component.
  • Parts without their own ward check: parts added by other mods that do no ward check of their own show their normal hover text on a locked ship, but using them is still refused.
  • Lock messages: after using the key, the "Ship locked" / "Ship unlocked" message appears straight away, before the change is confirmed. The hover text always shows the real state.
  • Distance: anyone close enough to see the hover text can use the key on the cargo or rudder, even from the dock.
  • ProtectiveWards' rule for strangers is unchanged on unlocked ships inside a ward. It lets through only the player who last steered that ship.
  • Villager timing: a villager who picked an unlocked ship's cargo just before the owner locks it can still take that one load.
  • Names on the list: names are stored when a player is added, and are not updated if the character is renamed.

Testing status

All in-game testing so far was done by the author, playing solo: two characters, played one after the other, in one locally hosted world.

  • 0.1.0: a first check that the lock lines show and the lock toggles on all five vanilla ships.
  • 0.2.0: a full solo test run covering refusals, adding and removing yourself, crafting from cargo, the admin bypass setting, the ward cases and reloading the world. Everything worked except one case inside someone else's ward, which 0.3.0 fixed.
  • 0.3.0: the same kind of run, including the new ward rules. Everything worked except a false "No access" on the LongshipUpgrades Hull, which 0.3.1 fixed.
  • 0.3.1: tested solo, and the fix for a false "No access" on ship parts is confirmed. Inside someone else's ward, the ship's owner could use the Hull, the lantern and the other LongshipUpgrades parts with no "No access" and no ward message, with the ship locked and unlocked. A stranger saw "No access" on the same parts and was refused, on the locked ship both inside and outside a ward. The change that makes villagers use the next kiln chest was not tested in game.
  • Vikings_Village: not tested in game yet.

Not yet tested with two players on separate machines. That is needed for:

  • someone steering while the owner locks the ship;
  • two players in the cargo through MultiUserChest;
  • the cargo window closing for another player;
  • the ship's data being held by another player's machine;
  • a player without the mod being refused;
  • an admin who is not the host;
  • ProtectiveWards' "Prevent building and demolishing" for a player on the ship's list.

Made with AI

This mod and its package were made with generative AI.

  • Code, tests, tools and package files: all the mod's code, its test tools, the build reports and the package files (this README, the changelog and the manifest) were written by Claude Code (Anthropic), model Claude Opus 5.5. The code was checked by Claude Opus and Claude Sonnet review agents (their versions were not recorded).
  • Specifications, briefs and icon: the specifications, the design questions, the work briefs and the icon artwork were written by Claude (Anthropic) in a claude.ai chat. The model was not recorded. The author chose the icon from six options.
  • The author (Zenaug) decided all behaviour, wording and look, and did all in-game testing.
  • No analytics, no network access: the mod collects no analytics and opens no network connections of its own. It only uses the game's own multiplayer messages to share each ship's lock state.

Changelog

See CHANGELOG.md.