Фиксы сна и одномесных кроватей
This commit is contained in:
parent
8039934feb
commit
894f66eb74
5 changed files with 41 additions and 14 deletions
|
|
@ -3,6 +3,7 @@ using Content.Server.Bed.Components;
|
|||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Bed;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Shared.Body.Components;
|
||||
|
|
@ -11,6 +12,7 @@ using Content.Shared.Damage;
|
|||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Power;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
|
|
@ -25,6 +27,7 @@ namespace Content.Server.Bed
|
|||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -50,22 +53,19 @@ namespace Content.Server.Bed
|
|||
// Sunrise-Start
|
||||
private void OnStrapped(Entity<CanSleepOnBuckleComponent> bed, ref StrappedEvent args)
|
||||
{
|
||||
EntityUid? action = null;
|
||||
_actionsSystem.AddAction(args.Buckle, ref action, SleepingSystem.SleepActionId, args.Buckle.Owner);
|
||||
if (action != null)
|
||||
bed.Comp.SleepAction.TryAdd(args.Buckle.Owner, action.Value);
|
||||
|
||||
// Single action entity, cannot strap multiple entities to the same bed.
|
||||
//DebugTools.AssertEqual(args.Strap.Comp.BuckledEntities.Count, 1);
|
||||
var canSleep = EnsureComp<CanSleepComponent>(args.Buckle);
|
||||
_actionsSystem.AddAction(args.Buckle.Owner, ref canSleep.SleepAction, SleepingSystem.SleepActionId, args.Buckle.Owner);
|
||||
}
|
||||
|
||||
private void OnUnstrapped(Entity<CanSleepOnBuckleComponent> bed, ref UnstrappedEvent args)
|
||||
{
|
||||
if (bed.Comp.SleepAction.TryGetValue(args.Buckle.Owner, out var action))
|
||||
{
|
||||
_actionsSystem.RemoveAction(args.Buckle.Owner, action);
|
||||
bed.Comp.SleepAction.Remove(args.Buckle.Owner);
|
||||
}
|
||||
if (!TryComp<CanSleepComponent>(args.Buckle.Owner, out var canSleep))
|
||||
return;
|
||||
|
||||
RemComp<CanSleepComponent>(args.Buckle.Owner);
|
||||
_actionsSystem.RemoveAction(args.Buckle.Owner, canSleep.SleepAction);
|
||||
if (canSleep.SleepAction != null)
|
||||
_actionContainer.RemoveAction(canSleep.SleepAction.Value);
|
||||
}
|
||||
// Sunrise-End
|
||||
|
||||
|
|
|
|||
12
Content.Shared/Bed/Sleep/CanSleepComponent.cs
Normal file
12
Content.Shared/Bed/Sleep/CanSleepComponent.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Bed.Sleep;
|
||||
|
||||
[NetworkedComponent, RegisterComponent]
|
||||
[AutoGenerateComponentState, AutoGenerateComponentPause(Dirty = true)]
|
||||
public sealed partial class CanSleepComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
[AutoNetworkedField]
|
||||
public EntityUid? SleepAction;
|
||||
}
|
||||
|
|
@ -140,6 +140,9 @@ public abstract partial class SharedBuckleSystem
|
|||
}
|
||||
|
||||
// Sunrise-Start
|
||||
if (strapComp.BuckleOffsets.Count == 0)
|
||||
return;
|
||||
|
||||
var isValid = false;
|
||||
foreach (var offset in strapComp.BuckleOffsets)
|
||||
{
|
||||
|
|
@ -421,7 +424,7 @@ public abstract partial class SharedBuckleSystem
|
|||
if (TryComp<PhysicsComponent>(buckle, out var physics))
|
||||
_physics.ResetDynamics(buckle, physics);
|
||||
|
||||
DebugTools.AssertEqual(xform.ParentUid, strap.Owner);
|
||||
//DebugTools.AssertEqual(xform.ParentUid, strap.Owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -15193,3 +15193,16 @@
|
|||
id: 1039
|
||||
time: '2025-04-21T04:45:52.0000000+00:00'
|
||||
url: https://github.com/space-sunrise/sunrise-station/pull/1888
|
||||
- author: VigersRay
|
||||
changes:
|
||||
- message: "\u0418\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043E \u043F\u0440\
|
||||
\u0438\u0441\u0442\u0435\u0433\u0438\u0432\u0430\u043D\u0438\u0435 \u043A \u043E\
|
||||
\u0431\u044B\u0447\u043D\u044B\u043C \u043A\u0440\u043E\u0432\u0430\u0442\u044F\
|
||||
\u043C."
|
||||
type: Fix
|
||||
- message: "\u0418\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044B \u0431\u0430\
|
||||
\u0433\u0438 \u0441 \u044D\u043A\u0448\u0435\u043D\u043E\u043C \u0441\u043D\u0430\
|
||||
."
|
||||
type: Fix
|
||||
id: 1040
|
||||
time: '2025-04-21T05:44:21.909478+00:00'
|
||||
|
|
|
|||
|
|
@ -307,7 +307,6 @@
|
|||
description: Go to sleep.
|
||||
components:
|
||||
- type: InstantAction
|
||||
temporary: true # Sunrise-Edit
|
||||
checkCanInteract: false
|
||||
checkConsciousness: false
|
||||
icon: { sprite: Clothing/Head/Hats/pyjamasyndicatered.rsi, state: icon }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue