@wayward/types 2.13.2-beta.dev.20230605.2 → 2.13.2-beta.dev.20230606.2

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.
@@ -20,7 +20,7 @@ import type { UsableActionType } from "game/entity/action/usable/UsableActionTyp
20
20
  import type { ICorpseDescription } from "game/entity/creature/corpse/ICorpse";
21
21
  import type { CreatureType, ICreatureDescription } from "game/entity/creature/ICreature";
22
22
  import type { EntityTag, StatusType } from "game/entity/IEntity";
23
- import type { SkillType } from "game/entity/IHuman";
23
+ import type { EquipType, InsulationWeight, SkillType } from "game/entity/IHuman";
24
24
  import type { Stat } from "game/entity/IStats";
25
25
  import type { NPCType } from "game/entity/npc/INPCs";
26
26
  import type { INPCClass } from "game/entity/npc/NPCS";
@@ -31,6 +31,7 @@ import type { Quest } from "game/entity/player/quest/quest/Quest";
31
31
  import type { QuestRequirementType } from "game/entity/player/quest/requirement/IRequirement";
32
32
  import type { QuestRequirement } from "game/entity/player/quest/requirement/Requirement";
33
33
  import type { ISkillDescription } from "game/entity/skill/ISkills";
34
+ import type { IStatDescription } from "game/entity/StatDescriptions";
34
35
  import type { StatusEffectClass } from "game/entity/status/StatusEffect";
35
36
  import type { InspectType } from "game/inspection/IInspection";
36
37
  import type { InspectionClass } from "game/inspection/InspectionTypeMap";
