Page MenuHomeWildfire Games

Move more things in the projectile part of the Attack component
ClosedPublic

Authored by wraitii on Dec 23 2017, 10:35 AM.

Details

Reviewers
bb
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22184: Move more things in the projectile part of the Attack/Ranged component
Summary

Following D945, I reckon more things should be moved from Attack/Ranged to Attack/Ranged/Projectile.

In the long run, I think most things should be moved to the Projectile, which would let us have several projectiles per attack (for example), make it easier to abstract away from the Melee/Ranged attack types, and would also be more coherent. This is the first step, as it adds the Projectile to all templates.

This also makes the launch point a parameter, though I only add "y" as implementing the rotation is left as an exercise to the reader.

Test Plan

Review the code, template changes, agree with the above direction (or not).

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
D1171
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6616
Build 10914: Vulcan BuildJenkins
Build 10913: arc lint + arc unit

Event Timeline

wraitii created this revision.Dec 23 2017, 10:35 AM
wraitii added a subscriber: Mate-86.

@Mate-86 after reviewing the entire projectileManager code, I no longer feel like the C++ changes I talked about in D945 are that useful, as it'd need a more general refactoring to be improved. So won't change for now.

binaries/data/mods/public/simulation/components/Attack.js
584–586

Changed these as a refactoring component of this patch, can be changed in a different diff.

Vulcan added a subscriber: Vulcan.Dec 23 2017, 11:28 AM

Build failure - The Moirai have given mortals hearts that can endure.

Executing section Default...
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/Attack.js
| 590| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
elexis added a subscriber: elexis.Dec 23 2017, 12:10 PM

Since ProjectileSpeed and Gravity are properties of Projectile, having them be part of Projectile is more correct than having them where they currently are - hence the patch is adding an improvement.
I assume the actor doesn't specify these properties, so this would be the ideal place too.

I'm not sure about the launchPoint property being specifyable in the simulation and being specifyable in the actor cmpVisual.GetProjectileLaunchPoint. We should define things only in one place.
(Same for the projectile actor name as mentioned in rP20676)

binaries/data/mods/public/simulation/components/Attack.js
168

(See discussion about the Projectile ActorName using either the sim template or the visual actor property otherwise in rP20676)

178

If the projectile property was the last one in Ranged, then all balancing numbers were grouped.

547

0.0 -> 0

clone -> VectorXD.add(vector1, vector2)

binaries/data/mods/public/simulation/components/tests/test_Damage.js
31–44

(One line per property would make this easier to read)

binaries/data/mods/public/simulation/templates/template_unit_hero_infantry_javelinist.xml
19

Templates are alphabetically sorted by components but not by property.
Equal to the template schema, the simulation values should be one consecutive part of the code.

binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_trireme.xml
18

(The parent template for towers was committed fortunately, not the one for a ship parent template.)

bb added a subscriber: bb.Dec 23 2017, 2:35 PM

Exactly what I planned to do for secondary attacks \0/, only spread should be moved into the projectile too.

binaries/data/mods/public/simulation/components/Attack.js
151

meter is the A.E . spelling of metre
add a period

158

period

165

period

170

period

binaries/data/mods/public/simulation/components/tests/test_Damage.js
31–44

"@"?

I'm not sure about the launchPoint property being specifyable in the simulation and being specifyable in the actor cmpVisual.GetProjectileLaunchPoint. We should define things only in one place.

(Same for the projectile actor name as mentioned in rP20676)

Projectile actor name imo should be defined in the template, but as a temporary workaround it wasn't done in D945. Since this patches adds Projectiles to everyone it could be done, though it's a bit more work.

Launch position can go either in the actor or the template, but if it goes in the template it becomes more of a gameplay thing. It depends how tightly integrated we want/need projectiles to be. So far they are mostly visual, but that could change.

Both projectile name and projectile position have to be in the templates since the same actor should be usable for different projectiles.
Which means both things should be removed from cmpVisual, right?
Then the properties can become mandatory too.

The attachpoints would have to be removed from the actor too?
Alternatively, the models could define one attach point for every possible projectile name (assuming that actually works).

