Я ебал NetEntity

This commit is contained in:
Aviu00
2024-01-19 13:14:12 +03:00
parent 14d9955ff9
commit 3cf07dd8a4
17 changed files with 48 additions and 80 deletions

View File

@@ -35,7 +35,6 @@ using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using TerraFX.Interop.Windows;
using static Robust.Client.UserInterface.Controls.BoxContainer; using static Robust.Client.UserInterface.Controls.BoxContainer;
using Direction = Robust.Shared.Maths.Direction; using Direction = Robust.Shared.Maths.Direction;

View File

@@ -182,9 +182,9 @@ namespace Content.Client.White.Radials;
public SortedSet<Radial> GetRadials(EntityUid target, EntityUid user, List<Type> verbTypes, public SortedSet<Radial> GetRadials(EntityUid target, EntityUid user, List<Type> verbTypes,
bool force = false) bool force = false)
{ {
if (!target.IsClientSide()) if (!IsClientSide(target))
{ {
RaiseNetworkEvent(new RequestServerRadialsEvent(target, verbTypes, adminRequest: force)); RaiseNetworkEvent(new RequestServerRadialsEvent(GetNetEntity(target), verbTypes, adminRequest: force));
} }
// Some admin menu interactions will try get verbs for entities that have not yet been sent to the player. // Some admin menu interactions will try get verbs for entities that have not yet been sent to the player.
@@ -216,10 +216,10 @@ namespace Content.Client.White.Radials;
return; return;
} }
if (radial.ClientExclusive || target.IsClientSide()) if (radial.ClientExclusive || IsClientSide(target))
ExecuteRadial(radial, user.Value, target); ExecuteRadial(radial, user.Value, target);
else else
EntityManager.RaisePredictiveEvent(new ExecuteRadialEvent(target, radial)); EntityManager.RaisePredictiveEvent(new ExecuteRadialEvent(GetNetEntity(target), radial));
} }
private void HandleRadialsResponse(RadialsResponseEvent msg) private void HandleRadialsResponse(RadialsResponseEvent msg)

View File

