Add more dakka (#307)

* Add more dakka

Some slight codebase changes to facilitate more robust behaviour.

* Update Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs

Co-Authored-By: Pieter-Jan Briers <pieterjan.briers@gmail.com>

* Remix last stereo to mono

hpistol + ltrifle
This commit is contained in:
metalgearsloth
2019-08-22 19:08:32 +10:00
committed by Pieter-Jan Briers
parent 44fdf4022e
commit 9431011ba5
816 changed files with 6969 additions and 139 deletions

View File

@@ -5,6 +5,10 @@ using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.GameObjects;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using Robust.Shared.Interfaces.Physics;
namespace Content.Server.GameObjects.Components.Projectiles
@@ -18,7 +22,23 @@ namespace Content.Server.GameObjects.Components.Projectiles
private EntityUid Shooter = EntityUid.Invalid;
public Dictionary<DamageType, int> damages = new Dictionary<DamageType, int>();
private Dictionary<DamageType, int> _damages;
[ViewVariables]
public Dictionary<DamageType, int> Damages => _damages;
private float _velocity;
public float Velocity
{
get => _velocity;
set => _velocity = value;
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
// If not specified 0 damage
serializer.DataField(ref _damages, "damages", new Dictionary<DamageType, int>());
serializer.DataField(ref _velocity, "velocity", 20f);
}
public float TimeLeft { get; set; } = 10;
@@ -53,7 +73,10 @@ namespace Content.Server.GameObjects.Components.Projectiles
{
if (entity.TryGetComponent(out DamageableComponent damage))
{
damage.TakeDamage(DamageType.Brute, 10);
foreach (var damageType in _damages)
{
damage.TakeDamage(damageType.Key, damageType.Value);
}
}
if (entity.TryGetComponent(out CameraRecoilComponent recoilComponent)