Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more dakka #307

Merged
merged 3 commits into from Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
@@ -1,7 +1,9 @@
using System;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.Utility;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;

Expand Down Expand Up @@ -37,8 +39,8 @@ public override void OnChangeData(AppearanceComponent component)
return;
}

var step = ContentHelpers.RoundToLevels(current, capacity, _steps);

// capacity is - 1 as normally a bullet is chambered so max state is virtually never hit.
var step = ContentHelpers.RoundToLevels(current, capacity - 1, _steps);
sprite.LayerSetState(0, $"{_baseState}-{step}");
}
else
Expand Down
Expand Up @@ -5,6 +5,10 @@
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
Expand All @@ -18,7 +22,21 @@ public class ProjectileComponent : Component, ICollideSpecial, ICollideBehavior

private EntityUid Shooter = EntityUid.Invalid;

public Dictionary<DamageType, int> damages = new Dictionary<DamageType, int>();
public Dictionary<DamageType, int> _damages;
metalgearsloth marked this conversation as resolved.
Show resolved Hide resolved
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;

Expand Down Expand Up @@ -53,7 +71,10 @@ void ICollideBehavior.CollideWith(List<IEntity> collidedwith)
{
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)
Expand Down
Expand Up @@ -136,6 +136,33 @@ void IMapInit.MapInit()
public enum BallisticMagazineType
{
Unspecified = 0,
A12mm,
// .32
A32,
// .357
A357,
// .44
A44,
// .45mm
A45mm,
// .50 cal
A50,
// 5.56mm
A556mm,
// 6.5mm
A65mm,
// 7.62mm
A762mm,
Maxim,
// 9mm
A9mm,
A9mmSMG,
A9mmTopMounted,
// 10mm
A10mm,
A10mmSMG,
// 20mm
A20mm,
// 24mm
A24mm,
}
}
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
Expand All @@ -12,6 +14,7 @@
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
Expand All @@ -30,10 +33,10 @@ public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse,

[ViewVariables]
private ContainerSlot _magazineSlot;
private BallisticMagazineType _magazineType;
private List<BallisticMagazineType> _magazineTypes;

[ViewVariables]
public BallisticMagazineType MagazineType => _magazineType;
public List<BallisticMagazineType> MagazineTypes => _magazineTypes;
[ViewVariables]
private IEntity Magazine => _magazineSlot.ContainedEntity;

Expand Down Expand Up @@ -65,7 +68,8 @@ public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);

serializer.DataField(ref _magazineType, "magazine", BallisticMagazineType.Unspecified);
serializer.DataField(ref _magazineTypes, "magazines",
new List<BallisticMagazineType>{BallisticMagazineType.Unspecified});
serializer.DataField(ref _defaultMagazine, "default_magazine", null);
serializer.DataField(ref _autoEjectMagazine, "auto_eject_magazine", false);
serializer.DataField(ref _autoEjectSound, "sound_auto_eject", null);
Expand Down Expand Up @@ -102,7 +106,7 @@ public bool InsertMagazine(IEntity magazine, bool playSound = true)
throw new ArgumentException("Not a magazine", nameof(magazine));
}

if (component.MagazineType != MagazineType)
if (!MagazineTypes.Contains(component.MagazineType))
{
throw new ArgumentException("Wrong magazine type", nameof(magazine));
}
Expand Down Expand Up @@ -170,7 +174,7 @@ protected override void CycleChamberedBullet(int chamber)
var entity = RemoveFromChamber(chamber);
entity.Transform.GridPosition = Owner.Transform.GridPosition;
entity.Transform.LocalRotation = _bulletDropRandom.Pick(_randomBulletDirs).ToAngle();
var effect = $"/Audio/items/weapons/casingfall{_bulletDropRandom.Next(1, 4)}.ogg";
var effect = $"/Audio/Guns/Casings/casingfall{_bulletDropRandom.Next(1, 4)}.ogg";
Owner.GetComponent<SoundComponent>().Play(effect, AudioParams.Default.WithVolume(-3));

if (Magazine != null)
Expand Down Expand Up @@ -223,7 +227,7 @@ public bool AttackBy(AttackByEventArgs eventArgs)
return false;
}

