@screeps/renderer 1.6.2-arena → 1.6.4-arena

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/renderer.js CHANGED
@@ -50548,7 +50548,6 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
50548
50548
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
50549
50549
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
50550
50550
 
50551
-
50552
50551
  var ActionHandle = /*#__PURE__*/function (_utils$EventEmitter) {
50553
50552
  function ActionHandle(container, action) {
50554
50553
  var _this;
@@ -52864,8 +52863,6 @@ const scaleGameToWorld = (value, {
52864
52863
 
52865
52864
 
52866
52865
 
52867
- var creepActions_Assets = Assets;
52868
-
52869
52866
 
52870
52867
  var TWEEN_DURATION = 0.6;
52871
52868
  var COLORS = {
@@ -52891,7 +52888,7 @@ function createCoverSprite(rootContainer, scope, world) {
52891
52888
  rootContainer.on('removed', function () {
52892
52889
  return container.destroy();
52893
52890
  });
52894
- var cover = new Sprite(creepActions_Assets.get('cover'));
52891
+ var cover = new Sprite(Assets.get('cover'));
52895
52892
  // coverSprite.blendMode = BLEND_MODES.ADD;
52896
52893
  // coverSprite.width = 150;
52897
52894
  // coverSprite.height = 150;
@@ -52901,7 +52898,7 @@ function createCoverSprite(rootContainer, scope, world) {
52901
52898
  // cover.filters = [new BlurFilter(1)];
52902
52899
  cover.parentLayer = world.layers.effects;
52903
52900
  container.addChild(cover);
52904
- var flare = new Sprite(creepActions_Assets.get('flare2'));
52901
+ var flare = new Sprite(Assets.get('flare2'));
52905
52902
  flare.blendMode = BLEND_MODES.ADD;
52906
52903
  flare.width = 300;
52907
52904
  flare.height = 300;
@@ -52910,7 +52907,7 @@ function createCoverSprite(rootContainer, scope, world) {
52910
52907
  flare.alpha = 0.05;
52911
52908
  flare.parentLayer = world.layers.effects;
52912
52909
  container.addChild(flare);
52913
- var coverLighting = new Sprite(creepActions_Assets.get('glow'));
52910
+ var coverLighting = new Sprite(Assets.get('glow'));
52914
52911
  coverLighting.anchor.x = 0.5;
52915
52912
  coverLighting.anchor.y = 0.5;
52916
52913
  coverLighting.x = 0;
@@ -52922,7 +52919,7 @@ function createCoverSprite(rootContainer, scope, world) {
52922
52919
  container.addChild(coverLighting);
52923
52920
  }
52924
52921
  function createChildCoverSprite(parent, scope, world) {
52925
- var sprite = new Sprite(creepActions_Assets.get('cover'));
52922
+ var sprite = new Sprite(Assets.get('cover'));
52926
52923
  sprite.anchor.x = 0.5;
52927
52924
  sprite.anchor.y = 0.5;
52928
52925
  sprite.alpha = 0;
@@ -53205,8 +53202,6 @@ function pushRangedShotActionWithBlur(actionsArray, stage, world, fromObject, to
53205
53202
  */
53206
53203
 
53207
53204
 
53208
-
53209
- var creepBuildBody_Assets = Assets;
53210
53205
  var maxParts = 50;
53211
53206
  var ANGLE_SHIFT = -Math.PI / 2;
53212
53207
  var PART_ANGLE = 2 * Math.PI / maxParts / 2;
@@ -53254,7 +53249,7 @@ function createBodyPartSprite(color, startAngle, endAngle, parent, bodySprites,
53254
53249
  return bodyPartBarSprite;
53255
53250
  }
53256
53251
  function createToughSprite(parent, bodySprites) {
53257
- var toughSprite = new Sprite(creepBuildBody_Assets.get('tough'));
53252
+ var toughSprite = new Sprite(Assets.get('tough'));
53258
53253
  toughSprite.width = 120;
53259
53254
  toughSprite.height = 120;
53260
53255
  toughSprite.anchor.x = 0.5;
@@ -53430,8 +53425,6 @@ function powerInfluence_toPrimitive(t, r) { if ("object" != powerInfluence_typeo
53430
53425
 
53431
53426
 
53432
53427
 
53433
- var powerInfluence_Assets = Assets;
53434
-
53435
53428
 
53436
53429
 
53437
53430
  var INFLUENCE_TEXTURE = (_INFLUENCE_TEXTURE = {}, powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(_INFLUENCE_TEXTURE, (constants_default()).PWR_DISRUPT_SOURCE, 'disrupt-source'), (constants_default()).PWR_DISRUPT_SPAWN, 'disrupt-spawn'), (constants_default()).PWR_DISRUPT_TERMINAL, 'disrupt-terminal'), (constants_default()).PWR_DISRUPT_TOWER, 'disrupt-tower'), (constants_default()).PWR_REGEN_MINERAL, 'regen-mineral'), (constants_default()).PWR_REGEN_SOURCE, 'regen-source'), (constants_default()).PWR_GENERATE_OPS, 'generate-ops'), (constants_default()).PWR_OPERATE_EXTENSION, 'operate-extension'), (constants_default()).PWR_OPERATE_LAB, 'operate-lab'), (constants_default()).PWR_OPERATE_OBSERVER, 'operate-observer'), powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(_INFLUENCE_TEXTURE, (constants_default()).PWR_OPERATE_SPAWN, 'operate-spawn'), (constants_default()).PWR_OPERATE_STORAGE, 'operate-storage'), (constants_default()).PWR_OPERATE_TERMINAL, 'operate-terminal'), (constants_default()).PWR_OPERATE_TOWER, 'operate-tower'), (constants_default()).PWR_SHIELD, 'shield'), (constants_default()).PWR_FORTIFY, 'fortify'), (constants_default()).PWR_OPERATE_CONTROLLER, 'operate-controller'), (constants_default()).PWR_OPERATE_POWER, 'operate-power'), (constants_default()).PWR_BERSERK, 'berserk'), (constants_default()).PWR_DEFEND, 'defend'), powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(_INFLUENCE_TEXTURE, (constants_default()).PWR_DISABLE, 'disable'), (constants_default()).PWR_ENCOURAGE, 'encourage'), (constants_default()).PWR_EXHAUST, 'exhaust'), (constants_default()).PWR_RENEW, 'renew'), (constants_default()).PWR_SIGHT, 'sight'), (constants_default()).PWR_SUMMON, 'summon'), (constants_default()).PWR_DEMOLISH, 'demolish'), (constants_default()).PWR_HARVEST_ENERGY, 'harvest-energy'), (constants_default()).PWR_HARVEST_MINERAL, 'harvest-mineral'), (constants_default()).PWR_KILL, 'kill'), powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(powerInfluence_defineProperty(_INFLUENCE_TEXTURE, (constants_default()).PWR_MASS_REPAIR, 'mass-repair'), (constants_default()).PWR_PUNCH, 'punch'), (constants_default()).PWR_REFLECT, 'reflect'), (constants_default()).PWR_REINFORCE, 'reinforce'), (constants_default()).PWR_REMOTE_TRANSFER, 'remote-transfer'), (constants_default()).PWR_SNIPE, 'snipe'));
