Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement gridinv, proper #703

Merged
merged 4 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/workflows/update-credits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
# Hey there fork dev! If you like to include your own contributors in this then you can probably just change this to your own repo
# Do this in dump_github_contributors.ps1 too into your own repo
if: github.repository == 'DeltaV-Station/Delta-v-rebase'
if: github.repository == 'DeltaV-Station/Delta-v'

steps:
- uses: actions/[email protected]
Expand All @@ -23,25 +23,25 @@ jobs:

# TODO
#- name: Get this week's Patreons
# run: Tools/script2dumppatreons > Resources/Credits/Patrons.yml
# run: Tools/script2dumppatreons > Resources/Credits/Patrons.yml

# MAKE SURE YOU ENABLED "Allow GitHub Actions to create and approve pull requests" IN YOUR ACTIONS, OTHERWISE IT WILL MOST LIKELY FAIL


# For this you can use a pat token of an account with direct push access to the repo if you have protected branches.
# For this you can use a pat token of an account with direct push access to the repo if you have protected branches.
# Uncomment this and comment the other line if you do this.
# https://github.com/stefanzweifel/git-auto-commit-action#push-to-protected-branches

#- name: Commit new credit files
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: Update Credits
# commit_author: PJBot <[email protected]>

# This will make a PR
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public static void SetupContexts(IInputContextContainer contexts)
common.AddFunction(ContentKeyFunctions.TakeScreenshot);
common.AddFunction(ContentKeyFunctions.TakeScreenshotNoUI);
common.AddFunction(ContentKeyFunctions.ToggleFullscreen);
common.AddFunction(ContentKeyFunctions.MoveStoredItem);
common.AddFunction(ContentKeyFunctions.RotateStoredItem);
common.AddFunction(ContentKeyFunctions.Point);
common.AddFunction(ContentKeyFunctions.ZoomOut);
common.AddFunction(ContentKeyFunctions.ZoomIn);
Expand Down Expand Up @@ -63,6 +65,8 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.OpenInventoryMenu);
human.AddFunction(ContentKeyFunctions.SmartEquipBackpack);
human.AddFunction(ContentKeyFunctions.SmartEquipBelt);
human.AddFunction(ContentKeyFunctions.OpenBackpack);
human.AddFunction(ContentKeyFunctions.OpenBelt);
human.AddFunction(ContentKeyFunctions.MouseMiddle);
human.AddFunction(ContentKeyFunctions.ArcadeUp);
human.AddFunction(ContentKeyFunctions.ArcadeDown);
Expand Down
10 changes: 10 additions & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ private void HandleToggleWalk(BaseButton.ButtonToggledEventArgs args)
_deferCommands.Add(_inputManager.SaveToUserData);
}

private void HandleStaticStorageUI(BaseButton.ButtonToggledEventArgs args)
{
_cfg.SetCVar(CCVars.StaticStorageUI, args.Pressed);
_cfg.SaveToFile();
}

public KeyRebindTab()
{
IoCManager.InjectDependencies(this);
Expand Down Expand Up @@ -175,10 +181,14 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.Drop);
AddButton(ContentKeyFunctions.ExamineEntity);
AddButton(ContentKeyFunctions.SwapHands);
AddButton(ContentKeyFunctions.MoveStoredItem);
AddButton(ContentKeyFunctions.RotateStoredItem);

AddHeader("ui-options-header-interaction-adv");
AddButton(ContentKeyFunctions.SmartEquipBackpack);
AddButton(ContentKeyFunctions.SmartEquipBelt);
AddButton(ContentKeyFunctions.OpenBackpack);
AddButton(ContentKeyFunctions.OpenBelt);
AddButton(ContentKeyFunctions.ThrowItemInHand);
AddButton(ContentKeyFunctions.TryPullObject);
AddButton(ContentKeyFunctions.MovePulledObject);
Expand Down
20 changes: 10 additions & 10 deletions Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public MiscTab()
ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow);
ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
// OpaqueStorageWindowCheckBox.Pressed = _cfg.GetCVar(CCVars.OpaqueStorageWindow);
OpaqueStorageWindowCheckBox.Pressed = _cfg.GetCVar(CCVars.OpaqueStorageWindow);
FancySpeechBubblesCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatEnableFancyBubbles);
FancyNameBackgroundsCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatFancyNameBackground);
// ToggleWalk.Pressed = _cfg.GetCVar(CCVars.ToggleWalk);
// StaticStorageUI.Pressed = _cfg.GetCVar(CCVars.StaticStorageUI);
StaticStorageUI.Pressed = _cfg.GetCVar(CCVars.StaticStorageUI);


ApplyButton.OnPressed += OnApplyButtonPressed;
Expand All @@ -55,12 +55,12 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CVars.DiscordEnabled, DiscordRich.Pressed);
_cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
_cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
// _cfg.SetCVar(CCVars.OpaqueStorageWindow, OpaqueStorageWindowCheckBox.Pressed);
_cfg.SetCVar(CCVars.OpaqueStorageWindow, OpaqueStorageWindowCheckBox.Pressed);
_cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
_cfg.SetCVar(CCVars.ChatEnableFancyBubbles, FancySpeechBubblesCheckBox.Pressed);
_cfg.SetCVar(CCVars.ChatFancyNameBackground, FancyNameBackgroundsCheckBox.Pressed);
// _cfg.SetCVar(CCVars.ToggleWalk, ToggleWalk.Pressed);
// _cfg.SetCVar(CCVars.StaticStorageUI, StaticStorageUI.Pressed);
_cfg.SetCVar(CCVars.StaticStorageUI, StaticStorageUI.Pressed);

