Repository navigation
Ramp up HVLI damage over 1U - #2855
Conversation
| { | ||
| public: | ||
| float lifetime = 1.0; | ||
| float initial_lifetime = 1.0; |
There was a problem hiding this comment.
I see why you added this. But I don't like the naming now.
I think it would be better to now have:
float alive_for = 0.0;
float maximum = 1.0;
And then count up in the system. This gives no way for a bad invariant. As with your implementation you could have that lifetime is bigger then initial_lifetime.
This also makes it less error prone to use. As you only need to set 1 value after creating the component.
There was a problem hiding this comment.
Updated PR to use this naming convention, and also break LifeTime out into a dedicated system, which resolves a comment in MissileSystem that it didn't belong there. This does minorly change the fields exposed to LUA (lifetime.lifetime -> lifetime.maximum) but no scripts in master access that directly.
There was a problem hiding this comment.
I give no guarantee over direct component API stability, as how hard this is linked to the C++ implementation, I do want to have the ability to change that. So that is no problem.
| void LifeTimeSystem::update(float delta) | ||
| { | ||
| if (game_server) { | ||
| // TODO: Not really part of missile |
There was a problem hiding this comment.
this comment can now be removed :) glad you cleaned up my messy bit.
For Legacy Compatibility, this PR restores the damage ramp-up for HVLI missiles in a way that I believe is extensible if missile type config gets pulled out of the C++ code.
This adds a
initial_lifetimemember to the LifeTime component to calculate how long an entity has existed.This adds a 'full_damage_after` member to the ExplodeOnTouch component, which is used to calculate lifetime before full damage is applied.
For HVLI, the
full_damage_afteris calculated based on the time for the projectile to travel 1000 units (1U), based on tube size.