tiger_lib/
item.rs

1//! Giant enum for all the [`Item`] types in the game.
2
3use std::fmt::{Display, Formatter};
4
5use strum_macros::{EnumIter, IntoStaticStr};
6
7use crate::block::Block;
8use crate::db::Db;
9#[cfg(doc)]
10use crate::everything::Everything;
11use crate::game::{Game, GameFlags};
12use crate::pdxfile::PdxEncoding;
13use crate::report::{Confidence, Severity};
14use crate::token::Token;
15
16/// "items" are all the things that can be looked up in the game databases.
17/// Anything that can be looked up in script with a literal string key, or that's loaded into
18/// tiger's database and needs a unique key, is an `Item`.
19///
20/// There is some overlap with scopes, for example "culture" is both an `Item` and a scope type,
21/// but the difference is that scopes are runtime values while items are always strings.
22///
23/// For example if a trigger takes a culture *scope*, you could supply either `culture:german` or
24/// `scope:target_culture`, while if a trigger takes a culture *item*, you would have to supply just
25/// `german` and don't have the option of supplying something determined at runtime.
26#[derive(Copy, Clone, Debug, PartialEq, Eq, IntoStaticStr, Hash, PartialOrd, Ord, EnumIter)]
27#[strum(serialize_all = "snake_case")]
28#[non_exhaustive]
29// The item table is in several alphabetized sections. First the generic items, then items used by
30// multiple games, then a section for each game.
31//
32// Each item is marked with a cfg clause for its game. This is not strictly necessary, but it helps
33// prevent "leakage" between the games, where they accidentally use each other's item types.
34#[rustfmt::skip] // having cfg and the variant on the same line is much more readable
35pub enum Item {
36    // Generic items used by all games and assumed to be there by the validators in
37    // non-game-specific `data` modules.
38    Accessory,
39    AccessoryTag,
40    AccessoryVariation,
41    AccessoryVariationLayout,
42    AccessoryVariationTextures,
43    Achievement,
44    AchievementGroup,
45    Asset,
46    BlendShape,
47    CharacterInteraction,
48    Coa,
49    CoaColorList,
50    CoaColoredEmblemList,
51    #[cfg(feature = "ck3")]
52    CoaDesignerColorPalette,
53    CoaDesignerColoredEmblem,
54    #[cfg(feature = "ck3")]
55    CoaDesignerEmblemLayout,
56    CoaDesignerPattern,
57    CoaPatternList,
58    CoaTemplate,
59    CoaTemplateList,
60    CoaTexturedEmblemList,
61    Culture,
62    CustomLocalization,
63    Decision,
64    Define,
65    Directory,
66    Dlc,
67    DlcFeature,
68    EffectLocalization,
69    Entity,
70    Entry,
71    Ethnicity,
72    Event,
73    EventNamespace,
74    File,
75    Font,
76    Fontfiles,
77    GameConcept,
78    GameRule,
79    GameRuleSetting,
80    GeneAgePreset,
81    GeneAttribute,
82    GeneCategory,
83    GovernmentType,
84    GuiLayer,
85    GuiTemplate,
86    GuiType,
87    LawGroup,
88    Localization,
89    MapEnvironment,
90    MapMode,
91    Modifier,
92    Music,
93    MusicPlayerCategory,
94    NamedColor,
95    OnAction,
96    Pdxmesh,
97    PortraitAnimation,
98    PortraitCamera,
99    PortraitEnvironment,
100    PortraitModifierGroup,
101    PortraitModifierPack,
102    Province,
103    Religion,
104    ScriptedEffect,
105    ScriptedGui,
106    ScriptedList,
107    ScriptedModifier,
108    ScriptedRule,
109    ScriptedTrigger,
110    ScriptValue,
111    Shortcut,
112    Sound,
113    Terrain,
114    TextFormat,
115    TextIcon,
116    TextureFile,
117    TriggerLocalization,
118    WidgetName,
119
120    // Items shared by more than one game
121    #[cfg(any(feature = "ck3", feature = "imperator"))]
122    Building,
123    #[cfg(any(feature = "ck3", feature = "vic3"))]
124    CharacterTemplate,
125    #[cfg(any(feature = "vic3", feature = "imperator"))]
126    CharacterTrait,
127    #[cfg(any(feature = "vic3", feature = "imperator"))]
128    Country,
129    #[cfg(any(feature = "ck3", feature = "imperator"))]
130    DeathReason,
131    #[cfg(any(feature = "ck3", feature = "vic3"))]
132    Dna,
133    #[cfg(any(feature = "ck3", feature = "imperator"))]
134    EventTheme,
135    #[cfg(any(feature = "ck3", feature = "imperator"))]
136    Law,
137    #[cfg(any(feature = "ck3", feature = "vic3"))]
138    Message,
139    #[cfg(any(feature = "vic3", feature = "imperator"))]
140    PopType,
141    #[cfg(any(feature = "ck3", feature = "imperator"))]
142    Region,
143    #[cfg(any(feature = "vic3", feature = "imperator"))]
144    SubjectType,
145    #[cfg(any(feature = "ck3", feature = "vic3"))]
146    TutorialLesson,
147    #[cfg(any(feature = "ck3", feature = "vic3"))]
148    TutorialLessonChain,
149    #[cfg(any(feature = "ck3", feature = "vic3"))]
150    TutorialLessonStep,
151    #[cfg(any(feature = "vic3", feature = "imperator"))]
152    Wargoal,
153
154    // Items for ck3
155    #[cfg(feature = "ck3")] AccoladeCategory,
156    #[cfg(feature = "ck3")] AccoladeIcon,
157    #[cfg(feature = "ck3")] AccoladeName,
158    #[cfg(feature = "ck3")] AccoladeParameter,
159    #[cfg(feature = "ck3")] AccoladeType,
160    #[cfg(feature = "ck3")] ActivityIntent,
161    #[cfg(feature = "ck3")] ActivityLocale,
162    #[cfg(feature = "ck3")] ActivityOption,
163    #[cfg(feature = "ck3")] ActivityOptionCategory,
164    #[cfg(feature = "ck3")] ActivityPhase,
165    #[cfg(feature = "ck3")] ActivityPulseAction,
166    #[cfg(feature = "ck3")] ActivityState,
167    #[cfg(feature = "ck3")] ActivityType,
168    #[cfg(feature = "ck3")] AiWarStance,
169    #[cfg(feature = "ck3")] AgentType,
170    #[cfg(feature = "ck3")] Amenity,
171    #[cfg(feature = "ck3")] AmenitySetting,
172    #[cfg(feature = "ck3")] ArtifactBlueprint,
173    #[cfg(feature = "ck3")] ArtifactFeature,
174    #[cfg(feature = "ck3")] ArtifactFeatureGroup,
175    #[cfg(feature = "ck3")] ArtifactHistory,
176    #[cfg(feature = "ck3")] ArtifactRarity,
177    #[cfg(feature = "ck3")] ArtifactSlot,
178    #[cfg(feature = "ck3")] ArtifactSlotType,
179    #[cfg(feature = "ck3")] ArtifactTemplate,
180    #[cfg(feature = "ck3")] ArtifactType,
181    #[cfg(feature = "ck3")] ArtifactVisual,
182    #[cfg(feature = "ck3")] Bookmark,
183    #[cfg(feature = "ck3")] BookmarkGroup,
184    #[cfg(feature = "ck3")] BookmarkPortrait,
185    #[cfg(feature = "ck3")] BuildingFlag,
186    #[cfg(feature = "ck3")] BuildingGfx,
187    #[cfg(feature = "ck3")] CasusBelli,
188    #[cfg(feature = "ck3")] CasusBelliGroup,
189    #[cfg(feature = "ck3")] Catalyst,
190    #[cfg(feature = "ck3")] ChallengeCharacter,
191    #[cfg(feature = "ck3")] Character,
192    #[cfg(feature = "ck3")] CharacterBackground,
193    #[cfg(feature = "ck3")] CharacterInteractionCategory,
194    #[cfg(feature = "ck3")] Climate,
195    #[cfg(feature = "ck3")] ClothingGfx,
196    #[cfg(feature = "ck3")] CoaGfx,
197    #[cfg(feature = "ck3")] CoaDynamicDefinition,
198    #[cfg(feature = "ck3")] CombatEffect,
199    #[cfg(feature = "ck3")] CombatPhaseEvent,
200    #[cfg(feature = "ck3")] CouncilPosition,
201    #[cfg(feature = "ck3")] CouncilTask,
202    #[cfg(feature = "ck3")] Countermeasure,
203    #[cfg(feature = "ck3")] CountermeasureParameter,
204    #[cfg(feature = "ck3")] CourtPosition,
205    #[cfg(feature = "ck3")] CourtPositionCategory,
206    #[cfg(feature = "ck3")] CourtSceneCulture,
207    #[cfg(feature = "ck3")] CourtSceneGroup,
208    #[cfg(feature = "ck3")] CourtSceneRole,
209    #[cfg(feature = "ck3")] CourtSceneSetting,
210    #[cfg(feature = "ck3")] CourtType,
211    #[cfg(feature = "ck3")] CourtierGuestManagement,
212    #[cfg(feature = "ck3")] CultureAesthetic,
213    #[cfg(feature = "ck3")] CultureCreationName,
214    #[cfg(feature = "ck3")] CultureEra,
215    #[cfg(feature = "ck3")] CultureEthos,
216    #[cfg(feature = "ck3")] CultureHeritage,
217    #[cfg(feature = "ck3")] CultureHistory,
218    #[cfg(feature = "ck3")] CultureParameter,
219    #[cfg(feature = "ck3")] CulturePillar,
220    #[cfg(feature = "ck3")] CultureTradition,
221    #[cfg(feature = "ck3")] CultureTraditionCategory,
222    #[cfg(feature = "ck3")] DangerType,
223    #[cfg(feature = "ck3")] DecisionGroup,
224    #[cfg(feature = "ck3")] DiarchyMandate,
225    #[cfg(feature = "ck3")] DiarchyParameter,
226    #[cfg(feature = "ck3")] DiarchyType,
227    #[cfg(feature = "ck3")] Doctrine,
228    #[cfg(feature = "ck3")] DoctrineCategory,
229    #[cfg(feature = "ck3")] DoctrineParameter,
230    #[cfg(feature = "ck3")] DomicileBuilding,
231    #[cfg(feature = "ck3")] DomicileParameter,
232    #[cfg(feature = "ck3")] DomicileType,
233    #[cfg(feature = "ck3")] Dynasty,
234    #[cfg(feature = "ck3")] DynastyLegacy,
235    #[cfg(feature = "ck3")] DynastyPerk,
236    #[cfg(feature = "ck3")] EpidemicType,
237    #[cfg(feature = "ck3")] EpidemicDeathReason,
238    #[cfg(feature = "ck3")] EventBackground,
239    #[cfg(feature = "ck3")] EventEffect2d,
240    #[cfg(feature = "ck3")] EventTransition,
241    #[cfg(feature = "ck3")] Faction,
242    #[cfg(feature = "ck3")] Faith,
243    #[cfg(feature = "ck3")] FaithIcon,
244    #[cfg(feature = "ck3")] FervorModifier,
245    #[cfg(feature = "ck3")] Flavorization,
246    #[cfg(feature = "ck3")] Focus,
247    #[cfg(feature = "ck3")] GeneticConstraint,
248    #[cfg(feature = "ck3")] GovernmentFlag,
249    #[cfg(feature = "ck3")] GraphicalFaith,
250    #[cfg(feature = "ck3")] GuestInviteRule,
251    #[cfg(feature = "ck3")] GuestSubset,
252    #[cfg(feature = "ck3")] GuestSystem,
253    #[cfg(feature = "ck3")] HoldingFlag,
254    #[cfg(feature = "ck3")] HoldingType,
255    #[cfg(feature = "ck3")] HolySite,
256    #[cfg(feature = "ck3")] HolySiteFlag,
257    #[cfg(feature = "ck3")] Hook,
258    #[cfg(feature = "ck3")] House,
259    #[cfg(feature = "ck3")] HousePowerBonus,
260    #[cfg(feature = "ck3")] HouseUnity,
261    #[cfg(feature = "ck3")] HouseUnityParameter,
262    #[cfg(feature = "ck3")] HouseUnityStage,
263    #[cfg(feature = "ck3")] ImportantAction,
264    #[cfg(feature = "ck3")] Innovation,
265    #[cfg(feature = "ck3")] InnovationFlag,
266    #[cfg(feature = "ck3")] Inspiration,
267    #[cfg(feature = "ck3")] Language,
268    #[cfg(feature = "ck3")] LawFlag,
269    #[cfg(feature = "ck3")] LeaseContract,
270    #[cfg(feature = "ck3")] LegendChapter,
271    #[cfg(feature = "ck3")] LegendChronicle,
272    #[cfg(feature = "ck3")] LegendProperty,
273    #[cfg(feature = "ck3")] LegendSeed,
274    #[cfg(feature = "ck3")] LegendType,
275    #[cfg(feature = "ck3")] LegitimacyFlag,
276    #[cfg(feature = "ck3")] LegitimacyType,
277    #[cfg(feature = "ck3")] Lifestyle,
278    #[cfg(feature = "ck3")] MartialCustom,
279    #[cfg(feature = "ck3")] MemoryCategory,
280    #[cfg(feature = "ck3")] MemoryType,
281    #[cfg(feature = "ck3")] MenAtArms,
282    #[cfg(feature = "ck3")] MenAtArmsBase,
283    #[cfg(feature = "ck3")] MessageFilterType,
284    #[cfg(feature = "ck3")] MessageGroupType,
285    #[cfg(feature = "ck3")] ModifierFormat,
286    #[cfg(feature = "ck3")] MottoInsert,
287    #[cfg(feature = "ck3")] Motto,
288    #[cfg(feature = "ck3")] NameEquivalency,
289    #[cfg(feature = "ck3")] NameList,
290    #[cfg(feature = "ck3")] Nickname,
291    #[cfg(feature = "ck3")] OpinionModifier,
292    #[cfg(feature = "ck3")] Perk,
293    #[cfg(feature = "ck3")] PerkTree,
294    #[cfg(feature = "ck3")] PlayableDifficultyInfo,
295    #[cfg(feature = "ck3")] PointOfInterest,
296    #[cfg(feature = "ck3")] PoolSelector,
297    #[cfg(feature = "ck3")] PortraitType,
298    #[cfg(feature = "ck3")] PrisonType,
299    #[cfg(feature = "ck3")] ProvinceMapping,
300    #[cfg(feature = "ck3")] Relation,
301    #[cfg(feature = "ck3")] RelationFlag,
302    #[cfg(feature = "ck3")] ReligionFamily,
303    #[cfg(feature = "ck3")] RewardItem,
304    #[cfg(feature = "ck3")] Scheme,
305    #[cfg(feature = "ck3")] SchemePulseAction,
306    #[cfg(feature = "ck3")] ScriptedAnimation,
307    #[cfg(feature = "ck3")] ScriptedCost,
308    #[cfg(feature = "ck3")] ScriptedIllustration,
309    #[cfg(feature = "ck3")] Secret,
310    #[cfg(feature = "ck3")] Sexuality,
311    #[cfg(feature = "ck3")] Skill,
312    #[cfg(feature = "ck3")] SpecialBuilding,
313    #[cfg(feature = "ck3")] SpecialGuest,
314    #[cfg(feature = "ck3")] Story,
315    #[cfg(feature = "ck3")] Struggle,
316    #[cfg(feature = "ck3")] StruggleHistory,
317    #[cfg(feature = "ck3")] StrugglePhase,
318    #[cfg(feature = "ck3")] StrugglePhaseParameter,
319    #[cfg(feature = "ck3")] SuccessionAppointment,
320    #[cfg(feature = "ck3")] SuccessionElection,
321    #[cfg(feature = "ck3")] Suggestion,
322    #[cfg(feature = "ck3")] TaskContractGroup,
323    #[cfg(feature = "ck3")] TaskContractReward,
324    #[cfg(feature = "ck3")] TaskContractType,
325    #[cfg(feature = "ck3")] TaxSlotFlag,
326    #[cfg(feature = "ck3")] TaxSlotObligation,
327    #[cfg(feature = "ck3")] TaxSlotType,
328    #[cfg(feature = "ck3")] Title,
329    #[cfg(feature = "ck3")] TitleHistory,
330    #[cfg(feature = "ck3")] TitleHistoryType,
331    #[cfg(feature = "ck3")] Trait,
332    #[cfg(feature = "ck3")] TraitCategory,
333    #[cfg(feature = "ck3")] TraitFlag,
334    #[cfg(feature = "ck3")] TraitPortraitModifier,
335    #[cfg(feature = "ck3")] TraitTrack,
336    #[cfg(feature = "ck3")] TravelOption,
337    #[cfg(feature = "ck3")] UnitGfx,
338    #[cfg(feature = "ck3")] VassalContract,
339    #[cfg(feature = "ck3")] VassalContractFlag,
340    #[cfg(feature = "ck3")] VassalObligationLevel,
341    #[cfg(feature = "ck3")] VassalStance,
342
343    // Items specific to vic3
344    #[cfg(feature = "vic3")] AcceptanceStatus,
345    #[cfg(feature = "vic3")] AiStrategy,
346    #[cfg(feature = "vic3")] Alert,
347    #[cfg(feature = "vic3")] AlertGroup,
348    #[cfg(feature = "vic3")] Approval,
349    #[cfg(feature = "vic3")] Attitude,
350    #[cfg(feature = "vic3")] BattleCondition,
351    #[cfg(feature = "vic3")] BuildingGroup,
352    #[cfg(feature = "vic3")] BuildingType,
353    #[cfg(feature = "vic3")] BuyPackage,
354    #[cfg(feature = "vic3")] CanalType,
355    #[cfg(feature = "vic3")] CharacterRole,
356    #[cfg(feature = "vic3")] CombatUnit,
357    #[cfg(feature = "vic3")] CombatUnitExperienceLevel,
358    #[cfg(feature = "vic3")] CombatUnitGroup,
359    #[cfg(feature = "vic3")] CommanderOrder,
360    #[cfg(feature = "vic3")] CommanderRank,
361    #[cfg(feature = "vic3")] CompanyType,
362    #[cfg(feature = "vic3")] CohesionLevel,
363    #[cfg(feature = "vic3")] CountryCreation,
364    #[cfg(feature = "vic3")] CountryFormation,
365    #[cfg(feature = "vic3")] CountryRank,
366    #[cfg(feature = "vic3")] CountryTier,
367    #[cfg(feature = "vic3")] CountryType,
368    #[cfg(feature = "vic3")] CultureGraphics,
369    #[cfg(feature = "vic3")] Decree,
370    #[cfg(feature = "vic3")] DiplomaticAction,
371    #[cfg(feature = "vic3")] DiplomaticCatalyst,
372    #[cfg(feature = "vic3")] DiplomaticCatalystCategory,
373    #[cfg(feature = "vic3")] DiplomaticPlay,
374    #[cfg(feature = "vic3")] DiscriminationTrait,
375    #[cfg(feature = "vic3")] DynamicCompanyName,
376    #[cfg(feature = "vic3")] DynamicCountryMapColor,
377    #[cfg(feature = "vic3")] DynamicCountryName,
378    #[cfg(feature = "vic3")] EventCategory,
379    #[cfg(feature = "vic3")] FlagDefinition,
380    #[cfg(feature = "vic3")] Goods,
381    #[cfg(feature = "vic3")] GradientBorderSettings,
382    #[cfg(feature = "vic3")] HarvestConditionType,
383    #[cfg(feature = "vic3")] Ideology,
384    #[cfg(feature = "vic3")] InfamyThreshold,
385    #[cfg(feature = "vic3")] Institution,
386    #[cfg(feature = "vic3")] InterestGroup,
387    #[cfg(feature = "vic3")] InterestGroupTrait,
388    #[cfg(feature = "vic3")] JournalEntry,
389    #[cfg(feature = "vic3")] JournalEntryGroup,
390    #[cfg(feature = "vic3")] LawType,
391    #[cfg(feature = "vic3")] LegitimacyLevel,
392    #[cfg(feature = "vic3")] Level,
393    #[cfg(feature = "vic3")] LibertyDesireLevel,
394    #[cfg(feature = "vic3")] MapLayer,
395    #[cfg(feature = "vic3")] MapInteractionType,
396    #[cfg(feature = "vic3")] MapNotificationType,
397    #[cfg(feature = "vic3")] MediaAlias,
398    #[cfg(feature = "vic3")] MilitaryFormationFlag,
399    #[cfg(feature = "vic3")] MobilizationOption,
400    #[cfg(feature = "vic3")] MobilizationOptionGroup,
401    #[cfg(feature = "vic3")] ModifierTypeDefinition,
402    #[cfg(feature = "vic3")] Objective,
403    #[cfg(feature = "vic3")] ObjectiveSubgoal,
404    #[cfg(feature = "vic3")] ObjectiveSubgoalCategory,
405    #[cfg(feature = "vic3")] Party,
406    #[cfg(feature = "vic3")] PoliticalLobby,
407    #[cfg(feature = "vic3")] PoliticalLobbyAppeasement,
408    #[cfg(feature = "vic3")] PoliticalMovement,
409    #[cfg(feature = "vic3")] PoliticalMovementCategory,
410    #[cfg(feature = "vic3")] PoliticalMovementPopSupport,
411    #[cfg(feature = "vic3")] PopNeed,
412    #[cfg(feature = "vic3")] PowerBlocCoaPiece,
413    #[cfg(feature = "vic3")] PowerBlocIdentity,
414    #[cfg(feature = "vic3")] PowerBlocMapTexture,
415    #[cfg(feature = "vic3")] PowerBlocName,
416    #[cfg(feature = "vic3")] Principle,
417    #[cfg(feature = "vic3")] PrincipleGroup,
418    #[cfg(feature = "vic3")] ProductionMethod,
419    #[cfg(feature = "vic3")] ProductionMethodGroup,
420    #[cfg(feature = "vic3")] ProposalType,
421    #[cfg(feature = "vic3")] RelationsThreshold,
422    #[cfg(feature = "vic3")] ScriptedButton,
423    #[cfg(feature = "vic3")] ScriptedProgressBar,
424    #[cfg(feature = "vic3")] ScriptedTest,
425    #[cfg(feature = "vic3")] SecretGoal,
426    #[cfg(feature = "vic3")] SocialClass,
427    #[cfg(feature = "vic3")] SocialHierarchy,
428    #[cfg(feature = "vic3")] StateRegion,
429    #[cfg(feature = "vic3")] StateTrait,
430    #[cfg(feature = "vic3")] Strata,
431    #[cfg(feature = "vic3")] StrategicRegion,
432    #[cfg(feature = "vic3")] Technology,
433    #[cfg(feature = "vic3")] TechnologyEra,
434    #[cfg(feature = "vic3")] TerrainKey,
435    #[cfg(feature = "vic3")] TerrainLabel,
436    #[cfg(feature = "vic3")] TerrainManipulator,
437    #[cfg(feature = "vic3")] TerrainMask,
438    #[cfg(feature = "vic3")] TerrainMaterial,
439    #[cfg(feature = "vic3")] TransferOfPower,
440
441    // Items specific to imperator
442    #[cfg(feature = "imperator")] Ambition,
443    #[cfg(feature = "imperator")] AiPlanGoals,
444    #[cfg(feature = "imperator")] Area,
445    #[cfg(feature = "imperator")] CultureGroup,
446    #[cfg(feature = "imperator")] CombatTactic,
447    #[cfg(feature = "imperator")] Deity,
448    #[cfg(feature = "imperator")] DeityCategory,
449    #[cfg(feature = "imperator")] DiplomaticStance,
450    #[cfg(feature = "imperator")] EconomicPolicy,
451    #[cfg(feature = "imperator")] EventPicture,
452    #[cfg(feature = "imperator")] GovernorPolicy,
453    #[cfg(feature = "imperator")] GraphicalCultureType,
454    #[cfg(feature = "imperator")] GreatWorkEffectTier,
455    #[cfg(feature = "imperator")] GreatWorkEffect,
456    #[cfg(feature = "imperator")] GreatWorkCategory,
457    #[cfg(feature = "imperator")] GreatWorkMaterial,
458    #[cfg(feature = "imperator")] GreatWorkModule,
459    #[cfg(feature = "imperator")] GreatWorkTemplate,
460    #[cfg(feature = "imperator")] Heritage,
461    #[cfg(feature = "imperator")] Idea,
462    #[cfg(feature = "imperator")] Invention,
463    #[cfg(feature = "imperator")] InventionGroup,
464    #[cfg(feature = "imperator")] LegionDistinction,
465    #[cfg(feature = "imperator")] LevyTemplate,
466    #[cfg(feature = "imperator")] Loyalty,
467    #[cfg(feature = "imperator")] MilitaryTraditionTree,
468    #[cfg(feature = "imperator")] MilitaryTradition,
469    #[cfg(feature = "imperator")] Mission,
470    #[cfg(feature = "imperator")] MissionTask,
471    #[cfg(feature = "imperator")] Office,
472    #[cfg(feature = "imperator")] Opinion,
473    #[cfg(feature = "imperator")] PartyAgenda,
474    #[cfg(feature = "imperator")] PartyType,
475    #[cfg(feature = "imperator")] PostSetupCharacters,
476    #[cfg(feature = "imperator")] Price,
477    #[cfg(feature = "imperator")] ProvinceRank,
478    #[cfg(feature = "imperator")] SetupCharacters,
479    #[cfg(feature = "imperator")] SetupProvinces,
480    #[cfg(feature = "imperator")] TechnologyTable,
481    #[cfg(feature = "imperator")] TradeGood,
482    #[cfg(feature = "imperator")] Treasure,
483    #[cfg(feature = "imperator")] Unit,
484    #[cfg(feature = "imperator")] UnitAbility,
485}
486
487/// Display items in `separated word case` for maximum friendliness.
488///
489/// Unfortunately there's no option for this in `strum` so we have to roll our own
490/// by using `snake_case` and changing the `_` to a space.
491impl Display for Item {
492    fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> {
493        let s: &'static str = self.into();
494        write!(f, "{}", s.replace('_', " "))
495    }
496}
497
498impl Item {
499    /// Returns a path where items of this type are kept in the script files. Can be `""` for items
500    /// that are built in.
501    ///
502    /// These paths are used both for the user in error reports, and to find the items when loading them.
503    pub fn path(self) -> &'static str {
504        #[allow(clippy::match_same_arms)]
505        // These variants are in the same order as the Item enum declaration
506        match self {
507            Item::Accessory => "gfx/portraits/accessories/",
508            Item::AccessoryTag => "gfx/portraits/accessories/",
509            Item::AccessoryVariation => "gfx/portraits/accessory_variations/",
510            Item::AccessoryVariationLayout => "gfx/portraits/accessory_variations/",
511            Item::AccessoryVariationTextures => "gfx/portraits/accessory_variations/",
512            Item::Achievement => "common/achievements",
513            Item::AchievementGroup => "common/achievement_groups.txt",
514            Item::Asset => "gfx/models/",
515            Item::BlendShape => "gfx/models/",
516            Item::CharacterInteraction => "common/character_interactions/",
517            Item::Coa => "common/coat_of_arms/coat_of_arms/",
518            Item::CoaColorList => "common/coat_of_arms/template_lists/",
519            Item::CoaColoredEmblemList => "common/coat_of_arms/template_lists/",
520            #[cfg(feature = "ck3")]
521            Item::CoaDesignerColorPalette => "gfx/coat_of_arms/color_palettes/",
522            Item::CoaDesignerColoredEmblem => "gfx/coat_of_arms/colored_emblems/",
523            #[cfg(feature = "ck3")]
524            Item::CoaDesignerEmblemLayout => "gfx/coat_of_arms/emblem_layouts/",
525            Item::CoaDesignerPattern => "gfx/coat_of_arms/patterns/",
526            Item::CoaPatternList => "common/coat_of_arms/template_lists/",
527            Item::CoaTemplate => "common/coat_of_arms/coat_of_arms/",
528            Item::CoaTemplateList => "common/coat_of_arms/template_lists/",
529            Item::CoaTexturedEmblemList => "common/coat_of_arms/template_lists/",
530            Item::Culture => match Game::game() {
531                #[cfg(feature = "ck3")]
532                Game::Ck3 => "common/culture/cultures/",
533                #[cfg(feature = "vic3")]
534                Game::Vic3 => "common/cultures/",
535                #[cfg(feature = "imperator")]
536                Game::Imperator => "common/cultures/",
537            },
538            Item::CustomLocalization => "common/customizable_localization/",
539            Item::Decision => match Game::game() {
540                #[cfg(feature = "ck3")]
541                Game::Ck3 => "common/decisions/",
542                #[cfg(feature = "vic3")]
543                Game::Vic3 => "common/decisions/",
544                #[cfg(feature = "imperator")]
545                Game::Imperator => "decisions/",
546            },
547            Item::Define => "common/defines/",
548            Item::Dlc => "",
549            Item::DlcFeature => "",
550            Item::Directory => "",
551            Item::EffectLocalization => "common/effect_localization/",
552            Item::Entity => "gfx/models/",
553            Item::Entry => "",
554            Item::Ethnicity => "common/ethnicities/",
555            Item::Event => "events/",
556            Item::EventNamespace => "events/",
557            Item::File => "",
558            Item::Font => "fonts/",
559            Item::Fontfiles => "fonts/",
560            Item::GameConcept => "common/game_concepts/",
561            Item::GameRule => "common/game_rules/",
562            Item::GameRuleSetting => "common/game_rules/",
563            Item::GeneAgePreset => "common/genes/",
564            Item::GeneAttribute => "gfx/models/",
565            Item::GeneCategory => "common/genes/",
566            Item::GovernmentType => match Game::game() {
567                #[cfg(feature = "ck3")]
568                Game::Ck3 => "common/governments/",
569                #[cfg(feature = "vic3")]
570                Game::Vic3 => "common/government_types/",
571                #[cfg(feature = "imperator")]
572                Game::Imperator => "common/governments/",
573            },
574            Item::GuiLayer => "gui/",
575            Item::GuiTemplate => "gui/",
576            Item::GuiType => "gui/",
577            Item::Localization => "localization/",
578            Item::MapEnvironment => "gfx/map/environment/",
579            Item::MapMode => "gfx/map/map_modes/",
580            Item::Modifier => match Game::game() {
581                #[cfg(feature = "ck3")]
582                Game::Ck3 => "common/modifiers/",
583                #[cfg(feature = "vic3")]
584                Game::Vic3 => "common/static_modifiers/",
585                #[cfg(feature = "imperator")]
586                Game::Imperator => "common/modifiers/",
587            },
588            Item::Music => "music/",
589            Item::MusicPlayerCategory => "music/music_player_categories/",
590            Item::NamedColor => "common/named_colors/",
591            Item::OnAction => match Game::game() {
592                #[cfg(feature = "ck3")]
593                Game::Ck3 => "common/on_action/",
594                #[cfg(feature = "vic3")]
595                Game::Vic3 => "common/on_actions/",
596                #[cfg(feature = "imperator")]
597                Game::Imperator => "common/on_action/",
598            },
599            Item::Pdxmesh => "gfx/models/",
600            Item::PortraitAnimation => "gfx/portraits/portrait_animations/",
601            Item::PortraitCamera => "gfx/portraits/cameras/",
602            Item::PortraitEnvironment => "gfx/portraits/environments/",
603            Item::PortraitModifierGroup => "gfx/portraits/portrait_modifiers/",
604            Item::PortraitModifierPack => "gfx/portraits/portrait_animations/",
605            Item::Province => match Game::game() {
606                #[cfg(feature = "ck3")]
607                Game::Ck3 => "map_data/definition.csv",
608                #[cfg(feature = "vic3")]
609                Game::Vic3 => "map_data/provinces.png",
610                #[cfg(feature = "imperator")]
611                Game::Imperator => "map_data/provinces.png",
612            },
613            Item::Religion => match Game::game() {
614                #[cfg(feature = "ck3")]
615                Game::Ck3 => "common/religion/religions/",
616                #[cfg(feature = "vic3")]
617                Game::Vic3 => "common/religions/",
618                #[cfg(feature = "imperator")]
619                Game::Imperator => "common/religions/",
620            },
621            Item::ScriptedEffect => "common/scripted_effects/",
622            Item::ScriptedGui => "common/scripted_guis/",
623            Item::ScriptedList => "common/scripted_lists/",
624            Item::ScriptedModifier => "common/scripted_modifiers/",
625            Item::ScriptedRule => "common/scripted_rules/",
626            Item::ScriptedTrigger => "common/scripted_triggers/",
627            Item::ScriptValue => "common/script_values/",
628            Item::Shortcut => "gui/shortcuts.shortcuts",
629            Item::Sound => "",
630            Item::Terrain => match Game::game() {
631                #[cfg(feature = "ck3")]
632                Game::Ck3 => "common/terrain_types/",
633                #[cfg(feature = "vic3")]
634                Game::Vic3 => "common/terrain/",
635                #[cfg(feature = "imperator")]
636                Game::Imperator => "common/terrain_types/",
637            },
638            Item::TextFormat => "gui/",
639            Item::TextIcon => "gui/",
640            Item::TextureFile => "gfx/models/",
641            Item::TriggerLocalization => "common/trigger_localization/",
642            Item::WidgetName => "gui/",
643
644            #[cfg(any(feature = "ck3", feature = "imperator"))]
645            Item::Building => "common/buildings/",
646            #[cfg(any(feature = "ck3", feature = "vic3"))]
647            Item::CharacterTemplate => match Game::game() {
648                #[cfg(feature = "ck3")]
649                Game::Ck3 => "common/scripted_character_templates/",
650                #[cfg(feature = "vic3")]
651                Game::Vic3 => "common/character_templates/",
652            },
653            #[cfg(any(feature = "vic3", feature = "imperator"))]
654            Item::CharacterTrait => match Game::game() {
655                #[cfg(feature = "vic3")]
656                Game::Vic3 => "common/character_traits",
657                #[cfg(feature = "imperator")]
658                Game::Imperator => "common/traits",
659            },
660            #[cfg(any(feature = "vic3", feature = "imperator"))]
661            Item::Country => match Game::game() {
662                #[cfg(feature = "vic3")]
663                Game::Vic3 => "common/country_definitions/",
664                #[cfg(feature = "imperator")]
665                Game::Imperator => "setup/countries/countries.txt",
666            },
667            #[cfg(any(feature = "ck3", feature = "imperator"))]
668            Item::DeathReason => "common/deathreasons/",
669            #[cfg(any(feature = "ck3", feature = "vic3"))]
670            Item::Dna => "common/dna_data/",
671            #[cfg(any(feature = "ck3", feature = "imperator"))]
672            Item::EventTheme => "common/event_themes/",
673            #[cfg(any(feature = "ck3", feature = "imperator"))]
674            Item::Law => "common/laws/",
675            Item::LawGroup => match Game::game() {
676                #[cfg(feature = "ck3")]
677                Game::Ck3 => "common/laws/",
678                #[cfg(feature = "imperator")]
679                Game::Imperator => "common/laws/",
680                #[cfg(feature = "vic3")]
681                Game::Vic3 => "common/law_groups/",
682            },
683            #[cfg(any(feature = "ck3", feature = "vic3"))]
684            Item::Message => "common/messages",
685            #[cfg(any(feature = "vic3", feature = "imperator"))]
686            Item::PopType => "common/pop_types/",
687            #[cfg(any(feature = "ck3", feature = "imperator"))]
688            Item::Region => match Game::game() {
689                #[cfg(feature = "ck3")]
690                Game::Ck3 => "map_data/geographical_regions/",
691                #[cfg(feature = "imperator")]
692                Game::Imperator => "map_data/regions.txt",
693            },
694            #[cfg(any(feature = "vic3", feature = "imperator"))]
695            Item::SubjectType => "common/subject_types/",
696            #[cfg(any(feature = "ck3", feature = "vic3"))]
697            Item::TutorialLesson => "common/tutorial_lessons",
698            #[cfg(any(feature = "ck3", feature = "vic3"))]
699            Item::TutorialLessonChain => "common/tutorial_lesson_chains",
700            #[cfg(any(feature = "ck3", feature = "vic3"))]
701            Item::TutorialLessonStep => "common/tutorial_lessons",
702            #[cfg(any(feature = "vic3", feature = "imperator"))]
703            Item::Wargoal => match Game::game() {
704                #[cfg(feature = "vic3")]
705                Game::Vic3 => "",
706                #[cfg(feature = "imperator")]
707                Game::Imperator => "common/wargoals",
708            },
709
710            #[cfg(feature = "ck3")]
711            Item::AccoladeCategory => "common/accolade_types/",
712            #[cfg(feature = "ck3")]
713            Item::AccoladeIcon => "common/accolade_icons/",
714            #[cfg(feature = "ck3")]
715            Item::AccoladeName => "common/accolade_names/",
716            #[cfg(feature = "ck3")]
717            Item::AccoladeParameter => "common/accolade_types/",
718            #[cfg(feature = "ck3")]
719            Item::AccoladeType => "common/accolade_types/",
720            #[cfg(feature = "ck3")]
721            Item::ActivityIntent => "common/activities/intents/",
722            #[cfg(feature = "ck3")]
723            Item::ActivityLocale => "common/activities/activity_locales/",
724            #[cfg(feature = "ck3")]
725            Item::ActivityOption => "common/activities/activity_types/",
726            #[cfg(feature = "ck3")]
727            Item::ActivityOptionCategory => "common/activities/activity_types/",
728            #[cfg(feature = "ck3")]
729            Item::ActivityPhase => "common/activities/activity_types/",
730            #[cfg(feature = "ck3")]
731            Item::ActivityPulseAction => "common/activities/pulse_actions/",
732            #[cfg(feature = "ck3")]
733            Item::ActivityState => "",
734            #[cfg(feature = "ck3")]
735            Item::ActivityType => "common/activities/activity_types/",
736            #[cfg(feature = "ck3")]
737            Item::AiWarStance => "common/ai_war_stances/",
738            #[cfg(feature = "ck3")]
739            Item::AgentType => "common/schemes/agent_types/",
740            #[cfg(feature = "ck3")]
741            Item::Amenity => "common/court_amenities/",
742            #[cfg(feature = "ck3")]
743            Item::AmenitySetting => "common/court_amenities/",
744            #[cfg(feature = "ck3")]
745            Item::ArtifactBlueprint => "common/artifacts/blueprints/",
746            #[cfg(feature = "ck3")]
747            Item::ArtifactFeature => "common/artifacts/features/",
748            #[cfg(feature = "ck3")]
749            Item::ArtifactFeatureGroup => "common/artifacts/feature_groups/",
750            #[cfg(feature = "ck3")]
751            Item::ArtifactHistory => "",
752            #[cfg(feature = "ck3")]
753            Item::ArtifactRarity => "",
754            #[cfg(feature = "ck3")]
755            Item::ArtifactSlot => "common/artifacts/slots/",
756            #[cfg(feature = "ck3")]
757            Item::ArtifactSlotType => "common/artifacts/slots/",
758            #[cfg(feature = "ck3")]
759            Item::ArtifactTemplate => "common/artifacts/templates/",
760            #[cfg(feature = "ck3")]
761            Item::ArtifactType => "common/artifacts/types/",
762            #[cfg(feature = "ck3")]
763            Item::ArtifactVisual => "common/artifacts/visuals/",
764            #[cfg(feature = "ck3")]
765            Item::Bookmark => "common/bookmarks/bookmarks/",
766            #[cfg(feature = "ck3")]
767            Item::BookmarkGroup => "common/bookmarks/groups/",
768            #[cfg(feature = "ck3")]
769            Item::BookmarkPortrait => "common/bookmark_portraits/",
770            #[cfg(feature = "ck3")]
771            Item::BuildingFlag => "common/buildings/",
772            #[cfg(feature = "ck3")]
773            Item::BuildingGfx => "common/culture/cultures/",
774            #[cfg(feature = "ck3")]
775            Item::CasusBelli => "common/casus_belli_types/",
776            #[cfg(feature = "ck3")]
777            Item::CasusBelliGroup => "common/casus_belli_groups/",
778            #[cfg(feature = "ck3")]
779            Item::Catalyst => "common/struggle/catalysts/",
780            #[cfg(feature = "ck3")]
781            Item::ChallengeCharacter => "common/bookmarks/challenge_characters/",
782            #[cfg(feature = "ck3")]
783            Item::Character => "history/characters/",
784            #[cfg(feature = "ck3")]
785            Item::CharacterBackground => "common/character_backgrounds/",
786            #[cfg(feature = "ck3")]
787            Item::CharacterInteractionCategory => "common/character_interaction_categories/",
788            #[cfg(feature = "ck3")]
789            Item::Climate => "map_data/climate.txt",
790            #[cfg(feature = "ck3")]
791            Item::ClothingGfx => "common/culture/cultures/",
792            #[cfg(feature = "ck3")]
793            Item::CoaGfx => "common/culture/cultures/",
794            #[cfg(feature = "ck3")]
795            Item::CoaDynamicDefinition => "common/coat_of_arms/dynamic_definitions/",
796            #[cfg(feature = "ck3")]
797            Item::CombatEffect => "common/combat_effects/",
798            #[cfg(feature = "ck3")]
799            Item::CombatPhaseEvent => "common/combat_phase_events/",
800            #[cfg(feature = "ck3")]
801            Item::CouncilPosition => "common/council_positions/",
802            #[cfg(feature = "ck3")]
803            Item::CouncilTask => "common/council_tasks/",
804            #[cfg(feature = "ck3")]
805            Item::Countermeasure => "common/schemes/scheme_countermeasures/",
806            #[cfg(feature = "ck3")]
807            Item::CountermeasureParameter => "common/schemes/scheme_countermeasures/",
808            #[cfg(feature = "ck3")]
809            Item::CourtPosition => "common/court_positions/types/",
810            #[cfg(feature = "ck3")]
811            Item::CourtPositionCategory => "common/court_positions/categories/",
812            #[cfg(feature = "ck3")]
813            Item::CourtSceneCulture => "gfx/court_scene/scene_cultures/",
814            #[cfg(feature = "ck3")]
815            Item::CourtSceneGroup => "gfx/court_scene/character_groups/",
816            #[cfg(feature = "ck3")]
817            Item::CourtSceneRole => "gfx/court_scene/character_roles/",
818            #[cfg(feature = "ck3")]
819            Item::CourtSceneSetting => "gfx/court_scene/scene_settings/",
820            #[cfg(feature = "ck3")]
821            Item::CourtType => "common/court_types/",
822            #[cfg(feature = "ck3")]
823            Item::CourtierGuestManagement => "common/courtier_guest_management/",
824            #[cfg(feature = "ck3")]
825            Item::CultureAesthetic => "common/culture/aesthetics_bundles/",
826            #[cfg(feature = "ck3")]
827            Item::CultureCreationName => "common/culture/creation_names/",
828            #[cfg(feature = "ck3")]
829            Item::CultureEra => "common/culture/eras/",
830            #[cfg(feature = "ck3")]
831            Item::CultureEthos => "common/culture/pillars/",
832            #[cfg(feature = "ck3")]
833            Item::CultureHeritage => "common/culture/pillars/",
834            #[cfg(feature = "ck3")]
835            Item::CultureHistory => "history/cultures/",
836            #[cfg(feature = "ck3")]
837            Item::CultureParameter => "common/culture/",
838            #[cfg(feature = "ck3")]
839            Item::CulturePillar => "common/culture/pillars/",
840            #[cfg(feature = "ck3")]
841            Item::CultureTradition => "common/culture/traditions/",
842            #[cfg(feature = "ck3")]
843            Item::CultureTraditionCategory => "common/culture/traditions/",
844            #[cfg(feature = "ck3")]
845            Item::DangerType => "",
846            #[cfg(feature = "ck3")]
847            Item::DecisionGroup => "common/decision_group_types/",
848            #[cfg(feature = "ck3")]
849            Item::DiarchyMandate => "common/diarchies/diarchy_mandates/",
850            #[cfg(feature = "ck3")]
851            Item::DiarchyParameter => "common/diarchies/diarchy_types/",
852            #[cfg(feature = "ck3")]
853            Item::DiarchyType => "common/diarchies/diarchy_types/",
854            #[cfg(feature = "ck3")]
855            Item::Doctrine => "common/religion/doctrines/",
856            #[cfg(feature = "ck3")]
857            Item::DoctrineCategory => "common/religion/doctrines/",
858            #[cfg(feature = "ck3")]
859            Item::DoctrineParameter => "common/religion/doctrines/",
860            #[cfg(feature = "ck3")]
861            Item::DomicileBuilding => "common/domiciles/buildings/",
862            #[cfg(feature = "ck3")]
863            Item::DomicileParameter => "common/domiciles/buildings/",
864            #[cfg(feature = "ck3")]
865            Item::DomicileType => "common/domiciles/types/",
866            #[cfg(feature = "ck3")]
867            Item::Dynasty => "common/dynasties/",
868            #[cfg(feature = "ck3")]
869            Item::DynastyLegacy => "common/dynasty_legacies/",
870            #[cfg(feature = "ck3")]
871            Item::DynastyPerk => "common/dynasty_perks/",
872            #[cfg(feature = "ck3")]
873            Item::EpidemicType => "common/epidemics/",
874            #[cfg(feature = "ck3")]
875            Item::EpidemicDeathReason => "common/deathreasons/",
876            #[cfg(feature = "ck3")]
877            Item::EventBackground => "common/event_backgrounds/",
878            #[cfg(feature = "ck3")]
879            Item::EventEffect2d => "common/event_2d_effects/",
880            #[cfg(feature = "ck3")]
881            Item::EventTransition => "common/event_transitions/",
882            #[cfg(feature = "ck3")]
883            Item::Faith => "common/religion/religions/",
884            #[cfg(feature = "ck3")]
885            Item::FaithIcon => "common/religion/religions/",
886            #[cfg(feature = "ck3")]
887            Item::FervorModifier => "common/religion/fervor_modifiers/",
888            #[cfg(feature = "ck3")]
889            Item::Faction => "common/factions/",
890            #[cfg(feature = "ck3")]
891            Item::Flavorization => "common/flavorization/",
892            #[cfg(feature = "ck3")]
893            Item::Focus => "common/focuses/",
894            #[cfg(feature = "ck3")]
895            Item::GeneticConstraint => "common/traits/",
896            #[cfg(feature = "ck3")]
897            Item::GovernmentFlag => "common/governments/",
898            #[cfg(feature = "ck3")]
899            Item::GraphicalFaith => "common/religion/religions/",
900            #[cfg(feature = "ck3")]
901            Item::GuestInviteRule => "common/activities/guest_invite_rules/",
902            #[cfg(feature = "ck3")]
903            Item::GuestSubset => "common/activities/activity_types/",
904            #[cfg(feature = "ck3")]
905            Item::GuestSystem => "common/guest_system/",
906            #[cfg(feature = "ck3")]
907            Item::HoldingFlag => "common/holdings/",
908            #[cfg(feature = "ck3")]
909            Item::HoldingType => "common/holdings/",
910            #[cfg(feature = "ck3")]
911            Item::HolySite => "common/religion/holy_sites/",
912            #[cfg(feature = "ck3")]
913            Item::HolySiteFlag => "common/religion/holy_sites/",
914            #[cfg(feature = "ck3")]
915            Item::Hook => "common/hook_types/",
916            #[cfg(feature = "ck3")]
917            Item::House => "common/dynasty_houses/",
918            #[cfg(feature = "ck3")]
919            Item::HousePowerBonus => "common/house_power_bonus/",
920            #[cfg(feature = "ck3")]
921            Item::HouseUnity => "common/house_unities/",
922            #[cfg(feature = "ck3")]
923            Item::HouseUnityParameter => "common/house_unities",
924            #[cfg(feature = "ck3")]
925            Item::HouseUnityStage => "common/house_unities/",
926            #[cfg(feature = "ck3")]
927            Item::ImportantAction => "common/important_actions/",
928            #[cfg(feature = "ck3")]
929            Item::Innovation => "common/culture/innovations/",
930            #[cfg(feature = "ck3")]
931            Item::InnovationFlag => "common/culture/innovations/",
932            #[cfg(feature = "ck3")]
933            Item::Inspiration => "common/inspirations/",
934            #[cfg(feature = "ck3")]
935            Item::Language => "common/culture/pillars/",
936            #[cfg(feature = "ck3")]
937            Item::LawFlag => "common/laws/",
938            #[cfg(feature = "ck3")]
939            Item::LeaseContract => "common/lease_contracts/",
940            #[cfg(feature = "ck3")]
941            Item::LegendChapter => "common/legends/chronicles/",
942            #[cfg(feature = "ck3")]
943            Item::LegendChronicle => "common/legends/chronicles/",
944            #[cfg(feature = "ck3")]
945            Item::LegendProperty => "common/legends/chronicles/",
946            #[cfg(feature = "ck3")]
947            Item::LegendSeed => "common/legends/legend_seeds/",
948            #[cfg(feature = "ck3")]
949            Item::LegendType => "common/legends/legend_types/",
950            #[cfg(feature = "ck3")]
951            Item::LegitimacyFlag => "common/legitimacy/",
952            #[cfg(feature = "ck3")]
953            Item::LegitimacyType => "common/legitimacy/",
954            #[cfg(feature = "ck3")]
955            Item::Lifestyle => "common/lifestyles/",
956            #[cfg(feature = "ck3")]
957            Item::MartialCustom => "common/culture/pillars/",
958            #[cfg(feature = "ck3")]
959            Item::MemoryCategory => "common/character_memory_types/",
960            #[cfg(feature = "ck3")]
961            Item::MemoryType => "common/character_memory_types/",
962            #[cfg(feature = "ck3")]
963            Item::MenAtArms => "common/men_at_arms_types/",
964            #[cfg(feature = "ck3")]
965            Item::MenAtArmsBase => "common/men_at_arms_types/",
966            #[cfg(feature = "ck3")]
967            Item::MessageFilterType => "common/message_filter_types/",
968            #[cfg(feature = "ck3")]
969            Item::MessageGroupType => "common/message_group_types/",
970            #[cfg(feature = "ck3")]
971            Item::ModifierFormat => "common/modifier_definition_formats/",
972            #[cfg(feature = "ck3")]
973            Item::MottoInsert => "common/dynasty_house_motto_inserts/",
974            #[cfg(feature = "ck3")]
975            Item::Motto => "common/dynasty_house_mottos/",
976            #[cfg(feature = "ck3")]
977            Item::NameEquivalency => "common/culture/name_equivalency/",
978            #[cfg(feature = "ck3")]
979            Item::NameList => "common/culture/name_lists/",
980            #[cfg(feature = "ck3")]
981            Item::Nickname => "common/nicknames/",
982            #[cfg(feature = "ck3")]
983            Item::OpinionModifier => "common/opinion_modifiers/",
984            #[cfg(feature = "ck3")]
985            Item::Perk => "common/lifestyle_perks/",
986            #[cfg(feature = "ck3")]
987            Item::PerkTree => "common/lifestyle_perks/",
988            #[cfg(feature = "ck3")]
989            Item::PlayableDifficultyInfo => "common/playable_difficulty_infos/",
990            #[cfg(feature = "ck3")]
991            Item::PointOfInterest => "common/travel/point_of_interest_types/",
992            #[cfg(feature = "ck3")]
993            Item::PoolSelector => "common/pool_character_selectors/",
994            #[cfg(feature = "ck3")]
995            Item::PortraitType => "common/portrait_types/",
996            #[cfg(feature = "ck3")]
997            Item::ProvinceMapping => "history/province_mapping/",
998            #[cfg(feature = "ck3")]
999            Item::PrisonType => "",
1000            #[cfg(feature = "ck3")]
1001            Item::Relation => "common/scripted_relations/",
1002            #[cfg(feature = "ck3")]
1003            Item::RelationFlag => "common/scripted_relations/",
1004            #[cfg(feature = "ck3")]
1005            Item::ReligionFamily => "common/religion/religion_families/",
1006            #[cfg(feature = "ck3")]
1007            Item::RewardItem => "",
1008            #[cfg(feature = "ck3")]
1009            Item::Scheme => "common/schemes/scheme_types",
1010            #[cfg(feature = "ck3")]
1011            Item::SchemePulseAction => "common/schemes/pulse_actions",
1012            #[cfg(feature = "ck3")]
1013            Item::ScriptedAnimation => "common/scripted_animations/",
1014            #[cfg(feature = "ck3")]
1015            Item::ScriptedCost => "common/scripted_costs/",
1016            #[cfg(feature = "ck3")]
1017            Item::ScriptedIllustration => "gfx/interface/illustrations/scripted_illustrations/",
1018            #[cfg(feature = "ck3")]
1019            Item::Secret => "common/secret_types/",
1020            #[cfg(feature = "ck3")]
1021            Item::Sexuality => "",
1022            #[cfg(feature = "ck3")]
1023            Item::Skill => "",
1024            #[cfg(feature = "ck3")]
1025            Item::SpecialBuilding => "common/buildings/",
1026            #[cfg(feature = "ck3")]
1027            Item::SpecialGuest => "common/activities/activity_types/",
1028            #[cfg(feature = "ck3")]
1029            Item::Story => "common/story_cycles/",
1030            #[cfg(feature = "ck3")]
1031            Item::Struggle => "common/struggle/struggles/",
1032            #[cfg(feature = "ck3")]
1033            Item::StruggleHistory => "history/struggles/",
1034            #[cfg(feature = "ck3")]
1035            Item::StrugglePhase => "common/struggle/struggles/",
1036            #[cfg(feature = "ck3")]
1037            Item::StrugglePhaseParameter => "common/struggle/struggles/",
1038            #[cfg(feature = "ck3")]
1039            Item::SuccessionAppointment => "common/succession_appointment/",
1040            #[cfg(feature = "ck3")]
1041            Item::SuccessionElection => "common/succession_election/",
1042            #[cfg(feature = "ck3")]
1043            Item::Suggestion => "common/suggestions/",
1044            #[cfg(feature = "ck3")]
1045            Item::TaskContractGroup => "common/task_contracts/",
1046            #[cfg(feature = "ck3")]
1047            Item::TaskContractReward => "common/task_contracts/",
1048            #[cfg(feature = "ck3")]
1049            Item::TaskContractType => "common/task_contracts/",
1050            #[cfg(feature = "ck3")]
1051            Item::TaxSlotFlag => "common/tax_slots/obligations",
1052            #[cfg(feature = "ck3")]
1053            Item::TaxSlotObligation => "common/tax_slots/obligations",
1054            #[cfg(feature = "ck3")]
1055            Item::TaxSlotType => "common/tax_slots/types",
1056            #[cfg(feature = "ck3")]
1057            Item::Title => "common/landed_titles/",
1058            #[cfg(feature = "ck3")]
1059            Item::TitleHistory => "history/titles/",
1060            #[cfg(feature = "ck3")]
1061            Item::TitleHistoryType => "",
1062            #[cfg(feature = "ck3")]
1063            Item::Trait => "common/traits/",
1064            #[cfg(feature = "ck3")]
1065            Item::TraitCategory => "",
1066            #[cfg(feature = "ck3")]
1067            Item::TraitFlag => "common/traits/",
1068            #[cfg(feature = "ck3")]
1069            Item::TraitPortraitModifier => "gfx/portraits/trait_portrait_modifiers",
1070            #[cfg(feature = "ck3")]
1071            Item::TraitTrack => "common/traits/",
1072            #[cfg(feature = "ck3")]
1073            Item::TravelOption => "common/travel/travel_options/",
1074            #[cfg(feature = "ck3")]
1075            Item::UnitGfx => "common/culture/cultures/",
1076            #[cfg(feature = "ck3")]
1077            Item::VassalContract => "common/vassal_contracts/",
1078            #[cfg(feature = "ck3")]
1079            Item::VassalContractFlag => "common/vassal_contracts/",
1080            #[cfg(feature = "ck3")]
1081            Item::VassalObligationLevel => "common/vassal_contracts/",
1082            #[cfg(feature = "ck3")]
1083            Item::VassalStance => "common/vassal_stances/",
1084
1085            #[cfg(feature = "vic3")]
1086            Item::AcceptanceStatus => "common/acceptance_statuses/",
1087            #[cfg(feature = "vic3")]
1088            Item::AiStrategy => "common/ai_strategies/",
1089            #[cfg(feature = "vic3")]
1090            Item::Alert => "common/alert_types",
1091            #[cfg(feature = "vic3")]
1092            Item::AlertGroup => "common/alert_groups",
1093            #[cfg(feature = "vic3")]
1094            Item::Approval => "",
1095            #[cfg(feature = "vic3")]
1096            Item::Attitude => "",
1097            #[cfg(feature = "vic3")]
1098            Item::BattleCondition => "common/battle_conditions/",
1099            #[cfg(feature = "vic3")]
1100            Item::BuildingGroup => "common/building_groups/",
1101            #[cfg(feature = "vic3")]
1102            Item::BuildingType => "common/buildings/",
1103            #[cfg(feature = "vic3")]
1104            Item::BuyPackage => "common/buy_packages/",
1105            #[cfg(feature = "vic3")]
1106            Item::CanalType => "common/canals/",
1107            #[cfg(feature = "vic3")]
1108            Item::CharacterRole => "",
1109            #[cfg(feature = "vic3")]
1110            Item::CombatUnit => "common/combat_unit_types/",
1111            #[cfg(feature = "vic3")]
1112            Item::CombatUnitExperienceLevel => "common/combat_unit_experience_levels/",
1113            #[cfg(feature = "vic3")]
1114            Item::CombatUnitGroup => "common/combat_unit_groups/",
1115            #[cfg(feature = "vic3")]
1116            Item::CommanderOrder => "common/commander_orders/",
1117            #[cfg(feature = "vic3")]
1118            Item::CommanderRank => "common/commander_ranks/",
1119            #[cfg(feature = "vic3")]
1120            Item::CompanyType => "common/company_types/",
1121            #[cfg(feature = "vic3")]
1122            Item::CohesionLevel => "common/cohesion_levels/",
1123            #[cfg(feature = "vic3")]
1124            Item::CountryCreation => "common/country_creation/",
1125            #[cfg(feature = "vic3")]
1126            Item::CountryFormation => "common/country_formation/",
1127            #[cfg(feature = "vic3")]
1128            Item::CountryRank => "common/country_ranks/",
1129            #[cfg(feature = "vic3")]
1130            Item::CountryTier => "",
1131            #[cfg(feature = "vic3")]
1132            Item::CountryType => "common/country_types/",
1133            #[cfg(feature = "vic3")]
1134            Item::CultureGraphics => "common/culture_graphics/",
1135            #[cfg(feature = "vic3")]
1136            Item::Decree => "common/decrees/",
1137            #[cfg(feature = "vic3")]
1138            Item::DiplomaticAction => "common/diplomatic_actions/",
1139            #[cfg(feature = "vic3")]
1140            Item::DiplomaticCatalyst => "common/diplomatic_catalysts/",
1141            #[cfg(feature = "vic3")]
1142            Item::DiplomaticCatalystCategory => "common/diplomatic_catalyst_categories/",
1143            #[cfg(feature = "vic3")]
1144            Item::DiplomaticPlay => "common/diplomatic_plays/",
1145            #[cfg(feature = "vic3")]
1146            Item::DiscriminationTrait => "common/discrimination_traits/",
1147            #[cfg(feature = "vic3")]
1148            Item::DynamicCompanyName => "common/dynamic_company_names/",
1149            #[cfg(feature = "vic3")]
1150            Item::DynamicCountryMapColor => "common/dynamic_country_map_colors/",
1151            #[cfg(feature = "vic3")]
1152            Item::DynamicCountryName => "common/dynamic_country_names/",
1153            #[cfg(feature = "vic3")]
1154            Item::EventCategory => "",
1155            #[cfg(feature = "vic3")]
1156            Item::FlagDefinition => "common/flag_definitions/",
1157            #[cfg(feature = "vic3")]
1158            Item::Goods => "common/goods/",
1159            #[cfg(feature = "vic3")]
1160            // TODO: find out if different filenames are acceptable in this dir
1161            Item::GradientBorderSettings => "gfx/map/gradient_border_settings/",
1162            #[cfg(feature = "vic3")]
1163            Item::HarvestConditionType => "common/harvest_condition_types/",
1164            #[cfg(feature = "vic3")]
1165            Item::Ideology => "common/ideologies/",
1166            #[cfg(feature = "vic3")]
1167            Item::InfamyThreshold => "",
1168            #[cfg(feature = "vic3")]
1169            Item::Institution => "common/institutions/",
1170            #[cfg(feature = "vic3")]
1171            Item::InterestGroup => "common/interest_groups/",
1172            #[cfg(feature = "vic3")]
1173            Item::InterestGroupTrait => "common/interest_group_traits/",
1174            #[cfg(feature = "vic3")]
1175            Item::JournalEntry => "common/journal_entries/",
1176            #[cfg(feature = "vic3")]
1177            Item::JournalEntryGroup => "common/journal_entry_groups/",
1178            #[cfg(feature = "vic3")]
1179            Item::LawType => "common/laws/",
1180            #[cfg(feature = "vic3")]
1181            Item::LegitimacyLevel => "common/legitimacy_levels/",
1182            #[cfg(feature = "vic3")]
1183            Item::Level => "",
1184            #[cfg(feature = "vic3")]
1185            Item::LibertyDesireLevel => "common/liberty_desire_levels/",
1186            #[cfg(feature = "vic3")]
1187            Item::MapLayer => "gfx/map/map_object_data/layers.txt",
1188            #[cfg(feature = "vic3")]
1189            Item::MapInteractionType => "common/map_interaction_types/",
1190            #[cfg(feature = "vic3")]
1191            Item::MapNotificationType => "common/map_notification_types/",
1192            #[cfg(feature = "vic3")]
1193            Item::MediaAlias => "gfx/media_aliases/",
1194            #[cfg(feature = "vic3")]
1195            Item::MilitaryFormationFlag => "common/military_formation_flags/",
1196            #[cfg(feature = "vic3")]
1197            Item::MobilizationOption => "common/mobilization_options/",
1198            #[cfg(feature = "vic3")]
1199            Item::MobilizationOptionGroup => "common/mobilization_option_groups/",
1200            #[cfg(feature = "vic3")]
1201            Item::ModifierTypeDefinition => "common/modifier_type_definitions/",
1202            #[cfg(feature = "vic3")]
1203            Item::Objective => "common/objectives/",
1204            #[cfg(feature = "vic3")]
1205            Item::ObjectiveSubgoal => "common/objective_subgoals/",
1206            #[cfg(feature = "vic3")]
1207            Item::ObjectiveSubgoalCategory => "common/objective_subgoal_categories/",
1208            #[cfg(feature = "vic3")]
1209            Item::Party => "common/parties/",
1210            #[cfg(feature = "vic3")]
1211            Item::PoliticalLobby => "common/political_lobbies/",
1212            #[cfg(feature = "vic3")]
1213            Item::PoliticalLobbyAppeasement => "common/political_lobby_appeasement/",
1214            #[cfg(feature = "vic3")]
1215            Item::PoliticalMovement => "common/political_movements",
1216            #[cfg(feature = "vic3")]
1217            Item::PoliticalMovementCategory => "common/political_movement_categories",
1218            #[cfg(feature = "vic3")]
1219            Item::PoliticalMovementPopSupport => "common/political_movement_pop_support",
1220            #[cfg(feature = "vic3")]
1221            Item::PopNeed => "common/pop_needs/",
1222            #[cfg(feature = "vic3")]
1223            Item::PowerBlocCoaPiece => "common/power_bloc_coa_pieces/",
1224            #[cfg(feature = "vic3")]
1225            Item::PowerBlocIdentity => "common/power_bloc_identities/",
1226            #[cfg(feature = "vic3")]
1227            Item::PowerBlocMapTexture => "common/power_bloc_map_textures/",
1228            #[cfg(feature = "vic3")]
1229            Item::PowerBlocName => "common/power_bloc_names/",
1230            #[cfg(feature = "vic3")]
1231            Item::Principle => "common/power_bloc_principles/",
1232            #[cfg(feature = "vic3")]
1233            Item::PrincipleGroup => "common/power_bloc_principle_groups/",
1234            #[cfg(feature = "vic3")]
1235            Item::ProductionMethod => "common/production_methods/",
1236            #[cfg(feature = "vic3")]
1237            Item::ProductionMethodGroup => "common/production_method_groups/",
1238            #[cfg(feature = "vic3")]
1239            Item::ProposalType => "common/proposal_types/",
1240            #[cfg(feature = "vic3")]
1241            Item::RelationsThreshold => "",
1242            #[cfg(feature = "vic3")]
1243            Item::ScriptedButton => "common/scripted_buttons/",
1244            #[cfg(feature = "vic3")]
1245            Item::ScriptedProgressBar => "common/scripted_progress_bars/",
1246            #[cfg(feature = "vic3")]
1247            Item::ScriptedTest => "common/scripted_tests/",
1248            #[cfg(feature = "vic3")]
1249            Item::SecretGoal => "",
1250            #[cfg(feature = "vic3")]
1251            Item::SocialClass => "common/social_classes/",
1252            #[cfg(feature = "vic3")]
1253            Item::SocialHierarchy => "common/social_hierarchies/",
1254            #[cfg(feature = "vic3")]
1255            Item::StateRegion => "map_data/state_regions/",
1256            #[cfg(feature = "vic3")]
1257            Item::StateTrait => "common/state_traits/",
1258            #[cfg(feature = "vic3")]
1259            Item::Strata => "",
1260            #[cfg(feature = "vic3")]
1261            Item::StrategicRegion => "common/strategic_regions/",
1262            #[cfg(feature = "vic3")]
1263            Item::Technology => "common/technology/technologies/",
1264            #[cfg(feature = "vic3")]
1265            Item::TechnologyEra => "common/technology/eras/",
1266            #[cfg(feature = "vic3")]
1267            Item::TerrainKey => "common/labels/",
1268            #[cfg(feature = "vic3")]
1269            Item::TerrainLabel => "common/labels/",
1270            #[cfg(feature = "vic3")]
1271            Item::TerrainManipulator => "common/terrain_manipulators/",
1272            #[cfg(feature = "vic3")]
1273            Item::TerrainMask => "gfx/map/masks/",
1274            #[cfg(feature = "vic3")]
1275            Item::TerrainMaterial => "gfx/map/terrain/materials.settings",
1276            #[cfg(feature = "vic3")]
1277            Item::TransferOfPower => "",
1278
1279            #[cfg(feature = "imperator")]
1280            Item::AiPlanGoals => "common/ai_plan_goals/",
1281            #[cfg(feature = "imperator")]
1282            Item::Ambition => "common/ambitions/",
1283            #[cfg(feature = "imperator")]
1284            Item::Area => "map_data/areas.txt",
1285            #[cfg(feature = "imperator")]
1286            Item::CombatTactic => "common/combat_tactics/",
1287            #[cfg(feature = "imperator")]
1288            Item::CultureGroup => "common/cultures/",
1289            #[cfg(feature = "imperator")]
1290            Item::Deity => "common/deities/",
1291            #[cfg(feature = "imperator")]
1292            Item::DeityCategory => "common/deity_categories/",
1293            #[cfg(feature = "imperator")]
1294            Item::DiplomaticStance => "common/diplomatic_stances/",
1295            #[cfg(feature = "imperator")]
1296            Item::EconomicPolicy => "common/economic_policies/",
1297            #[cfg(feature = "imperator")]
1298            Item::EventPicture => "common/event_pictures/",
1299            #[cfg(feature = "imperator")]
1300            Item::GovernorPolicy => "common/governor_policies/",
1301            #[cfg(feature = "imperator")]
1302            Item::GraphicalCultureType => "common/graphical_culture_types/",
1303            #[cfg(feature = "imperator")]
1304            Item::GreatWorkEffect => "common/great_work_effects/",
1305            #[cfg(feature = "imperator")]
1306            Item::GreatWorkEffectTier => "common/great_work_effect_tiers/",
1307            #[cfg(feature = "imperator")]
1308            Item::GreatWorkCategory => "common/great_work_categories/",
1309            #[cfg(feature = "imperator")]
1310            Item::GreatWorkMaterial => "common/great_work_materials/",
1311            #[cfg(feature = "imperator")]
1312            Item::GreatWorkModule => "common/great_work_modules/",
1313            #[cfg(feature = "imperator")]
1314            Item::GreatWorkTemplate => "common/great_work_templates/",
1315            #[cfg(feature = "imperator")]
1316            Item::Heritage => "common/heritage/",
1317            #[cfg(feature = "imperator")]
1318            Item::Idea => "common/ideas/",
1319            #[cfg(feature = "imperator")]
1320            Item::Invention => "common/inventions/",
1321            #[cfg(feature = "imperator")]
1322            Item::InventionGroup => "common/inventions/",
1323            #[cfg(feature = "imperator")]
1324            Item::LegionDistinction => "common/legion_distinctions/",
1325            #[cfg(feature = "imperator")]
1326            Item::LevyTemplate => "common/levy_templates/",
1327            #[cfg(feature = "imperator")]
1328            Item::Loyalty => "common/loyalty/",
1329            #[cfg(feature = "imperator")]
1330            Item::MilitaryTraditionTree => "common/military_traditions/",
1331            #[cfg(feature = "imperator")]
1332            Item::MilitaryTradition => "common/military_traditions/",
1333            #[cfg(feature = "imperator")]
1334            Item::Mission => "common/missions/",
1335            #[cfg(feature = "imperator")]
1336            Item::MissionTask => "common/missions/",
1337            #[cfg(feature = "imperator")]
1338            Item::Office => "common/offices/",
1339            #[cfg(feature = "imperator")]
1340            Item::Opinion => "common/opinions/",
1341            #[cfg(feature = "imperator")]
1342            Item::PartyAgenda => "common/party_agendas",
1343            #[cfg(feature = "imperator")]
1344            Item::PartyType => "common/party_types/",
1345            #[cfg(feature = "imperator")]
1346            Item::PostSetupCharacters => "setup/post_character/",
1347            #[cfg(feature = "imperator")]
1348            Item::Price => "common/prices/",
1349            #[cfg(feature = "imperator")]
1350            Item::ProvinceRank => "common/province_ranks/",
1351            #[cfg(feature = "imperator")]
1352            Item::TechnologyTable => "common/technology_tables/",
1353            #[cfg(feature = "imperator")]
1354            Item::SetupCharacters => "setup/characters/",
1355            #[cfg(feature = "imperator")]
1356            Item::SetupProvinces => "setup/provinces/",
1357            #[cfg(feature = "imperator")]
1358            Item::TradeGood => "common/trade_goods/",
1359            #[cfg(feature = "imperator")]
1360            Item::Treasure => "setup/main/",
1361            #[cfg(feature = "imperator")]
1362            Item::Unit => "common/units/",
1363            #[cfg(feature = "imperator")]
1364            Item::UnitAbility => "common/unit_abilities/",
1365        }
1366    }
1367
1368    /// Confidence value to use when reporting that an item is missing.
1369    /// Should be `Strong` for most, `Weak` for items that aren't defined anywhere but just used (such as gfx flags).
1370    pub fn confidence(self) -> Confidence {
1371        match self {
1372            Item::AccessoryTag
1373            // GuiType and GuiTemplate are here because referring to templates in other mods is a
1374            // common compatibility technique.
1375            | Item::GuiType
1376            | Item::GuiTemplate
1377            | Item::Sound => Confidence::Weak,
1378
1379            #[cfg(feature = "ck3")]
1380            Item::AccoladeCategory
1381            | Item::BuildingGfx
1382            | Item::ClothingGfx
1383            | Item::CoaGfx
1384            | Item::MemoryCategory
1385            | Item::UnitGfx => Confidence::Weak,
1386
1387            #[cfg(feature = "ck3")]
1388            Item::SpecialBuilding => Confidence::Reasonable,
1389
1390            _ => Confidence::Strong,
1391        }
1392    }
1393
1394    /// Severity value to use when reporting that an item is missing.
1395    /// * `Error` - most things
1396    /// * `Warning` - things that only impact visuals or presentation
1397    /// * `Untidy` - things that don't matter much at all
1398    /// * `Fatal` - things that cause crashes if they're missing
1399    ///
1400    /// This is only one piece of the severity puzzle. It can also depend on the caller who's expecting the item to exist.
1401    /// That part isn't handled yet.
1402    pub fn severity(self) -> Severity {
1403        match self {
1404            // GuiType and GuiTemplate are here because referring to templates in other mods is a
1405            // common compatibility technique.
1406            Item::GuiType | Item::GuiTemplate => Severity::Untidy,
1407
1408            Item::Accessory
1409            | Item::AccessoryTag
1410            | Item::AccessoryVariation
1411            | Item::AccessoryVariationLayout
1412            | Item::AccessoryVariationTextures
1413            | Item::Coa
1414            | Item::CoaColorList
1415            | Item::CoaColoredEmblemList
1416            | Item::CoaPatternList
1417            | Item::CoaTemplate
1418            | Item::CoaTemplateList
1419            | Item::CoaTexturedEmblemList
1420            | Item::CustomLocalization
1421            | Item::EffectLocalization
1422            | Item::Ethnicity
1423            | Item::File
1424            | Item::GameConcept
1425            | Item::Localization
1426            | Item::MapEnvironment
1427            | Item::NamedColor
1428            | Item::PortraitAnimation
1429            | Item::PortraitCamera
1430            | Item::PortraitEnvironment
1431            | Item::Sound
1432            | Item::TextFormat
1433            | Item::TextIcon
1434            | Item::TextureFile
1435            | Item::TriggerLocalization => Severity::Warning,
1436
1437            #[cfg(feature = "ck3")]
1438            Item::AccoladeIcon
1439            | Item::ArtifactVisual
1440            | Item::BuildingGfx
1441            | Item::ClothingGfx
1442            | Item::CoaDynamicDefinition
1443            | Item::CoaGfx
1444            | Item::CultureAesthetic
1445            | Item::CultureCreationName
1446            | Item::EventBackground
1447            | Item::EventTheme
1448            | Item::EventTransition
1449            | Item::Flavorization
1450            | Item::GraphicalFaith
1451            | Item::ModifierFormat
1452            | Item::MottoInsert
1453            | Item::Motto
1454            | Item::Music
1455            | Item::Nickname
1456            | Item::ScriptedIllustration
1457            | Item::UnitGfx => Severity::Warning,
1458
1459            #[cfg(feature = "vic3")]
1460            Item::MapLayer
1461            | Item::ModifierTypeDefinition
1462            | Item::TerrainManipulator
1463            | Item::TerrainMask
1464            | Item::TerrainMaterial => Severity::Warning,
1465
1466            _ => Severity::Error,
1467        }
1468    }
1469}
1470
1471/// The callback type for adding one item instance to the database.
1472pub(crate) type ItemAdder = fn(&mut Db, Token, Block);
1473
1474/// The specification for loading an [`Item`] type into the [`Db`].
1475///
1476/// An instance of this can be placed in every `data` module using the `inventory::collect!` macro.
1477/// This will register the loader so that the [`Everything`] object can load all defined items.
1478// Note that this is an enum so that users can more conveniently construct it. It used to be a
1479// struct with various constructor functions, but that didn't work because the ItemAdder type has a
1480// &mut in it, and that wasn't allowed in const functions even though the function pointer itself
1481// is const. See https://github.com/rust-lang/rust/issues/57349 for details.
1482// TODO: once that issue stabilizes, we can revisit the ItemLoader type.
1483pub(crate) enum ItemLoader {
1484    /// A convenience variant for loaders that are the most common type.
1485    ///
1486    /// * [`GameFlags`] is which games this item loader is for.
1487    /// * [`Item`] is the item type being loaded.
1488    ///
1489    /// The [`ItemAdder`] function does not have to load exclusively this type of item.
1490    /// Related items are ok. The main use of the [`Item`] field is to get the path for this item
1491    /// type, so that files are loaded from that folder.
1492    Normal(GameFlags, Item, ItemAdder),
1493    /// A variant that allows the full range of item loader behvavior.
1494    /// * [`PdxEncoding`] indicates whether to expect utf-8 and/or a BOM in the files.
1495    /// * The `&'static str` is the file extension to look for (including the dot).
1496    /// * The `bool` is whether to load the whole file as one item, or treat it as normal with a
1497    ///   series of items in one file.
1498    Full(GameFlags, Item, PdxEncoding, &'static str, bool, ItemAdder),
1499}
1500
1501inventory::collect!(ItemLoader);
1502
1503impl ItemLoader {
1504    pub fn for_game(&self, game: Game) -> bool {
1505        let game_flags = match self {
1506            ItemLoader::Normal(game_flags, _, _) | ItemLoader::Full(game_flags, _, _, _, _, _) => {
1507                game_flags
1508            }
1509        };
1510        game_flags.contains(GameFlags::from(game))
1511    }
1512
1513    pub fn itype(&self) -> Item {
1514        match self {
1515            ItemLoader::Normal(_, itype, _) | ItemLoader::Full(_, itype, _, _, _, _) => *itype,
1516        }
1517    }
1518
1519    pub fn encoding(&self) -> PdxEncoding {
1520        match self {
1521            ItemLoader::Normal(_, _, _) => PdxEncoding::Utf8Bom,
1522            ItemLoader::Full(_, _, encoding, _, _, _) => *encoding,
1523        }
1524    }
1525
1526    pub fn extension(&self) -> &'static str {
1527        match self {
1528            ItemLoader::Normal(_, _, _) => ".txt",
1529            ItemLoader::Full(_, _, _, extension, _, _) => extension,
1530        }
1531    }
1532
1533    pub fn whole_file(&self) -> bool {
1534        match self {
1535            ItemLoader::Normal(_, _, _) => false,
1536            ItemLoader::Full(_, _, _, _, whole_file, _) => *whole_file,
1537        }
1538    }
1539
1540    pub fn adder(&self) -> ItemAdder {
1541        match self {
1542            ItemLoader::Normal(_, _, adder) | ItemLoader::Full(_, _, _, _, _, adder) => *adder,
1543        }
1544    }
1545}