@screeps/renderer 1.6.8-arena → 1.6.10

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
@@ -52603,9 +52603,8 @@ function object_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; v
52603
52603
  // Helper function to validate and clamp color values for PixiJS v7 compatibility
52604
52604
  function object_validateColor(value) {
52605
52605
  if (typeof value === 'number') {
52606
- // Ensure color value is within valid range (0x000000 to 0xFFFFFF)
52607
- // Clamp negative values to 0 and large values to maximum
52608
- return Math.min(0xFFFFFF, Math.max(0, Math.floor(value)));
52606
+ // Mask to 24-bit RGB range (0x000000 to 0xFFFFFF)
52607
+ return Math.floor(value) & 0xFFFFFF;
52609
52608
  }
52610
52609
  return value;
52611
52610
  }
@@ -53985,11 +53984,27 @@ var PUBLIC_COLOR = 0xdd8888;
53985
53984
  var bubbleWidth = textMetrics.width + 60;
53986
53985
  var bubbleHeight = 100;
53987
53986
  var bubbleOffset = -170;
53987
+ var r = 30;
53988
+ var left = -bubbleWidth / 2;
53989
+ var right = bubbleWidth / 2;
53990
+ var top = bubbleOffset;
53991
+ var bottom = bubbleOffset + bubbleHeight;
53988
53992
  var graphics = new Graphics();
53989
53993
  graphics.lineStyle(8, 0x000000);
53990
53994
  graphics.beginFill(backgroundColor);
53991
- graphics.drawRoundedRect(-bubbleWidth / 2, bubbleOffset, bubbleWidth, bubbleHeight, 30);
53992
- graphics.drawPolygon([new Point(30, -74), new Point(0, -44), new Point(-30, -74)]);
53995
+ graphics.moveTo(left + r, top);
53996
+ graphics.lineTo(right - r, top);
53997
+ graphics.arc(right - r, top + r, r, -Math.PI / 2, 0);
53998
+ graphics.lineTo(right, bottom - r);
53999
+ graphics.arc(right - r, bottom - r, r, 0, Math.PI / 2);
54000
+ graphics.lineTo(30, bottom);
54001
+ graphics.lineTo(0, -44);
54002
+ graphics.lineTo(-30, bottom);
54003
+ graphics.lineTo(left + r, bottom);
54004
+ graphics.arc(left + r, bottom - r, r, Math.PI / 2, Math.PI);
54005
+ graphics.lineTo(left, top + r);
54006
+ graphics.arc(left + r, top + r, r, Math.PI, Math.PI * 3 / 2);
54007
+ graphics.closePath();
53993
54008
  graphics.endFill();
53994
54009
  container.addChild(graphics);
