Skip to content

Commit

Permalink
Merge pull request #71 from Kirus59/CultYoggBed
Browse files Browse the repository at this point in the history
CultYoggBed
  • Loading branch information
SkaldetSkaeg authored Dec 26, 2024
2 parents 4c875cb + 9930e5a commit 63ac2b0
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Content.Shared/Buckle/Components/StrapComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public sealed partial class StrapComponent : Component
/// </summary>
[DataField]
public bool BuckleOnInteractHand = true;

// SS220 Add uncuff time modifier when buckled begin
/// <summary>
/// A modifier that affects the time of uncuff when the entity is buckled on the strap.
/// </summary>
[DataField]
public float UncuffTimeModifier = 1f;
// SS220 Add uncuff time modifier when buckled end
}

public enum StrapPosition
Expand Down
16 changes: 16 additions & 0 deletions Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ private void InitializeBuckle()
{
BuckleDoafterEarly((uid, comp), ev.Event, ev);
});

SubscribeLocalEvent<BuckleComponent, ModifyUncuffDurationEvent>(OnBuckleModifyUncuffDuration); // SS220 Add uncuff time modifier when buckled
}

private void OnBuckleComponentShutdown(Entity<BuckleComponent> ent, ref ComponentShutdown args)
Expand Down Expand Up @@ -211,6 +213,20 @@ private void OnBuckleUpdateCanMove(EntityUid uid, BuckleComponent component, Upd
args.Cancel();
}

// SS220 Add uncuff time modifier when buckled begin
private void OnBuckleModifyUncuffDuration(Entity<BuckleComponent> entity, ref ModifyUncuffDurationEvent args)
{
if (!entity.Comp.Buckled)
return;

var strapUid = entity.Comp.BuckledTo;
if (!TryComp<StrapComponent>(strapUid, out var strapComp))
return;

args.Duration *= strapComp.UncuffTimeModifier;
}
// SS220 Add uncuff time modifier when buckled end

public bool IsBuckled(EntityUid uid, BuckleComponent? component = null)
{
return Resolve(uid, ref component, false) && component.Buckled;
Expand Down
14 changes: 14 additions & 0 deletions Resources/Prototypes/SS220/Entities/Objects/CultYogg/buildings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,17 @@
- stack: Tokl
count: 25
icon: { sprite: SS220/Interface/Materials/material_icons_16.rsi, state: tokl}

# TODO: раскомментить после того, как будут спрайты кровати
#- type: cultYoggBuilding
# id: CultYoggBedBuilding
# order: 6
# frame: CultYoggBuildingFrame
# result: CultYoggBed
# materials:
# - stack: Tokl
# count: 10
# icon: { sprite: SS220/Interface/Materials/material_icons_16.rsi, state: tokl}
# - stack: Cablelive
# count: 5
# icon: { sprite: SS220/Interface/Materials/material_icons_16.rsi, state: coillv}
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,19 @@
acts: ["Destruction"]
- type: CultYoggBuilding
eraseTime: 3

- type: entity
parent: Bed
id: CultYoggBed
suffix: CultYogg
components:
- type: Strap
hasSeatbelt: true
uncuffTimeModifier: 2.0
- type: CultYoggBuilding
eraseTime: 3
spawnOnErase:
- id: CableApcStack1Live
stackAmount: 3
- id: SheetTokl1
stackAmount: 5

0 comments on commit 63ac2b0

Please sign in to comment.