CREATORJD commited on
Commit
fb28b58
·
verified ·
1 Parent(s): 75f8d62

v1.32.44 faction wiring + team bars + terrain recovery

Browse files
Files changed (1) hide show
  1. src/ui/render3d.js +19 -4
src/ui/render3d.js CHANGED
@@ -1522,12 +1522,21 @@ function render(dtDraw){
1522
  visible structure, ground unit and aircraft gets a camera-facing bar.
1523
  Both the dark track and coloured fill share bbAlpha, so even a large army
1524
  remains one draw call instead of issuing UI geometry per entity. */
1525
- const putHealthBar=(x,y,h,w,bh,frac)=>{
 
 
 
 
 
 
1526
  frac=clamp(frac,0,1);
1527
  bbAlpha.addRect(sprites.px,x,y,h,w+2.4,bh+2.0,8,12,18,225);
1528
  if(frac<=0) return;
1529
  const off=-w*(1-frac)*0.5;
1530
- const r=frac>0.5?72:255, g=frac>0.5?235:frac>0.25?184:82, b=frac>0.5?112:62;
 
 
 
1531
  bbAlpha.addRect(sprites.px,
1532
  x+matV[0]*off, y+matV[8]*off, h+matV[4]*off,
1533
  w*frac,bh,r,g,b,255);
@@ -1548,7 +1557,7 @@ function render(dtDraw){
1548
  if(!fogEntityVisible(Bd.team,Bd.x,Bd.y)) continue;
1549
  const T=BT[Bd.type], H=gh(Bd.x,Bd.y);
1550
  const bw=Math.max(42,T.size*1.02), bh=H+T.size*1.18;
1551
- putHealthBar(Bd.x,Bd.y,bh,bw,5.2,Bd.hp/Bd.hpm);
1552
  if(Bd.shieldMax>0) putShieldBar(Bd.x,Bd.y,bh+6,bw,Bd.shield/Bd.shieldMax);
1553
  }
1554
  /* Typed scratch, reused across frames. This loop used to push one object
@@ -1568,7 +1577,13 @@ function render(dtDraw){
1568
  }
1569
  const putUnitBar=k=>{
1570
  const i=_hbI[k], T=TYPES[utype[i]], H=gh(ux[i],uy[i])+(T.air?58:0);
1571
- putHealthBar(ux[i],uy[i],H+T.size*(T.air?1.15:1.42),Math.max(22,T.size*1.35),4.0,_hbF[k]);
 
 
 
 
 
 
1572
  };
1573
  /* A type-select can contain hundreds of units in regular formation. One
1574
  bar per chassis then touches its neighbours and becomes a solid stripe.
 
1522
  visible structure, ground unit and aircraft gets a camera-facing bar.
1523
  Both the dark track and coloured fill share bbAlpha, so even a large army
1524
  remains one draw call instead of issuing UI geometry per entity. */
1525
+ /* ALLEGIANCE IS THE FIRST READ, damage the second. Every bar used to run
1526
+ the same green-amber-red damage ramp, so a brawl was a wall of identical
1527
+ green and you could not tell whose army was winning at a glance. Now the
1528
+ hue answers "whose?" - your bars keep the full damage ramp (their exact
1529
+ state is YOUR tactical information), enemy and wildlife bars live in the
1530
+ red family and darken as they fall. */
1531
+ const putHealthBar=(x,y,h,w,bh,frac,team)=>{
1532
  frac=clamp(frac,0,1);
1533
  bbAlpha.addRect(sprites.px,x,y,h,w+2.4,bh+2.0,8,12,18,225);
1534
  if(frac<=0) return;
1535
  const off=-w*(1-frac)*0.5;
1536
+ let r,g,b;
1537
+ if(team===1){ r=255; g=52+50*frac; b=44; } // enemy army - hard red
1538
+ else if(team===2){ r=255; g=118+50*frac; b=34; } // wildlife - hot ember
1539
+ else { r=frac>0.5?72:255; g=frac>0.5?235:frac>0.25?184:82; b=frac>0.5?112:62; }
1540
  bbAlpha.addRect(sprites.px,
1541
  x+matV[0]*off, y+matV[8]*off, h+matV[4]*off,
1542
  w*frac,bh,r,g,b,255);
 
1557
  if(!fogEntityVisible(Bd.team,Bd.x,Bd.y)) continue;
1558
  const T=BT[Bd.type], H=gh(Bd.x,Bd.y);
1559
  const bw=Math.max(42,T.size*1.02), bh=H+T.size*1.18;
1560
+ putHealthBar(Bd.x,Bd.y,bh,bw,5.2,Bd.hp/Bd.hpm,Bd.team);
1561
  if(Bd.shieldMax>0) putShieldBar(Bd.x,Bd.y,bh+6,bw,Bd.shield/Bd.shieldMax);
1562
  }
1563
  /* Typed scratch, reused across frames. This loop used to push one object
 
1577
  }
1578
  const putUnitBar=k=>{
1579
  const i=_hbI[k], T=TYPES[utype[i]], H=gh(ux[i],uy[i])+(T.air?58:0);
1580
+ const bh=H+T.size*(T.air?1.15:1.42), bw=Math.max(22,T.size*1.35);
1581
+ putHealthBar(ux[i],uy[i],bh,bw,4.0,_hbF[k],uteam[i]);
1582
+ /* Secondary shielding is a projected buff (ushielded is a short window a
1583
+ shield field keeps refreshing). While it holds, a thin cyan strip
1584
+ rides above the health bar - the one defensive state in the game that
1585
+ previously had no readback on the unit itself. */
1586
+ if(ushielded[i]>0) putShieldBar(ux[i],uy[i],bh+5,bw*0.72,clamp(ushielded[i]/0.7,0,1));
1587
  };
1588
  /* A type-select can contain hundreds of units in regular formation. One
1589
  bar per chassis then touches its neighbours and becomes a solid stripe.