if (component.MagazineType != MagazineType || component.Caliber != Caliber)
if (!MagazineTypes.Contains(component.MagazineType) || component.Caliber != Caliber)
{
Owner.PopupMessage(eventArgs.User, "Magazine doesn't fit.");
return false;
Expand Down
Expand Up @@ -21,9 +21,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
{
public abstract class ProjectileWeaponComponent : Component
{
private float _velocity = 20f;
private float _spreadStdDev = 3;
private bool _spread = true;
private string _soundGunshot;

#pragma warning disable 649
[Dependency] private IRobustRandom _spreadRandom;
Expand Down Expand Up @@ -57,6 +57,7 @@ public override void ExposeData(ObjectSerializer serializer)

serializer.DataField(ref _spread, "spread", true);
serializer.DataField(ref _spreadStdDev, "spreadstddev", 3);
serializer.DataField(ref _soundGunshot, "sound_gunshot", "/Audio/Guns/Gunshots/smg.ogg");
}

private void Fire(IEntity user, GridCoordinates clickLocation)
Expand Down Expand Up @@ -85,15 +86,16 @@ private void Fire(IEntity user, GridCoordinates clickLocation)

//Give it the velocity we fire from this weapon, and make sure it doesn't shoot our character
projectile.GetComponent<ProjectileComponent>().IgnoreEntity(user);
var velocity = projectile.GetComponent<ProjectileComponent>().Velocity;

//Give it the velocity this weapon gives to things it fires from itself
projectile.GetComponent<PhysicsComponent>().LinearVelocity = angle.ToVec() * _velocity;
projectile.GetComponent<PhysicsComponent>().LinearVelocity = angle.ToVec() * velocity;

//Rotate the bullets sprite to the correct direction, from north facing I guess
projectile.Transform.LocalRotation = angle.Theta;

// Sound!
Owner.GetComponent<SoundComponent>().Play("/Audio/gunshot_c20.ogg");
Owner.GetComponent<SoundComponent>().Play(_soundGunshot);
}

/// <summary>
Expand All @@ -105,6 +107,29 @@ private void Fire(IEntity user, GridCoordinates clickLocation)
public enum BallisticCaliber
{
Unspecified = 0,
A12mm,
// .32
A32,
// .357
A357,
// .44
A44,
// .45mm
A45mm,
// .50 cal
A50,
// 5.56mm
A556mm,
// 6.5mm
A65mm,
// 7.62mm
A762mm,
// 9mm
A9mm,
// 10mm
A10mm,
// 20mm
A20mm,
// 24mm
A24mm,
}
}
2 changes: 1 addition & 1 deletion Content.Shared/Utility/ContentHelpers.cs
Expand Up @@ -47,7 +47,7 @@ public static int RoundToLevels(double actual, double max, int levels)
}

