Skip to content

Commit

Permalink
[Work In Progress] Frankenstein (SS220 Box) (#124)
Browse files Browse the repository at this point in the history
* Started mapping

* Frankenstein: Mapping stage 1 - bridge

* Frankenstein: fixed map proto

* Frankenstein: Mapping stage 1.5 - below bridge

* Frankenstein: Mapping stage 1.5 - added ss220 signs

* Frankenstein: Mapping stage 1.5 - added benches and psych bed

* Oh shit oh god what have I done

* Frankenstein: Content additions

* Frankenstein: added mic stand

* Frankenstein: added new lockers

* Frankenstein: added stairs

* Frankenstein: added stairs construction recipes

* Frankenstein: added blueshields hardsuit

* Frankenstein: Mapping stage 2 - bar remap

* Frankenstein: Implemented InteractonRangeComponent

* Frankenstein: dorm and bar remap

* Frankenstein: Resaved

* Frankenstein: Mapping stage 3 beginning - brig

* Frankenstein: Mapping stage 3

* Frankenstein: bug fixes

* Frankenstein: added tv studio sign

* Tweaked blueshield rig light color

* Frankenstein: added bar mini sign

* Blueshield's gun safe now requires blueshield access

* Fixed clown's airlock

* Fixed wall chargers

* Added more stuff to psych locker

* Frankenstein: added north-western dock to brig

* Migrated Frankenstein

* Frankenstein: migration and small fixes

* Frankenstein: Replaced spawners and fixes

* Tweaked blinds to prevent lag

* Frankenstein: Sec dock access change & extra disposal units

* Added blinds construction graph

* Frankenstein: small changes

* Added construction graphs and recipes for sofas and benches

* Psych bed construction graph

* Frankenstein: added Open sign

* Frankenstein: Departure remap

* Fixed licenses in RSIs

* Frankenstein: small tweaks and fixes

* Update open sign texture

* Frankenstein: fix kitchen disposals

* Frankenstein: added TabletopGame for tacmap

* Frankenstein: added PDA message server

* Frankenstein statue locale

* Fix tests

* Fix attributions

* Fix sofa prices

* Fix canCollide on spawn

* Add Frankenstein to test pool

* Frankenstein: engineering remap 1

* Evidence board sprite improvements

* Frankenstein: batch fixes

* DAW is not tabletop

* Fixed outline not working properly with InteractionRange

* Frankenstein: added new signs

* Frankenstein: map fixes, expand CMO office, restore palette

* Frankenstein: added On Air sign, arrivals docks are always powered

* Frankenstein: small update and resave

* Wall maps le great beginning

* Wall map development

* Frankenstein: pet parrot, borg chargers and teg improvements

* Update map pool

* Frankenstein: new parallax from Crovax Delta

* Frankenstein: added medical bed to sec

* Fix blueshield goal stamp

* Fixed construction graphs

* Fixed operating table rotation

* Update Frankenstein to work with upstream

* Increase blinds activation range

* Ported changes from official box

* Frankenstein: small fixes

* Frankenstein: little teg improvements

* Frankenstein: move prototype & tweak

* Frankenstein: added desks

* Sprite adjustments

* carpet dithering

* Frankenstein: departure tweaks

* Frankenstein: fixes & removed from default pool
  • Loading branch information
TheArturZh authored Aug 21, 2023
1 parent 6c0a39b commit 1291275
Show file tree
Hide file tree
Showing 405 changed files with 205,047 additions and 31 deletions.
8 changes: 7 additions & 1 deletion Content.Client/Outline/InteractionOutlineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Client.Viewport;
using Content.Shared.CCVar;
using Content.Shared.Interaction;
using Content.Shared.SS220.Interaction;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
Expand Down Expand Up @@ -138,7 +139,12 @@ public override void FrameUpdate(float frameTime)
var inRange = false;
if (localPlayer.ControlledEntity != null && !Deleted(entityToClick))
{
inRange = _interactionSystem.InRangeUnobstructed(localPlayer.ControlledEntity.Value, entityToClick.Value);
var range = SharedInteractionSystem.InteractionRange;

if (TryComp<InteractionRangeComponent>(entityToClick.Value, out var rangeComp))
range = rangeComp.Range;

inRange = _interactionSystem.InRangeUnobstructed(localPlayer.ControlledEntity.Value, entityToClick.Value, range: range);
}

InteractionOutlineComponent? outline;
Expand Down
15 changes: 15 additions & 0 deletions Content.Client/SS220/PictureViewer/PictureViewer.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Control xmlns="https://spacestation14.io"
MouseFilter="Stop"
MinSize="100 100">

<Label
Name="NoImageLabel" Text="{Loc 'image-viewer-no-image'}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MouseFilter="Ignore"/>

<TextureRect
Name="Picture"
Stretch="KeepCentered"
MouseFilter="Ignore"/>
</Control>
106 changes: 106 additions & 0 deletions Content.Client/SS220/PictureViewer/PictureViewer.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using System.Numerics;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
using Robust.Shared.Utility;

namespace Content.Client.SS220.PictureViewer;

[GenerateTypedNameReferences]
public sealed partial class PictureViewer : Control
{
private ResPath _viewedPicture;

private const float ScrollSensitivity = 0.1f;
private const float MaxZoom = 10f;

private float _zoom = 1f;
private bool _draggin = false;
private Vector2 _offset = Vector2.Zero;

public ResPath ViewedPicture
{
get => _viewedPicture;
set
{
_viewedPicture = value;
Picture.TexturePath = value.ToString();
}
}

private void UpdateZoom()
{
var invZoom = 1 / _zoom;
Picture.TextureScale = new Vector2(invZoom, invZoom);
}

private void UpdateOffset()
{
//Picture.Margin = new Thickness(_offset.X, _offset.Y);
var position = _offset;
var rect = UIBox2.FromDimensions(position, this.Size);
Picture.Arrange(rect);
}

protected override void MouseWheel(GUIMouseWheelEventArgs args)
{
base.MouseWheel(args);
_zoom -= args.Delta.Y * ScrollSensitivity;
_zoom = float.Clamp(_zoom, 1, MaxZoom);
Logger.DebugS("ZOOM: ", _zoom.ToString());
UpdateZoom();
UpdateOffset();

args.Handle();
}

protected override void KeyBindDown(GUIBoundKeyEventArgs args)
{
base.KeyBindDown(args);

if (args.Function == EngineKeyFunctions.Use)
{
_draggin = true;
}
}

protected override void KeyBindUp(GUIBoundKeyEventArgs args)
{
base.KeyBindUp(args);

if (args.Function == EngineKeyFunctions.Use)
{
_draggin = false;
}
}

protected override void MouseMove(GUIMouseMoveEventArgs args)
{
base.MouseMove(args);

if (!_draggin)
return;

//_recentering = false;
_offset += new Vector2(args.Relative.X, args.Relative.Y);
Logger.DebugS("OFFSET: ", _offset.ToString());
UpdateOffset();

/*
if (_offset != Vector2.Zero)
{
_recenter.Disabled = false;
}
else
{
_recenter.Disabled = true;
}
*/
}

public PictureViewer()
{
RobustXamlLoader.Load(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:pv="clr-namespace:Content.Client.SS220.PictureViewer"
Title="{Loc 'viewable-station-map-ui-window-title'}"
MinSize="300 300"
SetSize="725 725">
<pv:PictureViewer Name="Viewer"/>
</DefaultWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;

namespace Content.Client.SS220.ViewableStationMap.UI;

[GenerateTypedNameReferences]
public sealed partial class ViewableStationMapWindow : DefaultWindow
{
public ResPath ViewedMap
{
get => Viewer.ViewedPicture;
set => Viewer.ViewedPicture = value;
}

public ViewableStationMapWindow()
{
RobustXamlLoader.Load(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Robust.Client.GameObjects;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Content.Client.SS220.ViewableStationMap.UI;
using Content.Shared.SS220.ViewableStationMap;
using JetBrains.Annotations;

namespace Content.Client.SS220.ViewableStationMap;

[UsedImplicitly]
public sealed class StationViewableMapBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IEntityManager _entMan = default!;

private ViewableStationMapWindow? _window;

public StationViewableMapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

/// <inheritdoc/>
protected override void Open()
{
base.Open();

_window = new ViewableStationMapWindow();
_window.OpenCentered();

_window.OnClose += Close;

if (_entMan.TryGetComponent(Owner, out ViewableStationMapComponent? comp))
_window.ViewedMap = SpriteSpecifierSerializer.TextureRoot/comp.MapTexture;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
_window?.Dispose();
}
}
2 changes: 2 additions & 0 deletions Content.Client/Tabletop/TabletopSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ private void OnTabletopPlay(TabletopPlayEvent msg)
Title = msg.Title
};

_window.SetSize = new Vector2(msg.WindowSize.X, msg.WindowSize.Y);

_window.OnClose += OnWindowClose;
}

Expand Down
3 changes: 2 additions & 1 deletion Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public sealed class PostMapInitTest
"CorvaxAvrite",
"CorvaxDelta",
"CorvaxIshimura",
"220Delta"
"220Delta",
"Frankenstein"
};

/// <summary>
Expand Down
98 changes: 98 additions & 0 deletions Content.Server/SS220/Blinds/BlindsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Shared.Interaction;
using Content.Shared.SS220.Blinds;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Enumerators;

namespace Content.Server.SS220.Blinds;

public sealed class BlindsSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly OccluderSystem _occluder = default!;
[Dependency] private readonly IMapManager _mapManager = default!;

private const int MaxConnectedBlinds = 64;

// <inheritdoc/>
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BlindsComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<BlindsComponent, ActivateInWorldEvent>(OnActivated);
}

public void SetOpen(EntityUid uid, BlindsComponent component, bool state)
{
component.IsOpen = state;
UpdateState(uid, component);
}

private void TrySetOpenAnchoredEntities(bool state, AnchoredEntitiesEnumerator entities, HashSet<EntityUid> processedEntities)
{
while (entities.MoveNext(out var entity))
{
if (processedEntities.Contains(entity.Value))
continue;

TrySetOpenAllConnected(entity.Value, state, processedEntities);
}
}

public void TrySetOpenAllConnected(EntityUid uid, bool state, HashSet<EntityUid>? processedEntities = null)
{
// No lagging the server with a shitton of connected blinds
if (processedEntities is not null && processedEntities.Count >= MaxConnectedBlinds)
return;

if (!TryComp<BlindsComponent>(uid, out var component))
return;

SetOpen(uid, component, state);

processedEntities ??= new HashSet<EntityUid>();
processedEntities.Add(uid);

// Make connected blinds change their state as well
if (!TryComp<TransformComponent>(uid, out var transform))
return;

if (transform.Anchored && _mapManager.TryGetGrid(transform.GridUid, out var grid))
{
var pos = grid.CoordinatesToTile(transform.Coordinates);

TrySetOpenAnchoredEntities(component.IsOpen, grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(1, 0)), processedEntities);
TrySetOpenAnchoredEntities(component.IsOpen, grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(-1, 0)), processedEntities);
TrySetOpenAnchoredEntities(component.IsOpen, grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(0, 1)), processedEntities);
TrySetOpenAnchoredEntities(component.IsOpen, grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(0, -1)), processedEntities);
}
}

