@wayward/types 2.13.0-beta.dev.20230412.1 → 2.13.0-beta.dev.20230413.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,7 +80,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
80
80
  private static readonly cachedItemsThatAreAcceptedAsOffer;
81
81
  private static readonly cachedItemsThatAreUsedForGrowingPlants;
82
82
  private static readonly cachedItemsThatAreUsedInRecipes;
83
- private static readonly cachedUseItemActions;
83
+ private static cachedUseItemActions;
84
84
  static cachedItemSpawns: OptionalDescriptions<BiomeType, OptionalDescriptions<WorldZ, OptionalDescriptions<TerrainType, ItemType[]>>>;
85
85
  static getItemTypes(): readonly ItemType[];
86
86
  static getItemsWithRecipes(): readonly ItemType[];
@@ -44,10 +44,10 @@ export default class Crafter {
44
44
  private quality?;
45
45
  constructor(recipe: Recipe, crafter: Entity, accessibleItems: Item[]);
46
46
  /**
47
- * Gets a stream of the tiles around the crafter entity.
47
+ * Gets an array of the tiles around the crafter entity.
48
48
  * @param includeCrafterTile Whether the tile the crafter is on should be included. Defaults to `true`.
49
49
  */
50
- tilesAroundCrafter(includeCrafterTile?: boolean): Stream<any>;
50
+ tilesAroundCrafter(includeCrafterTile?: boolean): import("../../tile/Tile").default[];
51
51
  getCrafter(): Entity<unknown, number, unknown, unknown>;
52
52
  getUsable<R extends RecipeRequirementType>(type: R, requirement: InstanceType<RecipeRequirementClass<R>>): Set<RecipeInputType<R>>;
53
53
  getUsed<R extends RecipeRequirementType>(type: R, requirement?: InstanceType<RecipeRequirementClass<R>>): Stream<RecipeInputType<R>>;
@@ -21,7 +21,7 @@ export default class DoodadRequirement extends RecipeRequirement<RecipeRequireme
21
21
  * Sets the "best" doodad to be used for this requirement. Used to display the efficacy of an actual input doodad.
22
22
  */
23
23
  setBestDoodad(doodad: Doodad): this;
24
- getUsable(api: Crafter): Set<any>;
24
+ getUsable(api: Crafter): Set<Doodad>;
25
25
  isMet(api: Crafter): boolean;
26
26
  private getQualityBonus;
27
27
  private getBestPossibleQualityBonus;
@@ -10,10 +10,11 @@
10
10
  */
11
11
  import type Crafter from "game/item/recipe/Crafter";
12
12
  import RecipeRequirement, { RecipeRequirementType } from "game/item/recipe/RecipeRequirement";
13
+ import type Tile from "game/tile/Tile";
13
14
  export default class FireRequirement extends RecipeRequirement<RecipeRequirementType.Fire> {
14
15
  static readonly BASE: FireRequirement;
15
16
  constructor();
16
- getUsable(api: Crafter): import("@wayward/goodstream").default<any>;
17
+ getUsable(api: Crafter): Tile[];
17
18
  isMet(api: Crafter): boolean;
18
19
  private onCraft;
19
20
  }
@@ -8,48 +8,6 @@
8
8
  * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide:
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
- export declare function TupleType<T>(): {
12
- create: <T2 extends T[]>(...items: T2) => T2;
13
- };
14
- export declare function Tuple<T extends any[]>(...items: T): T;
15
- export declare module Tuple {
16
- export function is<T extends any[]>(value: unknown): value is T;
17
- export type TupleFilterNot<I extends 0 | 1 | 2 | 3 | 4 | 5, NOT> = <A extends any[]>(value: A) => value is Extract<[...Slice<A>[I], Exclude<A[I], NOT>, ...SliceAfter<A>[IAddOne[I]]], A>;
18
- export type TupleNullishFilter<I extends 0 | 1 | 2 | 3 | 4 | 5> = TupleFilterNot<I, undefined | null>;
19
- export function filterNullish<I extends 0 | 1 | 2 | 3 | 4 | 5>(index: I): TupleNullishFilter<I>;
20
- export type TupleFalsyFilter<I extends 0 | 1 | 2 | 3 | 4 | 5> = TupleFilterNot<I, Falsy>;
21
- export function filterFalsy<I extends 0 | 1 | 2 | 3 | 4 | 5>(index: I): TupleFalsyFilter<I>;
22
- export type TupleGetter<I extends 0 | 1 | 2 | 3 | 4 | 5> = <A extends readonly any[]>(value: A) => A[I];
23
- export function getter<I extends 0 | 1 | 2 | 3 | 4 | 5>(index: I): TupleGetter<I>;
24
- export function filter<I extends 0 | 1 | 2 | 3 | 4 | 5, A extends any[], R extends A[I]>(index: I, predicate: (value: A[I], i: number) => value is R): (value: A) => value is Extract<[...Slice<A>[I], R, ...SliceAfter<A>[IAddOne[I]]], A>;
25
- export function filter<I extends 0 | 1 | 2 | 3 | 4 | 5, A extends any[]>(index: I, predicate: (value: A[I], i: number) => any): (value: A, i: number) => any;
26
- interface Slice<A extends any[]> {
27
- [0]: [];
28
- [1]: [A[0]];
29
- [2]: [A[0], A[1]];
30
- [3]: [A[0], A[1], A[2]];
31
- [4]: [A[0], A[1], A[2], A[3]];
32
- [5]: [A[0], A[1], A[2], A[3], A[4]];
33
- }
34
- interface SliceAfter<A extends any[]> {
35
- [1]: A extends [any, ...infer R] ? R : never;
36
- [2]: A extends [any, any, ...infer R] ? R : never;
37
- [3]: A extends [any, any, any, ...infer R] ? R : never;
38
- [4]: A extends [any, any, any, any, ...infer R] ? R : never;
39
- [5]: A extends [any, any, any, any, any, ...infer R] ? R : never;
40
- [6]: A extends [any, any, any, any, any, any, ...infer R] ? R : never;
41
- }
42
- interface IAddOne {
43
- [0]: 1;
44
- [1]: 2;
45
- [2]: 3;
46
- [3]: 4;
47
- [4]: 5;
48
- [5]: 6;
49
- }
50
- export type Twice<T> = [T, T];
51
- export {};
52
- }
53
11
  declare module Arrays {
54
12
  type Value<A extends any[]> = A extends Array<infer T> ? T : never;
55
13
  const EMPTY: readonly undefined[];
@@ -0,0 +1,53 @@
1
+ /*!
2
+ * Copyright 2011-2021 Unlok
3
+ * https://www.unlok.ca
4
+ *
5
+ * Credits & Thanks:
6
+ * https://www.unlok.ca/credits-thanks/
7
+ *
8
+ * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide:
9
+ * https://github.com/WaywardGame/types/wiki
10
+ */
11
+ export declare const SYMBOL_TUPLE: unique symbol;
12
+ export declare function Tuple<T extends any[]>(...items: T): T;
13
+ export declare function TupleType<T>(): {
14
+ create: <T2 extends T[]>(...items: T2) => T2;
15
+ };
16
+ export declare module Tuple {
17
+ export function is<T extends any[]>(value: unknown): value is T;
18
+ export type TupleFilterNot<I extends 0 | 1 | 2 | 3 | 4 | 5, NOT> = <A extends any[]>(value: A) => value is Extract<[...Slice<A>[I], Exclude<A[I], NOT>, ...SliceAfter<A>[IAddOne[I]]], A>;
19
+ export type TupleNullishFilter<I extends 0 | 1 | 2 | 3 | 4 | 5> = TupleFilterNot<I, undefined | null>;
20
+ export function filterNullish<I extends 0 | 1 | 2 | 3 | 4 | 5>(index: I): TupleNullishFilter<I>;
21
+ export type TupleFalsyFilter<I extends 0 | 1 | 2 | 3 | 4 | 5> = TupleFilterNot<I, Falsy>;
22
+ export function filterFalsy<I extends 0 | 1 | 2 | 3 | 4 | 5>(index: I): TupleFalsyFilter<I>;
23
+ export type TupleGetter<I extends 0 | 1 | 2 | 3 | 4 | 5> = <A extends readonly any[]>(value: A) => A[I];
24
+ export function getter<I extends 0 | 1 | 2 | 3 | 4 | 5>(index: I): TupleGetter<I>;
25
+ export function filter<I extends 0 | 1 | 2 | 3 | 4 | 5, A extends any[], R extends A[I]>(index: I, predicate: (value: A[I], i: number) => value is R): (value: A) => value is Extract<[...Slice<A>[I], R, ...SliceAfter<A>[IAddOne[I]]], A>;
26
+ export function filter<I extends 0 | 1 | 2 | 3 | 4 | 5, A extends any[]>(index: I, predicate: (value: A[I], i: number) => any): (value: A, i: number) => any;
27
+ interface Slice<A extends any[]> {
28
+ [0]: [];
29
+ [1]: [A[0]];
30
+ [2]: [A[0], A[1]];
31
+ [3]: [A[0], A[1], A[2]];
32
+ [4]: [A[0], A[1], A[2], A[3]];
33
+ [5]: [A[0], A[1], A[2], A[3], A[4]];
34
+ }
35
+ interface SliceAfter<A extends any[]> {
36
+ [1]: A extends [any, ...infer R] ? R : never;
37
+ [2]: A extends [any, any, ...infer R] ? R : never;
38
+ [3]: A extends [any, any, any, ...infer R] ? R : never;
39
+ [4]: A extends [any, any, any, any, ...infer R] ? R : never;
40
+ [5]: A extends [any, any, any, any, any, ...infer R] ? R : never;
41
+ [6]: A extends [any, any, any, any, any, any, ...infer R] ? R : never;
42
+ }
43
+ interface IAddOne {
44
+ [0]: 1;
45
+ [1]: 2;
46
+ [2]: 3;
47
+ [3]: 4;
48
+ [4]: 5;
49
+ [5]: 6;
50
+ }
51
+ export type Twice<T> = [T, T];
52
+ export {};
53
+ }
@@ -11,6 +11,7 @@
11
11
  import { Quality } from "game/IObject";
12
12
  import type Island from "game/island/Island";
13
13
  import type { IContainer, ItemType, ItemTypeGroup } from "game/item/IItem";
14
+ import Item from "game/item/Item";
14
15
  import Objects from "utilities/object/Objects";
15
16
  import type { RandomInstance } from "utilities/random/IRandom";
16
17
  import type { RandomReference } from "utilities/random/RandomReference";
@@ -22,6 +23,6 @@ export default class RandomItem extends RandomValueGenerator<Array<ItemType | It
22
23
  constructor(random: RandomInstance | RandomReference, ...options: Array<ItemType | ItemTypeGroup>);
23
24
  setQuality(quality: Quality): this;
24
25
  setMagical(amount: number): this;
25
- create(island: Island, container: IContainer): import("../../../../game/item/Item").default;
26
+ create(island: Island, container: IContainer): Item;
26
27
  [Objects.SYMBOL_CLONE](clone: typeof Objects.deepClone): this;
27
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wayward/types",
3
3
  "description": "TypeScript declarations for Wayward, used for modding.",
4
- "version": "2.13.0-beta.dev.20230412.1",
4
+ "version": "2.13.0-beta.dev.20230413.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",