var preround = toOne * (levels - 1);
if (toOne <= threshold)
if (toOne <= threshold || levels == 2)
{
return (int)Math.Ceiling(preround);
}
Expand Down
Binary file added Resources/Audio/guns/Cock/batrifle_cock.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/Cock/lmg_cock.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/Cock/ltrifle_cock.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/Cock/sfrifle_cock.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/Empty/lmg_empty.ogg
Binary file not shown.
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/batrifle_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/hpistol_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/lmg_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/ltrifle_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/m41_reload.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/pistol_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/revolver_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/rifle_load.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagIn/sfrifle_magin.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/batrifle_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/hpistol_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/lmg_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/ltrifle_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/pistol_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/revolver_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/sfrifle_magout.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/MagOut/shotgun_insert.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/batrifle.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/hpistol.ogg
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/lmg.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/ltrifle.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/pistol.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/revolver.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/rifle.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/rifle2.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/shotgun.ogg
Binary file not shown.
Binary file added Resources/Audio/guns/gunshots/silenced.ogg
Binary file not shown.
File renamed without changes.
Binary file added Resources/Audio/guns/gunshots/sniper.ogg
Binary file not shown.
62 changes: 62 additions & 0 deletions Resources/Audio/guns/sources.json
@@ -0,0 +1,62 @@
{
"description": "Using a .json makes it easier to tell if sounds have duplicate sources",
"Casings": {
"casingfall1.ogg": "https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/casingfall1.ogg",
"casingfall2.ogg": "https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/casingfall2.ogg",
"casingfall3.ogg": "https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/casingfall3.ogg"
},
"Cock": {
"batrifle_cock.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/batrifle_cock.ogg",
"lmg_cock.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/lmg_cock.ogg",
"ltrifle_cock.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/ltrifle_cock.ogg",
"sfrifle_cock.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/sfrifle_cock.ogg"
},
"Empty": {
"empty.ogg": "https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/gun_empty.ogg",
"lmg_empty.ogg": "https://github.com/vgstation-coders/vgstation13/blob/217aa33a41e891e144ceec710fbe1877df747adb/sound/weapons/empty.ogg"
},
"EmptyAlarm": {
"lmg_empty_alarm.ogg": "Soniss.com GDC 2019 Game Audio Bundle, gizmo_alarm_loop_001.wav",
"smg_empty_alarm.ogg": "https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/smg_empty_alarm.ogg"
},
"Gunshots": {
"batrifle.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/batrifle_fire.ogg",
"hpistol.ogg": "",
"laser.ogg": "",
"laser_cannon.ogg": "",
"laser_cannon2.ogg": "soniss.com GDC 2019 Game Audio Bundle, PM_CNDP_23.wav",
"lmg.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/lmg_fire.ogg",
"ltrifle.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/ltrifle_fire.ogg",
"pistol.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/pistol_fire.ogg",
"revolver.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/revolver_fire.ogg",
"rifle.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/m41_shoot.ogg",
"rifle2.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/sfrifle_fire.ogg",
"shotgun.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/shotgunp_fire.ogg",
"silenced.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/Gunshot_silenced.wav",
"smg.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/smg_fire.ogg",
"sniper.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/fire/sniper_fire.ogg"
},
"MagIn": {
"batrifle_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/batrifle_magin.ogg",
"hpistol_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/hpistol_magin.ogg",
"lmg_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/lmg_magin.ogg",
"ltrifle_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/ltrifle_magin.ogg",
"m41_reload.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/m41_reload.ogg",
"pistol_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/pistol_magin.ogg",
"rifle_load.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/rifle_load.ogg",
"sfrifle_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/sfrifle_magin.ogg",
"smg_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/smg_magin.ogg",
"revolver_magin.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/rev_magin.ogg",
"shotgun_insert.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/shotgun_insert.ogg"
},
"MagOut": {
"batrifle_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/batrifle_magout.ogg",
"hpistol_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/hpistol_magout.ogg",
"lmg_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/lmg_magout.ogg",
"ltrifle_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/ltrifle_magout.ogg",
"pistol_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/pistol_magout.ogg",
"revolver_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/rev_magout.ogg",
"sfrifle_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/sfrifle_magout.ogg",
"smg_magout.ogg": "https://github.com/discordia-space/CEV-Eris/blob/01f7518e0f8177734a6579aba2bbf76024aa96c4/sound/weapons/guns/interact/smg_magout.ogg"
}
}
10 changes: 0 additions & 10 deletions Resources/Audio/items/weapons/sources.txt

This file was deleted.

6 changes: 3 additions & 3 deletions Resources/Maps/stationstation.yml
Expand Up @@ -2096,7 +2096,7 @@ entities:
entities: []
type: Robust.Server.GameObjects.Components.Container.Container
type: ContainerContainer
- type: magazine_12mm_filled
- type: magazine_10mm_smg
uid: 267
components:
- grid: 0
Expand All @@ -2108,7 +2108,7 @@ entities:
entities: []
type: Robust.Server.GameObjects.Components.Container.Container
type: ContainerContainer
- type: magazine_12mm_filled
- type: magazine_10mm_smg
uid: 268
components:
- grid: 0
Expand All @@ -2120,7 +2120,7 @@ entities:
entities: []
type: Robust.Server.GameObjects.Components.Container.Container
type: ContainerContainer
- type: magazine_12mm_filled
- type: magazine_10mm_smg
uid: 269
components:
- grid: 0
Expand Down