Skip to content

Commit

Permalink
Removing old references to landscapeobject
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlackParade committed Mar 19, 2020
1 parent bd5cd0f commit 3ea8c61
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/net/incoming-packets/object-interaction-packet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export const objectInteractionPacket: incomingPacket = (player: Player, packetId
const objectChunk = world.chunkManager.getChunkForWorldPosition(objectPosition);
let cacheOriginal: boolean = true;

let landscapeObject = objectChunk.getCacheObject(objectId, objectPosition);
if(!landscapeObject) {
landscapeObject = objectChunk.getAddedObject(objectId, objectPosition);
let locationObject = objectChunk.getCacheObject(objectId, objectPosition);
if(!locationObject) {
locationObject = objectChunk.getAddedObject(objectId, objectPosition);
cacheOriginal = false;

if(!landscapeObject) {
if(!locationObject) {
return;
}
}
Expand All @@ -95,5 +95,5 @@ export const objectInteractionPacket: incomingPacket = (player: Player, packetId
return;
}

objectAction(player, landscapeObject, locationObjectDefinition, objectPosition, optionName.toLowerCase(), cacheOriginal);
objectAction(player, locationObject, locationObjectDefinition, objectPosition, optionName.toLowerCase(), cacheOriginal);
};
10 changes: 5 additions & 5 deletions src/net/outgoing-packets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,23 @@ export class OutgoingPackets {
this.queue(packet);
}

public setLocationObject(landscapeObject: LocationObject, position: Position, offset: number = 0): void {
public setLocationObject(locationObject: LocationObject, position: Position, offset: number = 0): void {
this.updateReferencePosition(position);

const packet = new Packet(241);
packet.writeByteInverted((landscapeObject.type << 2) + (landscapeObject.orientation & 3));
packet.writeUnsignedShortBE(landscapeObject.objectId);
packet.writeByteInverted((locationObject.type << 2) + (locationObject.orientation & 3));
packet.writeUnsignedShortBE(locationObject.objectId);
packet.writeUnsignedOffsetByte(offset);

this.queue(packet);
}

public removeLocationObject(landscapeObject: LocationObject, position: Position, offset: number = 0): void {
public removeLocationObject(locationObject: LocationObject, position: Position, offset: number = 0): void {
this.updateReferencePosition(position);

const packet = new Packet(143);
packet.writeUnsignedOffsetByte(offset);
packet.writeByteInverted((landscapeObject.type << 2) + (landscapeObject.orientation & 3));
packet.writeByteInverted((locationObject.type << 2) + (locationObject.orientation & 3));

this.queue(packet);
}
Expand Down
2 changes: 1 addition & 1 deletion src/world/actor/player/action/item-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const itemAction = (player: Player, itemId: number, slot: number, widgetI

let cancelActions = false;

// Find all object action plugins that reference this landscape object
// Find all object action plugins that reference this location object
let interactionActions = itemInteractions.filter(plugin => {
if(!questFilter(player, plugin)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/world/actor/player/action/item-on-object-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const itemOnObjectAction = (player: Player, locationObject: LocationObjec
return;
}

// Find all item on object action plugins that reference this landscape object
// Find all item on object action plugins that reference this location object
let interactionActions = itemOnObjectInteractions.filter(plugin => questFilter(player, plugin) && pluginFilter(plugin.objectIds, locationObject.objectId));
const questActions = interactionActions.filter(plugin => plugin.questAction !== undefined);

Expand Down
2 changes: 1 addition & 1 deletion src/world/actor/player/action/object-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const objectAction = (player: Player, locationObject: LocationObject, loc
return;
}

// Find all object action plugins that reference this landscape object
// Find all object action plugins that reference this location object
let interactionActions = objectInteractions.filter(plugin => questFilter(player, plugin) && pluginFilter(plugin.objectIds, locationObject.objectId, plugin.options, option));
const questActions = interactionActions.filter(plugin => plugin.questAction !== undefined);

Expand Down
2 changes: 1 addition & 1 deletion src/world/actor/player/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export class Player extends Actor {
}

/**
* Sends chunk updates to notify the client of added & removed landscape objects
* Sends chunk updates to notify the client of added & removed location objects
* @param chunks The chunks to update.
*/
private sendChunkUpdates(chunks: Chunk[]): void {
Expand Down

0 comments on commit 3ea8c61

Please sign in to comment.