Inline UID
This commit is contained in:
@@ -17,12 +17,12 @@ namespace Content.Server.PowerCell.Components
|
||||
|
||||
public override bool IsEntityCompatible(IEntity entity)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().HasComponent<BatteryComponent>(entity.Uid);
|
||||
return IoCManager.Resolve<IEntityManager>().HasComponent<BatteryComponent>(entity);
|
||||
}
|
||||
|
||||
protected override BatteryComponent GetBatteryFrom(IEntity entity)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(entity.Uid);
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ namespace Content.Server.PowerCell.Components
|
||||
|
||||
CurrentCharge = 0;
|
||||
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(OwnerUid, 0, heavy, light, light*2);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) Owner);
|
||||
}
|
||||
|
||||
private void UpdateVisuals()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(PowerCellVisuals.ChargeLevel, GetLevel(CurrentCharge / MaxCharge));
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Content.Server.PowerCell.Components
|
||||
get
|
||||
{
|
||||
if (_cellContainer.ContainedEntity == null) return null;
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(_cellContainer.ContainedEntity.Uid, out PowerCellComponent? cell) ? cell : null;
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(_cellContainer.ContainedEntity, out PowerCellComponent? cell) ? cell : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,14 +134,14 @@ namespace Content.Server.PowerCell.Components
|
||||
//Dirty();
|
||||
if (user != null)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user.Uid, out HandsComponent? hands) || !hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(cell.Owner.Uid)))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? hands) || !hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(cell.Owner)))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cell.Owner.Uid).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).Coordinates;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cell.Owner).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).Coordinates;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cell.Owner.Uid).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cell.Owner).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
}
|
||||
|
||||
if (playSound)
|
||||
@@ -149,7 +149,7 @@ namespace Content.Server.PowerCell.Components
|
||||
SoundSystem.Play(Filter.Pvs(Owner), CellRemoveSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(true), false);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new PowerCellChangedEvent(true), false);
|
||||
return cell;
|
||||
}
|
||||
|
||||
@@ -162,8 +162,8 @@ namespace Content.Server.PowerCell.Components
|
||||
public bool InsertCell(IEntity cell, bool playSound = true)
|
||||
{
|
||||
if (Cell != null) return false;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(cell.Uid, out (ItemComponent?) var _)) return false;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PowerCellComponent?>(cell.Uid, out var cellComponent)) return false;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent((EntityUid) cell, out (ItemComponent?) var _)) return false;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PowerCellComponent?>(cell, out var cellComponent)) return false;
|
||||
if (cellComponent.CellSize != SlotSize) return false;
|
||||
if (!_cellContainer.Insert(cell)) return false;
|
||||
//Dirty();
|
||||
@@ -172,7 +172,7 @@ namespace Content.Server.PowerCell.Components
|
||||
SoundSystem.Play(Filter.Pvs(Owner), CellInsertSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(false), false);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new PowerCellChangedEvent(false), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Content.Server.PowerCell.Components
|
||||
};
|
||||
}
|
||||
|
||||
var cell = IoCManager.Resolve<IEntityManager>().SpawnEntity(type, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||
var cell = IoCManager.Resolve<IEntityManager>().SpawnEntity(type, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_cellContainer.Insert(cell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.PowerCell
|
||||
!args.CanInteract ||
|
||||
!component.ShowVerb ||
|
||||
!component.HasCell ||
|
||||
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||
!_actionBlockerSystem.CanPickup(args.User))
|
||||
return;
|
||||
|
||||
Verb verb = new();
|
||||
@@ -47,12 +47,12 @@ namespace Content.Server.PowerCell
|
||||
!args.CanAccess ||
|
||||
!args.CanInteract ||
|
||||
component.HasCell ||
|
||||
!IoCManager.Resolve<IEntityManager>().HasComponent<PowerCellComponent>(args.Using.Uid) ||
|
||||
!_actionBlockerSystem.CanDrop(args.User.Uid))
|
||||
!IoCManager.Resolve<IEntityManager>().HasComponent<PowerCellComponent>(args.Using) ||
|
||||
!_actionBlockerSystem.CanDrop(args.User))
|
||||
return;
|
||||
|
||||
Verb verb = new();
|
||||
verb.Text = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(args.Using.Uid).EntityName;
|
||||
verb.Text = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(args.Using).EntityName;
|
||||
verb.Category = VerbCategory.Insert;
|
||||
verb.Act = () => component.InsertCell(args.Using);
|
||||
args.Verbs.Add(verb);
|
||||
|
||||
Reference in New Issue
Block a user