-
Notifications
You must be signed in to change notification settings - Fork 148
Harpy rework #646
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
base: master
Are you sure you want to change the base?
Harpy rework #646
Changes from 27 commits
affa18e
caef65d
555ccb8
38a157c
c6f124b
b528f1a
765e11e
d6ed068
f009157
0a2f782
5fde5a8
4f8f68d
f220a8a
1e2c6e3
7f6f078
aa65b83
9a27bb7
f689928
f86e144
09d0b55
014dca3
32f2473
b89e933
a6057d0
9f1ebc2
97bfb41
4a5c020
d6124b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
|
|
||
| namespace Content.Omu.Common.Proficiencies; | ||
|
|
||
| public abstract class CommonProficiencySystem : EntitySystem | ||
| { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| using Robust.Shared.Prototypes; | ||
| namespace Content.Omu.Shared.Proficiencies.Components; | ||
|
|
||
| [RegisterComponent] | ||
| public sealed partial class ProficiencyComponent : Component | ||
| { | ||
| [DataField] | ||
| public List<EntProtoId>? Items; | ||
|
|
||
| [DataField] | ||
| public float ProficiencyMultiplier { get; set; } = 1f; | ||
|
|
||
| [DataField] | ||
| public float SurgeryProficiency { get; set; } = 1f; | ||
|
|
||
| //the lower the reloadspeed modifier the faster it goes | ||
| [DataField] | ||
| public float ReloadSpeedProficiency { get; set; } = 1f; | ||
|
|
||
| [DataField] | ||
| public string? ProficiencyID; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using Robust.Shared.Prototypes; | ||
| using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
|
|
||
|
|
||
|
|
||
| namespace Content.Omu.Shared.Proficiencies; | ||
|
|
||
| [Prototype("Proficiency")] | ||
| [DataDefinition] | ||
| public sealed partial class ProficiencyPrototype : IPrototype | ||
| { | ||
|
|
||
| [IdDataField] | ||
| public string ID { get; private set; } = default!; | ||
|
|
||
| [DataField] | ||
| public List<EntProtoId>? Items; | ||
|
|
||
| [DataField] | ||
| public float ProficiencyMultiplier { get; private set; } = 1f; | ||
|
|
||
| [DataField] | ||
| public float SurgeryProficiency { get; private set; } = 1f; | ||
|
|
||
| /// <summary> | ||
| /// The lower the Reload speed modifier the faster it goes | ||
| /// </summary> | ||
| [DataField] | ||
| public float ReloadSpeedProficiency { get; private set; } = 1f; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| using Content.Shared._Shitmed.Medical.Surgery; | ||
| using Content.Shared.GameTicking; | ||
| using Content.Shared.Hands; | ||
| using Content.Shared.Tools.Components; | ||
| using Robust.Shared.Prototypes; | ||
| using Content.Shared.Weapons.Ranged.Components; | ||
| using Content.Omu.Common.Proficiencies; | ||
| using Content.Omu.Shared.Proficiencies.Components; | ||
|
|
||
| namespace Content.Omu.Shared.Proficiencies.Systems; | ||
| public sealed class ProficiencySystem : CommonProficiencySystem | ||
| { | ||
NotActuallyMarty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
NotActuallyMarty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public override void Initialize() | ||
| { | ||
| SubscribeLocalEvent<ProficiencyComponent, DidEquipHandEvent>(OnEquip); | ||
| SubscribeLocalEvent<ProficiencyComponent, DidUnequipHandEvent>(OnUnequip); | ||
| SubscribeLocalEvent<ProficiencyComponent, PlayerSpawnCompleteEvent>(OnPlayerSpawnComplete); | ||
| } | ||
|
|
||
|
|
||
| private void OnEquip(Entity<ProficiencyComponent> entity, ref DidEquipHandEvent args) | ||
| { | ||
| if (entity.Comp.Items == null | ||
| || entity.Comp.Items.Count.Equals(0)) | ||
| return; | ||
|
|
||
| var handled = false; | ||
|
|
||
| if(TryComp<BallisticAmmoProviderComponent>(args.Equipped, out var ammoComp)) | ||
| ammoComp.FillDelay *= entity.Comp.ReloadSpeedProficiency; | ||
|
|
||
| if (!TryComp<ToolComponent>(args.Equipped, out var toolComp)) | ||
| return; | ||
|
|
||
| foreach (var item in entity.Comp.Items) | ||
| { | ||
| var data = MetaData(args.Equipped); | ||
|
|
||
| if (data.EntityPrototype == null || data.EntityPrototype.ID != item.Id) | ||
| continue; | ||
|
|
||
| toolComp.SpeedModifier *= entity.Comp.ProficiencyMultiplier; | ||
| Dirty(args.Equipped, toolComp); | ||
|
|
||
| handled = true; | ||
| } | ||
| // If it isnt in the list of items buffed, debuff it instead | ||
| if (handled) | ||
| return; | ||
|
|
||
| toolComp.SpeedModifier *= MathF.Pow(entity.Comp.ProficiencyMultiplier, -1); | ||
| Dirty(args.Equipped, toolComp); | ||
| } | ||
|
|
||
| private void OnUnequip(Entity<ProficiencyComponent> entity, ref DidUnequipHandEvent args) | ||
| { | ||
| if (entity.Comp.Items == null | ||
| || entity.Comp.Items.Count.Equals(0)) | ||
| return; | ||
|
|
||
| var meta = MetaData(args.Unequipped); | ||
| if (meta.EntityPrototype == null) | ||
| return; | ||
|
|
||
| if (TryComp<ToolComponent>(args.Unequipped, out var toolComp)) | ||
| { | ||
| toolComp.SpeedModifier *= MathF.Pow(toolComp.SpeedModifier, -1); | ||
| Dirty(args.Unequipped, toolComp); | ||
| } | ||
|
|
||
| if (TryComp<BallisticAmmoProviderComponent>(args.Unequipped, out var ammoComp)) | ||
| ammoComp.FillDelay *= MathF.Pow(entity.Comp.ReloadSpeedProficiency, -1); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should not just assume that setting Check the prototype of the item, get its speedmod, and set it to that on unequip. |
||
| } | ||
|
|
||
| private void OnPlayerSpawnComplete(Entity<ProficiencyComponent> entity, ref PlayerSpawnCompleteEvent args) | ||
| { | ||
| if (args.JobId == null) | ||
| return; | ||
|
|
||
| entity.Comp.ProficiencyID = args.JobId; | ||
|
|
||
| if (!_prototypeManager.TryIndex<ProficiencyPrototype>(entity.Comp.ProficiencyID, out var proficiencyPrototype)) | ||
| return; | ||
|
Comment on lines
+80
to
+86
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See other comment, You should support multiple |
||
|
|
||
| entity.Comp.Items = proficiencyPrototype.Items; | ||
| entity.Comp.ProficiencyMultiplier = proficiencyPrototype.ProficiencyMultiplier; | ||
| entity.Comp.SurgeryProficiency = proficiencyPrototype.SurgeryProficiency; | ||
| entity.Comp.ReloadSpeedProficiency = proficiencyPrototype.ReloadSpeedProficiency; | ||
| if (entity.Comp.SurgeryProficiency == 1f) | ||
| return; | ||
|
|
||
| var surgerySpeedComp = EnsureComp<SurgerySpeedModifierComponent>(args.Mob); | ||
| surgerySpeedComp.SpeedModifier *= entity.Comp.SurgeryProficiency; | ||
|
|
||
| Dirty(args.Mob, surgerySpeedComp); | ||
| } | ||
| } | ||
NotActuallyMarty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| - type: Proficiency | ||
| id: BaseTools | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
|
|
||
| - type: Proficiency | ||
| id: advancedTools | ||
| items: | ||
| - WelderExperimental | ||
| - PowerDrill | ||
| - JawsOfLife | ||
|
|
||
| - type: Proficiency | ||
| id: BaseSci | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| proficiencyMultiplier: 1.2 | ||
| # give sci a minor surgery speed buff, robotics exists and needs surgery to function | ||
| surgeryProficiency: 1.1 | ||
|
|
||
| - type: Proficiency | ||
| id: BaseEngi | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - WelderIndustrial | ||
| - Multitool | ||
| - WelderExperimental | ||
| - PowerDrill | ||
| - JawsOfLife | ||
| proficiencyMultiplier: 1.2 | ||
|
Comment on lines
+1
to
+44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is bad. You might want to consider some type of parenting system, or listing proficiencies based on some other factor, i.e. checking for a For example, abductor tools here are not supported.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i was planning on doing this, i couldn't find a way where i could make it work at that time, but i probably just forgot something; i'll have a look into it later |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| - type: Proficiency | ||
| id: CargoTechnician | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| proficiencyMultiplier: 1.1 | ||
|
|
||
| - type: Proficiency | ||
| id: ShaftMiner | ||
| items: | ||
| - Crowbar | ||
|
Comment on lines
+1
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See other Comment about changing the base proficiencies, that way you could add a singular thing here (i.e. Ideally you should make the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, you could add more jobs to this datafield, that way you don't need multiple prototypes to set the same proficiency to multiple jobs. |
||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| proficiencyMultiplier: 1.2 | ||
|
|
||
| - type: Proficiency | ||
| id: SalvageSpecialist | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| proficiencyMultiplier: 1.2 | ||
|
|
||
| - type: Proficiency | ||
| id: Quartermaster | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| proficiencyMultiplier: 1.4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| - type: Proficiency | ||
| id: StationEngineer | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| - WelderExperimental | ||
| - PowerDrill | ||
| #- JawsOfLife | ||
| #so many buffs we can't have them ALL be fast | ||
| proficiencyMultiplier: 1.15 | ||
|
|
||
| - type: Proficiency | ||
| #basically just engi+ | ||
| id: AtmosphericsTechnician | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| - WelderExperimental | ||
| - PowerDrill | ||
| #- JawsOfLife | ||
| proficiencyMultiplier: 1.25 | ||
|
|
||
| - type: Proficiency | ||
| #basically just engi+ | ||
| id: ChiefEngineer | ||
| items: | ||
| - Crowbar | ||
| - Wrench | ||
| - Screwdriver | ||
| - Wirecutter | ||
| - Welder | ||
| - Multitool | ||
| - WelderExperimental | ||
| - PowerDrill | ||
| #- JawsOfLife | ||
| #same as RD | ||
| proficiencyMultiplier: 1.4 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| - type: Proficiency | ||
| id: MedicalDoctor | ||
| # specifying proficiency anyways to debuff tool use, go do your job and stop tiding | ||
| proficiencyMultiplier: 1.20 | ||
| surgeryProficiency: 1.25 | ||
|
|
||
| - type: Proficiency | ||
| id: Chemist | ||
| # specifying proficiency anyways to debuff tool use, go do your job and stop tiding | ||
| proficiencyMultiplier: 1.20 | ||
| surgeryProficiency: 1.25 | ||
|
|
||
| - type: Proficiency | ||
| id: Virologist | ||
| # specifying proficiency anyways to debuff tool use, go do your job and stop tiding | ||
| proficiencyMultiplier: 1.20 | ||
|
|
||
| - type: Proficiency | ||
| id: Paramedic | ||
| items: | ||
| # lets buff jaws for paramed, this could be huge and if it is feel free to come back and change it | ||
| - JawsOfLife | ||
| proficiencyMultiplier: 1.20 | ||
| surgeryProficiency: 1.10 | ||
|
|
||
| - type: Proficiency | ||
| id: ChiefMedicalOfficer | ||
| # less tool speed malus because you may need them more than docs, more surgery buff | ||
| proficiencyMultiplier: 1.10 | ||
| surgeryProficiency: 1.5 |
Uh oh!
There was an error while loading. Please reload this page.