Skip to content

Commit

Permalink
Merge branch 'master' into blueshield
Browse files Browse the repository at this point in the history
  • Loading branch information
pxc1984 committed Jun 11, 2024
2 parents 2cfe060 + 5460354 commit c483892
Show file tree
Hide file tree
Showing 287 changed files with 4,002 additions and 1,659 deletions.
16 changes: 6 additions & 10 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@

**Changelog**
<!--
Введите игроков в курс дела, кратко опишите всё что было изменено в этом PR.
-->

<!--
Перед выкладыванием/запросом о рассмотрении PR, напишите Changelog вне коментария.
Для добавления чейнжлога в Resources/Changelog/ChangelogSunrise.yml используйте скрипт manual_changelog.py который находится в директории Tools. Нужен установленый python.
Пример команды:
python .\Tools\manual_changelog.py
Далее указываете чейнжлог по данному шаблону:
Если вы хотите чтобы о ваших изменениях узнали игроки напишите что вы изменили вне коментария используя шаблон.
Если вы делаете слишком мелкий фикс, не стоит его указывать.
Так же не стоил делать его слишком длинним указывая все детали, пишите кратко и по существу.
Шаблон:
:cl: VigersRay
- add: Добавлено веселье!
- remove: Удалено веселье!
- tweak: Изменено веселье!
- fix: Исправлено веселье!
После чего закройте скрипт комбинацией CTRL + C.
Не изменяйте файл чейнжлога сами.
-->
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Client.Station;
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
Expand All @@ -14,6 +15,7 @@ public sealed partial class ObjectsTab : Control
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IClientConsoleHost _console = default!;

private readonly List<ObjectsTabEntry> _objects = new();
private readonly List<ObjectsTabSelection> _selections = new();
Expand All @@ -27,6 +29,9 @@ public sealed partial class ObjectsTab : Control
private readonly TimeSpan _updateFrequency = TimeSpan.FromSeconds(2);
private TimeSpan _nextUpdate;

private Action<NetEntity>? TeleportToObjAction { get; set; }
private Action<NetEntity>? DeleteObjAction { get; set; }

public ObjectsTab()
{
RobustXamlLoader.Load(this);
Expand Down Expand Up @@ -57,6 +62,19 @@ public ObjectsTab()

// Initialize the next update time
_nextUpdate = TimeSpan.Zero;

TeleportToObjAction += TeleportToObj;
DeleteObjAction += DeleteObj;
}

private void TeleportToObj(NetEntity nent)
{
_console.ExecuteCommand($"tpto {nent}");
}

private void DeleteObj(NetEntity nent)
{
_console.ExecuteCommand($"delete {nent}");
}

protected override void FrameUpdate(FrameEventArgs args)
Expand Down Expand Up @@ -129,7 +147,7 @@ private void GenerateButton(ListData data, ListContainerButton button)
if (data is not ObjectsListData { Info: var info, BackgroundColor: var backgroundColor })
return;

var entry = new ObjectsTabEntry(info.Name, info.Entity, new StyleBoxFlat { BackgroundColor = backgroundColor });
var entry = new ObjectsTabEntry(info.Name, info.Entity, new StyleBoxFlat { BackgroundColor = backgroundColor }, TeleportToObjAction, DeleteObjAction);
button.ToolTip = $"{info.Name}, {info.Entity}";

button.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(args, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,17 @@
SizeFlagsStretchRatio="3"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Button Name="TeleportButton"
Text="{Loc object-tab-entity-teleport}"
SizeFlagsStretchRatio="3"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Button Name="DeleteButton"
Text="{Loc object-tab-entity-delete}"
SizeFlagsStretchRatio="3"
HorizontalExpand="True"
ClipText="True"/>
</BoxContainer>
</PanelContainer>
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ public sealed partial class ObjectsTabEntry : PanelContainer
{
public NetEntity AssocEntity;

public ObjectsTabEntry(string name, NetEntity nent, StyleBox styleBox)
public ObjectsTabEntry(string name, NetEntity nent, StyleBox styleBox, Action<NetEntity>? teleportToObj, Action<NetEntity>? deleteObj)
{
RobustXamlLoader.Load(this);

AssocEntity = nent;
EIDLabel.Text = nent.ToString();
NameLabel.Text = name;
BackgroundColorPanel.PanelOverride = styleBox;

TeleportButton.OnPressed += _ => teleportToObj?.Invoke(nent);
DeleteButton.OnPressed += _ => deleteObj?.Invoke(nent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
ClipText="True"
Text="{Loc object-tab-entity-id}"
MouseFilter="Pass"/>
<Label Name="EntityTeleportLabel"
SizeFlagsStretchRatio="3"
HorizontalExpand="True"/>
<Label Name="EntityDeleteLabel"
SizeFlagsStretchRatio="3"
HorizontalExpand="True"/>
</BoxContainer>
</Control>
1 change: 1 addition & 0 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ public HumanoidProfileEditor(
{
PreferenceUnavailableButton.SelectId(args.Id);
Profile = Profile?.WithPreferenceUnavailable((PreferenceUnavailableMode) args.Id);
SetDirty();
};

_jobCategories = new Dictionary<string, BoxContainer>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Content.Shared._Sunrise.Pacificator;
using JetBrains.Annotations;

namespace Content.Client._Sunrise.Pacificator
{
[UsedImplicitly]
public sealed class PacificatorBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private PacificatorWindow? _window;

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

protected override void Open()
{
base.Open();

_window = new PacificatorWindow(this);

/*
_window.Switch.OnPressed += _ =>
{
SendMessage(new SharedPacificatorComponent.SwitchGeneratorMessage(!IsOn));
};
*/

_window.OpenCentered();
_window.OnClose += Close;
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

var castState = (GeneratorState) state;
_window?.UpdateState(castState);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;

_window?.Dispose();
}

public void SetPowerSwitch(bool on)
{
SendMessage(new SwitchGeneratorMessage(on));
}
}
}
35 changes: 35 additions & 0 deletions Content.Client/_Sunrise/Pacificator/PacificatorWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="Генератор пацифизма"
MinSize="270 130"
SetSize="360 180">
<BoxContainer Margin="4 0" Orientation="Horizontal">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<GridContainer Margin="2 0 0 0" Columns="2">
<!-- Power -->
<Label Text="{Loc 'gravity-generator-window-power'}" HorizontalExpand="True" StyleClasses="StatusFieldTitle" />
<BoxContainer Orientation="Horizontal" MinWidth="120">
<Button Name="OnButton" Text="{Loc 'gravity-generator-window-power-on'}" StyleClasses="OpenRight" />
<Button Name="OffButton" Text="{Loc 'gravity-generator-window-power-off'}" StyleClasses="OpenLeft" />
</BoxContainer>
<Control /> <!-- Empty control to act as a spacer in the grid. -->
<Label Name="PowerLabel" Text="0 / 0 W" />
<!-- Status -->
<Label Text="{Loc 'gravity-generator-window-status'}" StyleClasses="StatusFieldTitle" />
<Label Name="StatusLabel" Text="{Loc 'gravity-generator-window-status-fully-charged'}" />
<!-- ETA -->
<Label Text="{Loc 'gravity-generator-window-eta'}" StyleClasses="StatusFieldTitle" />
<Label Name="EtaLabel" Text="N/A" />
<!-- Charge -->
<Label Text="{Loc 'gravity-generator-window-charge'}" StyleClasses="StatusFieldTitle" />
<ProgressBar Name="ChargeBar" MaxValue="255">
<Label Name="ChargeText" Margin="4 0" Text="0 %" />
</ProgressBar>
</GridContainer>
</BoxContainer>
<PanelContainer Margin="12 0 0 0" StyleClasses="Inset" VerticalAlignment="Center">
<SpriteView Name="EntityView" SetSize="96 96" OverrideDirection="South" />
</PanelContainer>
</BoxContainer>

</controls:FancyWindow>
73 changes: 73 additions & 0 deletions Content.Client/_Sunrise/Pacificator/PacificatorWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Content.Shared._Sunrise.Pacificator;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using FancyWindow = Content.Client.UserInterface.Controls.FancyWindow;

namespace Content.Client._Sunrise.Pacificator
{
[GenerateTypedNameReferences]
public sealed partial class PacificatorWindow : FancyWindow
{
private readonly ButtonGroup _buttonGroup = new();

private readonly PacificatorBoundUserInterface _owner;

public PacificatorWindow(PacificatorBoundUserInterface owner)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

_owner = owner;

OnButton.Group = _buttonGroup;
OffButton.Group = _buttonGroup;

OnButton.OnPressed += _ => _owner.SetPowerSwitch(true);
OffButton.OnPressed += _ => _owner.SetPowerSwitch(false);

EntityView.SetEntity(owner.Owner);
}

public void UpdateState(GeneratorState state)
{
if (state.On)
OnButton.Pressed = true;
else
OffButton.Pressed = true;

PowerLabel.Text = Loc.GetString(
"gravity-generator-window-power-label",
("draw", state.PowerDraw),
("max", state.PowerDrawMax));

PowerLabel.SetOnlyStyleClass(MathHelper.CloseTo(state.PowerDraw, state.PowerDrawMax) ? "Good" : "Caution");

ChargeBar.Value = state.Charge;
ChargeText.Text = (state.Charge / 255f).ToString("P0");
StatusLabel.Text = Loc.GetString(state.PowerStatus switch
{
PacificatorPowerStatus.Off => "gravity-generator-window-status-off",
PacificatorPowerStatus.Discharging => "gravity-generator-window-status-discharging",
PacificatorPowerStatus.Charging => "gravity-generator-window-status-charging",
PacificatorPowerStatus.FullyCharged => "gravity-generator-window-status-fully-charged",
_ => throw new ArgumentOutOfRangeException()
});

StatusLabel.SetOnlyStyleClass(state.PowerStatus switch
{
PacificatorPowerStatus.Off => "Danger",
PacificatorPowerStatus.Discharging => "Caution",
PacificatorPowerStatus.Charging => "Caution",
PacificatorPowerStatus.FullyCharged => "Good",
_ => throw new ArgumentOutOfRangeException()
});

EtaLabel.Text = state.EtaSeconds >= 0
? Loc.GetString("gravity-generator-window-eta-value", ("left", TimeSpan.FromSeconds(state.EtaSeconds)))
: Loc.GetString("gravity-generator-window-eta-none");

EtaLabel.SetOnlyStyleClass(state.EtaSeconds >= 0 ? "Caution" : "Disabled");
}
}
}
14 changes: 10 additions & 4 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,21 @@ private void SpawnPlayer(ICommonSession player,

_playTimeTrackings.PlayerRolesChanged(player);

var arrivals = true;

// Все появляются в прибытии в начале раунда. Зачем? А мне нравится эта бегающаа орящая толпа.
EntityUid? mobMaybe = null;
var spawnPointType = SpawnPointType.Arrivals;
if (jobPrototype.AlwaysUseSpawner)
{
lateJoin = false;
arrivals = false;
spawnPointType = SpawnPointType.Job;
}
else
{
mobMaybe = _arrivals.SpawnPlayersOnArrivals(station, job, character);
}

var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character, arrivals: arrivals);
if (mobMaybe == null)
mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character, spawnPointType: spawnPointType);

DebugTools.AssertNotNull(mobMaybe);
var mob = mobMaybe!.Value;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/GameTicking/Rules/DeathMatchRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void OnBeforeSpawn(PlayerBeforeSpawnEvent ev)
var newMind = _mind.CreateMind(ev.Player.UserId, ev.Profile.Name);
_mind.SetUserId(newMind, ev.Player.UserId);

var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(ev.Station, null, ev.Profile, arrivals: false);
var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(ev.Station, null, ev.Profile);
DebugTools.AssertNotNull(mobMaybe);
var mob = mobMaybe!.Value;

Expand Down
Loading

0 comments on commit c483892

Please sign in to comment.