@@ -25,6 +25,9 @@ function max() {
25
25
function sgn() {
26
26
return _level1.sgn.apply(_root._level1, arguments);
27
27
}
28
+ function isArray() {
29
+ return _level1.isArray.apply(_root.level1, arguments);
30
+ }
28
31
29
32
function kvEvent() {
30
33
return _level1.kvEvent.apply(_root._level1, arguments);
@@ -442,14 +445,111 @@ function registerCheat(id:String, code:String, linked:Array) {
442
445
warn += "\nAssigned next available tile position {x: " + parent.tilePos.x + ", y: " + parent.tilePos.y + "} to avoid crash!";
443
446
_level0.Log(warn);
444
447
}
448
+ }]]> </script >
449
+ </Actionscript >
450
+ <elements />
451
+ </DOMFrame >
452
+ </frames >
453
+ </DOMLayer >
454
+ <DOMLayer name =" Indicator" color =" #9933CC" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
455
+ <DOMLayer name =" IndicatorHook" color =" #FF800A" parentLayerIndex =" 17" locked =" true" autoNamed =" false" visible =" false" >
456
+ <frames >
457
+ <DOMFrame index =" 0" keyMode =" 9728" >
458
+ <Actionscript >
459
+ <script ><![CDATA[ function IndicatorHook(parent, objA, objB, message, conditionType, lifespan) {
460
+
461
+ // If this indicator is of the objective to select one or more units...
462
+ if (this.conditionType == "selected") {
463
+ if (isArray(this.objA)) {
464
+ // Save each unit's current speed and temporarily set it to 0 so they cannot move.
465
+ for (var i in this.objA) {
466
+ this.objA[i].stats.indicatorHackSpeed = this.objA[i].stats.speed;
467
+ this.objA[i].stats.speed = 0;
468
+ }
469
+ } else {
470
+ // Save the unit's current speed and temporarily set it to 0 so it cannot move.
471
+ this.objA.stats.indicatorHackSpeed = this.objA.stats.speed;
472
+ this.objA.stats.speed = 0;
473
+ }
474
+ }
475
+
476
+ this.conditionMet = function() {
477
+ this.updatePos();
478
+ if (this.lifespan) {
479
+ this.lifespan--;
480
+ if (!this.lifespan) {
481
+ return true;
482
+ }
483
+ }
484
+ if (this.conditionType == "focus") {
485
+ return true;
486
+ }
487
+ if (this.conditionType == "selected") {
488
+ if (isArray(this.objA)) {
489
+ for (var i in this.objA) {
490
+ if (!this.objA[i].selected) {
491
+ return false;
492
+ }
493
+ }
494
+ // Restore the speed for each of the units.
495
+ for (var i in this.objA) {
496
+ this.objA[i].stats.speed = this.objA[i].stats.indicatorHackSpeed;
497
+ }
498
+ return true;
499
+ }
500
+ if (this.objA.selected) {
501
+ // Restore the speed for the unit.
502
+ this.objA.stats.speed = this.objA.stats.indicatorHackSpeed;
503
+ return true;
504
+ }
505
+ }
506
+ if (this.conditionType == "voyage") {
507
+ if ((this.objA.tilePos.x == this.objB.tilePos.x) && (this.objA.tilePos.y == this.objB.tilePos.y)) {
508
+ return true;
509
+ }
510
+ }
511
+ if (this.conditionType == "construction") {
512
+ if (this.parent.findBuilding(this.objA)) {
513
+ return true;
514
+ }
515
+ if (this.parent.findUnit(this.objA)) {
516
+ return true;
517
+ }
518
+ this.parent.parent.hud.showMessage(dialogue("int_construction_hint"));
519
+ }
520
+ if (this.conditionType == "message") {
521
+ if ((this.lifespan == undefined) || (this.lifespan >= 40)) {
522
+ this.parent.parent.hud.showMessage(this.message);
523
+ }
524
+ }
525
+ return false;
526
+ };
527
+
528
+ // This function is not in the original code, it's mainly just to revert the
529
+ // speed hack for selection type indicators. See LevelHook hack_init function.
530
+ this.cancel = function() {
531
+ if (this.conditionType == "selected") {
532
+ if (isArray(this.objA)) {
533
+ // Restore the speed for each of the units.
534
+ for (var i in this.objA) {
535
+ this.objA[i].stats.speed = this.objA[i].stats.indicatorHackSpeed;
536
+ }
537
+ }
538
+ if (this.objA.selected) {
539
+ // Restore the speed for the unit.
540
+ this.objA.stats.speed = this.objA.stats.indicatorHackSpeed;
541
+ }
542
+ }
543
+ };
544
+
445
545
}]]> </script >
446
546
</Actionscript >
447
547
<elements />
448
548
</DOMFrame >
449
549
</frames >
450
550
</DOMLayer >
451
551
<DOMLayer name =" LevelStats" color =" #FF4FFF" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
452
- <DOMLayer name =" outcomeOverride" color =" #4FFF4F" parentLayerIndex =" 17 " locked =" true" autoNamed =" false" visible =" false" >
552
+ <DOMLayer name =" outcomeOverride" color =" #4FFF4F" parentLayerIndex =" 19 " locked =" true" autoNamed =" false" visible =" false" >
453
553
<frames >
454
554
<DOMFrame index =" 0" keyMode =" 9728" >
455
555
<Actionscript >
@@ -658,7 +758,7 @@ function registerCheat(id:String, code:String, linked:Array) {
658
758
</DOMFrame >
659
759
</frames >
660
760
</DOMLayer >
661
- <DOMLayer name =" LevelStatsHook" color =" #9933CC" parentLayerIndex =" 17 " locked =" true" autoNamed =" false" visible =" false" >
761
+ <DOMLayer name =" LevelStatsHook" color =" #9933CC" parentLayerIndex =" 19 " locked =" true" autoNamed =" false" visible =" false" >
662
762
<frames >
663
763
<DOMFrame index =" 0" keyMode =" 9728" >
664
764
<Actionscript >
@@ -2102,7 +2202,7 @@ function registerCheat(id:String, code:String, linked:Array) {
2102
2202
</frames >
2103
2203
</DOMLayer >
2104
2204
<DOMLayer name =" Level" color =" #4FFFFF" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
2105
- <DOMLayer name =" shootHook" color =" #4FFF4F" parentLayerIndex =" 20 " locked =" true" autoNamed =" false" visible =" false" >
2205
+ <DOMLayer name =" shootHook" color =" #4FFF4F" parentLayerIndex =" 22 " locked =" true" autoNamed =" false" visible =" false" >
2106
2206
<frames >
2107
2207
<DOMFrame index =" 0" keyMode =" 9728" >
2108
2208
<Actionscript >
@@ -2117,7 +2217,7 @@ function registerCheat(id:String, code:String, linked:Array) {
2117
2217
</DOMFrame >
2118
2218
</frames >
2119
2219
</DOMLayer >
2120
- <DOMLayer name =" LevelHook" color =" #4FFF4F" parentLayerIndex =" 20 " locked =" true" autoNamed =" false" visible =" false" >
2220
+ <DOMLayer name =" LevelHook" color =" #4FFF4F" parentLayerIndex =" 22 " locked =" true" autoNamed =" false" visible =" false" >
2121
2221
<frames >
2122
2222
<DOMFrame index =" 0" keyMode =" 9728" >
2123
2223
<Actionscript >
@@ -2312,6 +2412,10 @@ function registerCheat(id:String, code:String, linked:Array) {
2312
2412
// This prevents impossible to fulfill indicator conditions.
2313
2413
if (this.parent.team != this.parent.parent.teams1337[this.level]) {
2314
2414
if (this.indicators.length > 0) {
2415
+ for (var i in this.indicators) {
2416
+ // Give the indicator a chance to revert any changes it might have made.
2417
+ this.indicators[i].cancel();
2418
+ }
2315
2419
this.indicators.splice(0);
2316
2420
}
2317
2421
}
@@ -2326,7 +2430,7 @@ function registerCheat(id:String, code:String, linked:Array) {
2326
2430
</frames >
2327
2431
</DOMLayer >
2328
2432
<DOMLayer name =" Control" color =" #4FFF4F" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
2329
- <DOMLayer name =" ControlHook" color =" #9933CC" parentLayerIndex =" 23 " locked =" true" autoNamed =" false" visible =" false" >
2433
+ <DOMLayer name =" ControlHook" color =" #9933CC" parentLayerIndex =" 25 " locked =" true" autoNamed =" false" visible =" false" >
2330
2434
<frames >
2331
2435
<DOMFrame index =" 0" keyMode =" 9728" >
2332
2436
<Actionscript >
@@ -2541,7 +2645,7 @@ function registerCheat(id:String, code:String, linked:Array) {
2541
2645
</frames >
2542
2646
</DOMLayer >
2543
2647
<DOMLayer name =" Game" color =" #4FFFFF" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
2544
- <DOMLayer name =" GameHook" color =" #4FFF4F" parentLayerIndex =" 25 " locked =" true" autoNamed =" false" visible =" false" >
2648
+ <DOMLayer name =" GameHook" color =" #4FFF4F" parentLayerIndex =" 27 " locked =" true" autoNamed =" false" visible =" false" >
2545
2649
<frames >
2546
2650
<DOMFrame index =" 0" keyMode =" 9728" >
2547
2651
<Actionscript offsets =" 1240,332" >
@@ -2621,7 +2725,7 @@ function registerCheat(id:String, code:String, linked:Array) {
2621
2725
</frames >
2622
2726
</DOMLayer >
2623
2727
<DOMLayer name =" Panel" color =" #808080" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
2624
- <DOMLayer name =" PanelAppend" color =" #4FFF4F" parentLayerIndex =" 27 " locked =" true" autoNamed =" false" visible =" false" >
2728
+ <DOMLayer name =" PanelAppend" color =" #4FFF4F" parentLayerIndex =" 29 " locked =" true" autoNamed =" false" visible =" false" >
2625
2729
<frames >
2626
2730
<DOMFrame index =" 0" keyMode =" 9728" >
2627
2731
<Actionscript >
@@ -2833,7 +2937,7 @@ function registerCheat(id:String, code:String, linked:Array) {
2833
2937
</frames >
2834
2938
</DOMLayer >
2835
2939
<DOMLayer name =" Mod" color =" #FF800A" locked =" true" autoNamed =" false" visible =" false" layerType =" folder" />
2836
- <DOMLayer name =" CACMod" color =" #00FF00" parentLayerIndex =" 29 " locked =" true" current =" true" isSelected =" true" autoNamed =" false" visible =" false" >
2940
+ <DOMLayer name =" CACMod" color =" #00FF00" parentLayerIndex =" 31 " locked =" true" current =" true" isSelected =" true" autoNamed =" false" visible =" false" >
2837
2941
<frames >
2838
2942
<DOMFrame index =" 0" keyMode =" 9728" >
2839
2943
<Actionscript >
@@ -2908,6 +3012,11 @@ function CACMod_OnGameMenu():Void {
2908
3012
var hook10:Object = wrapper.addPostHook(game.Unit, UnitHook);
2909
3013
game.Unit = hook10.override;
2910
3014
3015
+ // Hook Indicator to fix bugs with being able to move units before the indicator requests that they be selected.
3016
+ // Now the units will not move until the indicator is ready and the condition is met.
3017
+ var hook11:Object = wrapper.addPostHook(game.Indicator, IndicatorHook);
3018
+ game.Indicator = hook11.override;
3019
+
2911
3020
PanelAppend.apply(game.panel);
2912
3021
2913
3022
// For fun of course ;)
@@ -2927,7 +3036,7 @@ function CACMod_OnGameMenu():Void {
2927
3036
</DOMFrame >
2928
3037
</frames >
2929
3038
</DOMLayer >
2930
- <DOMLayer name =" My Code" color =" #FF800A" parentLayerIndex =" 29 " locked =" true" autoNamed =" false" visible =" false" >
3039
+ <DOMLayer name =" My Code" color =" #FF800A" parentLayerIndex =" 31 " locked =" true" autoNamed =" false" visible =" false" >
2931
3040
<frames >
2932
3041
<DOMFrame index =" 0" keyMode =" 9728" >
2933
3042
<Actionscript >
@@ -2946,25 +3055,25 @@ function CACMod_OnGameMenu():Void {
2946
3055
</persistentData >
2947
3056
<PrinterSettings />
2948
3057
<publishHistory >
2949
- <PublishItem publishSize =" 17259 " publishTime =" 1494125320 " />
2950
- <PublishItem publishSize =" 17259 " publishTime =" 1494123872 " />
2951
- <PublishItem publishSize =" 16975 " publishTime =" 1494102691 " />
2952
- <PublishItem publishSize =" 17015 " publishTime =" 1494102575 " />
2953
- <PublishItem publishSize =" 17048 " publishTime =" 1494102419 " />
2954
- <PublishItem publishSize =" 17047 " publishTime =" 1494102191 " />
2955
- <PublishItem publishSize =" 16994 " publishTime =" 1494101744 " />
2956
- <PublishItem publishSize =" 16994 " publishTime =" 1494101736 " />
2957
- <PublishItem publishSize =" 16956 " publishTime =" 1494100447 " />
2958
- <PublishItem publishSize =" 16956 " publishTime =" 1494100262 " />
2959
- <PublishItem publishSize =" 16955 " publishTime =" 1494100220 " />
2960
- <PublishItem publishSize =" 16953 " publishTime =" 1494100175 " />
2961
- <PublishItem publishSize =" 16953 " publishTime =" 1494100129 " />
2962
- <PublishItem publishSize =" 16953 " publishTime =" 1494099435 " />
2963
- <PublishItem publishSize =" 16953 " publishTime =" 1494099412 " />
2964
- <PublishItem publishSize =" 16953 " publishTime =" 1494099359 " />
2965
- <PublishItem publishSize =" 16953 " publishTime =" 1494099325 " />
2966
- <PublishItem publishSize =" 16953 " publishTime =" 1494098849 " />
2967
- <PublishItem publishSize =" 16953 " publishTime =" 1494098831 " />
2968
- <PublishItem publishSize =" 16946 " publishTime =" 1494097001 " />
3058
+ <PublishItem publishSize =" 17742 " publishTime =" 1494136748 " />
3059
+ <PublishItem publishSize =" 17742 " publishTime =" 1494136740 " />
3060
+ <PublishItem publishSize =" 17687 " publishTime =" 1494135653 " />
3061
+ <PublishItem publishSize =" 17687 " publishTime =" 1494134166 " />
3062
+ <PublishItem publishSize =" 17665 " publishTime =" 1494133937 " />
3063
+ <PublishItem publishSize =" 17664 " publishTime =" 1494132687 " />
3064
+ <PublishItem publishSize =" 17657 " publishTime =" 1494132634 " />
3065
+ <PublishItem publishSize =" 17658 " publishTime =" 1494132468 " />
3066
+ <PublishItem publishSize =" 17338 " publishTime =" 1494131730 " />
3067
+ <PublishItem publishSize =" 17888 " publishTime =" 1494131319 " />
3068
+ <PublishItem publishSize =" 17888 " publishTime =" 1494131267 " />
3069
+ <PublishItem publishSize =" 17883 " publishTime =" 1494131081 " />
3070
+ <PublishItem publishSize =" 17938 " publishTime =" 1494130972 " />
3071
+ <PublishItem publishSize =" 17947 " publishTime =" 1494130887 " />
3072
+ <PublishItem publishSize =" 17945 " publishTime =" 1494130838 " />
3073
+ <PublishItem publishSize =" 17932 " publishTime =" 1494130781 " />
3074
+ <PublishItem publishSize =" 17931 " publishTime =" 1494130737 " />
3075
+ <PublishItem publishSize =" 17909 " publishTime =" 1494130576 " />
3076
+ <PublishItem publishSize =" 17912 " publishTime =" 1494130488 " />
3077
+ <PublishItem publishSize =" 17907 " publishTime =" 1494130320 " />
2969
3078
</publishHistory >
2970
3079
</DOMDocument >
0 commit comments