Small code changes to simplify modding

Discussion in 'Suggestions' started by Pathoschild, Sep 18, 2017.

Tags:
  1. Pathoschild

    Pathoschild Tiy's Beard

    Hi!

    Here are some suggested changes to the game code that would make SMAPI modding & support easier. I tried to list them in order of usefulness, though any of these would be very useful.
    1. Include Stardew Valley.pdb in the release.
      This would add line numbers to errors that happen in game code, so we can help players and troubleshoot mods.

    2. Use IList<T> instead of List<T> for Game1 fields (and optionally anywhere else).
      This would let SMAPI override them with observable lists, so it can add new events for mods to use.

    3. Make LocalizedContentManager.CreateTemporary virtual.
      This would let SMAPI override the method. (Alternatively: remove it and use Game1.CreateContentManager instead.)

    4. Replace type checks with obj is type.
      The game uses obj.GetType() == type or obj.GetType().Name == "TypeName" in several places. Replacing those with obj is type would let SMAPI/mods add subclasses without breaking the game logic. This one is a bit trickier, since you'd need to check whether each change would affect the game logic on a case-by-case basis.
    @tccoxon Are you the right person to ping? :)
     
    • Entoarox

      Entoarox Oxygen Tank

      PLEASE! YES! FOR HEAVENS SAKE CF! DO IT! JUST DO IT!
       
      • tccoxon

        tccoxon Procedurally Generated Programmer

        I might be able to implement some of these changes while we're running the multiplayer beta. We'll be looking for modder feedback around then anyways.
         
          anothersarah and Pathoschild like this.

        Share This Page