This renames the CauseSplashDamage function to CauseDamageOverArea as that is more generic (viz. DeathDamage and D1838).
Grepped for occurences of CauseSplashDamage.
Details
- Reviewers
wraitii bb - Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP22486: Rename "CauseSplashDamage" to the more generic "CauseDamageOverArea"
Check that everything works the same as before.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 23| 23| let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | 24| 24| let turnLength = cmpTimer.GetLatestTurnLength(); | 25| 25| return new Vector3D( | 26| |- (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | | 26|+ (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | 27| 27| 0, | 28| 28| (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | 29| 29| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 24| 24| let turnLength = cmpTimer.GetLatestTurnLength(); | 25| 25| return new Vector3D( | 26| 26| (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | 27| |- 0, | | 27|+ 0, | 28| 28| (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | 29| 29| }; | 30| 30| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 25| 25| return new Vector3D( | 26| 26| (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | 27| 27| 0, | 28| |- (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | | 28|+ (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | 29| 29| }; | 30| 30| | 31| 31| /** | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 112| 112| | 113| 113| // Do this first in case the direct hit kills the target | 114| 114| if (data.isSplash) | 115| |- { | | 115|+ | 116| 116| this.CauseAreaDamage({ | 117| 117| "attacker": data.attacker, | 118| 118| "origin": Vector2D.from3D(data.position), | 125| 125| "type": data.type, | 126| 126| "attackerOwner": data.attackerOwner | 127| 127| }); | 128| |- } | | 128|+ | 129| 129| | 130| 130| let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager); | 131| 131| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 218| 218| damageMultiplier = 0; | 219| 219| } | 220| 220| else // In case someone calls this function with an invalid shape. | 221| |- { | | 221|+ | 222| 222| warn("The " + data.shape + " splash damage shape is not implemented!"); | 223| |- } | | 223|+ | 224| 224| | 225| 225| if (data.splashBonus) | 226| 226| damageMultiplier *= GetDamageBonus(data.attacker, ent, data.type, data.splashBonus); | | [NORMAL] ESLintBear (quote-props): | | Unquoted property 'turnLength' found. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 25| 25| | 26| 26| let cmpDamage = ConstructComponent(SYSTEM_ENTITY, "Damage"); | 27| 27| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer"); | 28| |- cmpTimer.OnUpdate({ turnLength: 1 }); | | 28|+ cmpTimer.OnUpdate({ "turnLength": 1 }); | 29| 29| let attacker = 11; | 30| 30| let atkPlayerEntity = 1; | 31| 31| let attackerOwner = 6; | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 63| 63| "position": targetPos, | 64| 64| "isSplash": false, | 65| 65| "projectileId": 9, | 66| |- "direction": new Vector3D(1,0,0) | | 66|+ "direction": new Vector3D(1, 0,0) | 67| 67| }; | 68| 68| | 69| 69| AddMock(atkPlayerEntity, IID_Player, { | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 63| 63| "position": targetPos, | 64| 64| "isSplash": false, | 65| 65| "projectileId": 9, | 66| |- "direction": new Vector3D(1,0,0) | | 66|+ "direction": new Vector3D(1,0, 0) | 67| 67| }; | 68| 68| | 69| 69| AddMock(atkPlayerEntity, IID_Player, { | | [NORMAL] ESLintBear (quote-props): | | Unquoted property 'turnLength' found. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 114| 114| | 115| 115| function TestDamage() | 116| 116| { | 117| |- cmpTimer.OnUpdate({ turnLength: 1 }); | | 117|+ cmpTimer.OnUpdate({ "turnLength": 1 }); | 118| 118| TS_ASSERT(damageTaken); | 119| 119| damageTaken = false; | 120| 120| } | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'hack'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 156| 156| "origin": origin, | 157| 157| "radius": 10, | 158| 158| "shape": "Linear", | 159| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 159|+ "strengths": { "hack": 100, "pierce" : 0, "crush": 0 }, | 160| 160| "direction": new Vector3D(1, 747, 0), | 161| 161| "playersToDamage": [2], | 162| 162| "type": "Ranged", | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'pierce'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 156| 156| "origin": origin, | 157| 157| "radius": 10, | 158| 158| "shape": "Linear", | 159| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 159|+ "strengths": { "hack" : 100, "pierce": 0, "crush": 0 }, | 160| 160| "direction": new Vector3D(1, 747, 0), | 161| 161| "playersToDamage": [2], | 162| 162| "type": "Ranged", | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 163| 163| "attackerOwner": attackerOwner | 164| 164| }; | 165| 165| | 166| |- let fallOff = function(x,y) | | 166|+ let fallOff = function(x, y) | 167| 167| { | 168| 168| return (1 - x * x / (data.radius * data.radius)) * (1 - 25 * y * y / (data.radius * data.radius)); | 169| 169| }; | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'hack'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 315| 315| "origin": new Vector2D(3, 4), | 316| 316| "radius": radius, | 317| 317| "shape": "Circular", | 318| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 318|+ "strengths": { "hack": 100, "pierce" : 0, "crush": 0 }, | 319| 319| "playersToDamage": [2], | 320| 320| "type": "Ranged", | 321| 321| "attackerOwner": 1 | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'pierce'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 315| 315| "origin": new Vector2D(3, 4), | 316| 316| "radius": radius, | 317| 317| "shape": "Circular", | 318| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 318|+ "strengths": { "hack" : 100, "pierce": 0, "crush": 0 }, | 319| 319| "playersToDamage": [2], | 320| 320| "type": "Ranged", | 321| 321| "attackerOwner": 1 binaries/data/mods/public/simulation/components/tests/test_Damage.js | 125| » type·=·data.type·=·"Ranged"; | | [NORMAL] ESLintBear (no-multi-assign): | | Unexpected chained assignment. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/45/display/redirect
If it is to be changed, shouldn't *all* occurrences of “splash” then be replaced with “area”?
Well, I think that the term "splash" is still correct in many places. It is splash damage that a projectile causes, right? You're more proficient with language ;)
I agree though that regarding DeathDamage it should probably be replaced.
Actually “splash” implies a liquid (the word itself is an onomatopoeia), so I'm not sure it is the most appropiate term for anything we use in 0 A.D.; anyway, that's probably outside the scope of this patch.
I merely chimed in here because I'm curious as to why you think this particular occurrence has to be renamed.
Thanks for the info! It might be in scope to change it then, but I guess that needs a team decision.
While working on proximity damage (D1838) I was pointed to the fact that my CauseProximityDamage-function can use the CauseSplashDamage-function instead. Then I thought it was weird for a trampling horse to cause "splash" damage, so I reckoned it was a good idea to rename the latter function to something more generic.
Splash Damage is common enough to appear in the wiki glossary of video game terms, so arguably it's a standard term. The alternative would be I guess "area-of-effect damage", which is just clunky. 'Area damage' is unclear.
I would agree that CauseSplashDamage is actually a generic handler for dealing damage in an area, but I would call it CauseDamageOverArea instead, since that's more explicit. In this particular function, SplashDamage is somewhat misleading since it implies a 'main' projectile which isn't needed at all.
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 23| 23| let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | 24| 24| let turnLength = cmpTimer.GetLatestTurnLength(); | 25| 25| return new Vector3D( | 26| |- (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | | 26|+ (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | 27| 27| 0, | 28| 28| (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | 29| 29| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 24| 24| let turnLength = cmpTimer.GetLatestTurnLength(); | 25| 25| return new Vector3D( | 26| 26| (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | 27| |- 0, | | 27|+ 0, | 28| 28| (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | 29| 29| }; | 30| 30| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 25| 25| return new Vector3D( | 26| 26| (curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength, | 27| 27| 0, | 28| |- (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | | 28|+ (curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength); | 29| 29| }; | 30| 30| | 31| 31| /** | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 112| 112| | 113| 113| // Do this first in case the direct hit kills the target | 114| 114| if (data.isSplash) | 115| |- { | | 115|+ | 116| 116| this.CauseDamageOverArea({ | 117| 117| "attacker": data.attacker, | 118| 118| "origin": Vector2D.from3D(data.position), | 125| 125| "type": data.type, | 126| 126| "attackerOwner": data.attackerOwner | 127| 127| }); | 128| |- } | | 128|+ | 129| 129| | 130| 130| let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager); | 131| 131| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Damage.js | 218| 218| damageMultiplier = 0; | 219| 219| } | 220| 220| else // In case someone calls this function with an invalid shape. | 221| |- { | | 221|+ | 222| 222| warn("The " + data.shape + " splash damage shape is not implemented!"); | 223| |- } | | 223|+ | 224| 224| | 225| 225| if (data.splashBonus) | 226| 226| damageMultiplier *= GetDamageBonus(data.attacker, ent, data.type, data.splashBonus); | | [NORMAL] ESLintBear (quote-props): | | Unquoted property 'turnLength' found. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 25| 25| | 26| 26| let cmpDamage = ConstructComponent(SYSTEM_ENTITY, "Damage"); | 27| 27| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer"); | 28| |- cmpTimer.OnUpdate({ turnLength: 1 }); | | 28|+ cmpTimer.OnUpdate({ "turnLength": 1 }); | 29| 29| let attacker = 11; | 30| 30| let atkPlayerEntity = 1; | 31| 31| let attackerOwner = 6; | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 63| 63| "position": targetPos, | 64| 64| "isSplash": false, | 65| 65| "projectileId": 9, | 66| |- "direction": new Vector3D(1,0,0) | | 66|+ "direction": new Vector3D(1, 0,0) | 67| 67| }; | 68| 68| | 69| 69| AddMock(atkPlayerEntity, IID_Player, { | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 63| 63| "position": targetPos, | 64| 64| "isSplash": false, | 65| 65| "projectileId": 9, | 66| |- "direction": new Vector3D(1,0,0) | | 66|+ "direction": new Vector3D(1,0, 0) | 67| 67| }; | 68| 68| | 69| 69| AddMock(atkPlayerEntity, IID_Player, { | | [NORMAL] ESLintBear (quote-props): | | Unquoted property 'turnLength' found. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 114| 114| | 115| 115| function TestDamage() | 116| 116| { | 117| |- cmpTimer.OnUpdate({ turnLength: 1 }); | | 117|+ cmpTimer.OnUpdate({ "turnLength": 1 }); | 118| 118| TS_ASSERT(damageTaken); | 119| 119| damageTaken = false; | 120| 120| } | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'hack'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 156| 156| "origin": origin, | 157| 157| "radius": 10, | 158| 158| "shape": "Linear", | 159| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 159|+ "strengths": { "hack": 100, "pierce" : 0, "crush": 0 }, | 160| 160| "direction": new Vector3D(1, 747, 0), | 161| 161| "playersToDamage": [2], | 162| 162| "type": "Ranged", | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'pierce'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 156| 156| "origin": origin, | 157| 157| "radius": 10, | 158| 158| "shape": "Linear", | 159| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 159|+ "strengths": { "hack" : 100, "pierce": 0, "crush": 0 }, | 160| 160| "direction": new Vector3D(1, 747, 0), | 161| 161| "playersToDamage": [2], | 162| 162| "type": "Ranged", | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 163| 163| "attackerOwner": attackerOwner | 164| 164| }; | 165| 165| | 166| |- let fallOff = function(x,y) | | 166|+ let fallOff = function(x, y) | 167| 167| { | 168| 168| return (1 - x * x / (data.radius * data.radius)) * (1 - 25 * y * y / (data.radius * data.radius)); | 169| 169| }; | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'hack'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 315| 315| "origin": new Vector2D(3, 4), | 316| 316| "radius": radius, | 317| 317| "shape": "Circular", | 318| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 318|+ "strengths": { "hack": 100, "pierce" : 0, "crush": 0 }, | 319| 319| "playersToDamage": [2], | 320| 320| "type": "Ranged", | 321| 321| "attackerOwner": 1 | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'pierce'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js | 315| 315| "origin": new Vector2D(3, 4), | 316| 316| "radius": radius, | 317| 317| "shape": "Circular", | 318| |- "strengths": { "hack" : 100, "pierce" : 0, "crush": 0 }, | | 318|+ "strengths": { "hack" : 100, "pierce": 0, "crush": 0 }, | 319| 319| "playersToDamage": [2], | 320| 320| "type": "Ranged", | 321| 321| "attackerOwner": 1 binaries/data/mods/public/simulation/components/tests/test_Damage.js | 125| » type·=·data.type·=·"Ranged"; | | [NORMAL] ESLintBear (no-multi-assign): | | Unexpected chained assignment. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/88/display/redirect