Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
chore: bump client to pixi v6
Browse files Browse the repository at this point in the history
  • Loading branch information
leia-uwu committed Feb 19, 2024
1 parent a17895c commit 4914171
Show file tree
Hide file tree
Showing 24 changed files with 603 additions and 137 deletions.
5 changes: 2 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
"base64-js": "^1.5.1",
"bit-buffer": "^0.2.5",
"jquery": "^3.7.1",
"pixi.js": "4.8.9"
"pixi.js": "6.5.10"
},
"devDependencies": {
"@types/jquery": "^3.5.29",
"vite": "^5.1.3",
"@types/pixi.js": "4.8.9"
"vite": "^5.1.3"
}
}
18 changes: 9 additions & 9 deletions client/src/emote.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,28 +290,28 @@ function s(e, t, r, a, o) {
const r = new PIXI.Container();
const a = new PIXI.Container();
const i = GameConfig.groupColors[e] || t;
const o = PIXI.Sprite.fromImage("ping-border.img");
const o = PIXI.Sprite.from("ping-border.img");
o.scale.set(0.4, 0.4);
o.anchor.set(0.5, 0.5);
o.tint = i;
o.alpha = 0;
o.visible = true;
r.addChild(o);
const s = PIXI.Sprite.fromImage("ping-team-danger.img");
const s = PIXI.Sprite.from("ping-team-danger.img");
s.scale.set(0.4, 0.4);
s.anchor.set(0.5, 0.5);
s.tint = i;
s.alpha = 0;
s.visible = true;
r.addChild(s);
const c = PIXI.Sprite.fromImage("ping-team-danger.img");
const c = PIXI.Sprite.from("ping-team-danger.img");
c.scale.set(0.5, 0.5);
c.anchor.set(0.5, 0.5);
c.tint = i;
c.alpha = 0;
c.visible = true;
a.addChild(c);
const m = PIXI.Sprite.fromImage("ping-indicator.img");
const m = PIXI.Sprite.from("ping-indicator.img");
m.scale.set(0.5, 0.5);
m.anchor.set(0.5, 0);
m.alpha = 0;
Expand Down Expand Up @@ -511,9 +511,9 @@ s.prototype = {
if (a) {
a.pos = e.pos;
a.pingSprite.sprite.texture =
PIXI.Texture.fromImage(r.texture);
PIXI.Texture.from(r.texture);
a.indSpriteInner.sprite.texture =
PIXI.Texture.fromImage(r.texture);
PIXI.Texture.from(r.texture);
a.indSpriteInner.sprite.tint = r.mapEvent
? r.tint
: a.indSpriteInner.baseTint;
Expand Down Expand Up @@ -558,7 +558,7 @@ s.prototype = {
r.alive = false;
r.pos = v2.create(0, 0);
r.container = new PIXI.Container();
r.circleOuter = new PIXI.Sprite.fromImage(
r.circleOuter = new PIXI.Sprite.from(
"emote-circle-outer.img"
);
r.circleOuter.anchor.set(0.5, 0.5);
Expand Down Expand Up @@ -588,15 +588,15 @@ s.prototype = {
r.life = this.emoteLife;
r.lifeOut = this.emoteLifeOut;
r.zIdx = this.zIdxNext++;
r.sprite.texture = PIXI.Texture.fromImage(t.texture);
r.sprite.texture = PIXI.Texture.from(t.texture);
r.container.visible = false;
r.baseScale = 0.55;
r.sound = t.sound;
r.channel = t.channel;
if (e.type == "emote_loot") {
const i = GameObjectDefs[e.itemType];
if (i?.lootImg) {
r.sprite.texture = PIXI.Texture.fromImage(
r.sprite.texture = PIXI.Texture.from(
i.lootImg.sprite
);
const o = GameObjectDefs[i.ammo];
Expand Down
6 changes: 3 additions & 3 deletions client/src/gas.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class GasRenderer {
i.lineTo(p, p);
i.lineTo(-p, p);
i.closePath();
// i.beginHole();
i.beginHole();
i.moveTo(0, 1);
for (let s = 1; s < h; s++) {
const n = s / h;
const l = Math.sin(Math.PI * 2 * n);
const c = Math.cos(Math.PI * 2 * n);
i.lineTo(l, c);
}
i.addHole();
// i.endHole();
// i.addHole();
i.endHole();
i.closePath();
}
this.display.visible = false;
Expand Down
12 changes: 6 additions & 6 deletions client/src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ s.prototype = {
e.endFill();
e.beginFill(u.beach);
i(e, c.shore);
// e.beginHole();
e.beginHole();
i(e, c.grass);
e.addHole();
// e.endHole();
// e.addHole();
e.endHole();
e.endFill();
if (r) {
e.beginFill(u.grass);
Expand Down Expand Up @@ -271,10 +271,10 @@ s.prototype = {
e.lineTo(d.x, d.y);
e.lineTo(p.x, p.y);
e.lineTo(m.x, m.y);
// e.beginHole();
e.beginHole();
i(e, c.shore);
e.addHole();
// e.endHole();
// e.addHole();
e.endHole();
e.closePath();
e.endFill();
const x = e;
Expand Down
2 changes: 1 addition & 1 deletion client/src/objects/Smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Smoke() {
const e = ["part-smoke-02.img", "part-smoke-03.img"];
this.active = false;
this.zIdx = 0;
this.sprite = PIXI.Sprite.fromImage(
this.sprite = PIXI.Sprite.from(
e[Math.floor(Math.random() * e.length)]
);
this.sprite.anchor = new PIXI.Point(0.5, 0.5);
Expand Down
2 changes: 1 addition & 1 deletion client/src/objects/aidrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AirDrop.prototype = {
this.isNew = true;
this.fallTicker = e.fallT * GameConfig.airdrop.fallTime;
const i = a.map.getMapDef().biome.airdrop.airdropImg;
this.sprite.texture = PIXI.Texture.fromImage(i);
this.sprite.texture = PIXI.Texture.from(i);
}
if (t) {
this.pos = v2.copy(e.pos);
Expand Down
6 changes: 4 additions & 2 deletions client/src/objects/building.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ Building.prototype = {
const r = math.oriToRad(e.rot || 0);
const s = i.allocSprite();
if (e.sprite && e.sprite != "none") {
s.texture = PIXI.Texture.fromImage(e.sprite);
s.texture = PIXI.Texture.from(e.sprite);
} else {
s.texture = PIXI.Texture.EMPTY;
}
s.tint = e.tint;
const l = a.map.getMapDef().biome.valueAdjust;
Expand Down Expand Up @@ -326,7 +328,7 @@ Building.prototype = {
const S = MapObjectDefs[this.type];
if (S.ceiling.destroy !== undefined) {
const v = this.allocSprite();
v.texture = PIXI.Texture.fromImage(
v.texture = PIXI.Texture.from(
S.ceiling.destroy.residue
);
v.position.set(0, 0);
Expand Down
2 changes: 1 addition & 1 deletion client/src/objects/bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ s.prototype = {
a.container = new PIXI.Container();
a.container.pivot.set(14.5, 0);
a.container.visible = false;
a.bulletTrail = PIXI.Sprite.fromImage(
a.bulletTrail = PIXI.Sprite.from(
"player-bullet-trail-02.img"
);
a.bulletTrail.anchor.set(0.5, 0.5);
Expand Down
2 changes: 1 addition & 1 deletion client/src/objects/deadBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function i() {
this.active = false;
this.pos = v2.create(0, 0);
this.container = new PIXI.Container();
this.sprite = PIXI.Sprite.fromImage("skull.img");
this.sprite = PIXI.Sprite.from("skull.img");
this.sprite.anchor.set(0.5, 0.5);
this.sprite.scale.set(0.4, 0.4);
this.sprite.tint = 5921370;
Expand Down
2 changes: 1 addition & 1 deletion client/src/objects/decal.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ o.prototype = {
this.zIdx = a.img.zIdx;
this.zOrd = e.__id;
const i = a.img;
this.sprite.texture = PIXI.Texture.fromImage(i.sprite);
this.sprite.texture = PIXI.Texture.from(i.sprite);
this.sprite.alpha = 1;
this.sprite.visible = true;
this.imgScale = a.img.scale;
Expand Down
4 changes: 2 additions & 2 deletions client/src/objects/flare.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ a.prototype = {
a.alive = false;
a.flareContainer = new PIXI.Container();
a.flareContainer.visible = false;
a.flare = PIXI.Sprite.fromImage("part-flare-01.img");
a.flare = PIXI.Sprite.from("part-flare-01.img");
a.flare.anchor.set(0.5, 0.5);
a.flareContainer.addChild(a.flare);
a.trailContainer = new PIXI.Container();
a.trailContainer.visible = false;
a.trailContainer.pivot.set(14.5, 0);
a.bulletTrail = PIXI.Sprite.fromImage(
a.bulletTrail = PIXI.Sprite.from(
"player-bullet-trail-02.img"
);
a.bulletTrail.anchor.set(0.5, 0.5);
Expand Down
6 changes: 3 additions & 3 deletions client/src/objects/loot.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ a.prototype = {
this.imgScale = i.lootImg.scale * 1.25;
const n = i.lootImg.innerScale || 0.8;
this.sprite.scale.set(n, n);
this.sprite.texture = PIXI.Texture.fromImage(
this.sprite.texture = PIXI.Texture.from(
i.lootImg.sprite
);
this.sprite.tint = i.lootImg.tint;
this.container.texture = i.lootImg.border
? PIXI.Texture.fromImage(i.lootImg.border)
? PIXI.Texture.from(i.lootImg.border)
: PIXI.Texture.EMPTY;
if (this.isPreloadedGun) {
this.container.texture = PIXI.Texture.fromImage(
this.container.texture = PIXI.Texture.from(
"loot-circle-outer-06.img"
);
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/objects/mapIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ a.prototype = {
c.alpha = 1;
c.zOrder = n;
c.visible = true;
c.sprite.texture = PIXI.Texture.fromImage(
c.sprite.texture = PIXI.Texture.from(
r.mapIndicator.sprite
);
c.sprite.tint = r.mapIndicator.tint;
Expand All @@ -78,7 +78,7 @@ a.prototype = {
m.zOrder = n - 1;
m.visible = true;
m.sprite.texture =
PIXI.Texture.fromImage("part-pulse-01.img");
PIXI.Texture.from("part-pulse-01.img");
m.sprite.tint = r.mapIndicator.pulseTint;
}
},
Expand Down
4 changes: 2 additions & 2 deletions client/src/objects/obstacle.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Obstacle.prototype = {
let h = p.pos || v2.create(0, 0);
h = v2.rotate(h, this.rot + Math.PI * 0.5);
const d = new PIXI.Sprite();
d.texture = PIXI.Texture.fromImage(p.sprite);
d.texture = PIXI.Texture.from(p.sprite);
d.anchor.set(0.5, 0.5);
d.posOffset = h;
d.imgScale = p.scale;
Expand Down Expand Up @@ -175,7 +175,7 @@ Obstacle.prototype = {
this.sprite.texture =
(w == "none" || !w)
? PIXI.Texture.EMPTY
: PIXI.Texture.fromImage(w);
: PIXI.Texture.from(w);
this.sprite.anchor.set(f.x, f.y);
this.sprite.tint = m.img.tint;
this.sprite.imgAlpha = this.dead
Expand Down
2 changes: 1 addition & 1 deletion client/src/objects/particles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3089,7 +3089,7 @@ s.prototype = {
const y = Array.isArray(g.image)
? g.image[Math.floor(Math.random() * g.image.length)]
: g.image;
this.sprite.texture = PIXI.Texture.fromImage(y);
this.sprite.texture = PIXI.Texture.from(y);
this.sprite.visible = false;
this.valueAdjust = g.ignoreValueAdjust ? 1 : u;
this.setColor(o(g.color));
Expand Down
4 changes: 2 additions & 2 deletions client/src/objects/plane.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ Plane.prototype = {
this.rad = this.config.planeRad;
switch (this.type) {
case GameConfig.Plane.Airdrop:
this.sprite.texture = PIXI.Texture.fromImage(
this.sprite.texture = PIXI.Texture.from(
t.getMapDef().biome.airdrop.planeImg
);
this.planeSound =
t.getMapDef().biome.airdrop.planeSound;
break;
case GameConfig.Plane.Airstrike:
this.sprite.texture =
PIXI.Texture.fromImage("map-plane-02.img");
PIXI.Texture.from("map-plane-02.img");
this.planeSound = "fighter_01";
}
this.sprite.visible = true;
Expand Down
Loading

0 comments on commit 4914171

Please sign in to comment.