Page MenuHomeWildfire Games

Optimize Resource Trickle by not running timers when not necessary
ClosedPublic

Authored by Stan on Nov 2 2019, 12:06 AM.

Details

Reviewers
bb
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23394: Optimize resource trickle by not running timers when not necessary.
Summary

When trying to see If I could make cmpTimer faster, I realized that we run a timer for Resource trickle every tick to recompute rates, even when rates are 0.

Test Plan

Test resource trickle still works as expected.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 9929
Build 16739: Vulcan Build
Build 16738: Vulcan Build (Windows)

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Polakrity added inline comments.Nov 2 2019, 11:54 PM
binaries/data/mods/public/simulation/components/ResourceTrickle.js
64

this return isn't necessary as said Freagarach.

Stan marked an inline comment as done.Nov 3 2019, 12:07 AM

It is possible to simplify this into only 1 function than to use 2 functions to start and stop the timer.

Could be done I guess, not sure if worth it.

I also wonder if it is necessary to cache the template values.

Well caching doesn't hurt since there is a cast.

binaries/data/mods/public/simulation/components/ResourceTrickle.js
64

Yes it is else you cancel a timer that shouldn't be there to start a new one :) Here it stops, and only resume on value modification.

Polakrity added inline comments.Nov 3 2019, 12:25 AM
binaries/data/mods/public/simulation/components/ResourceTrickle.js
64

you have early returns when you check if a timer exists in your StartTimer and StopTimer functions.

Stan marked 2 inline comments as done.Nov 3 2019, 12:34 AM
Stan added inline comments.
binaries/data/mods/public/simulation/components/ResourceTrickle.js
64

If you cancel it this.timer is undefined, hereby making the starttimer code work :)

Since the timer ought to be checked as well when an entity changes ownership (out of scope here), it seems beneficial to already have the checking code in a seperate function.
And while at it, the start timer and cancel timer can be merged in that, unless there is a strong reason to keep them seperate?

I think it is good to know what is going on just by reading that line e.g. CancelTimer, StartTimer. One is not forced to guess what would be outcome of given call and is not needed to find body of that function. Next advantage is that one is sure he is not going to start or cancel timer by calling given functions even multiple times or by accident if timer is at state one wants to have it.

Stan updated this revision to Diff 10245.Nov 3 2019, 12:37 PM
Stan marked an inline comment as done.
Stan added a subscriber: Palaiologos.

Fix some of @Palaiologos and @Freagarach 's notes on IRC

Stan updated this revision to Diff 10246.Nov 3 2019, 1:50 PM

Fix condition.

Vulcan added a comment.Nov 3 2019, 1:50 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1029/display/redirect

Vulcan added a comment.Nov 3 2019, 1:58 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/514/display/redirect

Stan updated this revision to Diff 10247.Nov 3 2019, 2:28 PM

Transform the function to look like the one in health.js

Vulcan added a comment.Nov 3 2019, 2:28 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1030/display/redirect

Vulcan added a comment.Nov 3 2019, 2:29 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/515/display/redirect

Stan updated this revision to Diff 10248.Nov 3 2019, 2:33 PM
Vulcan added a comment.Nov 3 2019, 2:34 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/516/display/redirect

Vulcan added a comment.Nov 3 2019, 2:40 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceTrickle.js
|  82|  82| 
|  83|  83| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  84|  84| 	this.timer = cmpTimer.SetInterval(this.entity, IID_ResourceTrickle, "Trickle", interval, interval, undefined);
|  85|    |-}
|    |  85|+};
|  86|  86| 
|  87|  87| Engine.RegisterComponentType(IID_ResourceTrickle, "ResourceTrickle", ResourceTrickle);

binaries/data/mods/public/simulation/components/ResourceTrickle.js
|  85| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1031/display/redirect

Stan updated this revision to Diff 10250.Nov 3 2019, 2:58 PM
Stan updated this revision to Diff 10251.
Vulcan added a comment.Nov 3 2019, 3:02 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceTrickle.js
|  80|  80| 
|  81|  81| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  82|  82| 	this.timer = cmpTimer.SetInterval(this.entity, IID_ResourceTrickle, "Trickle", interval, interval, undefined);
|  83|    |-}
|    |  83|+};
|  84|  84| 
|  85|  85| Engine.RegisterComponentType(IID_ResourceTrickle, "ResourceTrickle", ResourceTrickle);