@@ -38,6 +39,7 @@ import type { IItemDescription, IItemGroupDescription, ItemTag, ItemType, ItemTy
38
39
  import type { IMagicalPropertyDescription, MagicalPropertyType } from "game/magic/MagicalPropertyType";
39
40
  import type { ILoadingDescription } from "game/meta/Loading";
40
41
  import type { Prompt } from "game/meta/prompt/IPrompt";
42
+ import type { TempType } from "game/temperature/ITemperature";
41
43
  import type { ITerrainDescription, OverlayType, TerrainType } from "game/tile/ITerrain";
42
44
  import type { ITileEventDescription, TileEventType } from "game/tile/ITileEvent";
43
45
  import type { ITerrainLootItem } from "game/tile/TerrainResources";
@@ -66,6 +68,9 @@ import type { IStatDisplayDescription } from "ui/screen/screens/game/static/stat
66
68
  import type { HelpArticle, IHelpArticle } from "ui/screen/screens/menu/menus/help/HelpArticleDescriptions";
67
69
  import type { ModOptionSectionInitializer } from "ui/screen/screens/menu/menus/options/TabMods";
68
70
  export interface IModdable {
71
+ /**
72
+ * Do not provide or modify this value, only reference it. This is set by the modding system during the process of registration.
73
+ */
69
74
  modIndex?: number;
70
75
  }
71
76
  export declare const SYMBOL_MOD_REGISTRATIONS: unique symbol;
@@ -83,47 +88,48 @@ export declare enum ModRegistrationType {
83
88
  DoodadGroup = 10,
84
89
  DoodadTag = 11,
85
90
  EntityTag = 12,
86
- HelpArticle = 13,
87
- InspectionType = 14,
88
- InterModRegistration = 15,
89
- InterModRegistry = 16,
90
- Interrupt = 17,
91
- InterruptChoice = 18,
92
- Item = 19,
93
- ItemExtra = 20,
94
- ItemGroup = 21,
95
- ItemTag = 22,
96
- Language = 23,
97
- LanguageExtension = 24,
98
- Load = 25,
99
- MagicalProperty = 26,
100
- MenuBarButton = 27,
101
- Message = 28,
102
- MessageSource = 29,
103
- MusicTrack = 30,
104
- Note = 31,
105
- NPC = 32,
106
- OptionsSection = 33,
107
- Overlay = 34,
108
- Override = 35,
109
- Packet = 36,
110
- Prompt = 37,
111
- QuadrantComponent = 38,
112
- Quest = 39,
113
- QuestRequirement = 40,
114
- Registry = 41,
115
- Skill = 42,
116
- SoundEffect = 43,
117
- Stat = 44,
118
- StatusEffect = 45,
119
- Terrain = 46,
120
- TerrainDecoration = 47,
121
- TileEvent = 48,
122
- TileLayerType = 49,
123
- UsableActions = 50,
124
- UsableActionType = 51,
125
- UsableActionTypePlaceholder = 52,
126
- WorldLayer = 53
91
+ EquipType = 13,
92
+ HelpArticle = 14,
93
+ InspectionType = 15,
94
+ InterModRegistration = 16,
95
+ InterModRegistry = 17,
96
+ Interrupt = 18,
97
+ InterruptChoice = 19,
98
+ Item = 20,
99
+ ItemExtra = 21,
100
+ ItemGroup = 22,
101
+ ItemTag = 23,
102
+ Language = 24,
103
+ LanguageExtension = 25,
104
+ Load = 26,
105
+ MagicalProperty = 27,
106
+ MenuBarButton = 28,
107
+ Message = 29,
108
+ MessageSource = 30,
109
+ MusicTrack = 31,
110
+ Note = 32,
111
+ NPC = 33,
112
+ OptionsSection = 34,
113
+ Overlay = 35,
114
+ Override = 36,
115
+ Packet = 37,
116
+ Prompt = 38,
117
+ QuadrantComponent = 39,
118
+ Quest = 40,
119
+ QuestRequirement = 41,
120
+ Registry = 42,
121
+ Skill = 43,
122
+ SoundEffect = 44,
123
+ Stat = 45,
124
+ StatusEffect = 46,
125
+ Terrain = 47,
126
+ TerrainDecoration = 48,
127
+ TileEvent = 49,
128
+ TileLayerType = 50,
129
+ UsableActions = 51,
130
+ UsableActionType = 52,
131
+ UsableActionTypePlaceholder = 53,
132
+ WorldLayer = 54
127
133
  }
128
134
  export interface ILanguageRegistration extends IBaseModRegistration {
129
135
  type: ModRegistrationType.Language;
@@ -251,7 +257,7 @@ export interface ISkillRegistration extends IBaseModRegistration {
251
257
  export interface IStatRegistration extends IBaseModRegistration {
252
258
  type: ModRegistrationType.Stat;
253
259
  name: string;
254
- description?: IStatDisplayDescription;
260
+ description?: IStatDisplayDescription & IStatDescription;
255
261
  }
256
262
  export interface IStatusEffectRegistration extends IBaseModRegistration {
257
263
  type: ModRegistrationType.StatusEffect;
@@ -376,6 +382,36 @@ export interface IEntityTagRegistration extends IBaseModRegistration {
376
382
  type: ModRegistrationType.EntityTag;
377
383
  name: string;
378
384
  }
385
+ export interface IEquipTypeDescription extends IModdable {
386
+ /**
387
+ * If you need to set up an "internal" slot — such as the vanilla "EquipType.Held" which is an internal slot meaning "main hand or off hand."
388
+ */
389
+ disableSlot?: true;
390
+ /**
391
+ * Set this to true to allow the player to change which item is slotted in this slot for free. (IE, like the main hand and off hand slots.)
392
+ */
393
+ freeSlot?: true;
394
+ /**
395
+ * An item group to automatically assign to all items equippable in this equip slot.
396
+ */
397
+ itemGroup?: ItemTypeGroup;
398
+ /**
399
+ * For each temperature type (`TempType.Cold` and `TempType.Heat`), the "weight" that it has.
400
+ * When calculating insulation, this weight is compared with all other weights.
401
+ * Higher weight = higher % of the insulation score comes from this slot.
402
+ *
403
+ * To make the slot optional for insulation of a temp type,
404
+ * make the value 0 (not considered at all) OR make it `[<weight>, "onlyWhenEquipped"]`.
405
+ *
406
+ * Optional slots do not reduce the human's insulation.
407
+ */
408
+ insulationWeights?: PartialRecord<TempType, InsulationWeight>;
409
+ }
410
+ export interface IEquipTypeRegistration extends IBaseModRegistration {
411
+ type: ModRegistrationType.EquipType;
412
+ name: string;
413
+ description: IEquipTypeDescription;
414
+ }
379
415
  export interface IOverrideDescription<OBJECT extends object, PROPERTY extends keyof OBJECT> {
380
416
  object: OBJECT;
381
417
  property: PROPERTY;
@@ -388,7 +424,7 @@ export interface IOverrideRegistration<OBJECT extends object, PROPERTY extends k
388
424
  export interface IInheritsRegistrationTime {
389
425
  useRegistrationTime: ModRegistrationType;
390
426
  }
391
- export type ModRegistration = IActionRegistration | IBindableRegistration | IBiomeRegistration | IBulkRegistration | ICommandRegistration | ICreatureRegistration | IDialogRegistration | IDictionaryRegistration | IDoodadGroupRegistration | IDoodadRegistration | IDoodadTagRegistration | IEntityTagRegistration | IHelpArticleRegistration | IInspectionTypeRegistration | IInterModRegistration | IInterModRegistryRegistration | IInterruptChoiceRegistration | IInterruptRegistration | IItemGroupRegistration | IItemRegistration | IItemTagRegistration | ILanguageExtensionRegistration | ILanguageRegistration | ILoadRegistration | IMagicalPropertyRegistration | IMenuBarButtonRegistration | IMessageRegistration | IMessageSourceRegistration | IMusicTrackRegistration | INoteRegistration | INPCRegistration | IOptionsSectionRegistration | IOverlayRegistration | IOverrideRegistration<any, any> | IPacketRegistration | IPromptRegistration | IQuadrantComponentRegistration | IQuestRegistration | IQuestRequirementRegistration | IRegistryRegistration | ISkillRegistration | ISoundEffectRegistration | IStatRegistration | IStatusEffectRegistration | ITerrainDecorationRegistration | ITerrainRegistration | ITileEventRegistration | ITileLayerTypeRegistration | IUsableActionsRegistration | IUsableActionTypePlaceholderRegistration | IUsableActionTypeRegistration;
427
+ export type ModRegistration = IActionRegistration | IBindableRegistration | IBiomeRegistration | IBulkRegistration | ICommandRegistration | ICreatureRegistration | IDialogRegistration | IDictionaryRegistration | IDoodadGroupRegistration | IDoodadRegistration | IDoodadTagRegistration | IEntityTagRegistration | IEquipTypeRegistration | IHelpArticleRegistration | IInspectionTypeRegistration | IInterModRegistration | IInterModRegistryRegistration | IInterruptChoiceRegistration | IInterruptRegistration | IItemGroupRegistration | IItemRegistration | IItemTagRegistration | ILanguageExtensionRegistration | ILanguageRegistration | ILoadRegistration | IMagicalPropertyRegistration | IMenuBarButtonRegistration | IMessageRegistration | IMessageSourceRegistration | IMusicTrackRegistration | INoteRegistration | INPCRegistration | IOptionsSectionRegistration | IOverlayRegistration | IOverrideRegistration<any, any> | IPacketRegistration | IPromptRegistration | IQuadrantComponentRegistration | IQuestRegistration | IQuestRequirementRegistration | IRegistryRegistration | ISkillRegistration | ISoundEffectRegistration | IStatRegistration | IStatusEffectRegistration | ITerrainDecorationRegistration | ITerrainRegistration | ITileEventRegistration | ITileLayerTypeRegistration | IUsableActionsRegistration | IUsableActionTypePlaceholderRegistration | IUsableActionTypeRegistration;
392
428
  export declare const SYMBOL_SUPER_REGISTRY: unique symbol;
393
429
  declare module Register {
394
430
  /**
@@ -472,7 +508,7 @@ declare module Register {
472
508
  *
473
509
  * The decorated property will be injected with the id of the registered stat.
474
510
  */
475
- export function stat(name: string, description?: IStatDisplayDescription): <K extends string | number | symbol, T extends Record<K, Stat>>(target: T, key: K) => void;
511
+ export function stat(name: string, description?: IStatDisplayDescription & IStatDescription): <K extends string | number | symbol, T extends Record<K, Stat>>(target: T, key: K) => void;
476
512
  /**
477
513
  * Registers a status effect.
478
514
  * @param name The name of the status effect.
@@ -703,6 +739,11 @@ declare module Register {
703
739
  * `<your mod directory>/static/image/ui/icons/action/mod<your mod name><this registration name>.png`.
704
740
  */
705
741
  export function usableActionTypePlaceholder(name: string): <K extends string | number | symbol, T extends Record<K, UsableActionType>>(target: T, key: K) => void;
742
+ /**
743
+ * Registers an equip slot.
744
+ * @param description The definition of the equip slot.
745
+ */
746
+ export function equipType(name: string, description: IEquipTypeDescription): <K extends string | number | symbol, T extends Record<K, EquipType>>(target: T, key: K) => void;
706
747
  export function interModRegistry<V>(name: string): <K extends string | number | symbol, T extends Record<K, InterModRegistry<V>>>(target: T, key: K) => void;
707
748
  export function interModRegistration<V>(modName: string, registryName: string, value: V): <K extends string | number | symbol, T extends Record<K, InterModRegistration<V>>>(target: T, key: K) => void;
708
749
  /**
@@ -86,5 +86,6 @@ export declare enum EnumId {
86
86
  DoodadTag = 44,
87
87
  EntityTag = 45,
88
88
  ItemTypeExtra = 46,
89
- DoodadTypeExtra = 47
89
+ DoodadTypeExtra = 47,
90
+ EquipType = 48
90
91
  }
@@ -144,10 +144,20 @@ declare module Math2 {
144
144
  * - `0.75 + 0` is `0.75`.
145
145
  */
146
146
  function weightedAverage(...ns: Array<[number, number]>): number;
147
- type WeightedAverageWithExclusionInput = [number, number, {
147
+ interface IWeightedAverageWithExclusionInputOptions {
148
148
  excludeIfLowering?: boolean;
149
149
  excludeIfRaising?: boolean;
150
- }?];
150
+ }
151
+ type WeightedAverageWithExclusionInput = [weight: number, value: number, options?: IWeightedAverageWithExclusionInputOptions];
152
+ interface WeightedAverageWithExclusionOutput {
153
+ averageValue: number;
154
+ totalValue: number;
155
+ totalWeight: number;
156
+ includedInputsCount: number;
157
+ inputs: Array<{
158
+ included: boolean;
159
+ }>;
160
+ }
151
161
  /**
152
162
  * Takes an any number of `[weight, number]` tuples, and returns the "weighted average".
153
163
  * @param ns Any number of `[weight, number]` tuples.
@@ -159,6 +169,7 @@ declare module Math2 {
159
169
  * - `0.75 + 0` is `0.75`.
160
170
  */
161
171
  function weightedAverageWithExclusion(...ns: WeightedAverageWithExclusionInput[]): number;
172
+ function weightedAverageWithExclusion(returnDetail: true, ...ns: WeightedAverageWithExclusionInput[]): WeightedAverageWithExclusionOutput;
162
173
  function radians(degrees: number): number;
163
174
  function degrees(radians: number): number;
164
175
  function rotateTowards(direction: number, targetDirection: number, maxAmount: number): number;
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.2-beta.dev.20230605.2",
4
+ "version": "2.13.2-beta.dev.20230606.2",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",