Skip to content

Commit

Permalink
fix rcd placement direction
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirus59 committed Dec 30, 2024
1 parent ef50450 commit 433fd01
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Content.Shared/RCD/Systems/RCDSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class RCDSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly TagSystem _tags = default!;
[Dependency] private readonly SharedTransformSystem _xform = default!; // SS220 fix rcd rotation

private readonly int _instantConstructionDelay = 0;
private readonly EntProtoId _instantConstructionFx = "EffectRCDConstruct0";
Expand Down Expand Up @@ -515,21 +516,36 @@ private void FinalizeRCDOperation(EntityUid uid, RCDComponent component, MapGrid
break;

case RcdMode.ConstructObject:
var ent = Spawn(component.CachedPrototype.Prototype, _mapSystem.GridTileToLocal(mapGridData.GridUid, mapGridData.Component, mapGridData.Position));
//var ent = Spawn(component.CachedPrototype.Prototype, _mapSystem.GridTileToLocal(mapGridData.GridUid, mapGridData.Component, mapGridData.Position)); // SS220 fix rcd rotation

Angle rotation = 0; // SS220 fix rcd rotation
switch (component.CachedPrototype.Rotation)
{
case RcdRotation.Fixed:
Transform(ent).LocalRotation = Angle.Zero;
// SS220 fix rcd rotation begin
//Transform(ent).LocalRotation = Angle.Zero;
rotation = Angle.Zero;
// SS220 fix rcd rotation end
break;
case RcdRotation.Camera:
Transform(ent).LocalRotation = Transform(uid).LocalRotation;
// SS220 fix rcd rotation begin
//Transform(ent).LocalRotation = Transform(uid).LocalRotation;
rotation = Transform(uid).LocalRotation;
// SS220 fix rcd rotation end
break;
case RcdRotation.User:
Transform(ent).LocalRotation = direction.ToAngle();
// SS220 fix rcd rotation begin
//Transform(ent).LocalRotation = direction.ToAngle();
rotation = direction.ToAngle();
// SS220 fix rcd rotation end
break;
}

// SS220 fix rcd rotation begin
var mapcords = _xform.ToMapCoordinates(_mapSystem.GridTileToLocal(mapGridData.GridUid, mapGridData.Component, mapGridData.Position));
var ent = Spawn(component.CachedPrototype.Prototype, mapcords, rotation: rotation);
// SS220 fix rcd rotation end

_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(user):user} used RCD to spawn {ToPrettyString(ent)} at {mapGridData.Position} on grid {mapGridData.GridUid}");
break;

Expand Down

0 comments on commit 433fd01

Please sign in to comment.