@@ -22,6 +22,7 @@ public sealed class RadialUIController : UIController, IOnStateEntered<GameplayS
{ {
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
//[Dependency] private readonly ContextMenuUIController _context = default!; //[Dependency] private readonly ContextMenuUIController _context = default!;
[UISystemDependency] private readonly CombatModeSystem _combatMode = default!; [UISystemDependency] private readonly CombatModeSystem _combatMode = default!;
@@ -108,7 +109,7 @@ public sealed class RadialUIController : UIController, IOnStateEntered<GameplayS
private void HandleVerbsResponse(RadialsResponseEvent msg) private void HandleVerbsResponse(RadialsResponseEvent msg)
{ {
if (OpenMenu == null || CurrentTarget != msg.Entity) if (OpenMenu == null || CurrentTarget != _entityManager.GetEntity(msg.Entity))
return; return;
if (msg.Radials == null) if (msg.Radials == null)

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.Graphics; using Robust.Client.Graphics;

View File

@@ -1,4 +1,5 @@
using System.Linq; using System.Linq;
using System.Numerics;
using Content.Client.Gameplay; using Content.Client.Gameplay;
using Content.Client.Resources; using Content.Client.Resources;
using Content.Client.Viewport; using Content.Client.Viewport;

View File

@@ -10,6 +10,7 @@ using Content.Shared.CCVar;
using Content.Shared.Humanoid.Prototypes; using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences; using Content.Shared.Preferences;
using Content.Shared.Roles; using Content.Shared.Roles;
using Robust.Server.Player;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Player; using Robust.Shared.Player;

View File

@@ -6,7 +6,7 @@ namespace Content.Server.White.CriminalRecords;
public sealed class CriminalRecordsServerSystem : EntitySystem public sealed class CriminalRecordsServerSystem : EntitySystem
{ {
[Dependency] private readonly PVSOverrideSystem _pvsSys = default!; [Dependency] private readonly PvsOverrideSystem _pvsSys = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -22,6 +22,6 @@ public sealed class CriminalRecordsServerSystem : EntitySystem
private void OnCompRemove(EntityUid uid, CriminalRecordsServerComponent component, ComponentRemove args) private void OnCompRemove(EntityUid uid, CriminalRecordsServerComponent component, ComponentRemove args)
{ {
_pvsSys.ClearOverride(uid); _pvsSys.ClearOverride(GetNetEntity(uid));
} }
} }

View File

@@ -26,9 +26,9 @@ public sealed class RadialSystem : SharedRadialSystem
private void HandleRadialRequest(RequestServerRadialsEvent args, EntitySessionEventArgs eventArgs) private void HandleRadialRequest(RequestServerRadialsEvent args, EntitySessionEventArgs eventArgs)
{ {
var player = (IPlayerSession) eventArgs.SenderSession; var player = eventArgs.SenderSession;
if (!EntityManager.EntityExists(args.EntityUid)) if (!EntityManager.EntityExists(GetEntity(args.EntityUid)))
{ {
Logger.Warning($"{nameof(HandleRadialRequest)} called on a non-existent entity with id {args.EntityUid} by player {player}."); Logger.Warning($"{nameof(HandleRadialRequest)} called on a non-existent entity with id {args.EntityUid} by player {player}.");
return; return;
@@ -44,8 +44,7 @@ public sealed class RadialSystem : SharedRadialSystem
// this, and some verbs (e.g. view variables) won't even care about whether an entity is accessible through // this, and some verbs (e.g. view variables) won't even care about whether an entity is accessible through
// the entity menu or not. // the entity menu or not.
var force = args.AdminRequest && eventArgs.SenderSession is IPlayerSession playerSession && var force = args.AdminRequest && _adminMgr.HasAdminFlag(eventArgs.SenderSession, AdminFlags.Admin);
_adminMgr.HasAdminFlag(playerSession, AdminFlags.Admin);
List<Type> radialsTypes = new(); List<Type> radialsTypes = new();
foreach (var key in args.RadialTypes) foreach (var key in args.RadialTypes)
@@ -59,7 +58,7 @@ public sealed class RadialSystem : SharedRadialSystem
} }
var response = var response =
new RadialsResponseEvent(args.EntityUid, GetLocalRadials(args.EntityUid, attached, radialsTypes, force)); new RadialsResponseEvent(args.EntityUid, GetLocalRadials(GetEntity(args.EntityUid), attached, radialsTypes, force));
RaiseNetworkEvent(response, player.ConnectedClient); RaiseNetworkEvent(response, player.ConnectedClient);
} }

View File

@@ -40,7 +40,7 @@ namespace Content.Shared.White.Radials;
public int Priority; public int Priority;
public EntityUid? IconEntity; public NetEntity? IconEntity;
public bool? CloseMenu; public bool? CloseMenu;

View File

@@ -11,15 +11,15 @@ namespace Content.Shared.White.Radials;
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class RequestServerRadialsEvent : EntityEventArgs public sealed class RequestServerRadialsEvent : EntityEventArgs
{ {
public readonly EntityUid EntityUid; public readonly NetEntity EntityUid;
public readonly List<string> RadialTypes = new(); public readonly List<string> RadialTypes = new();
public readonly EntityUid? SlotOwner; public readonly NetEntity? SlotOwner;
public readonly bool AdminRequest; public readonly bool AdminRequest;
public RequestServerRadialsEvent(EntityUid entityUid, IEnumerable<Type> radialTypes, EntityUid? slotOwner = null, bool adminRequest = false) public RequestServerRadialsEvent(NetEntity entityUid, IEnumerable<Type> radialTypes, NetEntity? slotOwner = null, bool adminRequest = false)
{ {
EntityUid = entityUid; EntityUid = entityUid;
SlotOwner = slotOwner; SlotOwner = slotOwner;
@@ -37,9 +37,9 @@ namespace Content.Shared.White.Radials;
public sealed class RadialsResponseEvent : EntityEventArgs public sealed class RadialsResponseEvent : EntityEventArgs
{ {
public readonly List<Radial>? Radials; public readonly List<Radial>? Radials;
public readonly EntityUid Entity; public readonly NetEntity Entity;
public RadialsResponseEvent(EntityUid entity, SortedSet<Radial>? radials) public RadialsResponseEvent(NetEntity entity, SortedSet<Radial>? radials)
{ {
Entity = entity; Entity = entity;
@@ -53,10 +53,10 @@ namespace Content.Shared.White.Radials;
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class ExecuteRadialEvent : EntityEventArgs public sealed class ExecuteRadialEvent : EntityEventArgs
{ {
public readonly EntityUid Target; public readonly NetEntity Target;
public readonly Radial RequestedRadial; public readonly Radial RequestedRadial;
public ExecuteRadialEvent(EntityUid target, Radial requestedRadial) public ExecuteRadialEvent(NetEntity target, Radial requestedRadial)
{ {
Target = target; Target = target;
RequestedRadial = requestedRadial; RequestedRadial = requestedRadial;

View File

@@ -25,13 +25,13 @@ public abstract class SharedRadialSystem : EntitySystem
if (user == null) if (user == null)
return; return;
if (Deleted(args.Target) || Deleted(user)) if (Deleted(GetEntity(args.Target)) || Deleted(user))
return; return;
var radials = GetLocalRadials(args.Target, user.Value, args.RequestedRadial.GetType()); var radials = GetLocalRadials(GetEntity(args.Target), user.Value, args.RequestedRadial.GetType());
if (radials.TryGetValue(args.RequestedRadial, out var radial)) if (radials.TryGetValue(args.RequestedRadial, out var radial))
ExecuteRadial(radial, user.Value, args.Target); ExecuteRadial(radial, user.Value, GetEntity(args.Target));
} }
/// <summary> /// <summary>

View File

@@ -85,6 +85,8 @@
- type: IgnoreUIRange - type: IgnoreUIRange
- type: ShowSecurityIcons - type: ShowSecurityIcons
- type: ShowHealthIcons - type: ShowHealthIcons
damageContainers:
- Biological
- type: ShowWhiteHealthBars - type: ShowWhiteHealthBars
- type: entity - type: entity

View File

@@ -557,45 +557,6 @@
name: centcom clipboard name: centcom clipboard
description: A luxurious clipboard upholstered with green velvet. Often seen carried by CentCom officials, seldom seen actually used. description: A luxurious clipboard upholstered with green velvet. Often seen carried by CentCom officials, seldom seen actually used.
- type: entity
name: lawyer's rubber stamp
parent: BaseItem
id: RubberStampLawyer
description: A rubber stamp for stamping important documents.
components:
- type: Stamp
stampedName: stamp-component-stamped-name-lawyer
stampState: "paper_stamp-lawyer"
- type: Sprite
sprite: Objects/Misc/bureaucracy.rsi
state: stamp-lawyer
- type: Item
size: Small
- type: entity
name: captain's rubber stamp
parent: RubberStampMime
id: RubberStampCaptain
components:
- type: Sprite
sprite: Objects/Misc/cc-clipboard.rsi
layers:
- state: clipboard
- state: clipboard_paper
map: ["clipboard_paper"]
visible: false
- state: clipboard_pen
map: ["clipboard_pen"]
visible: false
- state: clipboard_over
- type: Item
sprite: Objects/Misc/cc-clipboard.rsi
size: Small
- type: Clothing
slots: [belt]
quickEquip: false
sprite: Objects/Misc/cc-clipboard.rsi
- type: entity - type: entity
id: BoxFolderQmClipboard id: BoxFolderQmClipboard
parent: BoxFolderBase parent: BoxFolderBase

View File

@@ -245,3 +245,18 @@
stampState: "paper_stamp-deny" stampState: "paper_stamp-deny"
- type: Sprite - type: Sprite
state: stamp-deny state: stamp-deny
- type: entity
name: lawyer's rubber stamp
parent: RubberStampBase
id: RubberStampLawyer
suffix: DO NOT MAP
description: A rubber stamp for stamping important documents.
components:
- type: Stamp
stampedName: stamp-component-stamped-name-lawyer
stampedColor: "#a23e3e"
stampState: "paper_stamp-lawyer"
- type: Sprite
sprite: Objects/Misc/bureaucracy.rsi
state: stamp-lawyer

View File

@@ -425,18 +425,6 @@
sprite: Objects/Consumable/Drinks/rewriter.rsi sprite: Objects/Consumable/Drinks/rewriter.rsi
state: icon state: icon
- type: reagent
id: TheMartinez
name: reagent-name-the-martinez
parent: BaseDrink
desc: reagent-desc-the-martinez
physicalDesc: reagent-physical-desc-vibrant
flavor: themartinez
color: "#75b1f0"
metamorphicSprite:
sprite: Objects/Consumable/Drinks/the_martinez.rsi
state: icon
- type: reagent - type: reagent
id: Kvass id: Kvass
name: reagent-name-kvass name: reagent-name-kvass

View File

@@ -3,7 +3,7 @@
id: EmoteActionFlip id: EmoteActionFlip
name: emote-flip-action-name name: emote-flip-action-name
description: emote-flip-action-description description: emote-flip-action-description
nospawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
icon: White/Actions/EmoteFlip.png icon: White/Actions/EmoteFlip.png
@@ -15,7 +15,7 @@
id: EmoteActionJump id: EmoteActionJump
name: emote-jump-action-name name: emote-jump-action-name
description: emote-jump-action-description description: emote-jump-action-description
nospawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
icon: White/Actions/EmoteJump.png icon: White/Actions/EmoteJump.png
@@ -27,7 +27,7 @@
id: EmoteActionTurn id: EmoteActionTurn
name: emote-turn-action-name name: emote-turn-action-name
description: emote-turn-action-description description: emote-turn-action-description
nospawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
icon: White/Actions/EmoteTurn.png icon: White/Actions/EmoteTurn.png

View File

@@ -2,7 +2,7 @@
id: EatMouse id: EatMouse
name: Eat mouse name: Eat mouse
description: Eat the mouse in your hand, receiving nutrients and a hairball charge. description: Eat the mouse in your hand, receiving nutrients and a hairball charge.
nospawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
icon: White/Icons/verbiconfangs.png icon: White/Icons/verbiconfangs.png
@@ -12,7 +12,7 @@
id: HairballAction id: HairballAction
name: Cough up a hairball. name: Cough up a hairball.
description: People don't like that. description: People don't like that.
nospawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
icon: icon: