Skip to content

Commit f477f3d

Browse files
authored
Merge pull request #57 from Kirus59/BurglarBug-changes
Burglar bug changes
2 parents 902b01d + ec69319 commit f477f3d

File tree

7 files changed

+52
-3
lines changed

7 files changed

+52
-3
lines changed

Content.Client/Sticky/Visualizers/StickyVisualizerSystem.cs

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ private void OnInit(Entity<StickyVisualizerComponent> ent, ref ComponentInit arg
2222
return;
2323

2424
ent.Comp.OriginalDrawDepth = sprite.DrawDepth;
25+
ent.Comp.OriginalNoRotation = sprite.NoRotation; // SS220 rotate ent face to the user
2526
}
2627

2728
protected override void OnAppearanceChange(EntityUid uid, StickyVisualizerComponent comp, ref AppearanceChangeEvent args)
@@ -34,5 +35,10 @@ protected override void OnAppearanceChange(EntityUid uid, StickyVisualizerCompon
3435

3536
var drawDepth = isStuck ? comp.StuckDrawDepth : comp.OriginalDrawDepth;
3637
args.Sprite.DrawDepth = drawDepth;
38+
39+
// SS220 rotate ent face to the user begin
40+
var noRotation = isStuck ? comp.StuckNoRotation : comp.OriginalNoRotation;
41+
args.Sprite.NoRotation = noRotation;
42+
// SS220 rotate ent face to the user end
3743
}
3844
}

Content.Shared/Sticky/Components/StickyComponent.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Content.Shared.Sticky.Systems;
1+
using Content.Shared.Sticky.Systems;
22
using Content.Shared.Whitelist;
33
using Robust.Shared.GameStates;
44
using Robust.Shared.Utility;
@@ -87,4 +87,12 @@ public sealed partial class StickyComponent : Component
8787
/// </summary>
8888
[DataField]
8989
public SpriteSpecifier VerbIcon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/eject.svg.192dpi.png"));
90+
91+
// SS220 rotate ent face to the user begin
92+
/// <summary>
93+
/// Should the entity turn its face to the user when stuck
94+
/// </summary>
95+
[DataField]
96+
public bool RotateFaceToUser = false;
97+
// SS220 rotate ent face to the user end
9098
}

Content.Shared/Sticky/Components/StickyVisualizerComponent.cs

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ public sealed partial class StickyVisualizerComponent : Component
2121
/// </summary>
2222
[DataField]
2323
public int OriginalDrawDepth;
24+
25+
// SS220 rotate ent face to the user begin
26+
/// <summary>
27+
/// Is sprite not performing rotation when stuck
28+
/// </summary>
29+
[DataField]
30+
public bool StuckNoRotation = false;
31+
32+
[DataField]
33+
public bool OriginalNoRotation;
34+
// SS220 rotate ent face to the user end
2435
}
2536

2637
[Serializable, NetSerializable]

Content.Shared/Sticky/Systems/StickySystem.cs

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public sealed class StickySystem : EntitySystem
1818
[Dependency] private readonly SharedHandsSystem _hands = default!;
1919
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
2020
[Dependency] private readonly SharedPopupSystem _popup = default!;
21+
[Dependency] private readonly SharedTransformSystem _transform = default!; // SS220 rotate ent face to the user
22+
[Dependency] private readonly RotateToFaceSystem _rotateToFace = default!; // SS220 rotate ent face to the user
2123

2224
private const string StickerSlotId = "stickers_container";
2325

@@ -172,6 +174,14 @@ public void StickToEntity(Entity<StickyComponent> ent, EntityUid target, EntityU
172174
// send information to appearance that entity is stuck
173175
_appearance.SetData(uid, StickyVisuals.IsStuck, true);
174176

177+
// SS220 rotate ent face to the user begin
178+
if (comp.RotateFaceToUser)
179+
{
180+
var userPosition = _transform.GetWorldPosition(user);
181+
_rotateToFace.TryFaceCoordinates(uid, userPosition);
182+
}
183+
// SS220 rotate ent face to the user end
184+
175185
comp.StuckTo = target;
176186
Dirty(uid, comp);
177187

Resources/Prototypes/SS220/CultYogg/burglarbug.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
components:
77
- type: Sprite
88
sprite: SS220/Objects/CultYogg/burglarbug.rsi
9-
state: icon
9+
layers:
10+
- map: ["base"]
11+
state: icon
1012
- type: Icon
1113
sprite: SS220/Objects/CultYogg/burglarbug.rsi
1214
state: icon
1315
- type: Item
1416
size: Small
1517
- type: Appearance
1618
- type: Sticky
19+
rotateFaceToUser: true
1720
stickDelay: 3
1821
unstickDelay: 3
1922
stickPopupSuccess: cult-yogg-burglar-bug-stick-success
@@ -26,6 +29,13 @@
2629
delay: 10
2730
examinable: false
2831
- type: StickyVisualizer
32+
stuckNoRotation: true
33+
- type: GenericVisualizer
34+
visuals:
35+
enum.StickyVisuals.IsStuck:
36+
base:
37+
True: { state: fox }
38+
False: { state: icon }
2939
- type: BurglarBug
3040
timeToOpen: 10
3141
notActivatedStickPopupCancellation: cult-yogg-burglar-bug-notactivated-cancellation
Loading

Resources/Textures/SS220/Objects/CultYogg/burglarbug.rsi/meta.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
0.3
3232
]
3333
]
34-
}
34+
},
35+
{
36+
"name": "fox",
37+
"directions": 4
38+
}
3539
]
3640
}

0 commit comments

Comments
 (0)