Diferenças entre edições de "Modificações:Guia do Modder/Teste e Solução de Problemas"

Fonte: Stardew Valley Wiki
Saltar para a navegação Saltar para a pesquisa
m (→‎Testing on all platforms: windows 11 traduzido)
Linha 52: Linha 52:
 
</dl>
 
</dl>
  
; If your main computer is Windows 10 or earlier&#x3A;
+
; Se o seu computador for Windows 10 ou anterior&#x3A;
:# Install [https://www.virtualbox.org/ VirtualBox].
+
:# Instale a [https://www.virtualbox.org/ VirtualBox].
:# Create a [https://zorinos.com/ ZorinOS Core] VM in VirtualBox.
+
:# Crie uma [https://zorinos.com/ ZorinOS Core] VM na VirtualBox.
:#* ''See [https://extr3metech.wordpress.com/2013/09/05/installing-zorin-os-7-in-virtual-box-screenshots this setup guide] for more details. The ZorinOS installer might be a bit different than shown, but should be pretty intuitive.''
+
:#* ''Veja [https://extr3metech.wordpress.com/2013/09/05/installing-zorin-os-7-in-virtual-box-screenshots esse guia de instalação] para mais detalhes. O instalador do ZorinOS pode ser um pouco diferente que o mostrado, mas deve continuar a ser bem intuitivo.''
:#* ''If you don't see any options for 64-bit OSes in VirtualBox, see [https://superuser.com/a/866963 how to enable them].''
+
:#* ''Se você não ver qualquer opção para sistemas operacionais de 64-bits na VirtualBox, veja [https://superuser.com/a/866963 como habilita-lo].''
:#* ''When creating the virtual disk, at least 20GB is recommended.''
+
:#* ''Quando criar o disco virtual, pelo menos 20GB é recomendado.''
:# [https://store.steampowered.com/about Download the Steam installer] in the VM and run it.
+
:# [https://store.steampowered.com/about Baixe o instalador do Steam] no VM e execute-o.
:# Launch Steam to finish installation. If nothing happens, see [https://askubuntu.com/questions/771032/steam-not-opening-in-ubuntu-16-04-lts these extra steps] to fix it.
+
:# Inicie o Steam para finalizar a instalação. Se nada acontecer, veja [https://askubuntu.com/questions/771032/steam-not-opening-in-ubuntu-16-04-lts essas etapas extras] para conserta-lo.
:# Install Stardew Valley through Steam.
+
:# Instale o Stardew Valley pelo Steam.
:# [[Modding:Player Guide/Getting Started#Install SMAPI|Install SMAPI]].
+
:# [[Modding:Player Guide/Getting Started#Install SMAPI|Instale SMAPI]].
:# ''(optional)'' Install [https://www.mono-project.com/ <samp>mono-complete</samp>] and [http://www.monodevelop.com/download/ MonoDevelop] in your VM. This is only needed if you want to compile separately for Linux/Mac. When installing <samp>.deb</samp> files, use the instructions for [https://zorinos.com/help/install-apps/#deb-files the Ubuntu version shown here]. If you run into errors, may Linux have mercy on your soul.
+
:# ''(opcional)'' Instale o [https://www.mono-project.com/ <samp>mono-complete</samp>] e o [http://www.monodevelop.com/download/ MonoDevelop] na sua VM. Isso só é necessário se você quiser compilar separadamente para Linux/Mac. Ao instalar os arquivos <samp>.deb</samp>, use as instruções para [https://zorinos.com/help/install-apps/#deb-files a versão Ubuntu mostrada aqui]. Se você encontrar erros, que o Linux tenha piedade da sua alma.
:# ''(optional)'' For unlocking Mac OS only: [https://www.insanelymac.com/forum/files/file/838-unlocker/ Virtual Machine Unlocker 2.1.1] for VmWare Workstation 11/12/14, VmWare Player 7/12/14, or Fusion 7/8/10.  '''This is needed to boot Mac OS on a virtual Machine'''
+
:# ''(opcional)'' Para desbloquear apenas o Mac OS: [https://www.insanelymac.com/forum/files/file/838-unlocker/ Virtual Machine Unlocker 2.1.1] para VmWare Workstation 11/12/14, VmWare Player 7/12/14, ou Fusion 7/8/10.  ''' Isso é necessário para inicializar o Mac OS em uma Maquina virtual (Virtual Machine).'''
  
