mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-27 05:15:11 -06:00
don't invent start position if you don't have one yet
This commit is contained in:
parent
12d7f526ac
commit
9b5ffa2255
3 changed files with 11 additions and 7 deletions
|
|
@ -214,7 +214,7 @@ public class NPC extends Entity {
|
|||
getProperties().setSpawnLocation(getLocation());
|
||||
initConfig();
|
||||
Repository.getNpcs().add(this);
|
||||
RegionManager.move(this, ServerConstants.START_LOCATION, location);
|
||||
RegionManager.move(this, null, location);
|
||||
if (getLocation().getRegion().isActive()) {
|
||||
Repository.addRenderableNPC(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public final class LoginConfiguration {
|
|||
Repository.getLobbyPlayers().remove(player);
|
||||
player.setPlaying(true);
|
||||
UpdateSequence.getRenderablePlayers().add(player);
|
||||
RegionManager.move(player, ServerConstants.START_LOCATION, player.getLocation());
|
||||
RegionManager.move(player, null, player.getLocation());
|
||||
player.getMusicPlayer().init();
|
||||
player.updateAppearance();
|
||||
player.getPlayerFlags().setUpdateSceneGraph(true);
|
||||
|
|
|
|||
|
|
@ -378,17 +378,21 @@ object RegionManager {
|
|||
* @param entity The entity.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun move(entity: Entity, src: Location, dst: Location) {
|
||||
if (src.chunk != dst.chunk) {
|
||||
fun move(entity: Entity, src: Location?, dst: Location) {
|
||||
if (src?.chunk != dst.chunk) {
|
||||
when (entity) {
|
||||
is Player -> {
|
||||
src.chunk.removePlayer(entity)
|
||||
src.region.decrementViewAmount()
|
||||
if (src != null) {
|
||||
src.chunk.removePlayer(entity)
|
||||
src.region.decrementViewAmount()
|
||||
}
|
||||
dst.chunk.addPlayer(entity)
|
||||
dst.region.incrementViewAmount()
|
||||
}
|
||||
is NPC -> {
|
||||
src.chunk.remove(entity)
|
||||
if (src != null) {
|
||||
src.chunk.remove(entity)
|
||||
}
|
||||
dst.chunk.add(entity)
|
||||
}
|
||||
else -> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue