# Conflicts: # Content.Server/Actions/Actions/DisarmAction.cs # Content.Server/Actions/Actions/ScreamAction.cs # Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs # Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs # Content.Server/Explosion/Components/FlashExplosiveComponent.cs # Content.Server/Physics/Controllers/MoverController.cs # Content.Server/Portal/Components/PortalComponent.cs # Content.Server/Portal/Components/TeleporterComponent.cs # Content.Server/Projectiles/Components/ProjectileComponent.cs # Content.Server/Singularity/Components/EmitterComponent.cs # Content.Server/Sound/EmitSoundSystem.cs # Content.Server/Stunnable/Components/StunbatonComponent.cs # Content.Server/Tools/Components/MultitoolComponent.cs # Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs # Content.Shared/Gravity/GravityComponent.cs # Content.Shared/Light/Component/SharedExpendableLightComponent.cs # Content.Shared/Maps/ContentTileDefinition.cs # Content.Shared/Slippery/SlipperyComponent.cs # Content.Shared/Standing/StandingStateComponent.cs # Resources/Prototypes/Entities/Objects/Fun/bike_horn.yml
53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Projectiles;
|
|
using Content.Shared.Sound;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Players;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Content.Server.Projectiles.Components
|
|
{
|
|
[RegisterComponent]
|
|
[ComponentReference(typeof(SharedProjectileComponent))]
|
|
public class ProjectileComponent : SharedProjectileComponent
|
|
{
|
|
[DataField("damages")] private Dictionary<DamageType, int> _damages = new();
|
|
|
|
[ViewVariables]
|
|
public Dictionary<DamageType, int> Damages
|
|
{
|
|
get => _damages;
|
|
set => _damages = value;
|
|
}
|
|
|
|
[DataField("deleteOnCollide")]
|
|
public bool DeleteOnCollide { get; } = true;
|
|
|
|
// Get that juicy FPS hit sound
|
|
[DataField("soundHit")] public string? SoundHit = default;
|
|
private SoundSpecifier _soundHit = default!;
|
|
[DataField("soundHitSpecies")] public string? SoundHitSpecies = default;
|
|
|
|
public bool DamagedEntity;
|
|
|
|
public float TimeLeft { get; set; } = 10;
|
|
|
|
/// <summary>
|
|
/// Function that makes the collision of this object ignore a specific entity so we don't collide with ourselves
|
|
/// </summary>
|
|
/// <param name="shooter"></param>
|
|
public void IgnoreEntity(IEntity shooter)
|
|
{
|
|
Shooter = shooter.Uid;
|
|
Dirty();
|
|
}
|
|
|
|
public override ComponentState GetComponentState(ICommonSession player)
|
|
{
|
|
return new ProjectileComponentState(Shooter, IgnoreShooter);
|
|
}
|
|
}
|
|
}
|