@@ -53502,7 +53495,7 @@ function powerInfluence_createCoverSpriteAction(sprite, tickDuration, pos) {
53502
53495
  if (!textureKey) {
53503
53496
  console.log('No texture key provided for power id', power.id);
53504
53497
  }
53505
- var texture = powerInfluence_Assets.get(textureKey);
53498
+ var texture = Assets.get(textureKey);
53506
53499
  if (!texture) {
53507
53500
  console.log('No texture provided for key ', textureKey);
53508
53501
  }
@@ -54124,8 +54117,6 @@ function sprite_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; v
54124
54117
 
54125
54118
 
54126
54119
 
54127
- var sprite_Assets = Assets;
54128
-
54129
54120
 
54130
54121
 
54131
54122
 
@@ -54164,7 +54155,7 @@ var sprite_Assets = Assets;
54164
54155
  var resource;
54165
54156
  var parsedTexture = actionHelper.parseExpression(texture, params);
54166
54157
  if (lodash_default().isString(parsedTexture)) {
54167
- resource = sprite_Assets.get(parsedTexture);
54158
+ resource = Assets.get(parsedTexture);
54168
54159
  } else {
54169
54160
  resource = texture;
54170
54161
  if (!resource) {
@@ -54472,8 +54463,6 @@ function terrain_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
54472
54463
 
54473
54464
 
54474
54465
 
54475
- var terrain_Assets = Assets;
54476
-
54477
54466
 
54478
54467
 
54479
54468
  var WALLS_BLUR = 0.006;
@@ -54625,7 +54614,8 @@ function addTilePositionAnimation(sprite, dx, dy) {
54625
54614
  'paint-order': 'stroke'
54626
54615
  }), {
54627
54616
  alpha: 0.4,
54628
- tint: tint
54617
+ tint: tint,
54618
+ zIndex: 1
54629
54619
  });
54630
54620
  if (swampTexture !== 'disabled') {
54631
54621
  swampObjects[1] = setupObject(buildSvg(swampPath, {
@@ -54644,19 +54634,21 @@ function addTilePositionAnimation(sprite, dx, dy) {
54644
54634
  }), {
54645
54635
  alpha: 0.25
54646
54636
  });
54647
- swampObjects[3] = setupObject(new TilingSprite(terrain_Assets.get('noise2'), VIEW_BOX, VIEW_BOX), {
54637
+ swampObjects[3] = setupObject(new TilingSprite(Assets.get('noise2'), VIEW_BOX, VIEW_BOX), {
54648
54638
  alpha: lighting === 'normal' ? 0.3 : 0.15,
54649
54639
  blendMode: BLEND_MODES.ADD,
54650
54640
  mask: swampObjects[1],
54651
54641
  tileScale: new Point(10, 10),
54652
- tint: 0x66FF00
54642
+ tint: 0x66FF00,
54643
+ zIndex: 1
54653
54644
  });
54654
- swampObjects[4] = setupObject(new TilingSprite(terrain_Assets.get('noise2'), VIEW_BOX, VIEW_BOX), {
54645
+ swampObjects[4] = setupObject(new TilingSprite(Assets.get('noise2'), VIEW_BOX, VIEW_BOX), {
54655
54646
  alpha: lighting === 'normal' ? 0.3 : 0.15,
54656
54647
  blendMode: BLEND_MODES.ADD,
54657
54648
  tileScale: new Point(14, 14),
54658
54649
  mask: swampObjects[2],
54659
- tint: 0x66FF00
54650
+ tint: 0x66FF00,
54651
+ zIndex: 1
54660
54652
  });
54661
54653
  if (swampTexture === 'animated') {
54662
54654
  addTilePositionAnimation(swampObjects[3], 1.5, 1.5);
@@ -54797,13 +54789,10 @@ function addTilePositionAnimation(sprite, dx, dy) {
54797
54789
  }, {
54798
54790
  fill: '#fff'
54799
54791
  });
54800
- if (terrainObjects.wallMask.texture !== Texture.EMPTY) {
54801
- terrainObjects.wallMask.texture.destroy(true);
54802
- }
54803
- terrainObjects.wallMask.texture = mask.texture;
54792
+ var previousMaskTexture = terrainObjects.wallMask.texture !== Texture.EMPTY ? terrainObjects.wallMask.texture : null;
54804
54793
  actionHelper.onTextureLoaded(mask.texture, function () {
54805
54794
  if (lighting !== 'disabled') {
54806
- var bump = new TilingSprite(terrain_Assets.get('noise1'), VIEW_BOX, VIEW_BOX);
54795
+ var bump = new TilingSprite(Assets.get('noise1'), VIEW_BOX, VIEW_BOX);
54807
54796
  Object.assign(bump, {
54808
54797
  alpha: 0.2,
54809
54798
  blendMode: BLEND_MODES.ADD,
@@ -54816,14 +54805,21 @@ function addTilePositionAnimation(sprite, dx, dy) {
54816
54805
  });
54817
54806
  bump.destroy();
54818
54807
  }
54808
+ terrainObjects.wallMask.texture = mask.texture;
54819
54809
  mask.destroy();
54820
54810
  var _wallObjects = wallObjects;
54821
54811
  var _wallObjects2 = terrain_slicedToArray(_wallObjects, 1);
54822
54812
  wallObjects[1].texture = _wallObjects2[0];
54823
54813
  wallObjects[1].visible = true;
54814
+ if (wallObjectsToDestroy[0]) {
54815
+ wallObjectsToDestroy[0].destroy(true);
54816
+ }
54824
54817
  if (wallObjectsToDestroy[1]) {
54825
54818
  wallObjectsToDestroy[1].destroy(true);
54826
54819
  }
54820
+ if (previousMaskTexture && previousMaskTexture !== mask.texture) {
54821
+ previousMaskTexture.destroy(true);
54822
+ }
54827
54823
  });
54828
54824
  wallObjects[2] = RenderTexture.create({
54829
54825
  width: size.width,
@@ -54852,6 +54848,9 @@ function addTilePositionAnimation(sprite, dx, dy) {
54852
54848
  var _wallObjects4 = terrain_slicedToArray(_wallObjects3, 3);
54853
54849
  wallObjects[3].texture = _wallObjects4[2];
54854
54850
  wallObjects[3].visible = true;
54851
+ if (wallObjectsToDestroy[2]) {
54852
+ wallObjectsToDestroy[2].destroy(true);
54853
+ }
54855
54854
  if (wallObjectsToDestroy[3]) {
54856
54855
  wallObjectsToDestroy[3].destroy(true);
54857
54856
  }
@@ -54935,7 +54934,7 @@ function addTilePositionAnimation(sprite, dx, dy) {
54935
54934
  tint: _tint
54936
54935
  });
54937
54936
  } else {
54938
- ground = new TilingSprite(terrain_Assets.get('ground'), VIEW_BOX, VIEW_BOX);
54937
+ ground = new TilingSprite(Assets.get('ground'), VIEW_BOX, VIEW_BOX);
54939
54938
  ground.x = -HALF_CELL_SIZE;
54940
54939
  ground.y = -HALF_CELL_SIZE;
54941
54940
  ground.tileScale.x = 3;
@@ -54947,7 +54946,7 @@ function addTilePositionAnimation(sprite, dx, dy) {
54947
54946
  } else {
54948
54947
  ground.alpha = 0.2;
54949
54948
  }
54950
- var ground2 = new TilingSprite(terrain_Assets.get('ground-mask'), VIEW_BOX, VIEW_BOX);
54949
+ var ground2 = new TilingSprite(Assets.get('ground-mask'), VIEW_BOX, VIEW_BOX);
54951
54950
  ground2.x = -HALF_CELL_SIZE;
54952
54951
  ground2.y = -HALF_CELL_SIZE;
54953
54952
  ground2.tileScale.x = 7;
@@ -55770,8 +55769,6 @@ function World_toPrimitive(t, r) { if ("object" != World_typeof(t) || !t) return
55770
55769
 
55771
55770
 
55772
55771
 
55773
- var World_Assets = Assets;
55774
-
55775
55772
 
55776
55773
 
55777
55774
 
@@ -55820,18 +55817,21 @@ var World = /*#__PURE__*/function () {
55820
55817
  var _ref2 = World_slicedToArray(_ref, 2),
55821
55818
  objectMetadata = _ref2[1];
55822
55819
  if (objectMetadata) {
55823
- var _objectMetadata$actio = objectMetadata.actions,
55824
- actions = _objectMetadata$actio === void 0 ? [] : _objectMetadata$actio,
55825
- _objectMetadata$calcu = objectMetadata.calculations,
55826
- calculations = _objectMetadata$calcu === void 0 ? [] : _objectMetadata$calcu,
55827
- _objectMetadata$data = objectMetadata.data,
55828
- data = _objectMetadata$data === void 0 ? [] : _objectMetadata$data,
55829
- _objectMetadata$proce = objectMetadata.processors,
55830
- processors = _objectMetadata$proce === void 0 ? [] : _objectMetadata$proce;
55831
- objectMetadata.actions = [].concat(World_toConsumableArray(allActions), World_toConsumableArray(actions));
55832
- objectMetadata.data = World_objectSpread(World_objectSpread({}, allData), data);
55833
- objectMetadata.calculations = [].concat(World_toConsumableArray(allCalculations), World_toConsumableArray(calculations));
55834
- objectMetadata.processors = [].concat(World_toConsumableArray(allProcessors), World_toConsumableArray(processors));
55820
+ if (!objectMetadata._initialized) {
55821
+ var _objectMetadata$actio = objectMetadata.actions,
55822
+ actions = _objectMetadata$actio === void 0 ? [] : _objectMetadata$actio,
55823
+ _objectMetadata$calcu = objectMetadata.calculations,
55824
+ calculations = _objectMetadata$calcu === void 0 ? [] : _objectMetadata$calcu,
55825
+ _objectMetadata$data = objectMetadata.data,
55826
+ data = _objectMetadata$data === void 0 ? [] : _objectMetadata$data,
55827
+ _objectMetadata$proce = objectMetadata.processors,
55828
+ processors = _objectMetadata$proce === void 0 ? [] : _objectMetadata$proce;
55829
+ objectMetadata.actions = [].concat(World_toConsumableArray(allActions), World_toConsumableArray(actions));
55830
+ objectMetadata.data = World_objectSpread(World_objectSpread({}, allData), data);
55831
+ objectMetadata.calculations = [].concat(World_toConsumableArray(allCalculations), World_toConsumableArray(calculations));
55832
+ objectMetadata.processors = [].concat(World_toConsumableArray(allProcessors), World_toConsumableArray(processors));
55833
+ objectMetadata._initialized = true;
55834
+ }
55835
55835
  }
55836
55836
  });
55837
55837
 
@@ -55872,16 +55872,16 @@ var World = /*#__PURE__*/function () {
55872
55872
  _context.p = 1;
55873
55873
  // Add all assets to the Assets loader
55874
55874
  Object.keys(this.resourceMap).forEach(function (key) {
55875
- World_Assets.add({
55875
+ Assets.add({
55876
55876
  alias: key,
55877
55877
  src: _this.resourceMap[key]
55878
55878
  });
55879
55879
  });
55880
55880
 
55881
55881
  // Load all assets
55882
- logger.debug('Loading resources...');
55882
+ logger.debug('Loading resources...', this.resourceMap);
55883
55883
  _context.n = 2;
55884
- return World_Assets.load(Object.keys(this.resourceMap));
55884
+ return Assets.load(Object.keys(this.resourceMap));
55885
55885
  case 2:
55886
55886
  logger.debug('Resources loaded successfully');
55887
55887
  _context.n = 4;
@@ -56015,7 +56015,8 @@ var World = /*#__PURE__*/function () {
56015
56015
  }, {
56016
56016
  key: "release",
56017
56017
  value: function release() {
56018
- World_Assets.reset();
56018
+ Assets.reset();
56019
+ this.removeAllObjects();
56019
56020
  }
56020
56021
  }, {
56021
56022
  key: "getResource",
@@ -56032,7 +56033,7 @@ var World = /*#__PURE__*/function () {
56032
56033
  case 0:
56033
56034
  url = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : name;
56034
56035
  logger = this.options.logger; // Check if already cached
56035
- cached = World_Assets.get(name);
56036
+ cached = Assets.get(name);
56036
56037
  if (!cached) {
56037
56038
  _context2.n = 1;
56038
56039
  break;
@@ -56042,12 +56043,12 @@ var World = /*#__PURE__*/function () {
56042
56043
  case 1:
56043
56044
  _context2.p = 1;
56044
56045
  logger.debug("Loading resource ".concat(name));
56045
- World_Assets.add({
56046
+ Assets.add({
56046
56047
  alias: name,
56047
56048
  src: url
56048
56049
  });
56049
56050
  _context2.n = 2;
56050
- return World_Assets.load(name);
56051
+ return Assets.load(name);
56051
56052
  case 2:
56052
56053
  resource = _context2.v;
56053
56054
  return _context2.a(2, resource);
@@ -56260,8 +56261,6 @@ function GameRenderer_toPrimitive(t, r) { if ("object" != GameRenderer_typeof(t)
56260
56261
 
56261
56262
 
56262
56263
 
56263
-
56264
- var GameRenderer_Application = Application;
56265
56264
  var THRESHOLD = 500;
56266
56265
  var GameRenderer = /*#__PURE__*/function () {
56267
56266
  /**
@@ -56316,7 +56315,7 @@ var GameRenderer = /*#__PURE__*/function () {
56316
56315
  if (!this.released) {
56317
56316
  this.release();
56318
56317
  }
56319
- app = new GameRenderer_Application({
56318
+ app = new Application({
56320
56319
  width: width,
56321
56320
  height: height,
56322
56321
  antialias: true,