Cleanup some events.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We do have enough things in the stack, so remove them and set the output result to true.
|
// We do have enough things in the stack, so remove them and set the output result to true.
|
||||||
RaiseLocalEvent(uid, new StackChangeCountEvent(stack.Count - args.Amount));
|
RaiseLocalEvent(uid, new StackChangeCountEvent(stack.Count - args.Amount), false);
|
||||||
args.Result = true;
|
args.Result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
: stack.Owner.Prototype?.ID ?? null;
|
: stack.Owner.Prototype?.ID ?? null;
|
||||||
|
|
||||||
// Remove the amount of things we want to split from the original stack...
|
// Remove the amount of things we want to split from the original stack...
|
||||||
RaiseLocalEvent(uid, new StackChangeCountEvent(stack.Count - args.Amount));
|
RaiseLocalEvent(uid, new StackChangeCountEvent(stack.Count - args.Amount), false);
|
||||||
|
|
||||||
// Set the output parameter in the event instance to the newly split stack.
|
// Set the output parameter in the event instance to the newly split stack.
|
||||||
args.Result = EntityManager.SpawnEntity(prototype, args.SpawnPosition);
|
args.Result = EntityManager.SpawnEntity(prototype, args.SpawnPosition);
|
||||||
@@ -78,7 +78,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
if (args.Result.TryGetComponent(out StackComponent? stackComp))
|
if (args.Result.TryGetComponent(out StackComponent? stackComp))
|
||||||
{
|
{
|
||||||
// Set the split stack's count.
|
// Set the split stack's count.
|
||||||
RaiseLocalEvent(args.Result.Uid, new StackChangeCountEvent(args.Amount));
|
RaiseLocalEvent(args.Result.Uid, new StackChangeCountEvent(args.Amount), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
var stack = args.Result.GetComponent<StackComponent>();
|
var stack = args.Result.GetComponent<StackComponent>();
|
||||||
|
|
||||||
// And finally, set the correct amount!
|
// And finally, set the correct amount!
|
||||||
RaiseLocalEvent(args.Result.Uid, new StackChangeCountEvent(args.Amount));
|
RaiseLocalEvent(args.Result.Uid, new StackChangeCountEvent(args.Amount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStackInteractUsing(EntityUid uid, StackComponent stack, InteractUsingEvent args)
|
private void OnStackInteractUsing(EntityUid uid, StackComponent stack, InteractUsingEvent args)
|
||||||
@@ -109,8 +109,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var toTransfer = Math.Min(stack.Count, otherStack.AvailableSpace);
|
var toTransfer = Math.Min(stack.Count, otherStack.AvailableSpace);
|
||||||
RaiseLocalEvent(uid, new StackChangeCountEvent(stack.Count - toTransfer));
|
RaiseLocalEvent(uid, new StackChangeCountEvent(stack.Count - toTransfer), false);
|
||||||
RaiseLocalEvent(args.Used.Uid, new StackChangeCountEvent(otherStack.Count + toTransfer));
|
RaiseLocalEvent(args.Used.Uid, new StackChangeCountEvent(otherStack.Count + toTransfer), false);
|
||||||
|
|
||||||
var popupPos = args.ClickLocation;
|
var popupPos = args.ClickLocation;
|
||||||
if (!popupPos.IsValid(EntityManager))
|
if (!popupPos.IsValid(EntityManager))
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
message.PushColor(Color.DarkGray);
|
message.PushColor(Color.DarkGray);
|
||||||
|
|
||||||
// Raise the event and let things that subscribe to it change the message...
|
// Raise the event and let things that subscribe to it change the message...
|
||||||
RaiseLocalEvent(entity.Uid, new ExaminedEvent(message, examiner, IsInDetailsRange(examiner, entity)));
|
RaiseLocalEvent(entity.Uid, new ExaminedEvent(message, entity, examiner, IsInDetailsRange(examiner, entity)));
|
||||||
|
|
||||||
//Add component statuses from components that report one
|
//Add component statuses from components that report one
|
||||||
foreach (var examineComponent in entity.GetAllComponents<IExamine>())
|
foreach (var examineComponent in entity.GetAllComponents<IExamine>())
|
||||||
@@ -228,14 +228,20 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity Examiner { get; }
|
public IEntity Examiner { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Entity being examined, for broadcast event purposes.
|
||||||
|
/// </summary>
|
||||||
|
public IEntity Examined { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the examiner is in range of the entity to get some extra details.
|
/// Whether the examiner is in range of the entity to get some extra details.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsInDetailsRange { get; }
|
public bool IsInDetailsRange { get; }
|
||||||
|
|
||||||
public ExaminedEvent(FormattedMessage message, IEntity examiner, bool isInDetailsRange)
|
public ExaminedEvent(FormattedMessage message, IEntity examined, IEntity examiner, bool isInDetailsRange)
|
||||||
{
|
{
|
||||||
Message = message;
|
Message = message;
|
||||||
|
Examined = examined;
|
||||||
Examiner = examiner;
|
Examiner = examiner;
|
||||||
IsInDetailsRange = isInDetailsRange;
|
IsInDetailsRange = isInDetailsRange;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user