Skip to content

Commit

Permalink
Merge branch 'swords' of https://github.com/AeraAuling/Delta-v-stuff
Browse files Browse the repository at this point in the history
…into swords
  • Loading branch information
AeraAuling committed Feb 1, 2025
2 parents abea10c + c43090c commit fea7835
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 114 deletions.

This file was deleted.

14 changes: 0 additions & 14 deletions Content.Server/Nyanotrasen/Abilities/Oni/OniComponent.cs

This file was deleted.

79 changes: 0 additions & 79 deletions Content.Server/Nyanotrasen/Abilities/Oni/OniSystem.cs

This file was deleted.

5 changes: 5 additions & 0 deletions Content.Shared/Damage/Systems/StaminaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ private void OnMeleeHit(EntityUid uid, StaminaDamageOnHitComponent component, Me
if (hitEvent.Handled)
return;

// Begin DeltaV additions
// Allow users to modifier stamina damage as well, this part of the event is not handle-able by listeners.
RaiseLocalEvent(args.User, hitEvent);
// End DeltaV additions

var damage = component.Damage;

damage *= hitEvent.Multiplier;
Expand Down
5 changes: 0 additions & 5 deletions Content.Shared/Nyanotrasen/Abilities/Oni/SharedOniSystem.cs

This file was deleted.

6 changes: 6 additions & 0 deletions Content.Shared/Prying/Systems/PryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ private bool StartPry(EntityUid target, EntityUid user, EntityUid? tool, float t
var modEv = new GetPryTimeModifierEvent(user);

RaiseLocalEvent(target, ref modEv);

// Begin DeltaV additions
// Also raise an event for users to modifiy the time to pry
RaiseLocalEvent(user, ref modEv);
// End DeltaV additions

var doAfterArgs = new DoAfterArgs(EntityManager, user, TimeSpan.FromSeconds(modEv.BaseTime * modEv.PryTimeModifier / toolModifier), new DoorPryDoAfterEvent(), target, target, tool)
{
BreakOnDamage = true,
Expand Down
3 changes: 1 addition & 2 deletions Content.Shared/Tools/Components/ToolComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Shared.Nyanotrasen.Abilities.Oni;
using Content.Shared.Tools.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
Expand All @@ -7,7 +6,7 @@
namespace Content.Shared.Tools.Components;

[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedToolSystem), typeof(SharedOniSystem))] // DeltaV - Allowed OniSystem access
[Access(typeof(SharedToolSystem))]
public sealed partial class ToolComponent : Component
{
[DataField]
Expand Down
8 changes: 7 additions & 1 deletion Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ public DamageSpecifier GetDamage(EntityUid uid, EntityUid user, MeleeWeaponCompo
var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
RaiseLocalEvent(uid, ref ev);

return DamageSpecifier.ApplyModifierSets(ev.Damage, ev.Modifiers);
// Begin DeltaV additions
// Allow users of melee weapons to have bonuses applied
var userEv = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
RaiseLocalEvent(user, ref userEv);

return DamageSpecifier.ApplyModifierSets(ev.Damage, ev.Modifiers.Concat(userEv.Modifiers));
// End DeltaV additions
}

public float GetAttackRate(EntityUid uid, EntityUid user, MeleeWeaponComponent? component = null)
Expand Down
11 changes: 9 additions & 2 deletions Content.Shared/Weapons/Ranged/Components/GunComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Numerics;
using Content.Shared.Nyanotrasen.Abilities.Oni; // DeltaV: Make Oni shooting guns less accurate
using Content.Shared.Weapons.Ranged.Events;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Audio;
Expand All @@ -10,7 +9,7 @@
namespace Content.Shared.Weapons.Ranged.Components;

[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), AutoGenerateComponentPause]
[Access(typeof(SharedGunSystem), typeof(SharedOniSystem))] // DeltaV - I didn't feel like rewriting big chunks of code
[Access(typeof(SharedGunSystem))]
public sealed partial class GunComponent : Component
{
#region Sound
Expand Down Expand Up @@ -145,6 +144,14 @@ public sealed partial class GunComponent : Component
[ViewVariables]
public EntityUid? Target = null;

// Begin DeltaV additions
/// <summary>
/// Who the gun is being held by
/// </summary>
[ViewVariables]
public EntityUid? Holder = null;
// End DeltaV additions

/// <summary>
/// The base value for how many shots to fire per burst.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public override void Initialize()
SubscribeLocalEvent<GunComponent, CycleModeEvent>(OnCycleMode);
SubscribeLocalEvent<GunComponent, HandSelectedEvent>(OnGunSelected);
SubscribeLocalEvent<GunComponent, MapInitEvent>(OnMapInit);

InitializeHolders(); // DeltaV
}

private void OnMapInit(Entity<GunComponent> gun, ref MapInitEvent args)
Expand Down Expand Up @@ -546,6 +548,14 @@ public void RefreshModifiers(Entity<GunComponent?> gun)
comp.ProjectileSpeed
);

// Begin DeltaV additions
// Raise an event at the user of the gun so they have a chance to modify the gun's details.
if (gun.Comp.Holder != null)
{
RaiseLocalEvent(gun.Comp.Holder.Value, ref ev);
}
// End DeltaV additions

RaiseLocalEvent(gun, ref ev);

if (comp.SoundGunshotModified != ev.SoundGunshot)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Robust.Shared.GameStates;

namespace Content.Shared._DV.Damage.Components;

/// <summary>
/// Allows entities to have additional stamina damage for their melee
/// and weapon attacks.
/// <see cref="Shared.Damage.Events.StaminaMeleeHitEvent"/>
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class BonusStaminaDamageComponent : Component
{
/// <summary>
/// Multiplies the stamina damage by this much during a stamina hit event
/// </summary>
[DataField]
public float Multiplier = 1.25f;
}
19 changes: 19 additions & 0 deletions Content.Shared/_DV/Damage/Systems/BonusStaminaDamageSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared._DV.Damage.Components;
using Content.Shared.Damage.Events;

namespace Content.Shared._DV.Damage.Systems;

public sealed partial class BonusStaminaDamageSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BonusStaminaDamageComponent, StaminaMeleeHitEvent>(OnStamHit);
}

private void OnStamHit(Entity<BonusStaminaDamageComponent> ent, ref StaminaMeleeHitEvent args)
{
args.Multiplier *= ent.Comp.Multiplier;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Robust.Shared.GameStates;

namespace Content.Shared._DV.Prying.Components;

/// <summary>
/// Alters the interaction speed of attached entity's tools.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class PlayerToolModifierComponent : Component
{
/// <summary>
/// Multiplies the time taken to perform a pry interaction on entities like
/// airlocks and doors.
/// <see cref="Shared.Prying.Components.GetPryTimeModifierEvent"/>
/// </summary>
[DataField]
public float PryTimeMultiplier = 1.0f;
}
19 changes: 19 additions & 0 deletions Content.Shared/_DV/Prying/Systems/PlayerToolModifierSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared._DV.Prying.Components;
using Content.Shared.Prying.Components;

namespace Content.Shared._DV.Prying.Systems;

public sealed partial class PlayerToolModifierSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PlayerToolModifierComponent, GetPryTimeModifierEvent>(OnPry);
}

private void OnPry(Entity<PlayerToolModifierComponent> ent, ref GetPryTimeModifierEvent args)
{
args.PryTimeModifier *= ent.Comp.PryTimeMultiplier;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Robust.Shared.GameStates;

namespace Content.Shared._DV.Weapons.Ranged.Components;

/// <summary>
/// Alters the accuracy of attached entity's held or wielded guns via
/// <see cref="Shared.Weapons.Ranged.Events.GunRefreshModifiersEvent"/>.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class PlayerAccuracyModifierComponent : Component
{
/// <summary>
/// Multiplies the Min/Max angles of a gun by this amount.
/// </summary>
[DataField]
public float SpreadMultiplier = 15f;

/// <summary>
/// Maximum angle, in degrees, an entity can shoot between.
/// After the SpreadMultiplier is applied, this clamp can stop the entity
/// from shooting behind themselves.
/// </summary>
[DataField]
public float MaxSpreadAngle = 180f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared.Weapons.Ranged.Events;
using Content.Shared._DV.Weapons.Ranged.Components;

namespace Content.Shared._DV.Weapons.Ranged.Systems;

public sealed class GunAccuracyModifierSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PlayerAccuracyModifierComponent, GunRefreshModifiersEvent>(OnGunRefreshModifiers);
}

private void OnGunRefreshModifiers(Entity<PlayerAccuracyModifierComponent> ent, ref GunRefreshModifiersEvent args)
{
var maxSpread = MathHelper.DegreesToRadians(ent.Comp.MaxSpreadAngle);
args.MinAngle = Math.Clamp(args.MinAngle * ent.Comp.SpreadMultiplier, 0f, maxSpread);
args.MaxAngle = Math.Clamp(args.MaxAngle * ent.Comp.SpreadMultiplier, 0f, maxSpread);

args.AngleIncrease *= ent.Comp.SpreadMultiplier;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Content.Shared.Hands;
using Content.Shared.Weapons.Ranged.Components;

namespace Content.Shared.Weapons.Ranged.Systems;

public abstract partial class SharedGunSystem
{
private void InitializeHolders()
{
SubscribeLocalEvent<GunComponent, GotEquippedHandEvent>(OnGunEquipped);
SubscribeLocalEvent<GunComponent, GotUnequippedHandEvent>(OnGunUnequipped);
}

private void OnGunEquipped(Entity<GunComponent> ent, ref GotEquippedHandEvent args)
{
ent.Comp.Holder = args.User;
RefreshModifiers((ent, ent));
}

private void OnGunUnequipped(Entity<GunComponent> ent, ref GotUnequippedHandEvent args)
{
ent.Comp.Holder = null;
RefreshModifiers((ent, ent));
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
reagent-effect-status-effect-PsionicallyInsulated = psionic insulation
reagent-effect-status-effect-PsionicsDisabled = inability to use psionic powers
reagent-effect-status-effect-Anesthesia = surgical anesthesia
11 changes: 9 additions & 2 deletions Resources/Prototypes/Nyanotrasen/Entities/Mobs/Species/Oni.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
species: Oni
- type: Sprite
scale: 1.2, 1.2
- type: Oni
modifiers:
- type: PlayerToolModifier
pryTimeMultiplier: 0.6
- type: PlayerAccuracyModifier
spreadMultiplier: 15
maxSpreadAngle: 180
- type: BonusStaminaDamage
multiplier: 1.25
- type: BonusMeleeDamage
damageModifierSet:
coefficients:
Blunt: 1.35
Slash: 1.2
Expand Down
Loading

0 comments on commit fea7835

Please sign in to comment.