(I'm aware that this might be a lot of work, but we should try to find out the ideal solution and possibly write a ticket for the afterworld)

binaries/data/mods/public/simulation/components/tests/test_Damage.js
31–44

since it's an attribute in XMLI assume.
Was wondering if that was the recommended way rather than xml child nodes

In D1171#47004, @elexis wrote:

Both projectile name and projectile position have to be in the templates since the same actor should be usable for different projectiles.

Indeed, but they could be in the projectile_creator actor instead of the projectile itself.

Which means both things should be removed from cmpVisual, right?
Then the properties can become mandatory too.

Correct.

The attachpoints would have to be removed from the actor too?

Are they used right now?

(I'm aware that this might be a lot of work, but we should try to find out the ideal solution and possibly write a ticket for the afterworld)

Agreed.

wraitii updated this revision to Diff 6507.May 5 2018, 4:35 PM
wraitii marked 7 inline comments as done.

Fix comments.

Re the launch point and name issue:

  • Launch point (and for that matter all Y stuff regarding projectiles) is purely graphical. If we move it to the templates, we kind of change that assumption. This opens up new possibilities (such as terrain collisions that do things) — but that's in the far future. Templates and actors, for units, are already pretty coupled so that's maybe not a huge issue.
  • Name: the projectile being fired should probably, logically, be a placeholder in most templates. Actors too should probably use placeholders, and we should have a "projectile graphics manager" of some kind, so that we could do AOE-like projectile swaps dynamically.

In the meantime, I'm keeping it as is. Please say whether you see these as a "must" or only as a "should" or "could" or "nice".

Vulcan added a comment.May 5 2018, 4:41 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Melee'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  43|  43| 	});
|  44|  44| 
|  45|  45| 	let cmpAttack = ConstructComponent(attacker, "Attack", {
|  46|    |-		"Melee" : {
|    |  46|+		"Melee": {
|  47|  47| 			"Hack": 11,
|  48|  48| 			"Pierce": 5,
|  49|  49| 			"Crush": 0,
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Ranged'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  63|  63| 				}
|  64|  64| 			}
|  65|  65| 		},
|  66|    |-		"Ranged" : {
|    |  66|+		"Ranged": {
|  67|  67| 			"Hack": 0,
|  68|  68| 			"Pierce": 10,
|  69|  69| 			"Crush": 0,
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Splash'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  78|  78| 			"RestrictedClasses": {
|  79|  79| 				"_string": "Elephant"
|  80|  80| 			},
|  81|    |-			"Splash" : {
|    |  81|+			"Splash": {
|  82|  82| 				"Shape": "Circular",
|  83|  83| 				"Range": 10,
|  84|  84| 				"FriendlyFire": "false",
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Capture'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  93|  93| 				}
|  94|  94| 			}
|  95|  95| 		},
|  96|    |-		"Capture" : {
|    |  96|+		"Capture": {
|  97|  97| 			"Value": 8,
|  98|  98| 			"MaxRange": 10,
|  99|  99| 		},
|    | [NORMAL] ESLintBear (comma-spacing):
|    | There should be no space before ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 124| 124| }
| 125| 125| 
| 126| 126| // Validate template getter functions
| 127|    |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => {
|    | 127|+attackComponentTest(undefined, true,(attacker, cmpAttack, defender) => {
| 128| 128| 
| 129| 129| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]);
| 130| 130| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 124| 124| }
| 125| 125| 
| 126| 126| // Validate template getter functions
| 127|    |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => {
|    | 127|+attackComponentTest(undefined, true , (attacker, cmpAttack, defender) => {
| 128| 128| 
| 129| 129| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]);
| 130| 130| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 147| 147| 		"Pierce": 10,
| 148| 148| 		"Crush": 0
| 149| 149| 	});
| 150|    |-	
|    | 150|+
| 151| 151| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), {
| 152| 152| 		"Hack": 0.0,
| 153| 153| 		"Pierce": 15.0,
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  24|  24| 
|  25|  25| 	let cmpDamage = ConstructComponent(SYSTEM_ENTITY, "Damage");
|  26|  26| 	let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer");
|  27|    |-	cmpTimer.OnUpdate({ turnLength: 1 });
|    |  27|+	cmpTimer.OnUpdate({ "turnLength": 1 });
|  28|  28| 	let attacker = 11;
|  29|  29| 	let atkPlayerEntity = 1;
|  30|  30| 	let attackerOwner = 6;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  62|  62| 		"position": targetPos,
|  63|  63| 		"isSplash": false,
|  64|  64| 		"projectileId": 9,
|  65|    |-		"direction": new Vector3D(1,0,0)
|    |  65|+		"direction": new Vector3D(1, 0,0)
|  66|  66| 	};
|  67|  67| 
|  68|  68| 	AddMock(atkPlayerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  62|  62| 		"position": targetPos,
|  63|  63| 		"isSplash": false,
|  64|  64| 		"projectileId": 9,
|  65|    |-		"direction": new Vector3D(1,0,0)
|    |  65|+		"direction": new Vector3D(1,0, 0)
|  66|  66| 	};
|  67|  67| 
|  68|  68| 	AddMock(atkPlayerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 113| 113| 
| 114| 114| 	function TestDamage()
| 115| 115| 	{
| 116|    |-		cmpTimer.OnUpdate({ turnLength: 1 });
|    | 116|+		cmpTimer.OnUpdate({ "turnLength": 1 });
| 117| 117| 		TS_ASSERT(damageTaken);
| 118| 118| 		damageTaken = false;
| 119| 119| 	}
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'hack'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 155| 155| 		"origin": origin,
| 156| 156| 		"radius": 10,
| 157| 157| 		"shape": "Linear",
| 158|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 158|+		"strengths": { "hack": 100, "pierce" : 0, "crush": 0 },
| 159| 159| 		"direction": new Vector3D(1, 747, 0),
| 160| 160| 		"playersToDamage": [2],
| 161| 161| 		"type": "Ranged",
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'pierce'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 155| 155| 		"origin": origin,
| 156| 156| 		"radius": 10,
| 157| 157| 		"shape": "Linear",
| 158|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 158|+		"strengths": { "hack" : 100, "pierce": 0, "crush": 0 },
| 159| 159| 		"direction": new Vector3D(1, 747, 0),
| 160| 160| 		"playersToDamage": [2],
| 161| 161| 		"type": "Ranged",
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 162| 162| 		"attackerOwner": attackerOwner
| 163| 163| 	};
| 164| 164| 
| 165|    |-	let fallOff = function(x,y)
|    | 165|+	let fallOff = function(x, y)
| 166| 166| 	{
| 167| 167| 		return (1 - x * x / (data.radius * data.radius)) * (1 - 25 * y * y / (data.radius * data.radius));
| 168| 168| 	};
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'hack'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 314| 314| 		"origin": new Vector2D(3, 4),
| 315| 315| 		"radius": radius,
| 316| 316| 		"shape": "Circular",
| 317|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 317|+		"strengths": { "hack": 100, "pierce" : 0, "crush": 0 },
| 318| 318| 		"playersToDamage": [2],
| 319| 319| 		"type": "Ranged",
| 320| 320| 		"attackerOwner": 1
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'pierce'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 314| 314| 		"origin": new Vector2D(3, 4),
| 315| 315| 		"radius": radius,
| 316| 316| 		"shape": "Circular",
| 317|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 317|+		"strengths": { "hack" : 100, "pierce": 0, "crush": 0 },
| 318| 318| 		"playersToDamage": [2],
| 319| 319| 		"type": "Ranged",
| 320| 320| 		"attackerOwner": 1

binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 124| »   type·=·data.type·=·"Ranged";
|    | [NORMAL] ESLintBear (no-multi-assign):
|    | Unexpected chained assignment.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 498| 498| 
| 499| 499| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 500| 500| 		let gravity = +this.template[type].Projectile.Gravity;
| 501|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 501|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 502| 502| 
| 503| 503| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 504| 504| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 545| 545| 		// TODO: Use unit rotation to implement x/z offsets.
| 546| 546| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 547| 547| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 548|    |-		
|    | 548|+
| 549| 549| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 550| 550| 		if (cmpVisual)
| 551| 551| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 616| 616| 			});
| 617| 617| 	}
| 618| 618| 	else
| 619|    |-	{
|    | 619|+	
| 620| 620| 		// Melee attack - hurt the target immediately
| 621| 621| 		cmpDamage.CauseDamage({
| 622| 622| 			"strengths": this.GetAttackStrengths(type),
| 626| 626| 			"type": type,
| 627| 627| 			"attackerOwner": attackerOwner
| 628| 628| 		});
| 629|    |-	}
|    | 629|+	
| 630| 630| };
| 631| 631| 
| 632| 632| /**

binaries/data/mods/public/simulation/components/Attack.js
| 488| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 591| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.

Link to build: https://jenkins.wildfiregames.com/job/differential/459/display/redirect

wraitii updated this revision to Diff 7154.Dec 30 2018, 6:48 PM

Rebasing with intention to commit

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Melee'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  43|  43| 	});
|  44|  44| 
|  45|  45| 	let cmpAttack = ConstructComponent(attacker, "Attack", {
|  46|    |-		"Melee" : {
|    |  46|+		"Melee": {
|  47|  47| 			"Hack": 11,
|  48|  48| 			"Pierce": 5,
|  49|  49| 			"Crush": 0,
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Ranged'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  63|  63| 				}
|  64|  64| 			}
|  65|  65| 		},
|  66|    |-		"Ranged" : {
|    |  66|+		"Ranged": {
|  67|  67| 			"Hack": 0,
|  68|  68| 			"Pierce": 10,
|  69|  69| 			"Crush": 0,
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Splash'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  78|  78| 			"RestrictedClasses": {
|  79|  79| 				"_string": "Elephant"
|  80|  80| 			},
|  81|    |-			"Splash" : {
|    |  81|+			"Splash": {
|  82|  82| 				"Shape": "Circular",
|  83|  83| 				"Range": 10,
|  84|  84| 				"FriendlyFire": "false",
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Capture'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  93|  93| 				}
|  94|  94| 			}
|  95|  95| 		},
|  96|    |-		"Capture" : {
|    |  96|+		"Capture": {
|  97|  97| 			"Value": 8,
|  98|  98| 			"MaxRange": 10,
|  99|  99| 		},
|    | [NORMAL] ESLintBear (comma-spacing):
|    | There should be no space before ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 124| 124| }
| 125| 125| 
| 126| 126| // Validate template getter functions
| 127|    |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => {
|    | 127|+attackComponentTest(undefined, true,(attacker, cmpAttack, defender) => {
| 128| 128| 
| 129| 129| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]);
| 130| 130| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 124| 124| }
| 125| 125| 
| 126| 126| // Validate template getter functions
| 127|    |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => {
|    | 127|+attackComponentTest(undefined, true , (attacker, cmpAttack, defender) => {
| 128| 128| 
| 129| 129| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]);
| 130| 130| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 147| 147| 		"Pierce": 10,
| 148| 148| 		"Crush": 0
| 149| 149| 	});
| 150|    |-	
|    | 150|+
| 151| 151| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), {
| 152| 152| 		"Hack": 0.0,
| 153| 153| 		"Pierce": 15.0,
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  24|  24| 
|  25|  25| 	let cmpDamage = ConstructComponent(SYSTEM_ENTITY, "Damage");
|  26|  26| 	let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer");
|  27|    |-	cmpTimer.OnUpdate({ turnLength: 1 });
|    |  27|+	cmpTimer.OnUpdate({ "turnLength": 1 });
|  28|  28| 	let attacker = 11;
|  29|  29| 	let atkPlayerEntity = 1;
|  30|  30| 	let attackerOwner = 6;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  62|  62| 		"position": targetPos,
|  63|  63| 		"isSplash": false,
|  64|  64| 		"projectileId": 9,
|  65|    |-		"direction": new Vector3D(1,0,0)
|    |  65|+		"direction": new Vector3D(1, 0,0)
|  66|  66| 	};
|  67|  67| 
|  68|  68| 	AddMock(atkPlayerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  62|  62| 		"position": targetPos,
|  63|  63| 		"isSplash": false,
|  64|  64| 		"projectileId": 9,
|  65|    |-		"direction": new Vector3D(1,0,0)
|    |  65|+		"direction": new Vector3D(1,0, 0)
|  66|  66| 	};
|  67|  67| 
|  68|  68| 	AddMock(atkPlayerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 113| 113| 
| 114| 114| 	function TestDamage()
| 115| 115| 	{
| 116|    |-		cmpTimer.OnUpdate({ turnLength: 1 });
|    | 116|+		cmpTimer.OnUpdate({ "turnLength": 1 });
| 117| 117| 		TS_ASSERT(damageTaken);
| 118| 118| 		damageTaken = false;
| 119| 119| 	}
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'hack'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 155| 155| 		"origin": origin,
| 156| 156| 		"radius": 10,
| 157| 157| 		"shape": "Linear",
| 158|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 158|+		"strengths": { "hack": 100, "pierce" : 0, "crush": 0 },
| 159| 159| 		"direction": new Vector3D(1, 747, 0),
| 160| 160| 		"playersToDamage": [2],
| 161| 161| 		"type": "Ranged",
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'pierce'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 155| 155| 		"origin": origin,
| 156| 156| 		"radius": 10,
| 157| 157| 		"shape": "Linear",
| 158|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 158|+		"strengths": { "hack" : 100, "pierce": 0, "crush": 0 },
| 159| 159| 		"direction": new Vector3D(1, 747, 0),
| 160| 160| 		"playersToDamage": [2],
| 161| 161| 		"type": "Ranged",
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 162| 162| 		"attackerOwner": attackerOwner
| 163| 163| 	};
| 164| 164| 
| 165|    |-	let fallOff = function(x,y)
|    | 165|+	let fallOff = function(x, y)
| 166| 166| 	{
| 167| 167| 		return (1 - x * x / (data.radius * data.radius)) * (1 - 25 * y * y / (data.radius * data.radius));
| 168| 168| 	};
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'hack'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 314| 314| 		"origin": new Vector2D(3, 4),
| 315| 315| 		"radius": radius,
| 316| 316| 		"shape": "Circular",
| 317|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 317|+		"strengths": { "hack": 100, "pierce" : 0, "crush": 0 },
| 318| 318| 		"playersToDamage": [2],
| 319| 319| 		"type": "Ranged",
| 320| 320| 		"attackerOwner": 1
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'pierce'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 314| 314| 		"origin": new Vector2D(3, 4),
| 315| 315| 		"radius": radius,
| 316| 316| 		"shape": "Circular",
| 317|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 317|+		"strengths": { "hack" : 100, "pierce": 0, "crush": 0 },
| 318| 318| 		"playersToDamage": [2],
| 319| 319| 		"type": "Ranged",
| 320| 320| 		"attackerOwner": 1

binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 124| »   type·=·data.type·=·"Ranged";
|    | [NORMAL] ESLintBear (no-multi-assign):
|    | Unexpected chained assignment.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 498| 498| 
| 499| 499| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 500| 500| 		let gravity = +this.template[type].Projectile.Gravity;
| 501|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 501|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 502| 502| 
| 503| 503| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 504| 504| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 545| 545| 		// TODO: Use unit rotation to implement x/z offsets.
| 546| 546| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 547| 547| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 548|    |-		
|    | 548|+
| 549| 549| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 550| 550| 		if (cmpVisual)
| 551| 551| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 616| 616| 			});
| 617| 617| 	}
| 618| 618| 	else
| 619|    |-	{
|    | 619|+	
| 620| 620| 		// Melee attack - hurt the target immediately
| 621| 621| 		cmpDamage.CauseDamage({
| 622| 622| 			"strengths": this.GetAttackStrengths(type),
| 626| 626| 			"type": type,
| 627| 627| 			"attackerOwner": attackerOwner
| 628| 628| 		});
| 629|    |-	}
|    | 629|+	
| 630| 630| };
| 631| 631| 
| 632| 632| /**

binaries/data/mods/public/simulation/components/Attack.js
| 488| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 591| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.

Link to build: https://jenkins.wildfiregames.com/job/differential/864/

wraitii updated this revision to Diff 7194.Jan 2 2019, 4:16 PM

Add Spread, fix two remaining templates using the unit test map.

As discussed with bb on IRC, this is a good idea because the "Melee/Ranged/et al" attack types will be merged and one will be able to add an arbitrary number of attacks, so having a decentralised way to handle projectiles is a good idea.

Ready to commit.

Vulcan added a comment.Jan 2 2019, 5:42 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Melee'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  43|  43| 	});
|  44|  44| 
|  45|  45| 	let cmpAttack = ConstructComponent(attacker, "Attack", {
|  46|    |-		"Melee" : {
|    |  46|+		"Melee": {
|  47|  47| 			"Hack": 11,
|  48|  48| 			"Pierce": 5,
|  49|  49| 			"Crush": 0,
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Ranged'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  63|  63| 				}
|  64|  64| 			}
|  65|  65| 		},
|  66|    |-		"Ranged" : {
|    |  66|+		"Ranged": {
|  67|  67| 			"Hack": 0,
|  68|  68| 			"Pierce": 10,
|  69|  69| 			"Crush": 0,
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Splash'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  77|  77| 			"RestrictedClasses": {
|  78|  78| 				"_string": "Elephant"
|  79|  79| 			},
|  80|    |-			"Splash" : {
|    |  80|+			"Splash": {
|  81|  81| 				"Shape": "Circular",
|  82|  82| 				"Range": 10,
|  83|  83| 				"FriendlyFire": "false",
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'Capture'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|  92|  92| 				}
|  93|  93| 			}
|  94|  94| 		},
|  95|    |-		"Capture" : {
|    |  95|+		"Capture": {
|  96|  96| 			"Value": 8,
|  97|  97| 			"MaxRange": 10,
|  98|  98| 		},
|    | [NORMAL] ESLintBear (comma-spacing):
|    | There should be no space before ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 123| 123| }
| 124| 124| 
| 125| 125| // Validate template getter functions
| 126|    |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => {
|    | 126|+attackComponentTest(undefined, true,(attacker, cmpAttack, defender) => {
| 127| 127| 
| 128| 128| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]);
| 129| 129| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 123| 123| }
| 124| 124| 
| 125| 125| // Validate template getter functions
| 126|    |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => {
|    | 126|+attackComponentTest(undefined, true , (attacker, cmpAttack, defender) => {
| 127| 127| 
| 128| 128| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]);
| 129| 129| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js
| 146| 146| 		"Pierce": 10,
| 147| 147| 		"Crush": 0
| 148| 148| 	});
| 149|    |-	
|    | 149|+
| 150| 150| 	TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), {
| 151| 151| 		"Hack": 0.0,
| 152| 152| 		"Pierce": 15.0,
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  24|  24| 
|  25|  25| 	let cmpDamage = ConstructComponent(SYSTEM_ENTITY, "Damage");
|  26|  26| 	let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer");
|  27|    |-	cmpTimer.OnUpdate({ turnLength: 1 });
|    |  27|+	cmpTimer.OnUpdate({ "turnLength": 1 });
|  28|  28| 	let attacker = 11;
|  29|  29| 	let atkPlayerEntity = 1;
|  30|  30| 	let attackerOwner = 6;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  62|  62| 		"position": targetPos,
|  63|  63| 		"isSplash": false,
|  64|  64| 		"projectileId": 9,
|  65|    |-		"direction": new Vector3D(1,0,0)
|    |  65|+		"direction": new Vector3D(1, 0,0)
|  66|  66| 	};
|  67|  67| 
|  68|  68| 	AddMock(atkPlayerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|  62|  62| 		"position": targetPos,
|  63|  63| 		"isSplash": false,
|  64|  64| 		"projectileId": 9,
|  65|    |-		"direction": new Vector3D(1,0,0)
|    |  65|+		"direction": new Vector3D(1,0, 0)
|  66|  66| 	};
|  67|  67| 
|  68|  68| 	AddMock(atkPlayerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 113| 113| 
| 114| 114| 	function TestDamage()
| 115| 115| 	{
| 116|    |-		cmpTimer.OnUpdate({ turnLength: 1 });
|    | 116|+		cmpTimer.OnUpdate({ "turnLength": 1 });
| 117| 117| 		TS_ASSERT(damageTaken);
| 118| 118| 		damageTaken = false;
| 119| 119| 	}
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'hack'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 155| 155| 		"origin": origin,
| 156| 156| 		"radius": 10,
| 157| 157| 		"shape": "Linear",
| 158|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 158|+		"strengths": { "hack": 100, "pierce" : 0, "crush": 0 },
| 159| 159| 		"direction": new Vector3D(1, 747, 0),
| 160| 160| 		"playersToDamage": [2],
| 161| 161| 		"type": "Ranged",
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'pierce'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 155| 155| 		"origin": origin,
| 156| 156| 		"radius": 10,
| 157| 157| 		"shape": "Linear",
| 158|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 158|+		"strengths": { "hack" : 100, "pierce": 0, "crush": 0 },
| 159| 159| 		"direction": new Vector3D(1, 747, 0),
| 160| 160| 		"playersToDamage": [2],
| 161| 161| 		"type": "Ranged",
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 162| 162| 		"attackerOwner": attackerOwner
| 163| 163| 	};
| 164| 164| 
| 165|    |-	let fallOff = function(x,y)
|    | 165|+	let fallOff = function(x, y)
| 166| 166| 	{
| 167| 167| 		return (1 - x * x / (data.radius * data.radius)) * (1 - 25 * y * y / (data.radius * data.radius));
| 168| 168| 	};
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'hack'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 314| 314| 		"origin": new Vector2D(3, 4),
| 315| 315| 		"radius": radius,
| 316| 316| 		"shape": "Circular",
| 317|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 317|+		"strengths": { "hack": 100, "pierce" : 0, "crush": 0 },
| 318| 318| 		"playersToDamage": [2],
| 319| 319| 		"type": "Ranged",
| 320| 320| 		"attackerOwner": 1
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'pierce'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 314| 314| 		"origin": new Vector2D(3, 4),
| 315| 315| 		"radius": radius,
| 316| 316| 		"shape": "Circular",
| 317|    |-		"strengths": { "hack" : 100, "pierce" : 0, "crush": 0 },
|    | 317|+		"strengths": { "hack" : 100, "pierce": 0, "crush": 0 },
| 318| 318| 		"playersToDamage": [2],
| 319| 319| 		"type": "Ranged",
| 320| 320| 		"attackerOwner": 1

binaries/data/mods/public/simulation/components/tests/test_Damage.js
| 124| »   type·=·data.type·=·"Ranged";
|    | [NORMAL] ESLintBear (no-multi-assign):
|    | Unexpected chained assignment.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 498| 498| 
| 499| 499| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 500| 500| 		let gravity = +this.template[type].Projectile.Gravity;
| 501|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 501|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 502| 502| 
| 503| 503| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 504| 504| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 545| 545| 		// TODO: Use unit rotation to implement x/z offsets.
| 546| 546| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 547| 547| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 548|    |-		
|    | 548|+
| 549| 549| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 550| 550| 		if (cmpVisual)
| 551| 551| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 616| 616| 			});
| 617| 617| 	}
| 618| 618| 	else
| 619|    |-	{
|    | 619|+	
| 620| 620| 		// Melee attack - hurt the target immediately
| 621| 621| 		cmpDamage.CauseDamage({
| 622| 622| 			"strengths": this.GetAttackStrengths(type),
| 626| 626| 			"type": type,
| 627| 627| 			"attackerOwner": attackerOwner
| 628| 628| 		});
| 629|    |-	}
|    | 629|+	
| 630| 630| };
| 631| 631| 
| 632| 632| /**

binaries/data/mods/public/simulation/components/Attack.js
| 488| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 591| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.

Link to build: https://jenkins.wildfiregames.com/job/differential/875/

bb added a comment.Mar 16 2019, 5:25 PM

One fairly trivial change required => accept

binaries/data/mods/public/simulation/components/tests/test_Attack.js
66

Projectile isn't optional so this should get one

binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml
28

That does change something in the simstate, so commit message should tell us

binaries/data/mods/public/simulation/templates/units/athen_champion_ranged_gastraphetes.xml
13

in parent, good

bb accepted this revision.Mar 16 2019, 5:26 PM
This revision is now accepted and ready to land.Mar 16 2019, 5:26 PM
This revision was automatically updated to reflect the committed changes.
wraitii marked 2 inline comments as done.