Fix Antimatter engine maths and overplacing (#2736)
* Antimatter engine parts can't be placed overlapping * Antimatter engine stability maths fixed * Antimatter engine: Clean up some unused stuff
This commit is contained in:
@@ -85,11 +85,12 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
||||
}
|
||||
|
||||
_jarSlot.ContainedEntity.TryGetComponent<AMEFuelContainerComponent>(out var fuelJar);
|
||||
if(fuelJar != null && _powerSupplier != null && fuelJar.FuelAmount > InjectionAmount)
|
||||
if(fuelJar != null && _powerSupplier != null)
|
||||
{
|
||||
_powerSupplier.SupplyRate = group.InjectFuel(InjectionAmount);
|
||||
fuelJar.FuelAmount -= InjectionAmount;
|
||||
InjectSound();
|
||||
var availableInject = fuelJar.FuelAmount >= InjectionAmount ? InjectionAmount : fuelJar.FuelAmount;
|
||||
_powerSupplier.SupplyRate = group.InjectFuel(availableInject, out var overloading);
|
||||
fuelJar.FuelAmount -= availableInject;
|
||||
InjectSound(overloading);
|
||||
UpdateUserInterface();
|
||||
}
|
||||
|
||||
@@ -315,9 +316,9 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
||||
|
||||
}
|
||||
|
||||
private void InjectSound()
|
||||
private void InjectSound(bool overloading)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/bang.ogg", Owner, AudioParams.Default.WithVolume(0f));
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/bang.ogg", Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
@@ -35,8 +36,12 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
||||
{
|
||||
|
||||
var mapGrid = _mapManager.GetGrid(args.ClickLocation.GetGridId(_serverEntityManager));
|
||||
var tile = mapGrid.GetTileRef(args.ClickLocation);
|
||||
var snapPos = mapGrid.SnapGridCellFor(args.ClickLocation, SnapGridOffset.Center);
|
||||
if (mapGrid.GetSnapGridCell(snapPos, SnapGridOffset.Center).Any(sc => sc.Owner.HasComponent<AMEShieldComponent>()))
|
||||
{
|
||||
Owner.PopupMessage(args.User, Loc.GetString("Shielding is already there!"));
|
||||
return true;
|
||||
}
|
||||
|
||||
var ent = _serverEntityManager.SpawnEntity("AMEShielding", mapGrid.GridTileToLocal(snapPos));
|
||||
ent.Transform.LocalRotation = Owner.Transform.LocalRotation;
|
||||
|
||||
@@ -26,11 +26,6 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
||||
Owner.TryGetComponent(out _pointLight);
|
||||
}
|
||||
|
||||
internal void OnUpdate(float frameTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetCore()
|
||||
{
|
||||
if(_isCore) { return; }
|
||||
|
||||
Reference in New Issue
Block a user