; If your main computer is Linux or macOS&#x3A;
+
; Se o seu computador principal for Linux ou macOS&#x3A;
:# Install [https://www.virtualbox.org/ VirtualBox].
+
:# Instale [https://www.virtualbox.org/ VirtualBox].
:# [http://www.macworld.co.uk/how-to/mac-software/run-windows-10-on-your-mac-using-virtualbox-3621650/ Create a VM with Windows].
+
:# [http://www.macworld.co.uk/how-to/mac-software/run-windows-10-on-your-mac-using-virtualbox-3621650/ Crie uma VM com o windows].
:# Install Stardew Valley in your VM.
+
:# Instale o Stardew Valley na sua VM (Virtual machine).
:# [[Modding:Player Guide/Getting Started#Install SMAPI|Install SMAPI]].
+
:# [[Modding:Player Guide/Getting Started#Install SMAPI|Instale o SMAPI]].
:# ''(optional)'' Install [https://visualstudio.microsoft.com/vs/community/ Visual Studio Community] in your VM. This is only needed if you want to compile separately for Windows.
+
:# ''(opcional)'' Instale o [https://visualstudio.microsoft.com/vs/community/ Visual Studio Community] na sua VM. Isso só é necessário se você quiser compilar separadamente pelo windows.
  
 
==Fix common build warnings==
 
==Fix common build warnings==

Revisão das 21h20min de 4 de setembro de 2022

Robin building.png
“Ainda tenho muito trabalho a fazer”
— Robin

Tradução incompleta

Este artigo ou seção não foi completamente traduzido para o português. Você está convidado a ajudar na sua construção editando-o
Última edição por LokKol em 2022-09-04 21:20:50.

Creating SMAPI mods SMAPI mascot.png


Modificações:Índice

This page helps you test your mods and solve common issues. For issues using mods, see Modding:Player Guide/Troubleshooting.

Teste o mod

Teste básico

Fazer um teste é bem simples pra maioria dos mods:

  1. Clique em Compilação > Recompilar solução (Visual Studio) ou Compilação > Compilar tudo (MonoDevelop).
  2. Certifique-se de não ter erros de compilação, e seu mod será copiado para sua pasta Mods.
  3. Teste o mod dentro do jogo.
  4. Certifique-se de que não há erros ou avisos para seu mod no console do SMAPI.

No geral, se um mod funciona em uma plataforma então ele irá se sair bem em outras.

Testando no Multijogador

Você pode testar mods multijogador no mesmo computador, ao iniciar duas instacias do jogo:

  1. Prepare o jogador um:
    1. Inicie o SMAPI normalmente
    2. Na tela de titulo: clique em coop, e então em host.
    3. Inicie uma nova fazenda (a menos que você já tenha criado uma). Certifique-se de ajustar as 'cabanas iniciais' para ao menos uma (you precisará de uma cabana extra por jogador)
  2. Prepare o jogador dois:
    1. Inicie o SMAPI novamente (Isso irá automaticamente criar uma instancia separada)
    2. Na tela de titulo: clique em coop, e então em entrar em jogo LAN
    3. Deixe a caixa Insira o IP...' vazia e clique em OK.

Testando em todas as plataformas

Para mods complexos, você talvez precise testar seu mod em todas as plataformas. O jogo é quase o mesmo no Linux/Mac, sendo assim, você terá de testar seu mod apenas duas vezes: uma vez no Windows, e a outra no Linux ou Mac. Você pode fazer isso testando uma versão no seu computador, e a outra em uma maquina virtual.

Se o seu computador é Windows 11:
  1. Instale o Windows Subsystem for Linux (WSL).
  2. Instale o software necessário no WSL:
    1. Instale o Steam.
    2. Inicialize export TERM=xterm && steam,e então install & launch Stardew Valley através de sua interface. Isso também irá instalar suas dependências.
    3. (opcional) Baixe e instale sua IDE preferida, se você planeja compilar seu código no linux. para a ultima versão do standalone Rider (Pago):
      wget "<download url here>" -O rider-install.tar.gz
      sudo tar -xzvf rider-install.tar.gz -C /opt
      ln -s "/opt/JetBrains Rider-<version>/bin/rider.sh"
      ./rider.sh
      
    4. Instale SMAPI.
  3. Para iniciar o jogo, inicie o steam e rode o jogo através de sua interface
