Skip to content

Commit

Permalink
Update for 2.14.4-beta.dev.20250103.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacetech committed Jan 3, 2025
1 parent a5bc7c3 commit f10db5a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"watch": "npx tsc --build --watch --pretty --preserveWatchOutput"
},
"devDependencies": {
"@wayward/types": "^2.14.4-beta.dev.20250102.1",
"@wayward/types": "^2.14.4-beta.dev.20250103.1",
"rimraf": "3.0.2",
"typescript": "^5.7.2"
}
Expand Down
16 changes: 13 additions & 3 deletions src/StarterQuest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import Translation from "@wayward/game/language/Translation";
import Mod from "@wayward/game/mod/Mod";
import Register, { Registry } from "@wayward/game/mod/ModRegistry";
import { RenderSource } from "@wayward/game/renderer/IRenderer";
import ACTION_BAR_DEFAULT_SLOTS from "@wayward/game/ui/screen/screens/game/static/actions/ActionBarDefaultSlots";
import { ActionSlot } from "@wayward/game/ui/screen/screens/game/static/actions/ActionSlot";
import type { IActionBarSlotData } from "@wayward/game/ui/screen/screens/game/static/actions/IActionBar";
import { IActionBarSlotData } from "@wayward/game/ui/screen/screens/game/static/actions/IActionBar";
import { HighlightType } from "@wayward/game/ui/util/IHighlight";
import Enums from "@wayward/game/utilities/enum/Enums";
import { Tuple } from "@wayward/utilities/collection/Tuple";
Expand All @@ -49,6 +50,13 @@ function isActionSlotType(type: ActionSlotType | undefined, slot: IActionBarSlot
return true;
}

function hasChangedActionSlot(requiredType: ActionSlotType | undefined): boolean {
return !!gameScreen?.actionBar?.slots.some((slot, i) => true
&& !IActionBarSlotData.equals(slot, ACTION_BAR_DEFAULT_SLOTS[i] ?? {})
&& (requiredType === undefined || isActionSlotType(requiredType, slot))
&& true);
}

class Quest extends QuestBase {
public constructor(type?: QuestType) {
super(type);
Expand All @@ -71,14 +79,16 @@ export default class StarterQuest extends Mod {

@Register.questRequirement("actionSlots", new QuestRequirement<[ActionSlotType?]>({})
.setEventTrigger(ActionSlot, "update", (api, slot) => {
if (gameScreen?.actionBar?.hasFilledSlot(slot => isActionSlotType(api.requirement.options[0], slot))) {
const [requiredType] = api.requirement.options;
if (hasChangedActionSlot(requiredType)) {
return true;
}

return false;
})
.setInitializeTrigger(api => {
if (gameScreen?.actionBar?.hasFilledSlot(slot => isActionSlotType(api.requirement.options[0], slot))) {
const [requiredType] = api.requirement.options;
if (hasChangedActionSlot(requiredType)) {
return true;
}

Expand Down

0 comments on commit f10db5a

Please sign in to comment.