Merge branch 'master' into 2020-04-28-tool-component
# Conflicts: # Content.Server/GameObjects/Components/AnchorableComponent.cs # Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs # Content.Server/GameObjects/Components/Interactable/Tools/CrowbarComponent.cs # Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs # Content.Server/GameObjects/Components/WiresComponent.cs # Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs # Resources/Prototypes/Entities/Items/tools.yml
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Content.Shared.Interfaces;
|
||||
@@ -58,28 +59,22 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
|
||||
[Verb]
|
||||
private sealed class InsertVerb : Verb<PowerCellChargerComponent>
|
||||
{
|
||||
protected override string GetText(IEntity user, PowerCellChargerComponent component)
|
||||
{
|
||||
if (!user.TryGetComponent(out HandsComponent handsComponent) || handsComponent.GetActiveHand == null)
|
||||
{
|
||||
return "Insert";
|
||||
}
|
||||
return $"Insert {handsComponent.GetActiveHand.Owner.Name}";
|
||||
}
|
||||
|
||||
protected override VerbVisibility GetVisibility(IEntity user, PowerCellChargerComponent component)
|
||||
protected override void GetData(IEntity user, PowerCellChargerComponent component, VerbData data)
|
||||
{
|
||||
if (!user.TryGetComponent(out HandsComponent handsComponent))
|
||||
{
|
||||
return VerbVisibility.Invisible;
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
}
|
||||
|
||||
if (component._container.ContainedEntity != null || handsComponent.GetActiveHand == null)
|
||||
{
|
||||
return VerbVisibility.Disabled;
|
||||
data.Visibility = VerbVisibility.Disabled;
|
||||
data.Text = "Insert";
|
||||
return;
|
||||
}
|
||||
|
||||
return VerbVisibility.Visible;
|
||||
data.Text = $"Insert {handsComponent.GetActiveHand.Owner.Name}";
|
||||
}
|
||||
|
||||
protected override void Activate(IEntity user, PowerCellChargerComponent component)
|
||||
@@ -102,22 +97,16 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
|
||||
[Verb]
|
||||
private sealed class EjectVerb : Verb<PowerCellChargerComponent>
|
||||
{
|
||||
protected override string GetText(IEntity user, PowerCellChargerComponent component)
|
||||
protected override void GetData(IEntity user, PowerCellChargerComponent component, VerbData data)
|
||||
{
|
||||
if (component._container.ContainedEntity == null)
|
||||
{
|
||||
return "Eject";
|
||||
data.Text = "Eject";
|
||||
data.Visibility = VerbVisibility.Disabled;
|
||||
return;
|
||||
}
|
||||
return $"Eject {component._container.ContainedEntity.Name}";
|
||||
}
|
||||
|
||||
protected override VerbVisibility GetVisibility(IEntity user, PowerCellChargerComponent component)
|
||||
{
|
||||
if (component._container.ContainedEntity == null)
|
||||
{
|
||||
return VerbVisibility.Disabled;
|
||||
}
|
||||
return VerbVisibility.Visible;
|
||||
data.Text = $"Eject {component._container.ContainedEntity.Name}";
|
||||
}
|
||||
|
||||
protected override void Activate(IEntity user, PowerCellChargerComponent component)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Content.Shared.Interfaces;
|
||||
@@ -48,28 +49,27 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
|
||||
[Verb]
|
||||
private sealed class InsertVerb : Verb<WeaponCapacitorChargerComponent>
|
||||
{
|
||||
protected override string GetText(IEntity user, WeaponCapacitorChargerComponent component)
|
||||
{
|
||||
if (!user.TryGetComponent(out HandsComponent handsComponent) || handsComponent.GetActiveHand == null)
|
||||
{
|
||||
return "Insert";
|
||||
}
|
||||
return $"Insert {handsComponent.GetActiveHand.Owner.Name}";
|
||||
}
|
||||
|
||||
protected override VerbVisibility GetVisibility(IEntity user, WeaponCapacitorChargerComponent component)
|
||||
protected override void GetData(IEntity user, WeaponCapacitorChargerComponent component, VerbData data)
|
||||
{
|
||||
if (!user.TryGetComponent(out HandsComponent handsComponent))
|
||||
{
|
||||
return VerbVisibility.Invisible;
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
}
|
||||
|
||||
if (component._container.ContainedEntity != null || handsComponent.GetActiveHand == null)
|
||||
if (handsComponent.GetActiveHand == null)
|
||||
{
|
||||
return VerbVisibility.Disabled;
|
||||
data.Visibility = VerbVisibility.Disabled;
|
||||
data.Text = "Insert";
|
||||
return;
|
||||
}
|
||||
|
||||
return VerbVisibility.Visible;
|
||||
if (component._container.ContainedEntity != null)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Disabled;
|
||||
}
|
||||
|
||||
data.Text = $"Insert {handsComponent.GetActiveHand.Owner.Name}";
|
||||
}
|
||||
|
||||
protected override void Activate(IEntity user, WeaponCapacitorChargerComponent component)
|
||||
@@ -92,22 +92,16 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
|
||||
[Verb]
|
||||
private sealed class EjectVerb : Verb<WeaponCapacitorChargerComponent>
|
||||
{
|
||||
protected override string GetText(IEntity user, WeaponCapacitorChargerComponent component)
|
||||
protected override void GetData(IEntity user, WeaponCapacitorChargerComponent component, VerbData data)
|
||||
{
|
||||
if (component._container.ContainedEntity == null)
|
||||
{
|
||||
return "Eject";
|
||||
data.Visibility = VerbVisibility.Disabled;
|
||||
data.Text = "Eject";
|
||||
return;
|
||||
}
|
||||
return $"Eject {component._container.ContainedEntity.Name}";
|
||||
}
|
||||
|
||||
protected override VerbVisibility GetVisibility(IEntity user, WeaponCapacitorChargerComponent component)
|
||||
{
|
||||
if (component._container.ContainedEntity == null)
|
||||
{
|
||||
return VerbVisibility.Disabled;
|
||||
}
|
||||
return VerbVisibility.Visible;
|
||||
data.Text = $"Eject {component._container.ContainedEntity.Name}";
|
||||
}
|
||||
|
||||
protected override void Activate(IEntity user, WeaponCapacitorChargerComponent component)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,6 +13,7 @@ using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
@@ -126,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>("glassbreak");
|
||||
var file = _random.Pick(soundCollection.PickFiles);
|
||||
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>().Play(file, Owner);
|
||||
EntitySystem.Get<AudioSystem>().Play(file, Owner);
|
||||
|
||||
State = LightBulbState.Broken;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Server.Utility;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components.Transform;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
@@ -15,8 +17,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
public Powernet()
|
||||
{
|
||||
var EntitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var powerSystem = EntitySystemManager.GetEntitySystem<PowerSystem>();
|
||||
var powerSystem = EntitySystem.Get<PowerSystem>();
|
||||
powerSystem.Powernets.Add(this);
|
||||
Uid = powerSystem.NewUid();
|
||||
}
|
||||
@@ -374,8 +375,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
/// </summary>
|
||||
private void RemoveFromSystem()
|
||||
{
|
||||
var EntitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
||||
EntitySystemManager.GetEntitySystem<PowerSystem>().Powernets.Remove(this);
|
||||
EntitySystem.Get<PowerSystem>().Powernets.Remove(this);
|
||||
}
|
||||
|
||||
#region Registration
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -25,6 +26,8 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
/// <inheritdoc />
|
||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||
|
||||
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GridID, out var grid))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user