Se o seu computador for Windows 10 ou anterior:
  1. Instale a VirtualBox.
  2. Crie uma ZorinOS Core VM na VirtualBox.
    • Veja esse guia de instalação para mais detalhes. O instalador do ZorinOS pode ser um pouco diferente que o mostrado, mas deve continuar a ser bem intuitivo.
    • Se você não ver qualquer opção para sistemas operacionais de 64-bits na VirtualBox, veja como habilita-lo.
    • Quando criar o disco virtual, pelo menos 20GB é recomendado.
  3. Baixe o instalador do Steam no VM e execute-o.
  4. Inicie o Steam para finalizar a instalação. Se nada acontecer, veja essas etapas extras para conserta-lo.
  5. Instale o Stardew Valley pelo Steam.
  6. Instale SMAPI.
  7. (opcional) Instale o mono-complete e o MonoDevelop na sua VM. Isso só é necessário se você quiser compilar separadamente para Linux/Mac. Ao instalar os arquivos .deb, use as instruções para a versão Ubuntu mostrada aqui. Se você encontrar erros, que o Linux tenha piedade da sua alma.
  8. (opcional) Para desbloquear apenas o Mac OS: Virtual Machine Unlocker 2.1.1 para VmWare Workstation 11/12/14, VmWare Player 7/12/14, ou Fusion 7/8/10. Isso é necessário para inicializar o Mac OS em uma Maquina virtual (Virtual Machine).
Se o seu computador principal for Linux ou macOS:
  1. Instale VirtualBox.
  2. Crie uma VM com o windows.
  3. Instale o Stardew Valley na sua VM (Virtual machine).
  4. Instale o SMAPI.
  5. (opcional) Instale o Visual Studio Community na sua VM. Isso só é necessário se você quiser compilar separadamente pelo windows.

Fix common build warnings

After building your project, you can see build warnings via Visual Studio > View > Error List or MonoDevelop > View > Pads > Errors. Here are some common ones.

This implicitly converts...

Sample warning: "This implicitly converts '{0}' from Net{1} to {2}, but Net{1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details."

Your code is referencing a net field, which can cause subtle bugs. This field has an equivalent non-net property, like monster.Health (int) instead of monster.health (NetBool). Change your code to use the suggested property instead.

FieldName is a Net* field...

Sample warning: "'{0}' is a Net{1} field; consider using the {2} property instead. See https://smapi.io/buildmsg/avoid-net-field for details."

Your code is referencing a net field, which can cause subtle bugs. You should access the underlying value instead:

  • For a reference type (i.e., one that can contain null), you can use the .Value property (or .FieldDict for a NetDictionary):
    if (building.indoors.Value == null)
    

    Or convert the value before comparison:

    GameLocation indoors = building.indoors.Value;
    if(indoors == null)
       // ...
    
  • For a value type (i.e., one that can't contain null), check if the parent is null (if needed) and compare with .Value:
    if (item != null && item.category.Value == 0)
    

The FieldName field is obsolete...

Sample warning: "The 'Character.friendships' field is obsolete and should be replaced with 'friendshipData'. See https://smapi.io/buildmsg/avoid-obsolete-field for details."

You're referencing a field which should no longer be used. Use the suggested field name instead to fix it.

An instance of analyzer ... cannot be created

Update to the latest Visual Studio; the NuGet package uses a recent feature that isn't available in older versions.

Other issues

Can't target .NET 5

If the target framework list has options starting with...

  • .NET Framework: you created the wrong type of project. Make sure you create a .NET 5 project for your mod instead. (The naming is a bit confusing.)
  • .NET Core, .NET Standard, or .NET 5+: use .NET 5 for compatibility with the game. If you don't have that option, you can install the .NET 5 SDK to add it.

Visual Studio can't find the game/SMAPI/MonoGame DLLs

Common solutions:

  • Restart Visual Studio.
  • Make sure the game and SMAPI are correctly installed and work fine.
  • Check for an error like "Failed to find game install path". If it's present, you need to specify your game path.
  • Make sure you created a .NET 5 project, not .NET Framework. (See how to set the target framework; if you see options starting with .NET Framework, delete the project and create a .NET 5 project instead.)
  • Make sure you target .NET 5 (see how to).

If those didn't fix it:

  1. Click Build > Rebuild Solution (Visual Studio) or Build > Rebuild All (MonoDevelop).
  2. Check the Output pane or error list (Visual Studio), or the Errors pad (MonoDevelop).
  3. If you don't see anything relevant, post the Output text to hastebin, ask for help on Discord, and include a link to your hastebin.

Ask for help

See Modding:Help for how to get help!