mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 17:51:53 +00:00
Fix issue with a player not being able to spawn when they join somone in co-op with a singleplayer team of more than the max allowed amount
This commit is contained in:
parent
3cc025efe0
commit
7417a1b62c
@ -158,7 +158,7 @@ public class TeamManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSpawned() {
|
public boolean isSpawned() {
|
||||||
return getPlayer().getWorld() != null && getPlayer().getScene().getEntities().containsKey(getCurrentAvatarEntity().getId());
|
return getPlayer().getScene() != null && getPlayer().getScene().getEntities().containsKey(getCurrentAvatarEntity().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxTeamSize() {
|
public int getMaxTeamSize() {
|
||||||
@ -256,7 +256,7 @@ public class TeamManager {
|
|||||||
updateTeamResonances();
|
updateTeamResonances();
|
||||||
|
|
||||||
// Packets
|
// Packets
|
||||||
getPlayer().getScene().broadcastPacket(new PacketSceneTeamUpdateNotify(getPlayer()));
|
getPlayer().getWorld().broadcastPacket(new PacketSceneTeamUpdateNotify(getPlayer()));
|
||||||
|
|
||||||
// Run callback
|
// Run callback
|
||||||
if (responsePacket != null) {
|
if (responsePacket != null) {
|
||||||
|
@ -152,6 +152,7 @@ public class World implements Iterable<GenshinPlayer> {
|
|||||||
// Copy main team to mp team
|
// Copy main team to mp team
|
||||||
if (this.isMultiplayer()) {
|
if (this.isMultiplayer()) {
|
||||||
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize());
|
player.getTeamManager().getMpTeam().copyFrom(player.getTeamManager().getCurrentSinglePlayerTeamInfo(), player.getTeamManager().getMaxTeamSize());
|
||||||
|
player.getTeamManager().setCurrentCharacterIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to scene
|
// Add to scene
|
||||||
|
@ -95,14 +95,14 @@ public class MultiplayerManager {
|
|||||||
hostPlayer.sendPacket(new PacketPlayerEnterSceneNotify(hostPlayer, hostPlayer, EnterType.EnterSelf, EnterReason.HostFromSingleToMp, hostPlayer.getScene().getId(), hostPlayer.getPos()));
|
hostPlayer.sendPacket(new PacketPlayerEnterSceneNotify(hostPlayer, hostPlayer, EnterType.EnterSelf, EnterReason.HostFromSingleToMp, hostPlayer.getScene().getId(), hostPlayer.getPos()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make requester join
|
|
||||||
hostPlayer.getWorld().addPlayer(requester);
|
|
||||||
|
|
||||||
// Set scene pos and id of requester to the host player's
|
// Set scene pos and id of requester to the host player's
|
||||||
requester.getPos().set(hostPlayer.getPos());
|
requester.getPos().set(hostPlayer.getPos());
|
||||||
requester.getRotation().set(hostPlayer.getRotation());
|
requester.getRotation().set(hostPlayer.getRotation());
|
||||||
requester.setSceneId(hostPlayer.getSceneId());
|
requester.setSceneId(hostPlayer.getSceneId());
|
||||||
|
|
||||||
|
// Make requester join
|
||||||
|
hostPlayer.getWorld().addPlayer(requester);
|
||||||
|
|
||||||
// Packet
|
// Packet
|
||||||
requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, hostPlayer, EnterType.EnterOther, EnterReason.TeamJoin, hostPlayer.getScene().getId(), hostPlayer.getPos()));
|
requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, hostPlayer, EnterType.EnterOther, EnterReason.TeamJoin, hostPlayer.getScene().getId(), hostPlayer.getPos()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user