Browse Source

feat: filters can now be removed, fixed static cameras and raised the level cap to 21

1993-leagues
Shaun 8 months ago
parent
commit
e30fc1a191
3 changed files with 21 additions and 13 deletions
  1. +2
    -0
      src/client/js/objects/objects.js
  2. +16
    -10
      src/client/js/rendering/renderer.js
  3. +3
    -3
      src/server/config/consts.js

+ 2
- 0
src/client/js/objects/objects.js View File

@@ -249,6 +249,8 @@ define([


if (template.filters && !obj.sprite?.filters?.length) if (template.filters && !obj.sprite?.filters?.length)
renderer.addFilter(obj.sprite, template.filters[0]); renderer.addFilter(obj.sprite, template.filters[0]);
else if (template.filters && template.filters.length === 0 && obj.sprite?.filters?.length > 0)
renderer.removeFilter(obj.sprite);


if (template.name) { if (template.name) {
if (obj.nameSprite) if (obj.nameSprite)


+ 16
- 10
src/client/js/rendering/renderer.js View File

@@ -288,7 +288,6 @@ define([
const { zoneId, collisionMap, map, hiddenRooms, clientObjects, rendererConfig } = msg; const { zoneId, collisionMap, map, hiddenRooms, clientObjects, rendererConfig } = msg;
const { staticCamera = false, cameraPosition } = rendererConfig; const { staticCamera = false, cameraPosition } = rendererConfig;


this.staticCamera = staticCamera;
this.map = map; this.map = map;


this.titleScreen = false; this.titleScreen = false;
@@ -339,12 +338,19 @@ define([
events.emit('onGetObject', c); events.emit('onGetObject', c);
}); });


if (cameraPosition) {
if (staticCamera) {
this.staticCamera = true;

this.setPosition({ this.setPosition({
x: (cameraPosition.x - (this.width / (scale * 2))) * scale,
y: (cameraPosition.y - (this.height / (scale * 2))) * scale
}, true, true);
}
pos: {
x: cameraPosition.x,
y: cameraPosition.y
},
instant: true,
staticPosition: true
});
} else
this.staticCamera = false;


//Normally, the mounts mod queues this event when unmounting. //Normally, the mounts mod queues this event when unmounting.
// If we rezone, our effects are destroyed, so the event is queued, // If we rezone, our effects are destroyed, so the event is queued,
@@ -359,7 +365,7 @@ define([
instant: boolean instant: boolean
should the camera pan to the location or not should the camera pan to the location or not
*/ */
setPosition: function ({ pos = { x: 0, y: 0 }, instant }) {
setPosition: function ({ pos = { x: 0, y: 0 }, instant, staticPosition }) {
let { x, y } = pos; let { x, y } = pos;


x = (x - (this.width / (scale * 2))) * scale; x = (x - (this.width / (scale * 2))) * scale;
@@ -389,8 +395,8 @@ define([
} }
} }


const staticCamera = window.staticCamera || this.staticCamera;
if (staticCamera && !instant) {
const staticCamera = window.staticCamera ?? this.staticCamera;
if (staticCamera && staticPosition === undefined) {
this.updateSprites(); this.updateSprites();
return; return;
@@ -609,7 +615,7 @@ define([
return filter; return filter;
}, },


removeFilter: function (sprite, filter) {
removeFilter: function (sprite) {
if (sprite.filters) if (sprite.filters)
sprite.filters = null; sprite.filters = null;
}, },


+ 3
- 3
src/server/config/consts.js View File

@@ -7,13 +7,13 @@ module.exports = {
tickTime: 350, tickTime: 350,


//The maximum level a player can reach //The maximum level a player can reach
maxLevel: 20,
maxLevel: 21,


//Rune damage is multiplied by nth entry from this array where n = level - 1 //Rune damage is multiplied by nth entry from this array where n = level - 1
dmgMults: [0.25, 0.4, 0.575, 0.8, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5],
dmgMults: [0.25, 0.4, 0.575, 0.8, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6],


//Mob HP is multiplied by nth entry from this array where n = level - 1 //Mob HP is multiplied by nth entry from this array where n = level - 1
hpMults: [0.1, 0.2, 0.4, 0.7, 0.78, 0.91, 1.16, 1.19, 1.65, 2.36, 3.07, 3.55, 4.1, 4.85, 5.6, 5.9, 6.5, 7.1, 7.9, 12],
hpMults: [0.1, 0.2, 0.4, 0.7, 0.78, 0.91, 1.16, 1.19, 1.65, 2.36, 3.07, 3.55, 4.1, 4.85, 5.6, 5.9, 6.5, 7.1, 7.9, 12, 15],


//How far a player can see objects horizontally //How far a player can see objects horizontally
viewDistanceX: 25, viewDistanceX: 25,


Loading…
Cancel
Save