53995
54010
  var textParams = Object.assign({}, params, {
@@ -54220,7 +54235,11 @@ var getRenderPath = function getRenderPath(worldOptions, objectsArray, filter, p
54220
54235
  var hasAny;
54221
54236
  objectsArray.forEach(function (objectArray) {
54222
54237
  objectArray.forEach(function (object) {
54223
- if (object.x === null || object.y === null) {
54238
+ if (!object) {
54239
+ console.error('null object');
54240
+ return;
54241
+ }
54242
+ if (object.x === null || object.x === undefined || object.y === null || object.y === undefined) {
54224
54243
  console.error('null coordinates in object', object);
54225
54244
  return;
54226
54245
  }
@@ -54504,8 +54523,10 @@ function addTilePositionAnimation(sprite, dx, dy) {
54504
54523
  effectsLayer = _params$world$layers.effects,
54505
54524
  rendererSize = _params$world.options.size,
54506
54525
  _params$state = params.state,
54507
- _params$state$gameDat = _params$state.gameData.swampTexture,
54508
- swampTexture = _params$state$gameDat === void 0 ? 'animated' : _params$state$gameDat,
54526
+ _params$state$gameDat = _params$state.gameData,
54527
+ player = _params$state$gameDat.player,
54528
+ _params$state$gameDat2 = _params$state$gameDat.swampTexture,
54529
+ swampTexture = _params$state$gameDat2 === void 0 ? 'animated' : _params$state$gameDat2,
54509
54530
  objects = _params$state.objects,
54510
54531
  _params$state$users = _params$state.users,
54511
54532
  users = _params$state$users === void 0 ? {} : _params$state$users,
@@ -54518,7 +54539,8 @@ function addTilePositionAnimation(sprite, dx, dy) {
54518
54539
  _params$world$options3 = _params$world$options.HALF_CELL_SIZE,
54519
54540
  HALF_CELL_SIZE = _params$world$options3 === void 0 ? CELL_SIZE / 2 : _params$world$options3,
54520
54541
  _params$world$options4 = _params$world$options.lighting,
54521
- lighting = _params$world$options4 === void 0 ? 'normal' : _params$world$options4;
54542
+ lighting = _params$world$options4 === void 0 ? 'normal' : _params$world$options4,
54543
+ userOwnerColor = _params$world$options.userOwnerColor;
54522
54544
  var sizeRatio = size.width / VIEW_BOX;
54523
54545
  function setupObject(object, params) {
54524
54546
  stage.addChild(object);
@@ -54674,7 +54696,7 @@ function addTilePositionAnimation(sprite, dx, dy) {
54674
54696
  isPublic = _ref0.isPublic,
54675
54697
  user = _ref0.user;
54676
54698
  return type === 'rampart' && !isPublic && user === _id;
54677
- }, rampartsObject.md5, true),
54699
+ }, rampartsObject.md5, false),
54678
54700
  rampartsMd5 = _pathHelper2.md5,
54679
54701
  rampartsPath = _pathHelper2.result;
54680
54702
  rampartsObject.md5 = rampartsMd5;
@@ -54683,7 +54705,17 @@ function addTilePositionAnimation(sprite, dx, dy) {
54683
54705
  var newSprite = buildSvg(rampartsPath, {
54684
54706
  size: size,
54685
54707
  VIEW_BOX: VIEW_BOX
54686
- }, {
54708
+ }, userOwnerColor ? player === _id ? {
54709
+ fill: '#105010',
54710
+ stroke: '#44ff44',
54711
+ 'stroke-width': 25,
54712
+ 'paint-order': 'stroke'
54713
+ } : {
54714
+ fill: '#501010',
54715
+ stroke: '#ff4444',
54716
+ 'stroke-width': 25,
54717
+ 'paint-order': 'stroke'
54718
+ } : {
54687
54719
  fill: multiply(users[_id].color, 0.3),
54688
54720
  stroke: users[_id].color,
54689
54721
  'stroke-width': 25,
@@ -55036,7 +55068,7 @@ var BADGE_PAYLOAD = {
55036
55068
  scope: _scope
55037
55069
  }, otherParams));
55038
55070
  } else {
55039
- var color = actionHelper.parseExpression(payloadColor, params);
55071
+ var color = Number.isInteger(payloadColor) ? payloadColor : actionHelper.parseExpression(payloadColor, params);
55040
55072
  return circle(userBadge_objectSpread({
55041
55073
  payload: {
55042
55074
  radius: radius,
@@ -55165,6 +55197,12 @@ function set(decorations, params) {
55165
55197
  });
55166
55198
  }
55167
55199
  ;// ./src/lib/processors/creepDecoration.js
55200
+ function creepDecoration_typeof(o) { "@babel/helpers - typeof"; return creepDecoration_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, creepDecoration_typeof(o); }
55201
+ function creepDecoration_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
55202
+ function creepDecoration_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? creepDecoration_ownKeys(Object(t), !0).forEach(function (r) { creepDecoration_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : creepDecoration_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
55203
+ function creepDecoration_defineProperty(e, r, t) { return (r = creepDecoration_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
55204
+ function creepDecoration_toPropertyKey(t) { var i = creepDecoration_toPrimitive(t, "string"); return "symbol" == creepDecoration_typeof(i) ? i : i + ""; }
55205
+ function creepDecoration_toPrimitive(t, r) { if ("object" != creepDecoration_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != creepDecoration_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
55168
55206
 
55169
55207
 
55170
55208
 
@@ -55217,17 +55255,19 @@ function set(decorations, params) {
55217
55255
  }
55218
55256
  i.decoration.graphics.forEach(function (graphic) {
55219
55257
  var sprite = Sprite.from(graphic.url);
55220
- Object.assign(sprite, {
55258
+ Object.assign(sprite, creepDecoration_objectSpread(creepDecoration_objectSpread({
55221
55259
  // blendMode: i.lighting ? 1 : 0,
55222
55260
  width: i.width,
55223
55261
  height: i.height,
55224
55262
  anchor: {
55225
55263
  x: 0.5,
55226
55264
  y: 0.5
55227
- },
55228
- parentLayer: i.position === 'below' ? layers.objects : layers.effects,
55265
+ }
55266
+ }, i.position !== 'below' && {
55267
+ parentLayer: layers.effects
55268
+ }), {}, {
55229
55269
  zIndex: 1
55230
- });
55270
+ }));
55231
55271
  if (i[graphic.alpha] !== undefined) {
55232
55272
  sprite.alpha = i[graphic.alpha];
55233
55273
  }
@@ -55319,7 +55359,6 @@ function set(decorations, params) {
55319
55359
  x: 0.5,
55320
55360
  y: 0.5
55321
55361
  },
55322
- parentLayer: layers.objects,
55323
55362
  zIndex: 1
55324
55363
  });
55325
55364
  if (i[graphic.alpha] !== undefined) {
@@ -56323,8 +56362,7 @@ var GameRenderer = /*#__PURE__*/function () {
56323
56362
  width: width,
56324
56363
  height: height,
56325
56364
  antialias: true,
56326
- backgroundAlpha: backgroundColor ? 1 : 0,
56327
- forceCanvas: worldConfigs.forceCanvas
56365
+ backgroundAlpha: backgroundColor ? 1 : 0
56328
56366
  });
56329
56367
  this.app = app;
56330
56368
  if (backgroundColor) {