diff --git a/lib/actions/server/skills/type-physical-attack.js b/lib/actions/server/skills/type-physical-attack.js
index b751736d4..90c0a935a 100644
--- a/lib/actions/server/skills/type-physical-attack.js
+++ b/lib/actions/server/skills/type-physical-attack.js
@@ -129,7 +129,7 @@ class TypePhysicalAttack extends PhysicalAttack
removeBullet(body)
{
body.world.removeBodies.push(body);
- // @TODO - BETA - Refactor and extract Colyseus into a driver.
+ // @TODO - BETA - Refactor and extract Colyseus into a driver. Check is been used?
this.room.state.removeBody(this.key+'_bullet_'+body.id);
}
diff --git a/lib/actions/server/skills/type-physical-effect.js b/lib/actions/server/skills/type-physical-effect.js
index 6979ae122..21516a70d 100644
--- a/lib/actions/server/skills/type-physical-effect.js
+++ b/lib/actions/server/skills/type-physical-effect.js
@@ -115,7 +115,7 @@ class TypePhysicalEffect extends PhysicalEffect
removeBullet(body)
{
body.world.removeBodies.push(body);
- // @TODO - BETA - Refactor and extract Colyseus into a driver.
+ // @TODO - BETA - Refactor and extract Colyseus into a driver. Check is been used?
this.room.state.removeBody(this.key+'_bullet_'+body.id);
}
diff --git a/lib/audio/client/scene-audio-player.js b/lib/audio/client/scene-audio-player.js
index 7e02edf86..65df2c8cd 100644
--- a/lib/audio/client/scene-audio-player.js
+++ b/lib/audio/client/scene-audio-player.js
@@ -38,36 +38,37 @@ class SceneAudioPlayer
continue;
}
sprite.on('animationstart', (event) => {
- let associatedAudio = this.attachAudioToSprite(sprite, event.key, audioManager, sceneDynamic);
- if(associatedAudio !== false){
+ let animationKey = AudioConst.AUDIO_ANIMATION_KEY_START+event.key;
+ let associatedAudio = this.attachAudioToSprite(sprite, animationKey, audioManager, sceneDynamic);
+ if(false !== associatedAudio){
this.playSpriteAudio(associatedAudio, sceneDynamic.key, audioManager);
}
});
sprite.on('animationupdate', (event) => {
let animationKey = AudioConst.AUDIO_ANIMATION_KEY_UPDATE+event.key;
let associatedAudio = this.attachAudioToSprite(sprite, animationKey, audioManager, sceneDynamic);
- if(associatedAudio !== false){
+ if(false !== associatedAudio){
this.playSpriteAudio(associatedAudio, sceneDynamic.key, audioManager);
}
});
sprite.on('animationcomplete', (event) => {
let animationKey = AudioConst.AUDIO_ANIMATION_KEY_COMPLETE+event.key;
let associatedAudio = this.attachAudioToSprite(sprite, animationKey, audioManager, sceneDynamic);
- if(associatedAudio !== false){
+ if(false !== associatedAudio){
this.playSpriteAudio(associatedAudio, sceneDynamic.key, audioManager);
}
});
sprite.on('animationrepeat', (event) => {
let animationKey = AudioConst.AUDIO_ANIMATION_KEY_REPEAT+event.key;
let associatedAudio = this.attachAudioToSprite(sprite, animationKey, audioManager, sceneDynamic);
- if(associatedAudio !== false){
+ if(false !== associatedAudio){
this.playSpriteAudio(associatedAudio, sceneDynamic.key, audioManager);
}
});
sprite.on('animationstop', (event) => {
let animationKey = AudioConst.AUDIO_ANIMATION_KEY_STOP+event.key;
let associatedAudio = this.attachAudioToSprite(sprite, animationKey, audioManager, sceneDynamic);
- if(associatedAudio !== false){
+ if(false !== associatedAudio){
this.playSpriteAudio(associatedAudio, sceneDynamic.key, audioManager);
}
});
diff --git a/lib/audio/constants.js b/lib/audio/constants.js
index 2a68a1404..d24e1f807 100644
--- a/lib/audio/constants.js
+++ b/lib/audio/constants.js
@@ -8,6 +8,7 @@
module.exports.AudioConst = {
AUDIO_UPDATE: 'ap',
AUDIO_DELETE: 'ad',
+ AUDIO_ANIMATION_KEY_START: 'i_',
AUDIO_ANIMATION_KEY_UPDATE: 'u_',
AUDIO_ANIMATION_KEY_COMPLETE: 'c_',
AUDIO_ANIMATION_KEY_REPEAT: 'r_',
diff --git a/lib/game/client/game-manager.js b/lib/game/client/game-manager.js
index 956f7f741..81e0be491 100644
--- a/lib/game/client/game-manager.js
+++ b/lib/game/client/game-manager.js
@@ -14,6 +14,7 @@ const { ConfigManager } = require('../../config/client/config-manager');
const { TranslationsMapper } = require('../../snippets/client/translations-mapper');
const Translations = require('./snippets/en_US');
const { GameDom } = require('./game-dom');
+const { RoomsConst } = require('../../rooms/constants');
const { GameConst } = require('../constants');
const { ErrorManager, EventsManagerSingleton, Logger, sc } = require('@reldens/utils');
@@ -188,7 +189,7 @@ class GameManager
// since the user is now registered:
this.userData.isNewUser = false;
await this.joinFeaturesRooms();
- let useLastLocation = '' !== selectedScene && selectedScene !== '@lastLocation';
+ let useLastLocation = '' !== selectedScene && selectedScene !== RoomsConst.ROOM_LAST_LOCATION_KEY;
let playerScene = useLastLocation ? selectedScene : this.playerData.state.scene;
this.playerData.state.scene = playerScene;
let joinedFirstRoom = await this.gameClient.joinOrCreate(playerScene, this.userData);
diff --git a/lib/game/client/room-events.js b/lib/game/client/room-events.js
index 4ef19a0f4..7ff21fd77 100644
--- a/lib/game/client/room-events.js
+++ b/lib/game/client/room-events.js
@@ -296,6 +296,9 @@ class RoomEvents
async runChangeScene(message)
{
+ if(message.act === GameConst.CHANGING_SCENE){
+ this.gameManager.getActiveScene().scene.setVisible(false);
+ }
if(
message.act !== GameConst.CHANGED_SCENE
|| message.scene !== this.room.name
@@ -578,6 +581,10 @@ class RoomEvents
async createEngineScene(player, room, previousScene)
{
+ let previousSceneInstance = this.gameEngine.scene.getScene(previousScene);
+ if(previousSceneInstance){
+ previousSceneInstance.scene.setVisible(false);
+ }
// this event happens once for every scene:
await this.events.emit('reldens.createEngineScene', player, room, previousScene, this);
!this.gameManager.room
@@ -645,12 +652,17 @@ class RoomEvents
async destroyPreviousScene(previousScene, player)
{
- if(!previousScene || !this.gameEngine.scene.getScene(previousScene)){
+ if(!previousScene){
+ Logger.warning('Missing previous scene data.', previousScene);
+ return false;
+ }
+ let previousSceneInstance = this.gameEngine.scene.getScene(previousScene);
+ if(!previousSceneInstance){
+ Logger.warning('Missing previous scene instance.', previousSceneInstance);
return false;
}
- // destroy previous scene tile set:
- await this.gameEngine.scene.getScene(previousScene).changeScene();
- // stop the previous scene and start the new one:
+ // previousSceneInstance.scene.setVisible(false);
+ await previousSceneInstance.changeScene();
this.gameEngine.scene.stop(previousScene);
this.gameEngine.scene.start(player.state.scene);
}
diff --git a/lib/game/client/scene-dynamic.js b/lib/game/client/scene-dynamic.js
index c469a36f7..a0f5058b9 100644
--- a/lib/game/client/scene-dynamic.js
+++ b/lib/game/client/scene-dynamic.js
@@ -286,6 +286,9 @@ class SceneDynamic extends Scene
}
for(let i of playerKeys){
let entityState = this.interpolatePlayersPosition[i];
+ if(!entityState){
+ continue;
+ }
let entity = this.player.players[i];
if(!entity){
continue;
@@ -297,6 +300,9 @@ class SceneDynamic extends Scene
let newX = Phaser.Math.Linear(entity.x, (entityState.x - this.player.leftOff), this.interpolationSpeed);
let newY = Phaser.Math.Linear(entity.y, (entityState.y - this.player.topOff), this.interpolationSpeed);
this.player.processPlayerPositionAnimationUpdate(entity, entityState, i, newX, newY);
+ if(!entityState.mov){
+ delete this.interpolatePlayersPosition[i];
+ }
}
}
@@ -323,6 +329,9 @@ class SceneDynamic extends Scene
return;
}
let entityState = this.interpolateObjectsPositions[i];
+ if(!entityState){
+ return;
+ }
if(this.isCurrentPosition(entity, entityState)){
delete this.interpolateObjectsPositions[i];
return;
@@ -332,6 +341,9 @@ class SceneDynamic extends Scene
y: Phaser.Math.Linear(entity.y, entityState.y, this.interpolationSpeed)
};
objectsPlugin.updateBulletBodyPosition(i, bodyData);
+ if(!entityState.mov){
+ delete this.interpolateObjectsPositions[i];
+ }
}
isBullet(objectKey)
@@ -346,6 +358,9 @@ class SceneDynamic extends Scene
return;
}
let entityState = this.interpolateObjectsPositions[i];
+ if(!entityState){
+ return;
+ }
if(this.isCurrentPosition(entity, entityState)){
delete this.interpolateObjectsPositions[i];
return;
@@ -357,6 +372,9 @@ class SceneDynamic extends Scene
mov: entityState.mov
};
objectsPlugin.updateObjectsAnimations(i, bodyData, this);
+ if(!entityState.mov){
+ delete this.interpolateObjectsPositions[i];
+ }
}
isCurrentPosition(entity, entityState)
diff --git a/lib/game/constants.js b/lib/game/constants.js
index 1675411bc..db2bbe19a 100644
--- a/lib/game/constants.js
+++ b/lib/game/constants.js
@@ -9,6 +9,7 @@ module.exports.GameConst = {
ACTION_KEY: 'act',
CREATE_PLAYER: 'cp',
CREATE_PLAYER_RESULT: 'cps',
+ CHANGING_SCENE: 'cgs',
CHANGED_SCENE: 'cs',
RECONNECT: 'r',
ROOM_GAME: 'room_game',
diff --git a/lib/game/server/login-manager.js b/lib/game/server/login-manager.js
index 8a1d37344..f5931e72e 100644
--- a/lib/game/server/login-manager.js
+++ b/lib/game/server/login-manager.js
@@ -5,6 +5,7 @@
*/
const { PasswordManager } = require('./password-manager');
+const { RoomsConst } = require('../../rooms/constants');
const { GameConst } = require('../constants');
const { ErrorManager, Logger, sc } = require('@reldens/utils');
@@ -141,7 +142,11 @@ class LoginManager
continue;
}
let config = this.config.get('client/rooms/selection');
- if(config.allowOnLogin && userData['selectedScene'] && userData['selectedScene'] !== '@lastLocation'){
+ if(
+ config.allowOnLogin
+ && userData['selectedScene']
+ && userData['selectedScene'] !== RoomsConst.ROOM_LAST_LOCATION_KEY
+ ){
await this.applySelectedLocation(player, userData['selectedScene']);
}
player.state.scene = await this.getRoomNameById(player.state.room_id);
diff --git a/lib/objects/client/animation-engine.js b/lib/objects/client/animation-engine.js
index f829fb1e1..8784cadff 100644
--- a/lib/objects/client/animation-engine.js
+++ b/lib/objects/client/animation-engine.js
@@ -53,9 +53,18 @@ class AnimationEngine
this.zeroPad = props.zeroPad || false;
this.prefix = props.prefix || false;
this.isInteractive = props.isInteractive || false;
+ this.highlightOnOver = Boolean(sc.get(
+ props,
+ 'highlightOnOver',
+ this.gameManager.config.getWithoutLogs('client/ui/animations/highlightOnOver', true)
+ ));
+ this.highlightColor = sc.get(
+ props,
+ 'highlightColor',
+ this.gameManager.config.getWithoutLogs('client/ui/animations/highlightColor', '0x00ff00')
+ );
this.restartTime = sc.get(props, 'restartTime', false);
this.calculateAnimPosition();
- this.extraAnimations = {};
// @NOTE: having this here we will get the animations generated for each object instance, so normally you would
// get duplicated animations for any respawn "multiple" object, BUT, at the same time, you could have an
// animation for a specific instance ID, we need to keep this here and check if the animation already exists on
@@ -203,6 +212,14 @@ class AnimationEngine
currentScene.player.currentTarget = thisTarget;
this.gameManager.gameEngine.showTarget(this.targetName, thisTarget, previousTarget);
});
+ if(this.highlightOnOver){
+ this.sceneSprite.on('pointerover', () => {
+ this.sceneSprite.setTint(this.highlightColor);
+ });
+ this.sceneSprite.on('pointerout', () => {
+ this.sceneSprite.clearTint();
+ });
+ }
}
runAnimation()
diff --git a/lib/objects/client/plugin.js b/lib/objects/client/plugin.js
index f8b00eb48..73b1f8f13 100644
--- a/lib/objects/client/plugin.js
+++ b/lib/objects/client/plugin.js
@@ -128,11 +128,17 @@ class ObjectsPlugin extends PluginInterface
await this.events.emit('reldens.objectBodyChange', {body, key, changes: {[bodyProp]: value}});
this.updateBodyProperties(bodyProp, stateProps, body, value);
let currentScene = gameManager.activeRoomEvents.getActiveScene();
- if(currentScene.clientInterpolation && GameConst.STATUS.AVOID_INTERPOLATION !== body.inState){
+ let isBullet = -1 !== key.indexOf('bullet');
+ let currentBody = isBullet ? this.bullets[key] : currentScene.objectsAnimations[key];
+ let currentBodyAxleCondition = currentBody && 0 < currentBody.x || currentBody && 0 < currentBody.y;
+ let axleCondition = 0 < body.x || 0 < body.y;
+ let canInterpolate = GameConst.STATUS.AVOID_INTERPOLATION !== body.inState;
+ this.setVisibility(currentBody, currentBodyAxleCondition, axleCondition);
+ Logger.debug({key, bodyProp, value, currentBody, updatedBody: body});
+ if(currentScene.clientInterpolation && canInterpolate && axleCondition && currentBodyAxleCondition){
currentScene.interpolateObjectsPositions[key] = body;
return;
}
- let isBullet = -1 !== key.indexOf('bullet');
if(isBullet){
return this.updateBulletBodyPosition(key, body);
}
@@ -141,6 +147,14 @@ class ObjectsPlugin extends PluginInterface
}
}
+ setVisibility(currentBody, currentBodyAxleCondition, axleCondition)
+ {
+ if(!currentBody || !currentBody.sceneSprite){
+ return;
+ }
+ currentBody?.sceneSprite?.setVisible(axleCondition);
+ }
+
updateBodyProperties(bodyProp, stateProps, body, value)
{
if(bodyProp === 'state'){
@@ -154,6 +168,9 @@ class ObjectsPlugin extends PluginInterface
updateBulletBodyPosition(key, body)
{
+ if(!this.bullets[key]){
+ return;
+ }
this.bullets[key].x = body.x;
this.bullets[key].y = body.y;
this.events.emit('reldens.objectBodyChanged', {body, key});
@@ -161,10 +178,10 @@ class ObjectsPlugin extends PluginInterface
updateObjectsAnimations(key, body, currentScene)
{
- if(!sc.hasOwn(currentScene.objectsAnimations, key)){
+ let objectAnimation = sc.get(currentScene.objectsAnimations, key);
+ if(!objectAnimation){
return false;
}
- let objectAnimation = currentScene.objectsAnimations[key];
objectAnimation.updateObjectAndSpritePositions(body.x, body.y);
this.events.emit('reldens.objectBodyChanged', {body, key});
let objectNewDepth = objectAnimation.updateObjectDepth();
diff --git a/lib/rooms/client/plugin.js b/lib/rooms/client/plugin.js
index d616734d3..527a901ce 100644
--- a/lib/rooms/client/plugin.js
+++ b/lib/rooms/client/plugin.js
@@ -5,6 +5,7 @@
*/
const { ActionsConst } = require('../../actions/constants');
+const { RoomsConst } = require('../constants');
const { PluginInterface } = require('../../features/plugin-interface');
const { Logger, sc } = require('@reldens/utils');
@@ -49,20 +50,22 @@ class RoomsPlugin extends PluginInterface
ActionsConst.SELECTORS.PLAYER_SELECTION_ADDITIONAL_INFO
);
if(!playerCreationAdditional && !playerSelectionAdditional){
+ Logger.warning('Missing element.', {playerCreationAdditional, playerSelectionAdditional});
return false;
}
- let lastLocationLabel = gameManager.config.get('client/rooms/selection/loginLastLocationLabel');
if(playerCreationAdditional){
- let creationRoomSelection = [...roomSelection];
- let index = roomSelection.indexOf(lastLocationLabel);
+ let index = roomSelection.indexOf({
+ name: RoomsConst.ROOM_LAST_LOCATION_KEY,
+ title: gameManager.config.get('client/rooms/selection/loginLastLocationLabel')
+ });
if(-1 !== index){
- creationRoomSelection.splice(index, 1);
+ roomSelection.splice(index, 1);
}
- let div = this.createSelectorElements(gameManager, creationRoomSelection);
+ let div = this.createSelectorElements(gameManager, roomSelection);
playerCreationAdditional.append(div);
}
if(playerSelectionAdditional){
- let div = this.createSelectorElements(gameManager, roomSelection, lastLocationLabel);
+ let div = this.createSelectorElements(gameManager, roomSelection);
playerSelectionAdditional.append(div);
}
}
@@ -80,7 +83,7 @@ class RoomsPlugin extends PluginInterface
gameManager.initialGameData.selectedScene = selectedScene;
}
- createSelectorElements(gameManager, roomSelection, lastLocationLabel)
+ createSelectorElements(gameManager, roomSelection)
{
let div = gameManager.gameDom.createElement('div');
div.classList.add('input-box');
@@ -91,11 +94,8 @@ class RoomsPlugin extends PluginInterface
select.name = 'selectedScene';
select.classList.add('select-element');
select.classList.add('scene-select');
- for(let roomName of roomSelection){
- let option = new Option(roomName, roomName);
- if(lastLocationLabel && roomName === lastLocationLabel){
- option.value = '@lastLocation';
- }
+ for(let roomData of roomSelection){
+ let option = new Option(roomData.title, roomData.name);
select.append(option);
}
div.append(label);
diff --git a/lib/rooms/constants.js b/lib/rooms/constants.js
index 46af14cbc..7d37a200d 100644
--- a/lib/rooms/constants.js
+++ b/lib/rooms/constants.js
@@ -11,4 +11,5 @@ module.exports.RoomsConst = {
TILE_INDEX: 'i',
NEXT_SCENE: 'n',
MAPS_BUCKET: '/assets/maps',
+ ROOM_LAST_LOCATION_KEY: '@lastLocation'
};
diff --git a/lib/rooms/server/manager.js b/lib/rooms/server/manager.js
index 6f9da1503..598e2efa3 100644
--- a/lib/rooms/server/manager.js
+++ b/lib/rooms/server/manager.js
@@ -126,6 +126,10 @@ class RoomsManager
let roomsByName = {};
for(let room of roomsModels){
let temp = this.generateRoomModel(room);
+ if(!temp){
+ Logger.error('Room model could not be generated.', room);
+ continue;
+ }
rooms.push(temp);
roomsById[room.id] = temp;
roomsByName[room.name] = temp;
@@ -156,6 +160,10 @@ class RoomsManager
let room = await this.dataServer.getEntity('rooms').loadBy(property, value);
if(room){
let temp = this.generateRoomModel(room);
+ if(!temp){
+ Logger.critical('Loading room by "'+property+'" with value "'+value+'", model could not be generated.');
+ return false;
+ }
this.loadedRooms.push(temp);
this.loadedRoomsById[room.id] = temp;
this.loadedRoomsByName[room.name] = temp;
@@ -166,6 +174,10 @@ class RoomsManager
generateRoomModel(room)
{
+ if(!room){
+ Logger.critical('Room not available.');
+ return false;
+ }
let temp = {
roomId: room.id,
roomName: room.name,
diff --git a/lib/rooms/server/plugin.js b/lib/rooms/server/plugin.js
index 5e7215d63..0879bf8c2 100644
--- a/lib/rooms/server/plugin.js
+++ b/lib/rooms/server/plugin.js
@@ -5,6 +5,7 @@
*/
const { PluginInterface } = require('../../features/plugin-interface');
+const { RoomsConst } = require('../constants');
const { Logger, sc } = require('@reldens/utils');
class RoomsPlugin extends PluginInterface
@@ -53,11 +54,14 @@ class RoomsPlugin extends PluginInterface
configuredRooms.split(','),
currentRooms
));
- let availableRoomsTitles = this.extractRoomTitles(availableRooms);
+ let availableRoomsForSelector = this.extractRoomDataForSelector(availableRooms);
if(config.loginLastLocation && !isRegistration){
- availableRoomsTitles = [config.loginLastLocationLabel, ...availableRoomsTitles];
+ availableRoomsForSelector = [
+ {name: RoomsConst.ROOM_LAST_LOCATION_KEY, title: config.loginLastLocationLabel},
+ ...availableRoomsForSelector
+ ];
}
- superInitialGameData.roomSelection = availableRoomsTitles;
+ superInitialGameData.roomSelection = availableRoomsForSelector;
}
}
@@ -77,11 +81,11 @@ class RoomsPlugin extends PluginInterface
return validRooms;
}
- extractRoomTitles(availableRooms)
+ extractRoomDataForSelector(availableRooms)
{
let titles = [];
for(let i of Object.keys(availableRooms)){
- titles.push(availableRooms[i].roomTitle);
+ titles.push({name: availableRooms[i].roomName, title: availableRooms[i].roomTitle});
}
return titles;
}
diff --git a/lib/rooms/server/scene.js b/lib/rooms/server/scene.js
index 088613616..e8c29e0e9 100644
--- a/lib/rooms/server/scene.js
+++ b/lib/rooms/server/scene.js
@@ -405,13 +405,19 @@ class RoomScene extends RoomLogin
async nextSceneInitialPosition(client, data, playerBody)
{
+ let currentPlayer = this.playerBySessionIdFromState(client.sessionId);
+ this.broadcast('*', {
+ act: GameConst.CHANGING_SCENE,
+ id: client.sessionId,
+ scene: currentPlayer.state.scene,
+ prev: data.prev,
+ });
let nextRoom = await this.loginManager.roomsManager.loadRoomByName(data.next);
if(!nextRoom){
Logger.error('Player room change error. Next room not found: ' + data.next);
playerBody.isChangingScene = false;
return;
}
- let currentPlayer = this.playerBySessionIdFromState(client.sessionId);
let newPosition = this.fetchNewPosition(nextRoom, data.prev);
if(!newPosition){
Logger.error('Can not find next room: '+nextRoom.roomName, {data, nextRoom});
diff --git a/lib/users/client/player-engine.js b/lib/users/client/player-engine.js
index 7c8a8b3b1..6c8b1cf91 100644
--- a/lib/users/client/player-engine.js
+++ b/lib/users/client/player-engine.js
@@ -37,9 +37,9 @@ class PlayerEngine
// @TODO - BETA - Set all the configs in a single config property.
this.animationBasedOnPress = this.config.get('client/players/animations/basedOnPress');
// @TODO - BETA - Make size configurations depend on class-paths assets if present.
- this.topOff = this.gameManager.config.get('client/players/size/topOffset');
- this.leftOff = this.gameManager.config.get('client/players/size/leftOffset');
- this.collideWorldBounds = this.gameManager.config.get('client/players/animations/collideWorldBounds');
+ this.topOff = this.config.get('client/players/size/topOffset');
+ this.leftOff = this.config.get('client/players/size/leftOffset');
+ this.collideWorldBounds = this.config.get('client/players/animations/collideWorldBounds');
this.fadeDuration = Number(this.config.get('client/players/animations/fadeDuration'));
this.cameraRoundPixels = Boolean(
this.config.getWithoutLogs('client/general/engine/cameraRoundPixels', true)
@@ -50,9 +50,11 @@ class PlayerEngine
this.cameraInterpolationY = Number(
this.config.getWithoutLogs('client/general/engine/cameraInterpolationY', 0.04)
);
- this.globalConfigNameText = this.gameManager.config.get('client/ui/players/nameText');
- this.globalConfigShowNames = Boolean(this.gameManager.config.get('client/ui/players/showNames'));
+ this.globalConfigNameText = this.config.get('client/ui/players/nameText');
+ this.globalConfigShowNames = Boolean(this.config.get('client/ui/players/showNames'));
this.defaultActionKeyConfig = this.config.get('client/ui/controls/defaultActionKey');
+ this.highlightOnOver = Boolean(this.config.getWithoutLogs('client/ui/players/highlightOnOver', true));
+ this.highlightColor = this.config.getWithoutLogs('client/ui/players/highlightColor', '0x00ff00');
this.lastKeyState = {};
}
@@ -125,6 +127,14 @@ class PlayerEngine
// update target ui:
this.setTargetPlayerById(id);
});
+ if(this.highlightOnOver){
+ this.players[id].on('pointerover', () => {
+ this.players[id].setTint(this.highlightColor);
+ });
+ this.players[id].on('pointerout', () => {
+ this.players[id].clearTint();
+ });
+ }
}
setTargetPlayerById(id)
@@ -197,6 +207,10 @@ class PlayerEngine
Logger.error('Missing player ID to process animation update.', playerSprite, playerState, playerId);
return;
}
+ let currentInterpolations = Object.keys(this.scene.interpolatePlayersPosition);
+ if(0 === currentInterpolations.length){
+ return;
+ }
this.playPlayerAnimation(playerSprite, playerState);
this.stopPlayerAnimation(playerSprite, playerState);
this.updateSpritePosition(playerSprite, newX, newY);
diff --git a/lib/world/server/collisions-manager.js b/lib/world/server/collisions-manager.js
index 25c20b691..b4d08961b 100644
--- a/lib/world/server/collisions-manager.js
+++ b/lib/world/server/collisions-manager.js
@@ -39,8 +39,11 @@ class CollisionsManager
if(1 >= pairs.length){
return;
}
- let bullet = false;
+ let bulletAny = false;
+ let bulletA = false;
+ let bulletB = false;
let player = false;
+ let roomWall = false;
for(let body of pairs){
if(body.playerId && body.pStop){
body.stopFull();
@@ -48,31 +51,54 @@ class CollisionsManager
if(body.playerId){
player = body;
}
+ if(body.isWall){
+ roomWall = body;
+ }
if(body.isBullet){
- bullet = body;
+ bulletAny = body;
+ if(bulletA && !bulletB){
+ bulletB = body;
+ }
+ if(bulletB && !bulletA){
+ bulletA = body;
+ }
}
}
- if(this.room.roomWorld.bulletsStopOnPlayer && player && bullet){
+ if(this.room.roomWorld.bulletsStopOnPlayer && player && bulletAny){
player.stopFull();
- bullet.stopFull();
- this.room.roomWorld.removeBodies.push(bullet);
+ this.stopAndRemoveBullet(bulletAny);
+ }
+ if(bulletAny && roomWall){
+ this.stopAndRemoveBullet(bulletAny);
+ }
+ if(bulletA && bulletB){
+ this.stopAndRemoveBullet(bulletA);
+ this.stopAndRemoveBullet(bulletB);
}
this.removeIdleBullets();
}
+ stopAndRemoveBullet(bulletBody)
+ {
+ bulletBody.stopFull();
+ this.room.roomWorld.removeBodies.push(bulletBody);
+ if(bulletBody.bodyStateId){
+ this.room.roomWorld.removeBulletsStateIds.push(bulletBody.bodyStateId);
+ }
+ }
+
removeIdleBullets()
{
if(0 === this.room.roomWorld.removeBulletsStateIds.length){
return;
}
- let fixedStateIds = [...this.room.roomWorld.removeBulletsStateIds];
- for(let stateId of fixedStateIds){
+ for(let stateId of this.room.roomWorld.removeBulletsStateIds){
+ // @TODO - BETA - Refactor and extract Colyseus into a driver.
+ this.room.state.removeBody(stateId);
this.room.roomWorld.removeBulletsStateIds.splice(
this.room.roomWorld.removeBulletsStateIds.indexOf(stateId),
1
);
- // @TODO - BETA - Refactor and extract Colyseus into a driver.
- this.room.state.removeBody(stateId);
}
}
diff --git a/lib/world/server/p2world.js b/lib/world/server/p2world.js
index 38495a982..47c42ace5 100644
--- a/lib/world/server/p2world.js
+++ b/lib/world/server/p2world.js
@@ -83,9 +83,9 @@ class P2world extends World
this.worldDateTime = new Date();
this.worldDateTimeInterval = setInterval(() => {
this.worldDateTime = new Date();
- Logger.debug(
- 'World "'+this.worldKey+'" time: '+this.worldDateTime.toISOString().slice(0, 19).replace('T', ' ')
- );
+ // Logger.debug(
+ // 'World "'+this.worldKey+'" time: '+this.worldDateTime.toISOString().slice(0, 19).replace('T', ' ')
+ // );
}, 1000);
}
diff --git a/lib/world/server/physical-body.js b/lib/world/server/physical-body.js
index f7cfbbf00..386c4da07 100644
--- a/lib/world/server/physical-body.js
+++ b/lib/world/server/physical-body.js
@@ -112,8 +112,8 @@ class PhysicalBody extends Body
this.bodyState.mov = false;
return;
}
- // @NOTE: the word "bullet" will be part of our glossary to refer to bodies that will be created, moved, and
- // destroyed on hit or that reach the world boundaries.
+ // @NOTE: with the key word "bullet" we will refer to bodies that will be created, moved, and destroyed on
+ // hit or that reach the world boundaries.
this.removeBullet();
// update position:
if(this.bodyState.x !== this.position[0]){
diff --git a/package-lock.json b/package-lock.json
index be49aa63a..874915f50 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "reldens",
- "version": "4.0.0-beta.32",
+ "version": "4.0.0-beta.33",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "reldens",
- "version": "4.0.0-beta.32",
+ "version": "4.0.0-beta.33",
"license": "MIT",
"dependencies": {
"@adminjs/design-system": "2.1.2",
@@ -64,7 +64,7 @@
"bcrypt": "5.1.1",
"body-parser": "^1.20.2",
"colyseus": "0.15.15",
- "colyseus.js": "0.15.17",
+ "colyseus.js": "0.15.18",
"core-js": "3.35.1",
"cors": "2.8.5",
"dotenv": "16.4.1",
@@ -6628,9 +6628,9 @@
}
},
"node_modules/colyseus.js": {
- "version": "0.15.17",
- "resolved": "https://registry.npmjs.org/colyseus.js/-/colyseus.js-0.15.17.tgz",
- "integrity": "sha512-cMSilA3W6VZmEdql7niIYjVTEKHNdhrAEXXqdcUEodQSZWtIjjW+OeaA0Hfh3zdH2aEwDlZQGT/VgGhodwCabA==",
+ "version": "0.15.18",
+ "resolved": "https://registry.npmjs.org/colyseus.js/-/colyseus.js-0.15.18.tgz",
+ "integrity": "sha512-/yLsqN0d0D1N2dhTlJkP80Z/YtKZU6MEaevu0q02V0qppQ/I53zzVqnDnaGAE1R/6NLB1I2Ry5+0l/tevnKDrw==",
"dependencies": {
"@colyseus/schema": "^2.0.4",
"httpie": "^2.0.0-next.13",
@@ -16908,9 +16908,9 @@
}
},
"colyseus.js": {
- "version": "0.15.17",
- "resolved": "https://registry.npmjs.org/colyseus.js/-/colyseus.js-0.15.17.tgz",
- "integrity": "sha512-cMSilA3W6VZmEdql7niIYjVTEKHNdhrAEXXqdcUEodQSZWtIjjW+OeaA0Hfh3zdH2aEwDlZQGT/VgGhodwCabA==",
+ "version": "0.15.18",
+ "resolved": "https://registry.npmjs.org/colyseus.js/-/colyseus.js-0.15.18.tgz",
+ "integrity": "sha512-/yLsqN0d0D1N2dhTlJkP80Z/YtKZU6MEaevu0q02V0qppQ/I53zzVqnDnaGAE1R/6NLB1I2Ry5+0l/tevnKDrw==",
"requires": {
"@colyseus/schema": "^2.0.4",
"httpie": "^2.0.0-next.13",
diff --git a/package.json b/package.json
index d8e94218d..e83ff4b9c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "reldens",
- "version": "4.0.0-beta.32",
+ "version": "4.0.0-beta.33",
"description": "Reldens - MMORPG Platform",
"author": "Damian A. Pastorini",
"license": "MIT",
@@ -89,7 +89,7 @@
"bcrypt": "5.1.1",
"body-parser": "^1.20.2",
"colyseus": "0.15.15",
- "colyseus.js": "0.15.17",
+ "colyseus.js": "0.15.18",
"core-js": "3.35.1",
"cors": "2.8.5",
"dotenv": "16.4.1",
diff --git a/theme/default/assets/email/forgot.html b/theme/default/assets/email/forgot.html
index 08495781a..e0d5f372e 100644
--- a/theme/default/assets/email/forgot.html
+++ b/theme/default/assets/email/forgot.html
@@ -1,5 +1,5 @@
Hello user!
-Did you forgot your password?
+Did you forget your password?
If so you can use this reset password link:
{{ resetLink }}
diff --git a/theme/default/assets/favicon/apple-touch-icon.png b/theme/default/assets/favicon/apple-touch-icon.png
deleted file mode 100644
index 3e15f3aeb..000000000
Binary files a/theme/default/assets/favicon/apple-touch-icon.png and /dev/null differ
diff --git a/theme/default/assets/favicons/android-icon-144x144.png b/theme/default/assets/favicons/android-icon-144x144.png
new file mode 100644
index 000000000..af2ddb60c
Binary files /dev/null and b/theme/default/assets/favicons/android-icon-144x144.png differ
diff --git a/theme/default/assets/favicon/android-chrome-192x192.png b/theme/default/assets/favicons/android-icon-192x192.png
similarity index 100%
rename from theme/default/assets/favicon/android-chrome-192x192.png
rename to theme/default/assets/favicons/android-icon-192x192.png
diff --git a/theme/default/assets/favicon/android-chrome-512x512.png b/theme/default/assets/favicons/android-icon-512x512.png
similarity index 100%
rename from theme/default/assets/favicon/android-chrome-512x512.png
rename to theme/default/assets/favicons/android-icon-512x512.png
diff --git a/theme/default/assets/favicons/apple-touch-icon.png b/theme/default/assets/favicons/apple-touch-icon.png
new file mode 100644
index 000000000..d26104f3c
Binary files /dev/null and b/theme/default/assets/favicons/apple-touch-icon.png differ
diff --git a/theme/default/assets/favicon/favicon-16x16.png b/theme/default/assets/favicons/favicon-16x16.png
similarity index 100%
rename from theme/default/assets/favicon/favicon-16x16.png
rename to theme/default/assets/favicons/favicon-16x16.png
diff --git a/theme/default/assets/favicon/favicon-32x32.png b/theme/default/assets/favicons/favicon-32x32.png
similarity index 100%
rename from theme/default/assets/favicon/favicon-32x32.png
rename to theme/default/assets/favicons/favicon-32x32.png
diff --git a/theme/default/assets/favicons/mstile-150x150.png b/theme/default/assets/favicons/mstile-150x150.png
new file mode 100644
index 000000000..6f707e2ed
Binary files /dev/null and b/theme/default/assets/favicons/mstile-150x150.png differ
diff --git a/theme/default/assets/favicons/safari-pinned-tab.svg b/theme/default/assets/favicons/safari-pinned-tab.svg
new file mode 100644
index 000000000..30620edbf
--- /dev/null
+++ b/theme/default/assets/favicons/safari-pinned-tab.svg
@@ -0,0 +1,121 @@
+
+
+
+
+Created by potrace 1.14, written by Peter Selinger 2001-2017
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme/default/assets/web/favicon.ico b/theme/default/assets/web/favicon.ico
deleted file mode 100644
index 0c77ba35d..000000000
Binary files a/theme/default/assets/web/favicon.ico and /dev/null differ
diff --git a/theme/default/browserconfig.xml b/theme/default/browserconfig.xml
new file mode 100644
index 000000000..2b7e9b77c
--- /dev/null
+++ b/theme/default/browserconfig.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+ #000000
+
+
+
diff --git a/theme/default/es-index.html b/theme/default/es-index.html
index f16828ac2..e50e5267e 100644
--- a/theme/default/es-index.html
+++ b/theme/default/es-index.html
@@ -1,213 +1,217 @@
- DwDeveloper - Reldens | MMORPG Plataforma
-
+ Reldens | MMORPG Platform | By DwDeveloper
+
-
-
-
+
+
+
+
-
+
+
+
+
-
-
-
-
-
- Descargo: Reldens no es solo un juego, es una plataforma para crear juegos.
- Esta es una demostración para mostrar cuántas funciones están disponibles en la plataforma.
-
+