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

Oni/refactor #2805

Merged
merged 11 commits into from
Feb 1, 2025
Merged

Oni/refactor #2805

merged 11 commits into from
Feb 1, 2025

Conversation

BarryNorfolk
Copy link
Contributor

@BarryNorfolk BarryNorfolk commented Jan 26, 2025

About the PR

Broke up the Oni component into four smaller ones and enabled players and gun/tool users to modify parts of the guns/tools through events.
Fixes #2708

Why / Balance

Oni code deserves a refactor because Oni are cool and I'm an Oni main.

Technical details

  • It's now in the shared directory instead of server only, should be predictable by clients now.
  • Works off of events and not direct interactions with tool/gun attributes.
  • Several components that now handle the player/user side of certain events.
  • PlayerAccuracyModifier allows for clamping of firing arcs to stop people shooting behind themselves when REALLY inaccurate.
  • Shows the full damage on melee weapon examination

Media

Examination now shows the actual damage including Oni bonuses.
image

Stamina Damage after hitting an Urist once with a stun baton (Usually 35 Stamina damage).
image

Prying speed:

Oni.-.Pry.Speed.mp4

Shooting:

Oni.-.Shooting.mp4

Requirements

  • I have tested all added content and changes.
  • I have added media to this PR or it does not require an ingame showcase.

Breaking changes

Changelog
🆑

  • fix; Refactored Oni code and broke it up into smaller chunks.
  • tweak; Oni gunshots no longer fire behind themselves.
  • add; Added PlayerAccuracyModifer, PlayerToolModifier, and BonusStaminaDamage components for use on players.

@github-actions github-actions bot added size/M 64-255 lines Changes: C# Changes any cs files labels Jan 26, 2025
@dvir001
Copy link
Contributor

dvir001 commented Jan 26, 2025

@github-actions github-actions bot added size/L 256-1023 lines and removed size/M 64-255 lines labels Jan 26, 2025
@BarryNorfolk BarryNorfolk marked this pull request as ready for review January 26, 2025 15:05
@BarryNorfolk BarryNorfolk requested a review from a team as a code owner January 26, 2025 15:05
@BarryNorfolk BarryNorfolk requested a review from a team as a code owner January 28, 2025 19:32
@github-actions github-actions bot added the Changes: YML Changes any yml files label Jan 28, 2025
@BarryNorfolk BarryNorfolk changed the title WIP: Oni/refactor Oni/refactor Jan 28, 2025
@Emily9031
Copy link
Contributor

Emily9031 commented Jan 31, 2025

I think the innacuracy of the oni aim is still wayyyy too severe. They would have to be flailing their arms around all over the place for that to happen. In my opinion, the minimum angle should be like 3 degrees, and maximum like 15 degrees.

Edit: Okay maybe I don't understand how the code for the angles works but you get what I mean.

@BarryNorfolk
Copy link
Contributor Author

I don't particularly have any thoughts about what the cone of fire should be for Oni, @Lyndomen do you have any input?
We could also get this in and tweak it later since it's now a yaml configuration parameter.

Copy link
Member

@deltanedas deltanedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add NetworkedComponent to the components now

@deltanedas deltanedas merged commit 23ae0b3 into DeltaV-Station:master Feb 1, 2025
16 checks passed
@Forzii Forzii mentioned this pull request Feb 21, 2025
4 tasks
@Forzii
Copy link

Forzii commented Feb 23, 2025

Hey uh, I went to go port this and found out the damage multiplier is applying to punches twice. I tested the master branch of Delta-V and you all have the same problem - Oni currently punch for 9.11 damage. I don't have a fix in mind yet, just wanted to let you know.

@BarryNorfolk
Copy link
Contributor Author

BarryNorfolk commented Feb 23, 2025

Oof, thanks for the report. I wonder why it's doing that.

Probably something with this:

        if (!Resolve(uid, ref component, false))
            return new DamageSpecifier();

        var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
        RaiseLocalEvent(uid, ref ev);

        // 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

where punches are the user so I didn't catch it. I'll put a fix in for this I think.

Edit:
Yep

image

@Forzii
Copy link

Forzii commented Feb 23, 2025

Oof, thanks for the report. I wonder why it's doing that.

Probably something with this:

        if (!Resolve(uid, ref component, false))
            return new DamageSpecifier();

        var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
        RaiseLocalEvent(uid, ref ev);

        // 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

where punches are the user so I didn't catch it. I'll put a fix in for this I think.

Yep, I just came to that conclusion - it's calling RaiseLocalEvent with the same uid twice because the user is the weapon when punching. Putting a check for if uid == user fixed it - ah you got it too lol.

Edit - unrelated, but I don't think you need userEv since ev and userEv are exactly the same.

@BarryNorfolk
Copy link
Contributor Author

Oof, thanks for the report. I wonder why it's doing that.
Probably something with this:

        if (!Resolve(uid, ref component, false))
            return new DamageSpecifier();

        var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
        RaiseLocalEvent(uid, ref ev);

        // 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

where punches are the user so I didn't catch it. I'll put a fix in for this I think.

Yep, I just came to that conclusion - it's calling RaiseLocalEvent with the same uid twice because the user is the weapon when punching. Putting a check for if uid == user fixed it - ah you got it too lol.

Edit - unrelated, but I don't think you need userEv since ev and userEv are exactly the same.

Yeah, don't need to but I thought it'd be nicer to have them segmented just in case there's some weird interactions. vOv purely a style thing on my part, don't know to what extent it would impact performance 🤔

@Forzii
Copy link

Forzii commented Feb 23, 2025

Oof, thanks for the report. I wonder why it's doing that.
Probably something with this:

        if (!Resolve(uid, ref component, false))
            return new DamageSpecifier();

        var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
        RaiseLocalEvent(uid, ref ev);

        // 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

where punches are the user so I didn't catch it. I'll put a fix in for this I think.

Yep, I just came to that conclusion - it's calling RaiseLocalEvent with the same uid twice because the user is the weapon when punching. Putting a check for if uid == user fixed it - ah you got it too lol.
Edit - unrelated, but I don't think you need userEv since ev and userEv are exactly the same.

Yeah, don't need to but I thought it'd be nicer to have them segmented just in case there's some weird interactions. vOv purely a style thing on my part, don't know to what extent it would impact performance 🤔

Fair enough! Since I'm taking your refector I'll take your fix too, keep us a little more in sync. Thanks for the work, it was bothering me that Oni's modifiers were so hard-coded instead of being modular systems so I was really happy when I saw this refactor.

Edit - plus fixing Oni shooting behind themselves is great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: C# Changes any cs files Changes: YML Changes any yml files S: Needs Review size/L 256-1023 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

oni shitcode needs refactoring
5 participants