Predicted internals (#33800)
* Predicted gas pumps I wanted to try out atmos and first thing I found. * a * Atmos device prediction - Canisters - Tanks - Internals AirMixes aren't predicted so nothing on that front but all the UIs should be a lot closer. * Remove details range * Gas tank prediction * Even more sweeping changes * Alerts * rehg * Popup fix * Fix merge conflicts * Fix * Review
This commit is contained in:
@@ -29,7 +29,10 @@ public sealed class MaskSystem : EntitySystem
|
||||
private void OnGetActions(EntityUid uid, MaskComponent component, GetItemActionsEvent args)
|
||||
{
|
||||
if (_inventorySystem.InSlotWithFlags(uid, SlotFlags.MASK))
|
||||
{
|
||||
args.AddAction(ref component.ToggleActionEntity, component.ToggleAction);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToggleMask(Entity<MaskComponent> ent, ref ToggleMaskEvent args)
|
||||
@@ -59,8 +62,27 @@ public sealed class MaskSystem : EntitySystem
|
||||
|
||||
private void OnGotUnequipped(EntityUid uid, MaskComponent mask, GotUnequippedEvent args)
|
||||
{
|
||||
// Masks are currently always un-toggled when unequipped.
|
||||
SetToggled((uid, mask), false);
|
||||
if (!mask.IsToggled || !mask.IsToggleable)
|
||||
return;
|
||||
|
||||
mask.IsToggled = false;
|
||||
ToggleMaskComponents(uid, mask, args.Equipee, mask.EquippedPrefix, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called after setting IsToggled, raises events and dirties.
|
||||
/// </summary>
|
||||
private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, string? equippedPrefix = null, bool isEquip = false)
|
||||
{
|
||||
Dirty(uid, mask);
|
||||
if (mask.ToggleActionEntity is {} action)
|
||||
_actionSystem.SetToggled(action, mask.IsToggled);
|
||||
|
||||
var maskEv = new ItemMaskToggledEvent((wearer, mask), wearer);
|
||||
RaiseLocalEvent(uid, ref maskEv);
|
||||
|
||||
var wearerEv = new WearerMaskToggledEvent((wearer, mask));
|
||||
RaiseLocalEvent(wearer, ref wearerEv);
|
||||
}
|
||||
|
||||
private void OnFolded(Entity<MaskComponent> ent, ref FoldedEvent args)
|
||||
|
||||
Reference in New Issue
Block a user