Revert "Refactor Damage to use Protoypes (#4262)"

This reverts commit 20bf5739a9.
This commit is contained in:
Silver
2021-08-24 00:50:39 -06:00
committed by Silver
parent 20bf5739a9
commit e708091518
121 changed files with 711 additions and 10237 deletions

View File

@@ -9,10 +9,8 @@ using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Content.Server.Projectiles.Components
{
@@ -27,96 +25,33 @@ namespace Content.Server.Projectiles.Components
public override string Name => "Hitscan";
public CollisionGroup CollisionMask => (CollisionGroup) _collisionMask;
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
public override string Name => "Hitscan";
public CollisionGroup CollisionMask => (CollisionGroup) _collisionMask;
=======
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
=======
>>>>>>> refactor-damageablecomponent
[DataField("layers")] //todo WithFormat.Flags<CollisionLayer>()
private int _collisionMask = (int) CollisionGroup.Opaque;
public float Damage
{
get => _damage;
set => _damage = value;
}
[DataField("damage")]
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
private float _damage = 10f;
public DamageType DamageType => _damageType;
[DataField("damageType")]
private DamageType _damageType = DamageType.Heat;
public float MaxLength => 20.0f;
=======
public float Damage { get; set; } = 10f;
public float MaxLength => 20.0f;
>>>>>>> refactor-damageablecomponent
<<<<<<< refs/remotes/origin/master
private TimeSpan _startTime;
private TimeSpan _deathTime;
=======
[DataField("damageType", required: true)]
private string _damageTypeID = default!;
private DamageTypePrototype _damageType => _prototypeManager.Index<DamageTypePrototype>(_damageTypeID);
>>>>>>> update damagecomponent across shared and server
=======
public float Damage { get; set; } = 10f;
<<<<<<< refs/remotes/origin/master
>>>>>>> Refactor damageablecomponent update (#4406)
public float ColorModifier { get; set; } = 1.0f;
<<<<<<< HEAD
[DataField("spriteName")]
=======
public float MaxLength => 20.0f;
private TimeSpan _startTime;
private TimeSpan _deathTime;
public float ColorModifier { get; set; } = 1.0f;
[DataField("spriteName")]
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
=======
[DataField("spriteName")]
>>>>>>> refactor-damageablecomponent
private string _spriteName = "Objects/Weapons/Guns/Projectiles/laser.png";
[DataField("muzzleFlash")]
private string? _muzzleFlash;
[DataField("impactFlash")]
private string? _impactFlash;
[DataField("soundHitWall")]
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master
private SoundSpecifier _soundHitWall = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
=======
private string _soundHitWall = "/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg";
[DataField("spriteName")]
private string _spriteName = "Objects/Weapons/Guns/Projectiles/laser.png";
=======
private SoundSpecifier _soundHitWall = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
=======
private SoundSpecifier _soundHitWall = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
>>>>>>> refactor-damageablecomponent
// TODO PROTOTYPE Replace this datafield variable with prototype references, once they are supported.
// Also remove Initialize override, if no longer needed.
[DataField("damageType")]
private readonly string _damageTypeID = "Piercing";
[ViewVariables(VVAccess.ReadWrite)]
public DamageTypePrototype DamageType = default!;
protected override void Initialize()
{
base.Initialize();
DamageType = IoCManager.Resolve<IPrototypeManager>().Index<DamageTypePrototype>(_damageTypeID);
}
<<<<<<< HEAD
>>>>>>> update damagecomponent across shared and server
=======
>>>>>>> refactor-damageablecomponent
public void FireEffects(IEntity user, float distance, Angle angle, IEntity? hitEntity = null)
{

View File

@@ -13,8 +13,6 @@ namespace Content.Server.Projectiles.Components
[ComponentReference(typeof(SharedProjectileComponent))]
public class ProjectileComponent : SharedProjectileComponent
{
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
[DataField("damages")] private Dictionary<DamageType, int> _damages = new();
[ViewVariables]
@@ -23,33 +21,12 @@ namespace Content.Server.Projectiles.Components
get => _damages;
set => _damages = value;
}
=======
=======
>>>>>>> refactor-damageablecomponent
// TODO PROTOTYPE Replace this datafield variable with prototype references, once they are supported.
// This also requires changing the dictionary type and modifying ProjectileSystem.cs, which uses it.
// While thats being done, also replace "damages" -> "damageTypes" For consistency.
[DataField("damages")]
[ViewVariables(VVAccess.ReadWrite)]
public Dictionary<string, int> Damages { get; set; } = new();
<<<<<<< HEAD
>>>>>>> Refactor damageablecomponent update (#4406)
=======
>>>>>>> refactor-damageablecomponent
[DataField("deleteOnCollide")]
public bool DeleteOnCollide { get; } = true;
// Get that juicy FPS hit sound
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
[DataField("soundHit", required: true)] public SoundSpecifier? SoundHit = default!;
=======
[DataField("soundHit", required: true)] public SoundSpecifier SoundHit = default!;
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
=======
[DataField("soundHit", required: true)] public SoundSpecifier SoundHit = default!;
>>>>>>> refactor-damageablecomponent
[DataField("soundHitSpecies")] public SoundSpecifier? SoundHitSpecies = null;
public bool DamagedEntity;

View File

@@ -7,17 +7,12 @@ using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
using Content.Shared.Damage;
namespace Content.Server.Projectiles
{
[UsedImplicitly]
internal sealed class ProjectileSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override void Initialize()
{
base.Initialize();
@@ -44,27 +39,19 @@ namespace Content.Server.Projectiles
}
else
{
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
var soundHit = component.SoundHit?.GetSound();
if (!string.IsNullOrEmpty(soundHit))
SoundSystem.Play(playerFilter, soundHit, coordinates);
=======
SoundSystem.Play(playerFilter, component.SoundHit.GetSound(), coordinates);
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
=======
SoundSystem.Play(playerFilter, component.SoundHit.GetSound(), coordinates);
>>>>>>> refactor-damageablecomponent
}
if (!otherEntity.Deleted && otherEntity.TryGetComponent(out IDamageableComponent? damage))
{
EntityManager.TryGetEntity(component.Shooter, out var shooter);
foreach (var (damageTypeID, amount) in component.Damages)
foreach (var (damageType, amount) in component.Damages)
{
damage.TryChangeDamage(_prototypeManager.Index<DamageTypePrototype>(damageTypeID), amount);
damage.ChangeDamage(damageType, amount, false, shooter);
}
component.DamagedEntity = true;