Add universal key (#1624)

* Add universal key

* Address issues
This commit is contained in:
Morb
2025-08-07 01:11:37 -07:00
committed by GitHub
parent 98ae6b22e6
commit 58c40c39ad
5 changed files with 38 additions and 5 deletions

View File

@@ -0,0 +1,9 @@
namespace Content.Shared._CP14.LockKey.Components;
/// <summary>
/// Makes key universal, so it changes his form to required by lock on use
/// </summary>
[RegisterComponent]
public sealed partial class CP14KeyUniversalComponent : Component
{
}

View File

@@ -481,7 +481,18 @@ public sealed class SharedCP14LockKeySystem : EntitySystem
if (keyShape == null || lockShape == null)
return;
if (keyShape.SequenceEqual(lockShape))
var isEqual = keyShape.SequenceEqual(lockShape);
if (HasComp<CP14KeyUniversalComponent>(key) && !isEqual)
{
// Make new shape for key and force equality for this use
_popup.PopupClient(Loc.GetString("cp14-lock-key-transforming"), key, user);
key.Comp.LockShape = new List<int>(lockShape);
DirtyField(key, key.Comp, nameof(CP14KeyComponent.LockShape));
isEqual = true;
}
if (isEqual)
{
if (lockComp.Locked)
{

View File

@@ -18,7 +18,7 @@ cp14-lock-verb-use-key-message = Use {$item} to lock or unlock the lock.
cp14-lock-examine-lock-slot = {$lock} is hanging here.
cp14-lock-examine-lock-lockpicked = {$lock} looks shabby.
cp14-lock-examine-key = The {$item} has prongs of the following shape:
cp14-lock-examine-key = The {$item} has prongs of the following shape:
cp14-lock-key-file-use-hint = Grind tooth: {$num}
cp14-lock-key-file-updated = New key shape:
@@ -28,4 +28,6 @@ cp14-lock-editor-updated = New lock shape:
cp14-lock-insert-start = {$player} starts installing a lock on {$name}.
cp14-lock-insert-fail-have-lock = {$name} already has a lock installed!
cp14-lock-insert-success = The new lock has been successfully installed in {$name}!
cp14-lock-insert-success = The new lock has been successfully installed in {$name}!
cp14-lock-key-transforming = The key changing its shape!

View File

@@ -18,7 +18,7 @@ cp14-lock-verb-use-key-message = Использовать {$item} чтобы з
cp14-lock-examine-lock-slot = Здесь висит {$lock}
cp14-lock-examine-lock-lockpicked = {$lock} выглядит потрепанным.
cp14-lock-examine-key = {$item} имеет зубцы следующей формы:
cp14-lock-examine-key = {$item} имеет зубцы следующей формы:
cp14-lock-key-file-use-hint = Сточить зубец: {$num}
cp14-lock-key-file-updated = Новая форма ключа:
@@ -28,4 +28,6 @@ cp14-lock-editor-updated = Новая форма замка:
cp14-lock-insert-start = {$player} начинает устанавливать замок в {$name}.
cp14-lock-insert-fail-have-lock = В {$name} уже установлен замок!
cp14-lock-insert-success = Новый замок успешно установлен в {$name}!
cp14-lock-insert-success = Новый замок успешно установлен в {$name}!
cp14-lock-key-transforming = Ключ изменяет свою форму!

View File

@@ -89,3 +89,12 @@
materialComposition:
CP14Mithril: 10
- type: entity
parent: CP14KeyMithrilBlank
id: CP14KeyUniversal
name: omni key
suffix: Universal
categories: [ ForkFiltered, DoNotMap ]
components:
- type: CP14Key
- type: CP14KeyUniversal