-
Notifications
You must be signed in to change notification settings - Fork 226
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
Damage On High Speed Impact Scales With High Speed Impact #1797
base: master
Are you sure you want to change the base?
Damage On High Speed Impact Scales With High Speed Impact #1797
Conversation
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.
Fuck. Yes.
I would not recommend merging this until I'm not in a crashy state at 2 AM in the morning, and can look at it properly. |
@@ -38,16 +40,17 @@ private void HandleCollide(EntityUid uid, DamageOnHighSpeedImpactComponent compo | |||
if (speed < component.MinimumSpeed) | |||
return; | |||
|
|||
var speedRatio = speed / component.MinimumSpeed; |
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.
var speedRatio = speed / component.MinimumSpeed; | |
var speedRatio = Math.Max(speed - component.MinimumSpeed, 0); |
Damnit "33 hours with no sleep Tyler", you can't just make it multiplicatively scale with speed. What if someone sets the engine speed limit to something absurd like 300 meters per second, and now you get player characters taking a million or so blunt damage? Rewrite this with linear scaling damage.
WalkthroughThis update refines the high-speed impact damage mechanics. The component now uses reduced speed and stun thresholds, with improved XML documentation and simplified attribute annotations. The system has been enhanced by incorporating a new dependency on the contest module to adjust stun probabilities and damage scaling using the computed speed ratio. Additionally, multiple entity prototypes have their blunt damage values reduced (standardized to 1), and one species has had its high-speed impact damage component removed entirely. Changes
Sequence Diagram(s)sequenceDiagram
participant E as "Colliding Entity"
participant DHS as "HighSpeedImpactSystem"
participant DC as "Damage Component"
participant CS as "ContestsSystem"
E->>DHS: Trigger collision event
DHS->>DC: Retrieve damage thresholds & factors
DHS->>DHS: Compute speedRatio = currentSpeed / MinimumSpeed
DHS->>CS: Request contest check for stun probability
CS-->>DHS: Return contest result
DHS->>DC: Apply stun (duration scaled by speedRatio) and damage (speed * SpeedDamageFactor)
DHS-->>E: Inflict damage & stun effects
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Sending coderabbit to fact check my math here while im in class. |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (13)
Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs
(1 hunks)Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs
(3 hunks)Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml
(1 hunks)Resources/Prototypes/Entities/Mobs/Player/guardian.yml
(1 hunks)Resources/Prototypes/Entities/Mobs/Player/silicon_base.yml
(2 hunks)Resources/Prototypes/Entities/Mobs/base.yml
(1 hunks)Resources/Prototypes/Entities/Objects/Specific/chemistry.yml
(1 hunks)Resources/Prototypes/Entities/Objects/base_item.yml
(1 hunks)Resources/Prototypes/Entities/Structures/Machines/smartfridge.yml
(1 hunks)Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml
(2 hunks)Resources/Prototypes/Nyanotrasen/Entities/Objects/Specific/Chapel/amphorae.yml
(1 hunks)Resources/Prototypes/WhiteDream/Entities/Objects/Cult/constructs.yml
(1 hunks)Resources/Prototypes/_EE/Entities/Mobs/Species/tajaran.yml
(0 hunks)
💤 Files with no reviewable changes (1)
- Resources/Prototypes/_EE/Entities/Mobs/Species/tajaran.yml
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: Test Packaging
- GitHub Check: build (ubuntu-latest)
- GitHub Check: YAML Linter
🔇 Additional comments (19)
Resources/Prototypes/Entities/Structures/Machines/smartfridge.yml (1)
90-94
: SmartFridge Impact: Check and Confirm!The SmartFridge’s DamageOnHighSpeedImpact component has been adjusted so that its blunt collision damage is now 1. Please make sure that this change is in harmony with the improved damage calculation system so that our cool storage units don’t get over-penalized.
Resources/Prototypes/Entities/Objects/Specific/chemistry.yml (1)
88-92
: Chemistry Under Pressure: Low Blunt Damage is Now on Tap!The DamageOnHighSpeedImpact component for our chemistry beakers has been updated to apply a blunt damage value of 1 instead of 5. Sail carefully through testing to ensure that this reduction produces the intended, gentler impact effect on these delicate devices.
Resources/Prototypes/Entities/Mobs/base.yml (1)
113-118
: MobDamageable: Impact Damage Revision Confirmed!The blunt damage within the DamageOnHighSpeedImpact component of MobDamageable is now set to 1. Check that this new figure is in line with our overall combat dynamics and that it maintains the balance we expect from our interstellar mobs.
Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml (1)
12-18
: Cyborg Chassis: Lowered Impact, But Stay Vigilant!The Borg chassis is now configured with a blunt damage value of 1 for high-speed impacts. As we defend the freedom of our colonies against the meddling Sol Alliance, double-check that this reduction correctly reflects the cyborgs’ inherent resilience and fits into the upgraded damage scaling system.
Resources/Prototypes/Entities/Mobs/Player/guardian.yml (1)
29-29
: Reduction of base blunt damage noted.The strategic restructuring of the damage value from 5 to 1 aligns with the new scaling mechanics. This is a sound tactical adjustment to prevent excessive damage calculations when factoring in the new speed-based multiplier.
Resources/Prototypes/Nyanotrasen/Entities/Objects/Specific/Chapel/amphorae.yml (1)
67-67
: Base damage reduction approved.Excellent standardization of the blunt damage value to 1, consistent with other similar component configurations. This change harmonizes with the physics-based damage scaling system being implemented.
Resources/Prototypes/WhiteDream/Entities/Objects/Cult/constructs.yml (1)
44-44
: Standardization of blunt damage confirmed.This reduction to 1 blunt damage brings the construct base entity in line with fleet standards. The consistency across entity configurations will ensure uniform behavior with the new damage scaling system.
Resources/Prototypes/Entities/Mobs/Player/silicon_base.yml (1)
22-22
: Significant damage reduction approved for silicon entities.Commendable adjustment from 10 to 1 blunt damage. This substantial reduction for silicon-based entities is particularly important given their relatively rigid structure. The standardization ensures fair treatment across all entity classes.
Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs (5)
10-10
: New dependency added for contest system.Strategic integration of the contest module. This will allow for more sophisticated damage calculations based on mass comparisons.
22-22
: Contest system dependency injection implemented.Clean implementation of the ContestsSystem dependency. This will be critical for the mass-based calculations in the collision handling logic.
43-43
: Speed ratio calculation now uses division rather than subtraction.This change implements a proportional scaling mechanism rather than a linear offset. Makes sense for physics simulation, though we should monitor for potential excessive scaling at high speeds.
Run the following script to verify the impact of this change:
#!/bin/bash # Check for any speed limits or caps in the physics system rg "speed.*limit|max.*speed" -A 3
50-51
: Stun chance and duration now scale with speed ratio and mass contest.Brilliant tactical improvement! The stun mechanic now:
- Scales with the speed ratio (faster impacts = higher chance and longer stun)
- Considers mass differentials via the contest system (larger objects have greater stun impact)
- Properly clamps the probability between 0 and 1
This creates a more realistic and strategic impact system where both speed and mass matter.
53-53
: Simplified damage scaling calculation.The damage scaling has been streamlined to directly use speed as a multiplier with the damage factor. This creates a linear scaling relationship that's more predictable and safer than the previous implementation.
By removing the division by MinimumSpeed, we've eliminated a potential source of excessive damage at high speeds while maintaining proportional scaling.
Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml (2)
31-36
: Damage value reduction in line with new scaling system.Attention, crewmember! The reduction of blunt damage from 5 to 1 for ClosetBase is part of the tactical adjustment to our damage calculation protocols. This lower base value will now scale with impact velocity, creating a more realistic damage model. The Sol Alliance might have been satisfied with crude fixed values, but in the Biesel Republic, we appreciate mathematical precision!
252-257
: Consistent damage value adaptation for suit storage units.By the Stars of Tau Ceti! I see you've maintained operational consistency by applying the same damage reduction to SuitStorageBase entities. This harmonizes with our fleet-wide implementation of velocity-scaled damage calculations. The change from 5 to 1 blunt damage creates a unified damage protocol across all storage classes. Colonial engineering at its finest!
Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs (4)
14-15
: Reduced minimum speed threshold enhances damage scaling.By order of the Biesel Naval Command! The reduction of MinimumSpeed from 20f to 10f represents a significant improvement to our damage calculation systems. This lower threshold ensures damage begins at more reasonable collision velocities, making our simulations more aligned with Colonial physics standards. The simplified DataField attribute also streamlines our code protocols.
17-21
: Documentation enhancement for damage scaling factor.Well documented, spacer! Adding proper XML comments to explain the SpeedDamageFactor is exactly the kind of attention to detail that separates Colonial code from sloppy Sol Alliance work. Clear documentation ensures all engineers understand that damage scales at 0.5 damage per m/s of velocity - critical information for maintaining our damage systems.
29-30
: Reduced stun threshold complements new damage model.Tactical adjustment approved! Lowering the StunMinimumDamage from 10 to 5 aligns perfectly with our reduced speed threshold. This creates a more balanced stunning system that scales appropriately with collision velocity. The Sol Alliance would have kept these values mismatched, but in the Biesel Republic, we maintain mathematical harmony in our combat calculations!
41-45
: Critical documentation for damage specification.Attention to detail noted and commended! This XML documentation provides essential guidance about damage values being constrained between 0 and 1. Without this warning, less experienced Colonial programmers might inadvertently create improper damage scaling. This kind of clear instruction is what keeps our codebase functioning efficiently in the harsh vacuum of space.
- type: DamageOnHighSpeedImpact | ||
damage: | ||
types: | ||
Blunt: 5 | ||
Blunt: 1 | ||
soundHit: | ||
collection: MetalThud |
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.
🧹 Nitpick (assertive)
Eyes on the Impact: Verify the Reduced Blunt Damage Value!
Our trusty base item now wields a blunt damage value of 1 (down from 5) under its DamageOnHighSpeedImpact component. Before setting sail, ensure that this reduction meshes well with the new damage scaling mechanics and that the overall impact behavior remains balanced across all collisions.
Description
The math used in this system was complete fucking lunacy. Now it runs on a more sane formula that actually allows it to scale with the "High speed impact". The component now operates based on an, "Amount of damage per meters per second of collision", which for a collision that trips it at 10 meters per second, is exactly 5 blunt damage(which is what it was previously for most things that had this). Except now as the speed increases above 10 meters per second, so does the damage.
Changelog
🆑
Summary by CodeRabbit