Исправление факса ПНТ + его факс перемещен в шкаф (#3467)

This commit is contained in:
A-Mironov 2025-12-25 20:56:45 +03:00 committed by GitHub
parent 1e059bdb0c
commit 7c24ee595d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 68 additions and 15 deletions

View file

@ -37,6 +37,7 @@ using Content.Shared.Ghost;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Robust.Server.Containers; using Robust.Server.Containers;
using Content.Server.Storage.EntitySystems; using Content.Server.Storage.EntitySystems;
using Content.Shared.Item;
using Robust.Shared.Utility; using Robust.Shared.Utility;
// sunrise-end // sunrise-end
@ -620,6 +621,28 @@ public sealed class FaxSystem : EntitySystem
var entityToSpawn = printout.PrototypeId.Length == 0 ? component.PrintPaperId.ToString() : printout.PrototypeId; var entityToSpawn = printout.PrototypeId.Length == 0 ? component.PrintPaperId.ToString() : printout.PrototypeId;
var printed = Spawn(entityToSpawn, Transform(uid).Coordinates); var printed = Spawn(entityToSpawn, Transform(uid).Coordinates);
// Sunrise-start - For portable faxes (items), attempt to add to inventory instead of dropping to floor
if (HasComp<ItemComponent>(uid))
{
bool successfullyInserted = _container.TryGetContainingContainer(uid, out var parentContainer) &&
_container.Insert(printed, parentContainer);
// 1. Try to insert into the container that holds the fax (e.g. backpack)
// 2. If not suitable, try to put it in the fax's own storage (if it has one)
if (!successfullyInserted && _container.TryGetContainer(uid, "storagebase", out var container))
{
if (_container.Insert(printed, container))
successfullyInserted = true;
}
// 3. Fallback: If we couldn't insert it anywhere, ensure it's on the grid/map (drop it)
// This handles cases where the fax is in a container but that container is full.
if (!successfullyInserted)
{
_transform.AttachToGridOrMap(printed);
}
}
// Sunrise-end
if (TryComp<PaperComponent>(printed, out var paper)) if (TryComp<PaperComponent>(printed, out var paper))
{ {

View file

@ -11913,7 +11913,7 @@ entities:
- type: Transform - type: Transform
pos: -12.5,-9.5 pos: -12.5,-9.5
parent: 2 parent: 2
- proto: LockerRepresentative - proto: LockerRepresentativeEmpty
entities: entities:
- uid: 1552 - uid: 1552
components: components:

View file

@ -688,16 +688,4 @@
stateDoorOpen: mime_open stateDoorOpen: mime_open
stateDoorClosed: mime_door stateDoorClosed: mime_door
# Representative
- type: entity
id: LockerRepresentative
name: representative locker
parent: LockerBaseSecure
components:
- type: Appearance
- type: AccessReader
access: [["Ntrep"]]
- type: EntityStorageVisuals
stateBaseClosed: hop
stateDoorOpen: hop_open
stateDoorClosed: representative_door

View file

@ -202,3 +202,46 @@
prob: 0.1 prob: 0.1
- id: PKAUpgradeDamage - id: PKAUpgradeDamage
prob: 0.1 prob: 0.1
# Representative
- type: entity
id: LockerRepresentative
name: representative locker
parent: LockerBaseSecure
components:
- type: Appearance
- type: AccessReader
access: [["Ntrep"]]
- type: EntityStorageVisuals
stateBaseClosed: hop
stateDoorOpen: hop_open
stateDoorClosed: representative_door
# Sunrise-start
- type: StorageFill
contents:
- id: HandheldFax
# Sunrise-end
- type: entity
id: LockerRepresentativeEmpty
name: representative locker
parent: LockerBaseSecure
suffix: Empty
components:
- type: Appearance
- type: AccessReader
access: [["Ntrep"]]
- type: EntityStorageVisuals
stateBaseClosed: hop
stateDoorOpen: hop_open
stateDoorClosed: representative_door
- type: entity
id: LockerRepresentativeFilled
parent: LockerRepresentative
suffix: Filled
# Sunrise-start
# This is now identical to the base LockerRepresentative, kept for compatibility/explicit usage
# Sunrise-end
#Fish-end

View file

@ -62,7 +62,6 @@
back: back:
- RubberStampNtrep - RubberStampNtrep
- CaneNT - CaneNT
- HandheldFax #sunrise-edit
- RubberStampVeto #sunrise-edit - RubberStampVeto #sunrise-edit
- type: chameleonOutfit - type: chameleonOutfit