Page MenuHomeWildfire Games

Transfer timers to a transformed entity.
AbandonedPublic

Authored by Freagarach on Sep 27 2019, 10:30 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

This diff transfers timers from a transformed entity to the new one. Useful for keeping statusEffects active when an entity promotes. But this might have other use cases.
It is split from D2281 due to the potential to break things.

Test Plan

This potentially breaks stuff; check:

  • Attack timers.
  • (Un)Packing still works as intended.
  • Health/Capture regen works (not doubled or something).

Event Timeline

Freagarach created this revision.Sep 27 2019, 10:30 AM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Timer.js
27

It returns an object, not an array.

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

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

Freagarach edited the summary of this revision. (Show Details)Sep 27 2019, 10:32 AM

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_Pack.js
|  42| »   "SetInterval":·(ent,·iid,·funcname,·time,·repeattime,·data)·=>·{·timerActivated·=·true;·return·7;·},
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'Callback' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|   8|   8| var fired = [];
|   9|   9| 
|  10|  10| AddMock(10, IID_Test, {
|  11|    |-	Callback: function(data, lateness) {
|    |  11|+	"Callback": function(data, lateness) {
|  12|  12| 		fired.push([data, lateness]);
|  13|  13| 	}
|  14|  14| });
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'Callback' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  15|  15| 
|  16|  16| var cancelId;
|  17|  17| AddMock(20, IID_Test, {
|  18|    |-	Callback: function(data, lateness) {
|    |  18|+	"Callback": function(data, lateness) {
|  19|  19| 		fired.push([data, lateness]);
|  20|  20| 		cmpTimer.CancelTimer(cancelId);
|  21|  21| 	}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  34|  34| TS_ASSERT_UNEVAL_EQUALS(fired, []);
|  35|  35| 
|  36|  36| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  37|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0]]);
|    |  37|+TS_ASSERT_UNEVAL_EQUALS(fired, [["a", 0]]);
|  38|  38| 
|  39|  39| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  40|  40| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  37|  37| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0]]);
|  38|  38| 
|  39|  39| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  40|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    |  40|+TS_ASSERT_UNEVAL_EQUALS(fired, [["a", 0], ["b",300]]);
|  41|  41| 
|  42|  42| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  43|  43| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  37|  37| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0]]);
|  38|  38| 
|  39|  39| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  40|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    |  40|+TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b", 300]]);
|  41|  41| 
|  42|  42| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  43|  43| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  40|  40| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|  41|  41| 
|  42|  42| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  43|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    |  43|+TS_ASSERT_UNEVAL_EQUALS(fired, [["a", 0], ["b",300]]);
|  44|  44| 
|  45|  45| fired = [];
|  46|  46| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  40|  40| TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|  41|  41| 
|  42|  42| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  43|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b",300]]);
|    |  43|+TS_ASSERT_UNEVAL_EQUALS(fired, [["a",0], ["b", 300]]);
|  44|  44| 
|  45|  45| fired = [];
|  46|  46| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  49|  49| var e = cmpTimer.SetTimeout(10, IID_Test, "Callback", 1000, "e");
|  50|  50| cmpTimer.CancelTimer(d);
|  51|  51| cmpTimer.OnUpdate({ "turnLength": 1.0 });
|  52|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["c",0], ["e",0]]);
|    |  52|+TS_ASSERT_UNEVAL_EQUALS(fired, [["c", 0], ["e",0]]);
|  53|  53| 
|  54|  54| fired = [];
|  55|  55| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  49|  49| var e = cmpTimer.SetTimeout(10, IID_Test, "Callback", 1000, "e");
|  50|  50| cmpTimer.CancelTimer(d);
|  51|  51| cmpTimer.OnUpdate({ "turnLength": 1.0 });
|  52|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["c",0], ["e",0]]);
|    |  52|+TS_ASSERT_UNEVAL_EQUALS(fired, [["c",0], ["e", 0]]);
|  53|  53| 
|  54|  54| fired = [];
|  55|  55| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  56|  56| var r = cmpTimer.SetInterval(10, IID_Test, "Callback", 500, 1000, "r");
|  57|  57| 
|  58|  58| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  59|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0]]);
|    |  59|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r", 0]]);
|  60|  60| 
|  61|  61| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  62|  62| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  59|  59| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0]]);
|  60|  60| 
|  61|  61| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  62|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0]]);
|    |  62|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r", 0]]);
|  63|  63| 
|  64|  64| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  65|  65| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  62|  62| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0]]);
|  63|  63| 
|  64|  64| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  65|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|    |  65|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r", 0], ["r",0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|  68| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  62|  62| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0]]);
|  63|  63| 
|  64|  64| cmpTimer.OnUpdate({ "turnLength": 0.5 });
|  65|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|    |  65|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r", 0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|  68| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  65|  65| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  68|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r", 0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|  69|  69| 
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  65|  65| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  68|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r", 0], ["r",2500], ["r",1500], ["r",500]]);
|  69|  69| 
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  65|  65| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  68|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r", 2500], ["r",1500], ["r",500]]);
|  69|  69| 
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  65|  65| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  68|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r", 1500], ["r",500]]);
|  69|  69| 
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  65|  65| TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0]]);
|  66|  66| 
|  67|  67| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  68|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  68|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r", 500]]);
|  69|  69| 
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|  72|  72| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  73|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  73|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r", 0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|  74|  74| 
|  75|  75| fired = [];
|  76|  76| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|  72|  72| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  73|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  73|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r", 0], ["r",2500], ["r",1500], ["r",500]]);
|  74|  74| 
|  75|  75| fired = [];
|  76|  76| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|  72|  72| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  73|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  73|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r", 2500], ["r",1500], ["r",500]]);
|  74|  74| 
|  75|  75| fired = [];
|  76|  76| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|  72|  72| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  73|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  73|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r", 1500], ["r",500]]);
|  74|  74| 
|  75|  75| fired = [];
|  76|  76| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  70|  70| cmpTimer.CancelTimer(r);
|  71|  71| 
|  72|  72| cmpTimer.OnUpdate({ "turnLength": 3.5 });
|  73|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r",500]]);
|    |  73|+TS_ASSERT_UNEVAL_EQUALS(fired, [["r",0], ["r",0], ["r",2500], ["r",1500], ["r", 500]]);
|  74|  74| 
|  75|  75| fired = [];
|  76|  76| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  77|  77| cancelId = cmpTimer.SetInterval(20, IID_Test, "Callback", 500, 1000, "s");
|  78|  78| 
|  79|  79| cmpTimer.OnUpdate({ "turnLength": 3.0 });
|  80|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["s",2500]]);
|    |  80|+TS_ASSERT_UNEVAL_EQUALS(fired, [["s", 2500]]);
|  81|  81| 
|  82|  82| fired = [];
|  83|  83| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Timer.js
|  84|  84| let t = cmpTimer.SetTimeout(10, IID_Test, "Callback", 1000, "t");
|  85|  85| cmpTimer.TransferTimer(t, 20);
|  86|  86| cmpTimer.OnUpdate({ "turnLength": 1.0 });
|  87|    |-TS_ASSERT_UNEVAL_EQUALS(fired, [["t",0]]);
|    |  87|+TS_ASSERT_UNEVAL_EQUALS(fired, [["t", 0]]);

binaries/data/mods/public/simulation/components/Timer.js
|  92| »   if·(typeof·repeattime·!=·"number"·||·!(repeattime·>·0))
|    | [NORMAL] JSHintBear:
|    | Confusing use of '!'.

binaries/data/mods/public/simulation/helpers/Transform.js
| 211| »   »   »   »   for·(let·ent·of·cmpNewObstruction.GetEntitiesDeletedUponConstruction())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
Executing section cli...

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

Freagarach abandoned this revision.Sep 27 2019, 1:45 PM

Either dangerous, unnecessary or both (at least). With the different approach on the StatusEffects, it is compleatly useless, AFAICK ;)