Privacy: key lockable chest, personal storage, bank safes

by AivanF

A range of private and secured storages to protect your stuff and make the game even more fun: 1. Locked chest requiring appropriate key. 2. Personal chest only available to specific player. 3. Bank that provides a separate safe strongbox inventory for each player. Keys can be crafted and engraved or found from the integrated mods.

Content
6 months ago
1.1
43
Storage
Owner:
AivanF
Source:
https://github.com/AivanF/factorio-Ai...
Homepage:
N/A
License:
GNU GPLv3
Created:
6 months ago
Latest Version:
0.9.4 (6 months ago)
Factorio version:
1.1
Downloaded by:
43 users

The mod adds a range of private and secured storage options that can be opened with different restricting conditions, to protect your stuff and make the game even more fun.

See how this does work: https://youtu.be/TTAyuQ41f9U

0. Purpose

The mod is intended for:

  • Multiplayer games
  • Creating fascinating scenarios
  • To be used by mods that introduce explorational content like ruins generators, RPG quests (which I'm working on), etc

1. Content

1.1. Storages

Builtin types:

  1. Locked chest requiring a mechanical key of appropriate shape or several of them.
  2. Personal chest only available to specific player.
  3. Bank that provides:
    • 1 common team inventory for 160 stacks;
    • Infinite number of personal strongboxes, 1 with 48 slots per each player;
    • 16 lockable safes with 48 slots that accept both mechanical and electronic keys.

Common features:

  • They cannot be mined until emptied.
  • They block automatic item putting/removing by inserters and drones.
  • They are durable, to prevent accident destruction and to provide security.
  • Each belongs to a configurable storage class that defines its behaviour, other mods can extend it, see API.

1.2. Keys

Features:

  • A key can be either raw or engraved having shape/password.
  • Raw keys get engraved using a dedicated work table to assign a shape/password.
  • Several engraved keys of the same category can be merged into a bunch of keys, aka master key, up to 10 mechanical keys and 128 electronic ones.
  • Each key has a category: mechanical, electronic, quantum, magic, etc.
  • A locked storage only accepts keys of its own category. I.e, you cannot use an electronic key to open a mechanical chest.
  • Under the hood, any item-with-tags having specific tag will be considered as a valid key.
  • Passwords get hashed to restrict skript kiddies.

Builtin keys available to craft:

  • Mechanical: keys made of stone, iron, bronze, steel, car key
  • Electronic: NFC card. It allows to merge much more keys together.

Also, there are some hidden keys, available for other mods to be used as quest items.

1.3. Engraving station / worktable

There is a couple of them:

  • Stone worktable, can handle mechanical keys only
  • Electronic engraving station, deals with mechanical and electronic keys

It allows to perform several "recipes":

  • Engrave raw keys.
  • Clean / erase key shape.
  • Copy engraved key shape to raw keys.
  • Merge engraved keys into a bunch.
  • Split a bunch of keys into separate ones.

2. API

The mod provides versatile API as remote interfaces and imported functions for other mods to deal with keys & storages infrastructure system. Below is a brief list of available functions, see remote_api.lua for more details.

2.1. Control time

  • register_storage – registers storage entity using specified storage class. Entity's prototype can be unregistered. Entity's prototype can be of any type, but I suggest smth not operable, like I made assembling-machine with empty recipe category.
  • get_main_inv – returns script inventory of a lockable chest or team storage of a bank. Can be nil if storage is a personalised lootbox.
  • get_personal_inv – returns personal inventory of a storage. Can be used for fulfilling lootboxes.

2.2. Load time

  • register_storage_entity – registers a storage entity prototype. This will automatically call register_storage when entity get placed. Entity's prototype can be of any type, but I suggest smth not operable, like I made assembling-machine with empty recipe category.
  • register_storage_class – registers new storage class importing it from given file path and variable name. You can easily create new class reusing code of existing ones, see storage_classes.lua.
  • register_key_item – registers a key item prototype, it needs to be item-with-tags. Registration is only used as a source of default category, e.g for craftable keys, so it's not required for ready-to-use keys created by quests/scripts, and you can simply assign a compatible tag, see tag_info and engrave_key_item in utils.lua. Key category can be any string, it don't have to be builtin or registered.
  • register_engraving_entity – registers an engraving work table entity prototype. This will add engraving UI when a player opens an instance of this entity. Note that it should be of container type. If you wanna smth different – feel free to design and code a brand new engraving station, it simply should deal with keys in a similar way; in this case, no need to register your entity.

3. Plans

  • Unlocking storages (so that it can be opened without keys or locked with other keys).
  • Close storage inventory when a player goes far away.
  • Key durability capacity to restrict number of usages (don't worry, for specific types only).
  • Lockable cars.
  • Hacking chests with a pick-wrench or special machine.
  • Storage class that provides personal dynamically created content considering player's keys and/or quests.
  • Collapsing storage class that is perfect for loot boxes.