From 6782a525e5499fe27c263a1f05f1296fbc5dae78 Mon Sep 17 00:00:00 2001 From: Spacetech <824323+Spacetech@users.noreply.github.com> Date: Tue, 31 Dec 2024 06:08:58 -0800 Subject: [PATCH] Update for 2.14.4-beta.dev.20241231.1 --- package-lock.json | 8 ++++---- package.json | 2 +- src/TarsMod.ts | 2 +- src/utilities/MovementUtilities.ts | 28 +++++++++++++++++++++------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 64891f9..b50d93e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "@wayward/tars", "version": "1.0.0", "devDependencies": { - "@wayward/types": "^2.14.4-beta.dev.20241230.1", + "@wayward/types": "^2.14.4-beta.dev.20241231.1", "rimraf": "3.0.2", "typescript": "^5.7.2" } @@ -34,9 +34,9 @@ } }, "node_modules/@wayward/types": { - "version": "2.14.4-beta.dev.20241230.1", - "resolved": "https://registry.npmjs.org/@wayward/types/-/types-2.14.4-beta.dev.20241230.1.tgz", - "integrity": "sha512-6oZFWCCehks7kQgBGClCeAkoapXB4ruZCEQ5i1TqOLCa1L6aMRDq3wpif3VMm/7fLawEX581lhgdFifRcth7eA==", + "version": "2.14.4-beta.dev.20241231.1", + "resolved": "https://registry.npmjs.org/@wayward/types/-/types-2.14.4-beta.dev.20241231.1.tgz", + "integrity": "sha512-9KNoj2fquaWwhA82cCS+xtyzDV+vv/YjTUNTIIPmnC80CvIFAfSboXZ6zCx42Wic0KE6axTCHSaG5pMH/qFOeA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 3a7582c..fe45b51 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "watch": "npx tsc --build --watch --pretty --preserveWatchOutput" }, "devDependencies": { - "@wayward/types": "^2.14.4-beta.dev.20241230.1", + "@wayward/types": "^2.14.4-beta.dev.20241231.1", "rimraf": "3.0.2", "typescript": "^5.7.2" } diff --git a/src/TarsMod.ts b/src/TarsMod.ts index 69d42af..76bd6b1 100644 --- a/src/TarsMod.ts +++ b/src/TarsMod.ts @@ -163,7 +163,7 @@ export default class TarsMod extends Mod { this.globalSaveData.dataSlots = []; } - Log.disableFileLogging(logSourceName); + Log.disableFileLoggingForSource(logSourceName); } public override onUninitialize(): void { diff --git a/src/utilities/MovementUtilities.ts b/src/utilities/MovementUtilities.ts index a309af2..024a3ee 100644 --- a/src/utilities/MovementUtilities.ts +++ b/src/utilities/MovementUtilities.ts @@ -10,6 +10,7 @@ import PathOverlayFootPrints from "@wayward/game/ui/screen/screens/game/util/mov import { Direction } from "@wayward/game/utilities/math/Direction"; import type { IVector3 } from "@wayward/game/utilities/math/IVector"; import { VehicleType } from "@wayward/game/game/item/IItem"; +import { TileUpdateType } from "@wayward/game/game/IGame"; import Butcher from "@wayward/game/game/entity/action/actions/Butcher"; import Chop from "@wayward/game/game/entity/action/actions/Chop"; @@ -215,16 +216,29 @@ export class MovementUtilities { if (nextTile.creature) { // walking into a creature + context.log.info("Walking into a creature"); - // ensure we are wearing the correct equipment - const handEquipmentChange = context.utilities.item.updateHandEquipment(context); - if (handEquipmentChange) { - context.log.info(`Going to equip ${handEquipmentChange.item} before attacking`); + if (!nextTile.creature.isTamed) { + // ensure we are wearing the correct equipment + const handEquipmentChange = context.utilities.item.updateHandEquipment(context); + if (handEquipmentChange) { + context.log.info(`Going to equip ${handEquipmentChange.item} before attacking`); - await context.utilities.action.executeAction(context, Equip, [handEquipmentChange.item, handEquipmentChange.equipType]); - } + await context.utilities.action.executeAction(context, Equip, [handEquipmentChange.item, handEquipmentChange.equipType]); + } - context.log.info("Walking into a creature"); + } else if (!nextTile.creature.canSwapWith(context.human, undefined)) { + // issue with navigation nodes since canSwapWith might be cached due to a tile update + context.log.info("Creature is blocking movement"); + + const baseTiles = context.utilities.base.getBaseTiles(context); + const tile = nextTile.creature.tile; + if (tile) { + context.utilities.navigation.processTileUpdate(tile, tile.type, baseTiles.has(tile), TileUpdateType.Creature); + } + + return MoveResult.NoPath; + } await context.utilities.action.executeAction(context, Move, [direction]);