From fb4d9808483d9ce8fa20bc215e696374d9858b35 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 6 Aug 2023 11:23:38 +1000 Subject: [PATCH] Mining tweaks (#18686) So we have pickaxe, drill, crusher, and PKA (projectiles). The tier list in terms of mining speed should go: - PKA - Crusher - Pickaxe - Drill As a result: - Nerfed PKA firerate to 0.5 and bumped damage (slight DPS nerf due to meta). - Crusher bumped to 1 hit per second as PKA is still more common and also to make it better at mining. - Pickaxe is 1 hit per second and also gets structural (fireaxe should still beat it by a little bit) so it's better to break stuff than crusher but worse in combat. - Drill is 1.5 hits per second but otherwise weak. --- .../Components/GatheringToolComponent.cs | 38 ------------- Content.Server/Gatherable/GatherableSystem.cs | 53 +++---------------- .../Gatherable/GatherableDoAfterEvent.cs | 9 ---- .../Prototypes/Entities/Mobs/Species/base.yml | 4 -- .../Objects/Weapons/Guns/Basic/base_pka.yml | 2 +- .../Weapons/Guns/Projectiles/projectiles.yml | 2 +- .../Entities/Objects/Weapons/Melee/mining.yml | 13 +++-- .../Objects/Weapons/Melee/pickaxe.yml | 35 ++++++------ .../XenoArch/Effects/utility_effects.yml | 6 --- 9 files changed, 32 insertions(+), 130 deletions(-) delete mode 100644 Content.Server/Gatherable/Components/GatheringToolComponent.cs delete mode 100644 Content.Shared/Gatherable/GatherableDoAfterEvent.cs diff --git a/Content.Server/Gatherable/Components/GatheringToolComponent.cs b/Content.Server/Gatherable/Components/GatheringToolComponent.cs deleted file mode 100644 index 1d6f806904..0000000000 --- a/Content.Server/Gatherable/Components/GatheringToolComponent.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Threading; -using Content.Shared.Damage; -using Robust.Shared.Audio; - -namespace Content.Server.Gatherable.Components -{ - /// - /// When interacting with an allows it to spawn entities. - /// - [RegisterComponent] - public sealed class GatheringToolComponent : Component - { - /// - /// Sound that is made once you completed gathering - /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("sound")] - public SoundSpecifier GatheringSound { get; set; } = new SoundPathSpecifier("/Audio/Items/Mining/pickaxe.ogg"); - - /// - /// What damage should be given to objects when - /// gathered using this tool? (0 for infinite gathering) - /// - [DataField("damage", required: true)] - public DamageSpecifier Damage { get; set; } = default!; - - /// - /// How many entities can this tool gather from at once? - /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("maxEntities")] - public int MaxGatheringEntities = 1; - - [ViewVariables] - [DataField("gatheringEntities")] - public readonly List GatheringEntities = new(); - } -} diff --git a/Content.Server/Gatherable/GatherableSystem.cs b/Content.Server/Gatherable/GatherableSystem.cs index abee3e4549..3de5670380 100644 --- a/Content.Server/Gatherable/GatherableSystem.cs +++ b/Content.Server/Gatherable/GatherableSystem.cs @@ -1,10 +1,9 @@ using Content.Server.Destructible; using Content.Server.Gatherable.Components; -using Content.Shared.DoAfter; using Content.Shared.EntityList; -using Content.Shared.Gatherable; using Content.Shared.Interaction; using Content.Shared.Tag; +using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Audio; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -16,9 +15,7 @@ public sealed partial class GatherableSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly DestructibleSystem _destructible = default!; - [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; - [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly TagSystem _tagSystem = default!; public override void Initialize() @@ -26,59 +23,21 @@ public sealed partial class GatherableSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnActivate); - SubscribeLocalEvent(OnInteractUsing); - SubscribeLocalEvent(OnDoAfter); + SubscribeLocalEvent(OnAttacked); InitializeProjectile(); } - private void Gather(EntityUid gatheredUid, EntityUid user, EntityUid used, GatheringToolComponent? tool = null, GatherableComponent? component = null) + private void OnAttacked(EntityUid uid, GatherableComponent component, AttackedEvent args) { - if (!Resolve(used, ref tool, false) || !Resolve(gatheredUid, ref component, false) || - component.ToolWhitelist?.IsValid(used) == false) - { - return; - } - - // Can't gather too many entities at once. - if (tool.MaxGatheringEntities < tool.GatheringEntities.Count + 1) + if (component.ToolWhitelist?.IsValid(args.Used, EntityManager) != true) return; - var damageRequired = _destructible.DestroyedAt(gatheredUid); - var damageTime = (damageRequired / tool.Damage.Total).Float(); - damageTime = Math.Max(1f, damageTime); - - var doAfter = new DoAfterArgs(user, damageTime, new GatherableDoAfterEvent(), gatheredUid, target: gatheredUid, used: used) - { - BreakOnDamage = true, - BreakOnTargetMove = true, - BreakOnUserMove = true, - MovementThreshold = 0.25f, - }; - - _doAfterSystem.TryStartDoAfter(doAfter); + Gather(uid, args.User, component); } private void OnActivate(EntityUid uid, GatherableComponent component, ActivateInWorldEvent args) { - Gather(uid, args.User, args.User); - } - - private void OnInteractUsing(EntityUid uid, GatherableComponent component, InteractUsingEvent args) - { - Gather(uid, args.User, args.Used, component: component); - } - - private void OnDoAfter(EntityUid uid, GatherableComponent component, GatherableDoAfterEvent args) - { - if(!TryComp(args.Args.Used, out var tool)) - return; - - tool.GatheringEntities.Remove(uid); - if (args.Handled || args.Cancelled) - return; - - Gather(uid, args.Args.Used, component, tool.GatheringSound); - args.Handled = true; + Gather(uid, args.User, component); } public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, GatherableComponent? component = null, SoundSpecifier? sound = null) diff --git a/Content.Shared/Gatherable/GatherableDoAfterEvent.cs b/Content.Shared/Gatherable/GatherableDoAfterEvent.cs deleted file mode 100644 index 4944ae3ee1..0000000000 --- a/Content.Shared/Gatherable/GatherableDoAfterEvent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Content.Shared.DoAfter; -using Robust.Shared.Serialization; - -namespace Content.Shared.Gatherable; - -[Serializable, NetSerializable] -public sealed class GatherableDoAfterEvent : SimpleDoAfterEvent -{ -} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 654a86a088..bac174b060 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -34,10 +34,6 @@ - type: Polymorphable - type: Identity - type: Hands - - type: GatheringTool - damage: - types: - Structural: 50 - type: MovementSpeedModifier - type: MovedByPressure - type: Barotrauma diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/base_pka.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/base_pka.yml index d5fd65554b..3e38a3608b 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/base_pka.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/base_pka.yml @@ -14,7 +14,7 @@ - type: Wieldable wieldedInhandPrefix: null - type: Gun - fireRate: 0.75 + fireRate: 0.5 selectedMode: SemiAuto angleDecay: 45 minAngle: 44 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 89a5f6af07..f0821be2d9 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -339,7 +339,7 @@ impactEffect: BulletImpactEffectKinetic damage: types: - Blunt: 20 + Blunt: 25 # Short lifespan - type: TimedDespawn lifetime: 0.4 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml index 68303d9152..7216bebab7 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml @@ -23,23 +23,26 @@ parent: BaseWeaponCrusher id: WeaponCrusher components: + - type: Tag + tags: + - Pickaxe - type: Sprite sprite: Objects/Weapons/Melee/crusher.rsi state: icon - type: AmmoCounter - type: UseDelayOnShoot - type: UseDelay - delay: 1.9 + delay: 0.9 - type: LeechOnMarker leech: groups: Brute: -10 - type: Gun soundGunshot: /Audio/Weapons/plasma_cutter.ogg - fireRate: 0.5 + fireRate: 1 useKey: false - type: RechargeBasicEntityAmmo - rechargeCooldown: 1.5 + rechargeCooldown: 0.5 rechargeSound: path: /Audio/Weapons/Guns/MagIn/kinetic_reload.ogg - type: BasicEntityAmmoProvider @@ -47,7 +50,6 @@ capacity: 1 count: 1 - type: MeleeWeapon - attackRate: 0.75 damage: types: Blunt: 10 @@ -86,6 +88,9 @@ id: WeaponCrusherGlaive description: An early design of the proto-kinetic accelerator, in glaive form. components: + - type: Tag + tags: + - Pickaxe - type: UseDelayOnShoot - type: UseDelay delay: 1.9 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml index 36ae62c804..7d00b451d1 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml @@ -10,16 +10,21 @@ - type: Sprite sprite: Objects/Weapons/Melee/pickaxe.rsi state: pickaxe - - type: GatheringTool - damage: - types: - Structural: 50 - type: ItemCooldown - type: MeleeWeapon damage: types: - Piercing: 10 - Blunt: 4 + Piercing: 5 + Blunt: 5 + Structural: 15 + - type: Wieldable + wieldedInhandPrefix: null + - type: IncreaseDamageOnWield + damage: + types: + Blunt: 5 + Piercing: 5 + Structural: 15 - type: Item size: 24 sprite: Objects/Weapons/Melee/pickaxe.rsi @@ -36,21 +41,11 @@ - type: Sprite sprite: Objects/Tools/handdrill.rsi state: handdrill - - type: GatheringTool - damage: - types: - Structural: 75 - gatheringTime: 0.50 - MaxGatheringEntities: 2 - type: ItemCooldown - type: MeleeWeapon + attackRate: 1.5 damage: types: - Piercing: 10 - Blunt: 4 - Structural: 7 - - type: Wieldable - - type: IncreaseDamageOnWield - damage: - types: - Structural: 30 + Blunt: 5 + Piercing: 5 + Structural: 15 diff --git a/Resources/Prototypes/XenoArch/Effects/utility_effects.yml b/Resources/Prototypes/XenoArch/Effects/utility_effects.yml index 88003d7594..f819946a4d 100644 --- a/Resources/Prototypes/XenoArch/Effects/utility_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/utility_effects.yml @@ -113,12 +113,6 @@ components: - Item permanentComponents: - - type: GatheringTool - damage: - types: - Structural: 125 - gatheringTime: 0.50 - MaxGatheringEntities: 3 - type: ItemCooldown - type: MeleeWeapon damage: