Skip to content

Commit

Permalink
Fix compile triggering workshop change.
Browse files Browse the repository at this point in the history
Compile verb was allowing a metadata change. In addition, the Folder was being set causing a full content update, with change notice.

Also fix the workshop category detection.
  • Loading branch information
Gwindalmir committed Sep 5, 2021
1 parent 9bdc110 commit d83c3d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 6 additions & 2 deletions WorkshopToolCommon/GameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,12 @@ static bool ProcessItemsUpload(WorkshopType type, List<string> paths, ProcessedO
else
{
MySandboxGame.Log.WriteLineAndConsole(string.Format("Not uploading: {0}", mod.Title));
foreach (var item in mod.ModId)
mod.UpdatePreviewFileOrTags(item);
// Don't send metadata updates unless it's a publishing verb
if (options.Type.IsSubclassOf(typeof(PublishVerbBase)))
{
foreach (var item in mod.ModId)
mod.UpdatePreviewFileOrTags(item);
}
MySandboxGame.Log.WriteLineAndConsole(string.Format("Complete: {0}", mod.Title));
}
}
Expand Down
13 changes: 6 additions & 7 deletions WorkshopToolCommon/Uploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,8 @@ void ProcessTags()

// 2) Verify the modtype matches what was listed in the workshop
// TODO If type doesn't match, process as workshop type
if (existingTags != null && existingTags.Length > 0)
{
var msg = string.Format("Workshop category '{0}' does not match expected '{1}'. Is something wrong?", existingTags[0], modtype);
MySandboxGame.Log.WriteLineWarning(msg);
MyDebug.AssertDebug(existingTags.Contains(modtype, StringComparer.InvariantCultureIgnoreCase), msg);
}
if (existingTags?.Length > 0 && !existingTags.Contains(modtype, StringComparer.InvariantCultureIgnoreCase))
MySandboxGame.Log.WriteLineWarning(string.Format("Workshop category '{0}' does not match expected '{1}'. Is something wrong?", existingTags[0], modtype));

#if SE
// 3a) check if user passed in the 'development' tag
Expand Down Expand Up @@ -675,10 +671,13 @@ public bool UpdatePreviewFileOrTags(WorkshopId modId)
publisher.Visibility = (MyPublishedFileVisibility)(int)(m_visibility ?? GetVisibility());
publisher.Thumbnail = m_previewFilename;
publisher.Tags = new List<string>(m_tags);
publisher.Folder = m_modPath;
#if SE
if (m_dlcs != null)
publisher.DLCs = new HashSet<uint>(m_dlcs);
#else
// ME will throw an exception if this isn't set, however setting this in SE
// will trigger a full change event (with a new change note entry), which we don't want.
publisher.Folder = m_modPath;
#endif
if (m_deps != null)
publisher.Dependencies = new List<ulong>(m_deps);
Expand Down

0 comments on commit d83c3d1

Please sign in to comment.