Linha 2: |
Linha 2: |
| {{../cabeçalho}} | | {{../cabeçalho}} |
| | | |
− | This page helps you test your mods and solve common issues. '''For issues ''using'' mods, see [[Modding:Player Guide/Troubleshooting]].'''
| + | Essa página te ajudará a testar seus mods e resolver problemas comuns. '''Já para problemas ao ''usar'' mods, veja [[Modding:Player Guide/Troubleshooting]].''' |
| | | |
| ==Teste o mod== | | ==Teste o mod== |
Linha 72: |
Linha 72: |
| :# ''(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. | | :# ''(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== | + | ==Consertando alertas de compilação comums== |
− | 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.
| + | Após montar seu projeto, você pode ver avisos de compilação no ''Visual Studio > View > Error List'' ou ''MonoDevelop > View > Pads > Errors'. Aqui estão alguns deles. |
| | | |
| ===This implicitly converts...=== | | ===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.''"
| + | Exemplo do alerta: "''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 [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. This field has an equivalent non-net property, like <samp>monster.Health</samp> (<samp>int</samp>) instead of <samp>monster.health</samp> (<samp>NetBool</samp>). Change your code to use the suggested property instead.
| + | Seu código está referenciando um [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], na qual pode causar alguns bugs sutis. Esse campo tem uma propriedade não-net equivalente, Como <samp>monster.Health</samp> (<samp>int</samp>) Ao invés de <samp>monster.health</samp> (<samp>NetBool</samp>). Altere seu código para usar a propriedade sugerida ao invés disso. |
| | | |
| ===FieldName is a Net* field...=== | | ===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.''"
| + | Exemplo do alerta: "'''{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 [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead:
| + | Seu código está referenciando um [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], na qual pode causar alguns bugs sutis. Você deveria acessar o valor base ao invés. |
| <ul> | | <ul> |
− | <li>For a reference type (''i.e.,'' one that can contain <samp>null</samp>), you can use the <samp>.Value</samp> property (or <samp>.FieldDict</samp> for a <samp>NetDictionary</samp>): | + | <li>Para um tipo de referencia (''ex.,'' aquele que pode conter <samp>null</samp>), você pode usar a propriedade <samp>.Value</samp> (ou <samp>.FieldDict</samp> para um <samp>NetDictionary</samp>): |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| if (building.indoors.Value == null) | | if (building.indoors.Value == null) |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | Or convert the value before comparison:
| + | Ou converta o valor antes da comparação: |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| GameLocation indoors = building.indoors.Value; | | GameLocation indoors = building.indoors.Value; |
Linha 96: |
Linha 96: |
| // ... | | // ... |
| </syntaxhighlight></li> | | </syntaxhighlight></li> |
− | <li>For a value type (''i.e.,'' one that can't contain <samp>null</samp>), check if the parent is null (if needed) and compare with <samp>.Value</samp>: | + | <li>Para um tipo value (''i.e.,'' aquele que não pode conter <samp>null</samp>), verifique se o pai é nulo (se necessário) e compare com <samp>.Value</samp>: |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| if (item != null && item.category.Value == 0) | | if (item != null && item.category.Value == 0) |
Linha 103: |
Linha 103: |
| | | |
| ===The FieldName field is obsolete...=== | | ===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.''"
| + | Exemplo de alerta: "''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.
| + | Você está referenciando um campo que não deverá mais ser usado. Use o nome do campo sugerido ao invés para conserta-lo. |
| | | |
− | ===An instance of analyzer ... cannot be created=== | + | ===An instance of analyzer ... cannot be created=== |
− | Update to the latest [https://visualstudio.microsoft.com/vs/community/ Visual Studio]; the NuGet package uses a recent feature that isn't available in older versions.
| + | Atualize para o último [https://visualstudio.microsoft.com/vs/community/ Visual Studio]; o pacote NuGet usa um recurso recente que não está disponível em versões antigas. |
| | | |
− | ==Other issues== | + | ==Outros problemas== |
− | ===Can't target .NET 5=== | + | ===Não consigo definir .NET 5=== |
− | If the target framework list has options starting with...
| + | Se a lista de frameworks tiver opções começando com... |
− | * ''.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 Framework'': você criou o tipo de projeto errado. Certifique-se de criar um projeto .NET 5 ao invés disso. (A nomenclatura é um pouco confusa.) |
− | * ''.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 [https://dotnet.microsoft.com/en-us/download/dotnet/5.0 .NET 5 SDK] to add it. | + | * ''.NET Core'', ''.NET Standard'', ou ''.NET 5+'': use .NET 5 para compatibilidade com o jogo. Se você não tiver essa opção, você poderá instalar o [https://dotnet.microsoft.com/en-us/download/dotnet/5.0 .NET 5 SDK] para adiciona-lo. |
| | | |
− | ===Visual Studio can't find the game/SMAPI/MonoGame DLLs=== | + | ===Visual Studio não consegue detectar o jogo/SMAPI/MonoGame DLLs=== |
| <span id="Visual_Studio_can.27t_find_the_game.2FSMAPI.2FXNA_DLLs"><!--old section name--></span> | | <span id="Visual_Studio_can.27t_find_the_game.2FSMAPI.2FXNA_DLLs"><!--old section name--></span> |
− | Common solutions:
| + | Soluções comuns: |
− | * Restart Visual Studio. | + | * Reinicie o Visual Studio. |
− | * Make sure the game and SMAPI are correctly installed and work fine. | + | * Certifique-se de que o jogo e o SMAPI estão instalados e funcionando corretamente. |
− | * Check for an error like "''Failed to find game install path''". If it's present, you need to [https://smapi.io/package/custom-game-path specify your game path]. | + | * Verifique se há um erro tipo "''Failed to find game install path/Falha ao encontrar o caminho de instalação do jogo''". Se isso aparecer, Você precisa [https://smapi.io/package/custom-game-path especificar o diretório do jogo]. |
− | * Make sure you created a .NET 5 project, '''not''' .NET Framework. (See [[Modding:IDE reference#Set the target framework|how to set the target framework]]; if you see options starting with .NET Framework, delete the project and create a .NET 5 project instead.) | + | * Certifique-se de ter criado um projeto .NET 5, e '''Não''' um .NET Framework. (Veja [[Modding:IDE reference#Set the target framework|Como definir o framework alvo]]; Se você ver as opções começando com .NET Framework, delete o projeto e crie um .NET 5 ao invés disso.) |
− | * Make sure you target .NET 5 (see [[Modding:IDE reference#Set the target framework|how to]]). | + | * Tenha certeza de que selecionou .NET 5 (veja [[Modding:IDE reference#Set the target framework|como fazer]]). |
| | | |
− | If those didn't fix it:
| + | Se isso não o consertar: |
− | # Click ''Build > Rebuild Solution'' (Visual Studio) or ''Build > Rebuild All'' (MonoDevelop). | + | # Clique ''Compilação > Recompilar solução'' (Visual Studio) ou ''Build > Rebuild All'' (MonoDevelop). |
− | # Check the ''Output'' pane or error list (Visual Studio), or the ''Errors'' pad (MonoDevelop). | + | # Verifique o painel de ''Saída/Output'' ou a lista de erros (Visual Studio), ou a aba de''Errors'' (MonoDevelop). |
− | # If you don't see anything relevant, post the ''Output'' text to [https://hastebin.com hastebin], [[#Ask for help|ask for help on Discord]], and include a link to your hastebin. | + | # Se você não encontrou nada relevante, poste a ''Saída/Output'' na [https://hastebin.com hastebin], [[#Ask for help|peça por ajuda no discord]], e inclua o link da sua hastebin. |
| | | |
− | ==Ask for help== | + | ==Solicitar ajuda== |
− | See [[Modding:Help]] for how to get help!
| + | Veja a página [[Modificações:Ajuda]] para saber como solicitar ajuda! |
| | | |
| [[en:Modding:Modder Guide/Test and Troubleshoot]] | | [[en:Modding:Modder Guide/Test and Troubleshoot]] |
| [[es:Modding:Guía del Modder/Prueba y solución de problemas]] | | [[es:Modding:Guía del Modder/Prueba y solución de problemas]] |