mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
# Description
Fixes the attack values of mining weapons which were messed up in the
Wizmerge.
For the pickaxe, I reverted all damage values to be the same as before.
For the mining drill however, I opted to keep the rapid fire rate
because it was an interesting effect and just added the extra range from
pre-wizmerge and the throwing damage back. I also **greatly reduced the
mining drill's stamina cost** because it was a common complaint among
players.
Before the wizmerge, the mining weapons (pickaxe and drill) were in
`Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml` but
they got moved to
`Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml` and
thus the EE-specific changes got wiped.
Also fixes a subtle bug in `SharedMeleeWeaponSystem.OnMeleeSelected`,
responsible for resetting the cooldown of a melee weapon upon selecting
it, that treated attack rate as attacks per second as opposed to seconds
per attack :
```diff
private void OnMeleeSelected(EntityUid uid, MeleeWeaponComponent component, HandSelectedEvent args)
{
...
- var minimum = curTime + TimeSpan.FromSeconds(1 / attackRate);
+ var minimum = curTime + TimeSpan.FromSeconds(GetAttackRate(uid, args.User, component));
if (minimum < component.NextAttack)
return;
component.NextAttack = minimum;
DirtyField(uid, component, nameof(MeleeWeaponComponent.NextAttack));
}
```
Bug above was particularly noticeable for weapons with a very fast
attack rate like the mining drill and north stars, which caused the
`NextAttack` delay on select to be 4 seconds instead of 0.25 seconds.
Another subtle issue, the Goliath's attack rate field was `0.75` but the
field was set from Wizden and means attacks per second, not seconds per
attack so I changed it `1.33`.
## Media
**Pickaxe**
<img width=300px
src="https://github.com/user-attachments/assets/8bf1290e-6506-4ac8-9b8b-2bb23a2013b6">
**Mining Drill**
<img width=300px
src="https://github.com/user-attachments/assets/2f852a29-7b58-4e33-8264-67bab87254fd">
**Diamond Tipped Mining Drill**
<img width=300px
src="https://github.com/user-attachments/assets/750fa019-17dc-4d21-900c-88526c873771">
**Mining with Mining Drill**
https://github.com/user-attachments/assets/a9822ccb-c991-4341-a076-fd89a8689e0c
## Changelog
🆑 Skubman
- fix: The mining drill now has a fast fire rate and extra range again.
- fix: The pickaxe and the mining drill can now be used as throwing
weapons again.
- fix: Fixed a bug where selecting weapons with a fast attack rate took
a few seconds before you could attack with them.
- fix: Fixed the Goliath attacking too fast.
- tweak: The power attack stamina cost of mining drills has been reduced
to 0.7 stamina.
- tweak: Re-adjusted the damage of the pickaxe.
(cherry picked from commit 64c11963c6db0b6ea7c7bb576903c777d57b4256)
69 lines
2.7 KiB
C#
69 lines
2.7 KiB
C#
using Content.Shared.Camera;
|
|
using Content.Shared.CombatMode.Pacification;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Damage.Events;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Effects;
|
|
using Content.Shared.Item.ItemToggle.Components;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Projectiles;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Throwing;
|
|
using Content.Shared.Weapons.Melee;
|
|
using Content.Server.Weapons.Melee;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Physics.Components;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Damage.Systems
|
|
{
|
|
public sealed class DamageOtherOnHitSystem : SharedDamageOtherOnHitSystem
|
|
{
|
|
[Dependency] private readonly DamageExamineSystem _damageExamine = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
[Dependency] private readonly StaminaSystem _stamina = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<StaminaComponent, BeforeThrowEvent>(OnBeforeThrow, after: [typeof(PacificationSystem)]);
|
|
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine, after: [typeof(MeleeWeaponSystem)]);
|
|
}
|
|
|
|
private void OnBeforeThrow(EntityUid uid, StaminaComponent component, ref BeforeThrowEvent args)
|
|
{
|
|
if (args.Cancelled || !TryComp<DamageOtherOnHitComponent>(args.ItemUid, out var damage))
|
|
return;
|
|
|
|
if (component.CritThreshold - component.StaminaDamage <= damage.StaminaCost)
|
|
{
|
|
args.Cancelled = true;
|
|
_popup.PopupEntity(Loc.GetString("throw-no-stamina", ("item", args.ItemUid)), uid, uid);
|
|
return;
|
|
}
|
|
|
|
_stamina.TakeStaminaDamage(uid, damage.StaminaCost, component, visual: false);
|
|
}
|
|
|
|
private void OnDamageExamine(EntityUid uid, DamageOtherOnHitComponent component, ref DamageExamineEvent args)
|
|
{
|
|
_damageExamine.AddDamageExamine(args.Message, GetDamage(uid, component, args.User), Loc.GetString("damage-throw"));
|
|
|
|
if (component.StaminaCost == 0)
|
|
return;
|
|
|
|
var staminaCostMarkup = FormattedMessage.FromMarkupOrThrow(
|
|
Loc.GetString("damage-stamina-cost",
|
|
("type", Loc.GetString("damage-throw")), ("cost", Math.Round(component.StaminaCost, 2).ToString("0.##"))));
|
|
args.Message.PushNewline();
|
|
args.Message.AddMessage(staminaCostMarkup);
|
|
}
|
|
}
|
|
}
|