-
Notifications
You must be signed in to change notification settings - Fork 146
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
Partial Armor Ignore System #659
Closed
Closed
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
999e9a3
Update DamageableSystem.cs
sanek31 090f7d0
Update DamageSpecifier.cs
sanek31 02b227c
Update DamageableComponent.cs
sanek31 0092289
Update DamageableComponent.cs
sanek31 6ca1854
Update MeleeWeaponComponent.cs
sanek31 cdd57c9
Update ProjectileComponent.cs
sanek31 428a6cd
Update DamageSpecifier.cs - apply modifier sets changes
sanek31 8af74aa
Update SharedMeleeWeaponSystem.cs - meleeweapon
sanek31 9236ab9
Update ProjectileSystem.cs - projectiles
sanek31 5bc6ed1
Merge branch 'master' into sanek31-1
sanek31 3baa1c5
Merge branch 'Simple-Station:master' into sanek31-1
sanek31 b16b555
Update SharedMeleeWeaponSystem.cs - temporal remove
sanek31 7e08450
Update ProjectileSystem.cs - temporal remove
sanek31 13a8d1e
Update DamageSpecifier.cs - remove a.m set's changes
sanek31 7aae83a
Update ProjectileComponent.cs - float? to float
sanek31 181db52
Update MeleeWeaponComponent.cs - float? to float
sanek31 eba893f
Update DamageableSystem.cs - float? to float
sanek31 270d1b6
Update DamageableSystem.cs
sanek31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,7 @@ public DamageSpecifier(DamageGroupPrototype group, FixedPoint2 value) | |
/// Only applies resistance to a damage type if it is dealing damage, not healing. | ||
/// This will never convert damage into healing. | ||
/// </remarks> | ||
public static DamageSpecifier ApplyModifierSet(DamageSpecifier damageSpec, DamageModifierSet modifierSet) | ||
public static DamageSpecifier ApplyModifierSet(DamageSpecifier damageSpec, DamageModifierSet modifierSet, float br = 1) | ||
{ | ||
// Make a copy of the given data. Don't modify the one passed to this function. I did this before, and weapons became | ||
// duller as you hit walls. Neat, but not FixedPoint2ended. And confusing, when you realize your fists don't work no | ||
|
@@ -147,10 +147,10 @@ public static DamageSpecifier ApplyModifierSet(DamageSpecifier damageSpec, Damag | |
float newValue = value.Float(); | ||
|
||
if (modifierSet.FlatReduction.TryGetValue(key, out var reduction)) | ||
newValue = Math.Max(0f, newValue - reduction); // flat reductions can't heal you | ||
newValue = Math.Max(0f, newValue - reduction*br); // flat reductions can't heal you | ||
|
||
if (modifierSet.Coefficients.TryGetValue(key, out var coefficient)) | ||
newValue *= coefficient; // coefficients can heal you, e.g. cauterizing bleeding | ||
newValue *= 1-coefficient*br; // coefficients can heal you, e.g. cauterizing bleeding | ||
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 sussy and probably will never work as intended, instead making damage heal you. |
||
|
||
if(newValue != 0) | ||
newDamage.DamageDict[key] = FixedPoint2.New(newValue); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -125,7 +125,7 @@ public void DamageChanged(EntityUid uid, DamageableComponent component, DamageSp | |||||||||||||||||||
/// null if the user had no applicable components that can take damage. | ||||||||||||||||||||
/// </returns> | ||||||||||||||||||||
public DamageSpecifier? TryChangeDamage(EntityUid? uid, DamageSpecifier damage, bool ignoreResistances = false, | ||||||||||||||||||||
bool interruptsDoAfters = true, DamageableComponent? damageable = null, EntityUid? origin = null) | ||||||||||||||||||||
bool interruptsDoAfters = true, DamageableComponent? damageable = null, EntityUid? origin = null, float? bypassResistance = null) | ||||||||||||||||||||
{ | ||||||||||||||||||||
if (!uid.HasValue || !_damageableQuery.Resolve(uid.Value, ref damageable, false)) | ||||||||||||||||||||
{ | ||||||||||||||||||||
|
@@ -150,9 +150,14 @@ public void DamageChanged(EntityUid uid, DamageableComponent component, DamageSp | |||||||||||||||||||
if (damageable.DamageModifierSetId != null && | ||||||||||||||||||||
_prototypeManager.TryIndex<DamageModifierSetPrototype>(damageable.DamageModifierSetId, out var modifierSet)) | ||||||||||||||||||||
{ | ||||||||||||||||||||
// TODO DAMAGE PERFORMANCE | ||||||||||||||||||||
// use a local private field instead of creating a new dictionary here.. | ||||||||||||||||||||
damage = DamageSpecifier.ApplyModifierSet(damage, modifierSet); | ||||||||||||||||||||
if (bypassResistance != null) | ||||||||||||||||||||
{ | ||||||||||||||||||||
damage = DamageSpecifier.ApplyModifierSet(damage, modifierSet,(float) bypassResistance); | ||||||||||||||||||||
} | ||||||||||||||||||||
else | ||||||||||||||||||||
{ | ||||||||||||||||||||
damage = DamageSpecifier.ApplyModifierSet(damage, modifierSet); | ||||||||||||||||||||
} | ||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
var ev = new DamageModifyEvent(damage, origin); | ||||||||||||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the parameter should have a meaningful name.