Moving PDA to ECS (#4538)

* Moved pen slot to separate component

* Moved it all to more generic item slot class

* Add sounds

* Item slots now supports many slots

* Some clean-up

* Refactored slots a bit

* Moving ID card out

* Moving pda to system

* Moving PDA owner to ECS

* Moved PDA flashlight to separate component

* Toggle lights work through events

* Fixing UI

* Moving uplink to separate component

* Continue moving uplink to separate component

* More cleaning

* Removing pda shared

* Nuked shared pda component

* Fixed flashlight

* Pen slot now showed in UI

* Light toggle now shows correctly in UI

* Small refactoring of item slots

* Added contained entity

* Fixed tests

* Finished with PDA

* Moving PDA uplink to separate window

* Adding-removing uplink should show new button

* Working on a better debug

* Debug command to add uplink

* Uplink send state to UI

* Almost working UI

* Uplink correcty updates when you buy-sell items

* Ups

* Moved localization to separate file

* Minor fixes

* Removed item slots methods events

* Removed PDA owner name

* Removed one uplink event

* Deleted all uplink events

* Removed flashlight events

* Update Content.Shared/Traitor/Uplink/UplinkVisuals.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Update Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Item slots system review

* Flashlight review

* PDA to XAML

* Move UplinkMenu to seperate class, fix WeightedColors methods

* Move UI to XAML

* Moved events to entity id

* Address review

* Removed uplink extensions

* Minor fix

* Moved item slots to shared

* My bad Robust...

* Fixed pda sound

* Fixed pda tests

* Fixed pda test again

Co-authored-by: Alexander Evgrashin <evgrashin.adl@gmail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Visne <vincefvanwijk@gmail.com>
This commit is contained in:
Alex Evgrashin
2021-10-03 07:05:52 +03:00
committed by GitHub
parent 39270d3ec7
commit e5df8dbee3
50 changed files with 1815 additions and 1313 deletions

View File

@@ -2,6 +2,7 @@ using System.Threading.Tasks;
using Content.Server.Inventory.Components;
using Content.Server.Mind.Components;
using Content.Server.PDA;
using Content.Server.Traitor.Uplink.Components;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Popups;
@@ -40,7 +41,7 @@ namespace Content.Server.TraitorDeathMatch.Components
return false;
}
if (!eventArgs.Using.TryGetComponent<PDAComponent>(out var victimPDA))
if (!eventArgs.Using.TryGetComponent<UplinkComponent>(out var victimUplink))
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message",
("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-pda-message"))));
@@ -62,13 +63,13 @@ namespace Content.Server.TraitorDeathMatch.Components
}
var userPDAEntity = userInv.GetSlotItem(EquipmentSlotDefines.Slots.IDCARD)?.Owner;
PDAComponent? userPDA = null;
UplinkComponent? userUplink = null;
if (userPDAEntity != null)
if (userPDAEntity.TryGetComponent<PDAComponent>(out var userPDAComponent))
userPDA = userPDAComponent;
if (userPDAEntity.TryGetComponent<UplinkComponent>(out var userUplinkComponent))
userUplink = userUplinkComponent;
if (userPDA == null)
if (userUplink == null)
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message",
("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-pda-in-pocket-message"))));
@@ -77,8 +78,8 @@ namespace Content.Server.TraitorDeathMatch.Components
// We have finally determined both PDA components. FINALLY.
var userAccount = userPDA.SyndicateUplinkAccount;
var victimAccount = victimPDA.SyndicateUplinkAccount;
var userAccount = userUplink.UplinkAccount;
var victimAccount = victimUplink.UplinkAccount;
if (userAccount == null)
{
@@ -107,7 +108,7 @@ namespace Content.Server.TraitorDeathMatch.Components
victimAccount.ModifyAccountBalance(0);
userAccount.ModifyAccountBalance(userAccount.Balance + transferAmount);
victimPDA.Owner.Delete();
victimUplink.Owner.Delete();
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-success-message", ("tcAmount", transferAmount)));
return true;