User:Pathoschild/Modding wishlist

From Stardew Valley Wiki
< User:Pathoschild
Revision as of 16:00, 7 September 2021 by Pathoschild (talk | contribs) (→‎Small changes: + NPC name substring issue)
Jump to navigation Jump to search

A list of requested changes in the game code to support modders. This list does not include complex refactoring or rewriting, which is unlikely to be accepted.

Wishlist

Bug fixes

All done!

Small changes

  • ☐ Add a TouchAction Warp tile property which is identical TouchAction MagicWarp, but without the sound/visual effects.
  • ☐ Add map properties IsFarm T and IsGreenhouse T to set the location's IsFarm and IsGreenhouse properties in GameLocation.loadMap (similar to the existing Outdoors T).
  • ☐ NPCs check the player spouse or NPC relationships with a substring match. That causes issues for mods; e.g. Jas will show marriage dialogue for a custom Jasper NPC. More specifically:
    method proposed change
    NPC.loadCurrentDialogue
    old: Game1.player.spouse.Contains(base.Name)
    new: Game1.player.spouse == base.Name
    NPC.performTenMinuteUpdate
    old: !dispositions[base.Name].Split('/')[9].Contains(c.Name)
    new: !dispositions[base.Name].Split('/')[9].Split(' ').Contains(c.Name)
    NPC.tryToReceiveActiveObject
    old: !who.spouse.Contains(base.Name)
    new: who.spouse != base.Name

    The proposed changes should have no effect on vanilla, since no vanilla NPC name is a substring of another NPC's name.

    • ☐ Change all remaining internal class and private class to public class to simplify mod access.

    Medium changes

    • ☐ Move hardcoded scarecrow logic from Farm.addCrows into new Object.IsScarecrow() and Object.GetRadiusForScarecrow() methods.
    • ☐ Some XNB files have a separate display name field, but only in non-English. Using display names consistently regardless of language would let mods rename things without breaking keys:
      • Data\Bundles
      • Data\CraftingRecipes
      • Data\CookingRecipes
      • Data\Weapons
    • ☐ Remove hardcoded logic that ignores display names when playing in English (e.g. for NPC gift taste dialogues); can search LocalizedContentManager.LanguageCode.en to find many of them. That causes a bug where renamed NPCs still show their internal name in some places.

    Refactoring

    • ☐ The farmhouse walls are hardcoded in FarmHouse.getWalls; moving those into a content file would make custom renovations and layouts much easier.
    • ☐ Replace Item.ParentSheetIndex with three properties:
      field type notes
      ID string An ID unique across all item types (like parsnip or radish_salad). That would allow unambiguous and human-readable item references throughout the code (e.g. gift tastes, machine behaviour, etc), fix bugs like the wallpaper glitch, and make it easy to avoid ID collisions in mods (e.g. spacechase0.JsonAssets/watermelon).
      Sheet Texture2D The spritesheet to draw (e.g. Game1.objectSpriteSheet). This lets modders easily add custom items with their own spritesheet, and simplifies draw logic.
      SheetIndex int Equivalent to the old ParentSheetIndex, but for the Sheet texture. No longer used as an ID.

      Files like Data/ObjectInformation would be updated to use the new IDs:

      # old format
      634: "Apricot/50/15/Basic -79/Apricot/A tender little fruit with a rock-hard pit."
      629: "Apricot Sapling/500/-300/Basic -74/Apricot Sapling/Takes 28 days to produce a mature Apricot tree. Bears fruit in the spring. Only grows if the 8 surrounding \"tiles\" are empty."
      
      # new format
      apricot: "634/Apricot/50/15/Basic -79/A tender little fruit with a rock-hard pit."
      apricot_sapling: "629/Apricot Sapling/500/-300/Basic -74/Takes 28 days to produce a mature Apricot tree. Bears fruit in the spring. Only grows if the 8 surrounding \"tiles\" are empty."
      

      With equivalent changes in files like Data/NPCGiftTastes:

      # old format
      Universal_Like: "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459"
      
      # new format
      Universal_Like: "-2 -7 -26 -75 -80 apple apricot cherry coffee maple_syrup mead orange peach pomegranate shrimp"
      

      Creating a vanilla item would use a key lookup like before:

      Object item = new Object("apricot"); // equivalent to new Object("apricot", "Maps/springobjects", 634, ...);
      

      This also avoids needing to check item types in most code (e.g. no need to exclude bigcraftables in gift tastes, since there's no possible ID overlap with the IDs listed in Data/NPCGiftTastes).

    • ☐ Change all const fields to static readonly. They're accessed the same way and the performance difference is negligible, but that'll make the decompiled code much easier to understand, and avoid issues where const values get 'baked in' to mod assemblies.

    Completed items

    See the list of items completed in previous game versions.