binaries/data/mods/public/simulation/components/ResourceTrickle.js
|  83| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1033/display/redirect

Vulcan added a comment.Nov 3 2019, 3:05 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/518/display/redirect

Vulcan added a comment.Nov 3 2019, 3:06 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/519/display/redirect

Vulcan added a comment.Nov 3 2019, 3:06 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1034/display/redirect

Stan updated this revision to Diff 10255.Nov 3 2019, 4:38 PM

Add tests.

Vulcan added a comment.Nov 3 2019, 4:39 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/520/display/redirect

Vulcan added a comment.Nov 3 2019, 4:42 PM

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 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   1|   1| Resources = {
|   2|    |-    "GetCodes": () => ["food", "metal", "stone", "wood"],
|    |   2|+	"GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   1|   1| Resources = {
|   2|   2|     "GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|    |-    "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|    |   3|+	"GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   1|   1| Resources = {
|   2|   2|     "GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|    |-    "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|    |   4|+	"GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   2|   2|     "GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|    |-    "GetResource": () => ({}),
|    |   5|+	"GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|    |-    "BuildSchema": (type) => {
|    |   6|+	"BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|   9|   9|             schema +=
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|    |-        let schema = "";
|    |   7|+		let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|   9|   9|             schema +=
|  10|  10|                 "<optional>" +
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|    |-        for (let res of Resources.GetCodes())
|    |   8|+		for (let res of Resources.GetCodes())
|   9|   9|             schema +=
|  10|  10|                 "<optional>" +
|  11|  11|                 "<element name='" + res + "'>" +
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|   9|    |-            schema +=
|    |   9|+			schema +=
|  10|  10|                 "<optional>" +
|  11|  11|                 "<element name='" + res + "'>" +
|  12|  12|                 "<ref name='" + type + "'/>" +
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  12|  12|                 "<ref name='" + type + "'/>" +
|  13|  13|                 "</element>" +
|  14|  14|                 "</optional>";
|  15|    |-        return "<interleave>" + schema + "</interleave>";
|    |  15|+		return "<interleave>" + schema + "</interleave>";
|  16|  16|     }
|  17|  17| };
|  18|  18| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  13|  13|                 "</element>" +
|  14|  14|                 "</optional>";
|  15|  15|         return "<interleave>" + schema + "</interleave>";
|  16|    |-    }
|    |  16|+	}
|  17|  17| };
|  18|  18| 
|  19|  19| Engine.LoadComponentScript("interfaces/ResourceTrickle.js");
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  29|  29| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer", {});
|  30|  30| 
|  31|  31| let cmpResourceTrickle = ConstructComponent(wonderEnt, "ResourceTrickle", {
|  32|    |-    "Interval": "200",
|    |  32|+	"Interval": "200",
|  33|  33|     "Rates": {
|  34|  34|         "food": "0.0",
|  35|  35|         "metal": "0.0"
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  30|  30| 
|  31|  31| let cmpResourceTrickle = ConstructComponent(wonderEnt, "ResourceTrickle", {
|  32|  32|     "Interval": "200",
|  33|    |-    "Rates": {
|    |  33|+	"Rates": {
|  34|  34|         "food": "0.0",
|  35|  35|         "metal": "0.0"
|  36|  36|     }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  31|  31| let cmpResourceTrickle = ConstructComponent(wonderEnt, "ResourceTrickle", {
|  32|  32|     "Interval": "200",
|  33|  33|     "Rates": {
|  34|    |-        "food": "0.0",
|    |  34|+		"food": "0.0",
|  35|  35|         "metal": "0.0"
|  36|  36|     }
|  37|  37| });
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  32|  32|     "Interval": "200",
|  33|  33|     "Rates": {
|  34|  34|         "food": "0.0",
|  35|    |-        "metal": "0.0"
|    |  35|+		"metal": "0.0"
|  36|  36|     }
|  37|  37| });
|  38|  38| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  33|  33|     "Rates": {
|  34|  34|         "food": "0.0",
|  35|  35|         "metal": "0.0"
|  36|    |-    }
|    |  36|+	}
|  37|  37| });
|  38|  38| 
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  37|  37| });
|  38|  38| 
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|  40|    |-    "SpyCostMultiplier": 1,
|    |  40|+	"SpyCostMultiplier": 1,
|  41|  41|     "BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  38|  38| 
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|  40|  40|     "SpyCostMultiplier": 1,
|  41|    |-    "BarterMultiplier": {
|    |  41|+	"BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|  40|  40|     "SpyCostMultiplier": 1,
|  41|  41|     "BarterMultiplier": {
|  42|    |-        "Buy": {
|    |  42|+		"Buy": {
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  40|  40|     "SpyCostMultiplier": 1,
|  41|  41|     "BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|    |-            "wood": 1.0,
|    |  43|+			"wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|  46|         },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  41|  41|     "BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|  44|    |-            "stone": 1.0,
|    |  44|+			"stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|  46|         },
|  47|  47|         "Sell": {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|    |-            "metal": 1.0
|    |  45|+			"metal": 1.0
|  46|  46|         },
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|    |-        },
|    |  46|+		},
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|  46|         },
|  47|    |-        "Sell": {
|    |  47|+		"Sell": {
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  45|  45|             "metal": 1.0
|  46|  46|         },
|  47|  47|         "Sell": {
|  48|    |-            "wood": 1.0,
|    |  48|+			"wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|  51|         }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  46|  46|         },
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|  49|    |-            "stone": 1.0,
|    |  49|+			"stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|  51|         }
|  52|  52|     },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|    |-            "metal": 1.0
|    |  50|+			"metal": 1.0
|  51|  51|         }
|  52|  52|     },
|  53|  53| });
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|    |-        }
|    |  51|+		}
|  52|  52|     },
|  53|  53| });
|  54|  54| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|  51|         }
|  52|    |-    },
|    |  52|+	},
|  53|  53| });
|  54|  54| 
|  55|  55| let QueryOwnerInterface = () => cmpPlayer;
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'food' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  54|  54| 
|  55|  55| let QueryOwnerInterface = () => cmpPlayer;
|  56|  56| Engine.RegisterGlobal("QueryOwnerInterface", QueryOwnerInterface);
|  57|    |-TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, metal: 300, stone: 300, wood: 300 });
|    |  57|+TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { "food": 300, metal: 300, stone: 300, wood: 300 });
|  58|  58| TS_ASSERT_EQUALS(cmpResourceTrickle.GetTimer(), 200);
|  59|  59| TS_ASSERT_UNEVAL_EQUALS(cmpResourceTrickle.GetRates(), {});
|  60|  60| TS_ASSERT_EQUALS(cmpResourceTrickle.ComputeRates(), false);
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'metal' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  54|  54| 
|  55|  55| let QueryOwnerInterface = () => cmpPlayer;
|  56|  56| Engine.RegisterGlobal("QueryOwnerInterface", QueryOwnerInterface);
|  57|    |-TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, metal: 300, stone: 300, wood: 300 });
|    |  57|+TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, "metal": 300, stone: 300, wood: 300 });
|  58|  58| TS_ASSERT_EQUALS(cmpResourceTrickle.GetTimer(), 200);
|  59|  59| TS_ASSERT_UNEVAL_EQUALS(cmpResourceTrickle.GetRates(), {});
|  60|  60| TS_ASSERT_EQUALS(cmpResourceTrickle.ComputeRates(), false);
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'stone' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  54|  54| 
|  55|  55| let QueryOwnerInterface = () => cmpPlayer;
|  56|  56| Engine.RegisterGlobal("QueryOwnerInterface", QueryOwnerInterface);
|  57|    |-TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, metal: 300, stone: 300, wood: 300 });
|    |  57|+TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, metal: 300, "stone": 300, wood: 300 });
|  58|  58| TS_ASSERT_EQUALS(cmpResourceTrickle.GetTimer(), 200);
|  59|  59| TS_ASSERT_UNEVAL_EQUALS(cmpResourceTrickle.GetRates(), {});
|  60|  60| TS_ASSERT_EQUALS(cmpResourceTrickle.ComputeRates(), false);
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'wood' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  54|  54| 
|  55|  55| let QueryOwnerInterface = () => cmpPlayer;
|  56|  56| Engine.RegisterGlobal("QueryOwnerInterface", QueryOwnerInterface);
|  57|    |-TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, metal: 300, stone: 300, wood: 300 });
|    |  57|+TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetResourceCounts(), { food: 300, metal: 300, stone: 300, "wood": 300 });
|  58|  58| TS_ASSERT_EQUALS(cmpResourceTrickle.GetTimer(), 200);
|  59|  59| TS_ASSERT_UNEVAL_EQUALS(cmpResourceTrickle.GetRates(), {});
|  60|  60| TS_ASSERT_EQUALS(cmpResourceTrickle.ComputeRates(), false);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  60|  60| TS_ASSERT_EQUALS(cmpResourceTrickle.ComputeRates(), false);
|  61|  61| cmpTimer.OnUpdate({ "turnLength": turnLength });
|  62|  62| ApplyValueModificationsToEntity = (valueName, currentValue, entity) => {
|  63|    |-    if (valueName == "ResourceTrickle/Rates/food")
|    |  63|+	if (valueName == "ResourceTrickle/Rates/food")
|  64|  64|         return currentValue + 1;
|  65|  65| 
|  66|  66|     return currentValue;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  61|  61| cmpTimer.OnUpdate({ "turnLength": turnLength });
|  62|  62| ApplyValueModificationsToEntity = (valueName, currentValue, entity) => {
|  63|  63|     if (valueName == "ResourceTrickle/Rates/food")
|  64|    |-        return currentValue + 1;
|    |  64|+		return currentValue + 1;
|  65|  65| 
|  66|  66|     return currentValue;
|  67|  67| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  63|  63|     if (valueName == "ResourceTrickle/Rates/food")
|  64|  64|         return currentValue + 1;
|  65|  65| 
|  66|    |-    return currentValue;
|    |  66|+	return currentValue;
|  67|  67| };
|  68|  68| Engine.RegisterGlobal("ApplyValueModificationsToEntity", ApplyValueModificationsToEntity);
|  69|  69| cmpResourceTrickle.OnValueModification({ "component": "ResourceTrickle" });
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1035/display/redirect

Stan updated this revision to Diff 10256.Nov 3 2019, 4:47 PM

Add missing quotes.

Vulcan added a comment.Nov 3 2019, 4:48 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/521/display/redirect

Stan updated this revision to Diff 10257.Nov 3 2019, 4:50 PM

spaces → tabs.

Vulcan added a comment.Nov 3 2019, 4:51 PM

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 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   1|   1| Resources = {
|   2|    |-    "GetCodes": () => ["food", "metal", "stone", "wood"],
|    |   2|+	"GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   1|   1| Resources = {
|   2|   2|     "GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|    |-    "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|    |   3|+	"GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   1|   1| Resources = {
|   2|   2|     "GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|    |-    "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|    |   4|+	"GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   2|   2|     "GetCodes": () => ["food", "metal", "stone", "wood"],
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|    |-    "GetResource": () => ({}),
|    |   5|+	"GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   3|   3|     "GetTradableCodes": () => ["food", "metal", "stone", "wood"],
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|    |-    "BuildSchema": (type) => {
|    |   6|+	"BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|   9|   9|             schema +=
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   4|   4|     "GetBarterableCodes": () => ["food", "metal", "stone", "wood"],
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|    |-        let schema = "";
|    |   7|+		let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|   9|   9|             schema +=
|  10|  10|                 "<optional>" +
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   5|   5|     "GetResource": () => ({}),
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|    |-        for (let res of Resources.GetCodes())
|    |   8|+		for (let res of Resources.GetCodes())
|   9|   9|             schema +=
|  10|  10|                 "<optional>" +
|  11|  11|                 "<element name='" + res + "'>" +
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|   6|   6|     "BuildSchema": (type) => {
|   7|   7|         let schema = "";
|   8|   8|         for (let res of Resources.GetCodes())
|   9|    |-            schema +=
|    |   9|+			schema +=
|  10|  10|                 "<optional>" +
|  11|  11|                 "<element name='" + res + "'>" +
|  12|  12|                 "<ref name='" + type + "'/>" +
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  12|  12|                 "<ref name='" + type + "'/>" +
|  13|  13|                 "</element>" +
|  14|  14|                 "</optional>";
|  15|    |-        return "<interleave>" + schema + "</interleave>";
|    |  15|+		return "<interleave>" + schema + "</interleave>";
|  16|  16|     }
|  17|  17| };
|  18|  18| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  13|  13|                 "</element>" +
|  14|  14|                 "</optional>";
|  15|  15|         return "<interleave>" + schema + "</interleave>";
|  16|    |-    }
|    |  16|+	}
|  17|  17| };
|  18|  18| 
|  19|  19| Engine.LoadComponentScript("interfaces/ResourceTrickle.js");
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  29|  29| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer", {});
|  30|  30| 
|  31|  31| let cmpResourceTrickle = ConstructComponent(wonderEnt, "ResourceTrickle", {
|  32|    |-    "Interval": "200",
|    |  32|+	"Interval": "200",
|  33|  33|     "Rates": {
|  34|  34|         "food": "0.0",
|  35|  35|         "metal": "0.0"
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  30|  30| 
|  31|  31| let cmpResourceTrickle = ConstructComponent(wonderEnt, "ResourceTrickle", {
|  32|  32|     "Interval": "200",
|  33|    |-    "Rates": {
|    |  33|+	"Rates": {
|  34|  34|         "food": "0.0",
|  35|  35|         "metal": "0.0"
|  36|  36|     }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  31|  31| let cmpResourceTrickle = ConstructComponent(wonderEnt, "ResourceTrickle", {
|  32|  32|     "Interval": "200",
|  33|  33|     "Rates": {
|  34|    |-        "food": "0.0",
|    |  34|+		"food": "0.0",
|  35|  35|         "metal": "0.0"
|  36|  36|     }
|  37|  37| });
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  32|  32|     "Interval": "200",
|  33|  33|     "Rates": {
|  34|  34|         "food": "0.0",
|  35|    |-        "metal": "0.0"
|    |  35|+		"metal": "0.0"
|  36|  36|     }
|  37|  37| });
|  38|  38| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  33|  33|     "Rates": {
|  34|  34|         "food": "0.0",
|  35|  35|         "metal": "0.0"
|  36|    |-    }
|    |  36|+	}
|  37|  37| });
|  38|  38| 
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  37|  37| });
|  38|  38| 
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|  40|    |-    "SpyCostMultiplier": 1,
|    |  40|+	"SpyCostMultiplier": 1,
|  41|  41|     "BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  38|  38| 
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|  40|  40|     "SpyCostMultiplier": 1,
|  41|    |-    "BarterMultiplier": {
|    |  41|+	"BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  39|  39| let cmpPlayer = ConstructComponent(10, "Player", {
|  40|  40|     "SpyCostMultiplier": 1,
|  41|  41|     "BarterMultiplier": {
|  42|    |-        "Buy": {
|    |  42|+		"Buy": {
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  40|  40|     "SpyCostMultiplier": 1,
|  41|  41|     "BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|    |-            "wood": 1.0,
|    |  43|+			"wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|  46|         },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  41|  41|     "BarterMultiplier": {
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|  44|    |-            "stone": 1.0,
|    |  44|+			"stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|  46|         },
|  47|  47|         "Sell": {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  42|  42|         "Buy": {
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|    |-            "metal": 1.0
|    |  45|+			"metal": 1.0
|  46|  46|         },
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  43|  43|             "wood": 1.0,
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|    |-        },
|    |  46|+		},
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  44|  44|             "stone": 1.0,
|  45|  45|             "metal": 1.0
|  46|  46|         },
|  47|    |-        "Sell": {
|    |  47|+		"Sell": {
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  45|  45|             "metal": 1.0
|  46|  46|         },
|  47|  47|         "Sell": {
|  48|    |-            "wood": 1.0,
|    |  48|+			"wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|  51|         }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  46|  46|         },
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|  49|    |-            "stone": 1.0,
|    |  49|+			"stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|  51|         }
|  52|  52|     },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 12 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  47|  47|         "Sell": {
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|    |-            "metal": 1.0
|    |  50|+			"metal": 1.0
|  51|  51|         }
|  52|  52|     },
|  53|  53| });
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  48|  48|             "wood": 1.0,
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|    |-        }
|    |  51|+		}
|  52|  52|     },
|  53|  53| });
|  54|  54| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  49|  49|             "stone": 1.0,
|  50|  50|             "metal": 1.0
|  51|  51|         }
|  52|    |-    },
|    |  52|+	},
|  53|  53| });
|  54|  54| 
|  55|  55| let QueryOwnerInterface = () => cmpPlayer;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  60|  60| TS_ASSERT_EQUALS(cmpResourceTrickle.ComputeRates(), false);
|  61|  61| cmpTimer.OnUpdate({ "turnLength": turnLength });
|  62|  62| ApplyValueModificationsToEntity = (valueName, currentValue, entity) => {
|  63|    |-    if (valueName == "ResourceTrickle/Rates/food")
|    |  63|+	if (valueName == "ResourceTrickle/Rates/food")
|  64|  64|         return currentValue + 1;
|  65|  65| 
|  66|  66|     return currentValue;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 8 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  61|  61| cmpTimer.OnUpdate({ "turnLength": turnLength });
|  62|  62| ApplyValueModificationsToEntity = (valueName, currentValue, entity) => {
|  63|  63|     if (valueName == "ResourceTrickle/Rates/food")
|  64|    |-        return currentValue + 1;
|    |  64|+		return currentValue + 1;
|  65|  65| 
|  66|  66|     return currentValue;
|  67|  67| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 4 spaces.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
|  63|  63|     if (valueName == "ResourceTrickle/Rates/food")
|  64|  64|         return currentValue + 1;
|  65|  65| 
|  66|    |-    return currentValue;
|    |  66|+	return currentValue;
|  67|  67| };
|  68|  68| Engine.RegisterGlobal("ApplyValueModificationsToEntity", ApplyValueModificationsToEntity);
|  69|  69| cmpResourceTrickle.OnValueModification({ "component": "ResourceTrickle" });
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1036/display/redirect

Vulcan added a comment.Nov 3 2019, 4:51 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/522/display/redirect

Vulcan added a comment.Nov 3 2019, 4:54 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1037/display/redirect

Stan updated this revision to Diff 10258.Nov 3 2019, 7:25 PM

Add comments to the tests.

Vulcan added a comment.Nov 3 2019, 7:26 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/523/display/redirect

Vulcan added a comment.Nov 3 2019, 7:29 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1038/display/redirect

Freagarach added inline comments.Nov 3 2019, 7:59 PM
binaries/data/mods/public/simulation/components/ResourceTrickle.js
28

at least one non-zero trickle rate.?

binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
2 ↗(On Diff #10258)

You can use two or three resources for testing.
Also, are the below functions necessary?

30 ↗(On Diff #10258)

Comment not necessary.

42 ↗(On Diff #10258)

playerID?

61 ↗(On Diff #10258)
\n
Since there is no rate > 0, nothing should change.

And one can discard L62 and L66.

67 ↗(On Diff #10258)
\n
Test that only trickling food works.

And one can discard L68 and L80.

82 ↗(On Diff #10258)

+\n

87 ↗(On Diff #10258)

Comment not necessary.

91 ↗(On Diff #10258)

Comment not necessary.

Stan updated this revision to Diff 10259.Nov 3 2019, 8:23 PM
Stan marked 9 inline comments as done.

Fix notes.

Vulcan added a comment.Nov 3 2019, 8:24 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/524/display/redirect

Vulcan added a comment.Nov 3 2019, 8:25 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1039/display/redirect

Freagarach added inline comments.Nov 3 2019, 9:44 PM
binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
43 ↗(On Diff #10259)

These and cmpPlayer.GetResourceCounts() below can be updated.

2 ↗(On Diff #10258)

Also, are the below functions necessary?

Yes would also have been a valid answer ;)

Stan updated this revision to Diff 10262.Nov 3 2019, 9:54 PM

Fix tests

Stan marked 2 inline comments as done.Nov 3 2019, 9:54 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
2 ↗(On Diff #10258)

Only BuildSchema is

Vulcan added a comment.Nov 3 2019, 9:55 PM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/526/display/redirect

Vulcan added a comment.Nov 3 2019, 9:58 PM

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1041/display/redirect

bb accepted this revision.Jan 14 2020, 9:50 PM
bb added a subscriber: bb.

only trivialities left

binaries/data/mods/public/simulation/components/ResourceTrickle.js
28

has

34
if (rate)
{
   foo()
}

?

binaries/data/mods/public/simulation/components/tests/test_ResourceTrickle.js
10–14 ↗(On Diff #10262)

indent?

32 ↗(On Diff #10262)

the timer tests seem to miss that last argument => note to self: fix it

37–38 ↗(On Diff #10262)

trailing 0

46 ↗(On Diff #10262)

trailing 0, didn't you like strings?

This revision is now accepted and ready to land.Jan 14 2020, 9:50 PM
Stan updated this revision to Diff 11020.Jan 14 2020, 10:38 PM
Stan marked 6 inline comments as done.

Update for luck.

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1042/display/redirect

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1560/display/redirect

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/138/display/redirect

This revision was automatically updated to reflect the committed changes.