_cfg.SaveToFile();
UpdateApplyButton();
Expand All @@ -71,22 +71,22 @@ private void UpdateApplyButton()
var isDiscordSame = DiscordRich.Pressed == _cfg.GetCVar(CVars.DiscordEnabled);
var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
// var isOpaqueStorageWindow = OpaqueStorageWindowCheckBox.Pressed == _cfg.GetCVar(CCVars.OpaqueStorageWindow);
var isOpaqueStorageWindow = OpaqueStorageWindowCheckBox.Pressed == _cfg.GetCVar(CCVars.OpaqueStorageWindow);
var isLoocShowSame = ShowLoocAboveHeadCheckBox.Pressed == _cfg.GetCVar(CCVars.LoocAboveHeadShow);
var isFancyChatSame = FancySpeechBubblesCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatEnableFancyBubbles);
var isFancyBackgroundSame = FancyNameBackgroundsCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatFancyNameBackground);
// var isToggleWalkSame = ToggleWalk.Pressed == _cfg.GetCVar(CCVars.ToggleWalk);
// var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);
var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);

ApplyButton.Disabled = isDiscordSame &&
isShowHeldItemSame &&
isCombatModeIndicatorsSame &&
//isOpaqueStorageWindow &&
isOpaqueStorageWindow &&
isLoocShowSame &&
isFancyChatSame &&
isFancyBackgroundSame; // &&
// isToggleWalkSame &&
//isStaticStorageUISame;
isFancyBackgroundSame &&
// isToggleWalkSame &&
isStaticStorageUISame;
}

}
Expand Down
141 changes: 26 additions & 115 deletions Content.Client/Storage/StorageBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,129 +1,40 @@
using Content.Client.Examine;
using Content.Client.Storage.UI;
using Content.Client.UserInterface.Controls;
using Content.Client.Verbs.UI;
using Content.Shared.Input;
using Content.Shared.Interaction;
using Content.Client.Storage.Systems;
using Content.Shared.Storage;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
using static Content.Shared.Storage.StorageComponent;

namespace Content.Client.Storage
{
[UsedImplicitly]
public sealed class StorageBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private StorageWindow? _window;

[Dependency] private readonly IEntityManager _entManager = default!;

public StorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void Open()
{
base.Open();
namespace Content.Client.Storage;

if (_window == null)
{
// TODO: This is a bit of a mess but storagecomponent got moved to shared and cleaned up a bit.
var controller = IoCManager.Resolve<IUserInterfaceManager>().GetUIController<StorageUIController>();
_window = controller.EnsureStorageWindow(Owner);
_window.Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName;

_window.EntityList.GenerateItem += _window.GenerateButton;
_window.EntityList.ItemPressed += InteractWithItem;
_window.StorageContainerButton.OnPressed += TouchedContainerButton;

_window.OnClose += Close;

if (EntMan.TryGetComponent<StorageComponent>(Owner, out var storageComp))
{
BuildEntityList(Owner, storageComp);
}

}
else
{
_window.Open();
}
}

public void BuildEntityList(EntityUid uid, StorageComponent component)
{
_window?.BuildEntityList(uid, component);
}
[UsedImplicitly]
public sealed class StorageBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IEntityManager _entManager = default!;

public void InteractWithItem(BaseButton.ButtonEventArgs? args, ListData? cData)
{
if (args == null || cData is not EntityListData { Uid: var entity })
return;
private readonly StorageSystem _storage;

if (args.Event.Function == EngineKeyFunctions.UIClick)
{
SendPredictedMessage(new StorageInteractWithItemEvent(_entManager.GetNetEntity(entity)));
}
else if (EntMan.EntityExists(entity))
{
OnButtonPressed(args.Event, entity);
}
}
public StorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
_storage = _entManager.System<StorageSystem>();
}

private void OnButtonPressed(GUIBoundKeyEventArgs args, EntityUid entity)
{
if (args.Function == ContentKeyFunctions.ExamineEntity)
{
EntMan.System<ExamineSystem>()
.DoExamine(entity);
}
else if (args.Function == EngineKeyFunctions.UseSecondary)
{
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<VerbMenuUIController>().OpenVerbMenu(entity);
}
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
{
EntMan.EntityNetManager?.SendSystemNetworkMessage(
new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: false));
}
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
{
EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: true));
}
else
{
return;
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

args.Handle();
}
_storage.CloseStorageWindow(Owner);
}

public void TouchedContainerButton(BaseButton.ButtonEventArgs args)
{
SendPredictedMessage(new StorageInsertItemMessage());
}
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
base.ReceiveMessage(message);

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

if (_window != null)
{
_window.Orphan();
_window.EntityList.GenerateItem -= _window.GenerateButton;
_window.EntityList.ItemPressed -= InteractWithItem;
_window.StorageContainerButton.OnPressed -= TouchedContainerButton;
_window.OnClose -= Close;
_window = null;
}
if (_entManager.TryGetComponent<StorageComponent>(Owner, out var comp))
_storage.OpenStorageWindow((Owner, comp));
}
}
}

Loading
Loading