Skip to content

Commit f0c9314

Browse files
committed
Changing the active world to be named activeWorld for clarity
1 parent 31f80e1 commit f0c9314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+167
-167
lines changed

src/engine/net/inbound-packets/examine.packet.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Player } from '@engine/world/actor';
22
import { PacketData } from '@engine/net';
3-
import { world } from '@engine/world';
3+
import { activeWorld } from '@engine/world';
44

55
const examinePacket = (player: Player, packet: PacketData) => {
66
const { packetId, buffer } = packet;
@@ -9,11 +9,11 @@ const examinePacket = (player: Player, packet: PacketData) => {
99
let message;
1010

1111
if(packetId === 151) {
12-
message = world.examine.getItem(id);
12+
message = activeWorld.examine.getItem(id);
1313
} else if(packetId === 148) {
14-
message = world.examine.getObject(id);
14+
message = activeWorld.examine.getObject(id);
1515
} else if(packetId === 247) {
16-
message = world.examine.getNpc(id);
16+
message = activeWorld.examine.getNpc(id);
1717
}
1818

1919
if(message) {

src/engine/net/inbound-packets/item-on-npc.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { logger } from '@runejs/core';
2-
import { world, World } from '@engine/world';
2+
import { activeWorld, World } from '@engine/world';
33
import { widgets } from '@engine/config';
44
import { Player } from '@engine/world/actor';
55
import { PacketData } from '@engine/net';
@@ -35,7 +35,7 @@ const itemOnNpcPacket = (player: Player, packet: PacketData) => {
3535
return;
3636
}
3737

38-
const npc = world.npcList[npcIndex];
38+
const npc = activeWorld.npcList[npcIndex];
3939
if (!npc) {
4040
return;
4141
}

src/engine/net/inbound-packets/item-on-object.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { logger } from '@runejs/core';
22
import { filestore } from '@server/game/game-server';
3-
import { Position, world } from '@engine/world';
3+
import { Position, activeWorld } from '@engine/world';
44
import { widgets } from '@engine/config';
55
import { getVarbitMorphIndex } from '@engine/util';
66
import { Player } from '@engine/world/actor';
@@ -37,7 +37,7 @@ const itemOnObjectPacket = (player: Player, packet: PacketData) => {
3737
const level = player.position.level;
3838
const objectPosition = new Position(objectX, objectY, level);
3939

40-
const { object: locationObject, cacheOriginal } = world.findObjectAtLocation(player, objectId, objectPosition);
40+
const { object: locationObject, cacheOriginal } = activeWorld.findObjectAtLocation(player, objectId, objectPosition);
4141
if(!locationObject) {
4242
return;
4343
}

src/engine/net/inbound-packets/item-on-player.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { logger } from '@runejs/core';
2-
import { world, World } from '@engine/world';
2+
import { activeWorld, World } from '@engine/world';
33
import { widgets } from '@engine/config';
44
import { Player } from '@engine/world/actor';
55
import { PacketData } from '@engine/net';
@@ -36,7 +36,7 @@ const itemOnPlayerPacket = (player: Player, packet: PacketData) => {
3636
return;
3737
}
3838

39-
const otherPlayer = world.playerList[playerIndex];
39+
const otherPlayer = activeWorld.playerList[playerIndex];
4040
if(!otherPlayer) {
4141
return;
4242
}

src/engine/net/inbound-packets/magic-attack.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Player } from '@engine/world/actor';
22
import { PacketData } from '@engine/net';
3-
import { world } from '@engine/world';
3+
import { activeWorld } from '@engine/world';
44

55

66
const magicAttackPacket = (player: Player, packet: PacketData) => {
@@ -9,7 +9,7 @@ const magicAttackPacket = (player: Player, packet: PacketData) => {
99
const widgetId = buffer.get('short', 'u', 'le'); // unsigned short LE
1010
const widgetChildId = buffer.get('byte'); // unsigned short LE
1111

12-
const npc = world.npcList[npcWorldIndex];
12+
const npc = activeWorld.npcList[npcWorldIndex];
1313

1414
player.actionPipeline.call('magic_on_npc', npc, player, widgetId, widgetChildId);
1515
};

src/engine/net/inbound-packets/npc-interaction.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { logger } from '@runejs/core';
22
import { DataType, Endianness, Signedness } from '@runejs/core/buffer';
33

44
import { PacketData } from '@engine/net';
5-
import { world, World } from '@engine/world';
5+
import { activeWorld, World } from '@engine/world';
66
import { Player } from '@engine/world/actor';
77

88
const npcInteractionPacket = (player: Player, packet: PacketData) => {
@@ -21,7 +21,7 @@ const npcInteractionPacket = (player: Player, packet: PacketData) => {
2121
return;
2222
}
2323

24-
const npc = world.npcList[npcIndex];
24+
const npc = activeWorld.npcList[npcIndex];
2525
if (!npc) {
2626
return;
2727
}

src/engine/net/inbound-packets/object-interaction.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { logger } from '@runejs/core';
33
import { filestore } from '@server/game/game-server';
44
import { PacketData } from '@engine/net';
55
import { getVarbitMorphIndex } from '@engine/util';
6-
import { Position, world } from '@engine/world';
6+
import { Position, activeWorld } from '@engine/world';
77
import { Player, Rights } from '@engine/world/actor';
88

99

@@ -72,7 +72,7 @@ const objectInteractionPacket = (player: Player, packet: PacketData) => {
7272
const { objectId, x, y } = objectInteractionPackets[packetId].packetDef(packet);
7373
const level = player.position.level;
7474
const objectPosition = new Position(x, y, level);
75-
const { object: landscapeObject, cacheOriginal } = world.findObjectAtLocation(player, objectId, objectPosition);
75+
const { object: landscapeObject, cacheOriginal } = activeWorld.findObjectAtLocation(player, objectId, objectPosition);
7676
if(!landscapeObject) {
7777
if(player.rights === Rights.ADMIN) {
7878
player.sendMessage(`Custom object ${objectId} @[${objectPosition.key}]`);

src/engine/net/inbound-packets/player-interaction.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { logger } from '@runejs/core';
22

3-
import { world, World } from '@engine/world';
3+
import { activeWorld, World } from '@engine/world';
44
import { Player, playerOptions } from '@engine/world/actor';
55
import { PacketData } from '@engine/net';
66
import { DataType, Endianness, Signedness } from '@runejs/core/buffer';
@@ -17,7 +17,7 @@ const playerInteractionPacket = (player: Player, packet: PacketData) => {
1717
return;
1818
}
1919

20-
const otherPlayer = world.playerList[playerIndex];
20+
const otherPlayer = activeWorld.playerList[playerIndex];
2121
if(!otherPlayer) {
2222
return;
2323
}

src/engine/net/inbound-packets/private-message.packet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { longToString } from '@engine/util';
22
import { Player } from '@engine/world/actor';
33
import { PacketData } from '@engine/net';
4-
import { world } from '@engine/world';
4+
import { activeWorld } from '@engine/world';
55

66
export default {
77
opcode: 207,
@@ -18,7 +18,7 @@ export default {
1818
messageBytes[i] = buffer[buffer.readerIndex + i];
1919
}
2020

21-
const otherPlayer = world.findActivePlayerByUsername(username);
21+
const otherPlayer = activeWorld.findActivePlayerByUsername(username);
2222
if(otherPlayer) {
2323
otherPlayer.privateMessageReceived(player, messageBytes);
2424
}

src/engine/net/outbound-packet-handler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { stringToLong } from '@engine/util/strings';
1212
import { LandscapeObject } from '@runejs/filestore';
1313
import { xteaRegions } from '@engine/config/config-handler';
1414
import { ConstructedChunk, ConstructedRegion } from '@engine/world/map/region';
15-
import { world } from '@engine/world';
15+
import { activeWorld } from '@engine/world';
1616

1717

1818

@@ -600,8 +600,8 @@ export class OutboundPacketHandler {
600600
const mapWorldX = mapData.renderPosition.x;
601601
const mapWorldY = mapData.renderPosition.y;
602602

603-
const topCornerMapChunk = world.chunkManager.getChunkForWorldPosition(new Position(mapWorldX, mapWorldY, this.player.position.level));
604-
const playerChunk = world.chunkManager.getChunkForWorldPosition(this.player.position);
603+
const topCornerMapChunk = activeWorld.chunkManager.getChunkForWorldPosition(new Position(mapWorldX, mapWorldY, this.player.position.level));
604+
const playerChunk = activeWorld.chunkManager.getChunkForWorldPosition(this.player.position);
605605

606606
const offsetX = playerChunk.position.x - (topCornerMapChunk.position.x - 2);
607607
const offsetY = playerChunk.position.y - (topCornerMapChunk.position.y - 2);

0 commit comments

Comments
 (0)