Skip to content

Commit

Permalink
Merge pull request #41 from HippieStation/upstream
Browse files Browse the repository at this point in the history
Upstream
  • Loading branch information
rhailrake committed May 26, 2023
2 parents 33ccde9 + 0bc0d5b commit fd9c661
Show file tree
Hide file tree
Showing 3,580 changed files with 2,247,572 additions and 2,663,930 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ csharp_preserve_single_line_blocks = true
#dotnet_naming_style.begins_with_i.word_separator =
#dotnet_naming_style.begins_with_i.capitalization = pascal_case


dotnet_diagnostic.IDE0055.severity = warning

dotnet_naming_rule.constants_rule.severity = warning
dotnet_naming_rule.constants_rule.style = upper_camel_case_style
Expand Down
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,7 @@ Resources/MapImages
/Content.Docfx/api/
/Content.Docfx/*site

*.bak

# Direnv stuff
.direnv/
2 changes: 1 addition & 1 deletion .run/Content Server+Client.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<toRun name="Content.Server" type="DotNetProject" />
<method v="2" />
</configuration>
</component>
</component>
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"omnisharp.analyzeOpenDocumentsOnly": true
}
5 changes: 3 additions & 2 deletions Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void SelectJobPreset(OptionButton.ItemSelectedEventArgs args)
// this is a sussy way to do this
foreach (var access in job.Access)
{
if (_accessButtons.TryGetValue(access, out var button))
if (_accessButtons.TryGetValue(access, out var button) && !button.Disabled)
{
button.Pressed = true;
}
Expand All @@ -131,7 +131,7 @@ private void SelectJobPreset(OptionButton.ItemSelectedEventArgs args)

foreach (var access in groupPrototype.Tags)
{
if (_accessButtons.TryGetValue(access, out var button))
if (_accessButtons.TryGetValue(access, out var button) && !button.Disabled)
{
button.Pressed = true;
}
Expand Down Expand Up @@ -187,6 +187,7 @@ public void UpdateState(IdCardConsoleBoundUserInterfaceState state)
if (interfaceEnabled)
{
button.Pressed = state.TargetIdAccessList?.Contains(accessName) ?? false;
button.Disabled = (!state.AllowedModifyAccessList?.Contains(accessName)) ?? true;
}
}

Expand Down
75 changes: 24 additions & 51 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System.IO;
using System.Linq;
using Content.Client.Popups;
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Audio;
using Robust.Shared.ContentPack;
using Robust.Shared.GameStates;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Markdown;
using Robust.Shared.Serialization.Markdown.Mapping;
Expand All @@ -29,8 +26,6 @@ public sealed class ActionsSystem : SharedActionsSystem
[Dependency] private readonly IResourceManager _resources = default!;
[Dependency] private readonly ISerializationManager _serialization = default!;

[Dependency] private readonly PopupSystem _popupSystem = default!;

public event Action<ActionType>? ActionAdded;
public event Action<ActionType>? ActionRemoved;
public event OnActionReplaced? ActionReplaced;
Expand All @@ -50,12 +45,22 @@ public override void Initialize()
SubscribeLocalEvent<ActionsComponent, ComponentHandleState>(HandleComponentState);
}

public override void Dirty(ActionType action)
{
if (_playerManager.LocalPlayer?.ControlledEntity != action.AttachedEntity)
return;

base.Dirty(action);
ActionsUpdated?.Invoke();
}

private void HandleComponentState(EntityUid uid, ActionsComponent component, ref ComponentHandleState args)
{
if (args.Current is not ActionsComponentState state)
return;

var serverActions = new SortedSet<ActionType>(state.Actions);
state.SortedActions ??= new SortedSet<ActionType>(state.Actions);
var serverActions = state.SortedActions;
var removed = new List<ActionType>();

foreach (var act in component.Actions.ToList())
Expand All @@ -73,14 +78,16 @@ private void HandleComponentState(EntityUid uid, ActionsComponent component, ref
}

act.CopyFrom(serverAct);
serverActions.Remove(serverAct);
}

var added = new List<ActionType>();

// Anything that remains is a new action
foreach (var newAct in serverActions)
{
if (component.Actions.Contains(newAct))
continue;

// We create a new action, not just sorting a reference to the state's action.
var action = (ActionType) newAct.Clone();
component.Actions.Add(action);
Expand Down Expand Up @@ -119,66 +126,32 @@ protected override void AddActionInternal(ActionsComponent comp, ActionType acti

public override void AddAction(EntityUid uid, ActionType action, EntityUid? provider, ActionsComponent? comp = null, bool dirty = true)
{
if (GameTiming.ApplyingState && !action.ClientExclusive)
return;

if (!Resolve(uid, ref comp, false))
return;

dirty &= !action.ClientExclusive;
base.AddAction(uid, action, provider, comp, dirty);

if (uid == _playerManager.LocalPlayer?.ControlledEntity)
ActionAdded?.Invoke(action);
}

public override void RemoveActions(EntityUid uid, IEnumerable<ActionType> actions, ActionsComponent? comp = null, bool dirty = true)
public override void RemoveAction(EntityUid uid, ActionType action, ActionsComponent? comp = null, bool dirty = true)
{
if (uid != _playerManager.LocalPlayer?.ControlledEntity)
if (GameTiming.ApplyingState && !action.ClientExclusive)
return;

if (!Resolve(uid, ref comp, false))
return;

var actionList = actions.ToList();
base.RemoveActions(uid, actionList, comp, dirty);

foreach (var act in actionList)
{
if (act.AutoRemove)
ActionRemoved?.Invoke(act);
}
}
dirty &= !action.ClientExclusive;
base.RemoveAction(uid, action, comp, dirty);

/// <summary>
/// Execute convenience functionality for actions (pop-ups, sound, speech)
/// </summary>
protected override bool PerformBasicActions(EntityUid user, ActionType action, bool predicted)
{
var performedAction = action.Sound != null
|| !string.IsNullOrWhiteSpace(action.UserPopup)
|| !string.IsNullOrWhiteSpace(action.Popup);

if (!GameTiming.IsFirstTimePredicted)
return performedAction;

if (!string.IsNullOrWhiteSpace(action.UserPopup))
{
var msg = (!action.Toggled || string.IsNullOrWhiteSpace(action.PopupToggleSuffix))
? Loc.GetString(action.UserPopup)
: Loc.GetString(action.UserPopup + action.PopupToggleSuffix);

_popupSystem.PopupEntity(msg, user);
}
else if (!string.IsNullOrWhiteSpace(action.Popup))
{
var msg = (!action.Toggled || string.IsNullOrWhiteSpace(action.PopupToggleSuffix))
? Loc.GetString(action.Popup)
: Loc.GetString(action.Popup + action.PopupToggleSuffix);

_popupSystem.PopupEntity(msg, user);
}

if (action.Sound != null)
SoundSystem.Play(action.Sound.GetSound(), Filter.Local(), user, action.AudioParams);

return performedAction;
if (action.AutoRemove && uid == _playerManager.LocalPlayer?.ControlledEntity)
ActionRemoved?.Invoke(action);
}

private void OnPlayerAttached(EntityUid uid, ActionsComponent component, PlayerAttachedEvent args)
Expand Down
33 changes: 0 additions & 33 deletions Content.Client/Administration/Commands/LoadPrototypeCommand.cs

This file was deleted.

48 changes: 0 additions & 48 deletions Content.Client/Administration/Commands/PlayGlobalSoundCommand.cs

This file was deleted.

64 changes: 0 additions & 64 deletions Content.Client/Administration/Commands/UploadFile.cs

This file was deleted.

Loading

0 comments on commit fd9c661

Please sign in to comment.