private void OnInit(EntityUid uid, BlindsComponent component, ComponentInit args)
{
UpdateState(uid, component);
}

private void UpdateState(EntityUid uid, BlindsComponent component)
{
_appearance.SetData(uid, BlindsVisualState.State, component.IsOpen);
if (TryComp<OccluderComponent>(uid, out var occluder))
_occluder.SetEnabled(uid, !component.IsOpen, occluder);
}

private void OnActivated(EntityUid uid, BlindsComponent component, ActivateInWorldEvent args)
{
if (args.Handled)
return;

TrySetOpenAllConnected(uid, !component.IsOpen);
var soundToPlay = component.IsOpen ? component.OpenSound : component.CloseSound;
_audio.PlayPvs(soundToPlay, args.User);

args.Handled = true;
}
}
37 changes: 37 additions & 0 deletions Content.Server/SS220/Clocks/PhysicalClockSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Server.GameTicking;
using Content.Shared.Examine;
using Robust.Shared.Timing;
using Content.Shared.SS220.Clocks;

namespace Content.Server.SS220.Clocks;

/// <summary>
/// This system makes clocks state time when examined.
/// </summary>
public sealed class PhysicalClockSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;

// <inheritdoc/>
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PhysicalClockComponent, ExaminedEvent>(OnExamine);
}

private void OnExamine(EntityUid uid, PhysicalClockComponent component, ExaminedEvent args)
{
if (!component.Enabled)
return;

var gameTicker = _entitySystem.GetEntitySystem<GameTicker>();
var stationTime = gameTicker.RoundDuration();

args.PushMarkup(Loc.GetString("comp-clocks-time-description",
("time", stationTime.ToString("hh\\:mm\\:ss"))));
}
}
Loading

0 comments on commit 1291275

Please sign in to comment.