@screeps/renderer 1.6.5-arena → 1.6.7-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
@@ -53766,8 +53766,6 @@ function fillRoads(states) {
53766
53766
  scope = params.scope,
53767
53767
  stateExtra = params.stateExtra,
53768
53768
  _params$world = params.world,
53769
- app = _params$world.app,
53770
- terrainLayer = _params$world.layers.terrain,
53771
53769
  _params$world$options = _params$world.options,
53772
53770
  CELL_SIZE = _params$world$options.CELL_SIZE,
53773
53771
  _params$world$options2 = _params$world$options.lighting,
@@ -53816,17 +53814,12 @@ function fillRoads(states) {
53816
53814
  var l = CELL_SIZE;
53817
53815
  var lb = l;
53818
53816
  var graphics = new Graphics();
53819
- graphics.parentLayer = terrainLayer;
53820
- graphics.zIndex = 1;
53821
- if (!(app.renderer instanceof Renderer)) {
53817
+ graphics.zIndex = -1;
53818
+ if (lighting === 'disabled') {
53822
53819
  graphics.tint = 0xa0a0a0;
53823
- } else {
53824
- if (lighting === 'disabled') {
53825
- graphics.tint = 0xa0a0a0;
53826
- }
53827
- if (lighting === 'low') {
53828
- graphics.tint = 0xc0c0c0;
53829
- }
53820
+ }
53821
+ if (lighting === 'low') {
53822
+ graphics.tint = 0xc0c0c0;
53830
53823
  }
53831
53824
  var color = decorationFloorLandscape ? colorBrightness(parseInt(decorationFloorLandscape.roadsColor.substring(1), 16), decorationFloorLandscape.roadsBrightness) : ROAD_COLOR;
53832
53825
  graphics.clear();
@@ -54686,10 +54679,8 @@ function addTilePositionAnimation(sprite, dx, dy) {
54686
54679
  rampartsPath = _pathHelper2.result;
54687
54680
  rampartsObject.md5 = rampartsMd5;
54688
54681
  if (rampartsPath) {
54689
- if (rampartsObject.sprite) {
54690
- rampartsObject.sprite.destroy(rampartsObject.sprite._generatedSvgTexture);
54691
- }
54692
- rampartsObject.sprite = setupObject(buildSvg(rampartsPath, {
54682
+ var spriteToDestroy = rampartsObject.sprite;
54683
+ var newSprite = buildSvg(rampartsPath, {
54693
54684
  size: size,
54694
54685
  VIEW_BOX: VIEW_BOX
54695
54686
  }, {
@@ -54697,10 +54688,23 @@ function addTilePositionAnimation(sprite, dx, dy) {
54697
54688
  stroke: users[_id].color,
54698
54689
  'stroke-width': 25,
54699
54690
  'paint-order': 'stroke'
54700
- }), {
54691
+ });
54692
+ rampartsObject.sprite = setupObject(newSprite, {
54701
54693
  alpha: 0.4,
54702
54694
  blendMode: BLEND_MODES.ADD,
54703
- parentLayer: effectsLayer
54695
+ parentLayer: effectsLayer,
54696
+ visible: false
54697
+ });
54698
+
54699
+ // Destroy old sprite only after new texture is loaded
54700
+ actionHelper.onTextureLoaded(newSprite.texture, function () {
54701
+ // Safety check: only update visibility if this sprite is still the current one
54702
+ if (rampartsObject.sprite === newSprite) {
54703
+ rampartsObject.sprite.visible = true;
54704
+ }
54705
+ if (spriteToDestroy) {
54706
+ spriteToDestroy.destroy(spriteToDestroy._generatedSvgTexture);
54707
+ }
54704
54708
  });
54705
54709
  } else if (rampartsPath === false && rampartsObject.sprite) {
54706
54710
  rampartsObject.sprite.destroy(rampartsObject.sprite._generatedSvgTexture);