Jump to content

UnrealScript Ext for ModBuddy


TeamDragonpunk

Recommended Posts

It's cool to see this Unrealscript language service integrated into Modbuddy!

 

As far as needing the base game files present to work properly, that is pretty standard and I expect Alex's hands are somewhat tied there by the language service interfaces. Modbuddy already avoids including base game *.u files if you haven't made changes, it should also be made to avoid including the base game source files in the same circumstance. That way, you can have the base game source files there to make the parser happy without worrying about an inefficient mod upload.

Link to comment
Share on other sites

  • Replies 100
  • Created
  • Last Reply

Top Posters In This Topic

" it should also be made to avoid including the base game source files in the same circumstance. That way, you can have the base game source files there to make the parser happy without worrying about an inefficient mod upload."

 

Forgive my confusion, but is this something that could be accomplished by Firaxis through ModBuddy configurations, or what are your thoughts on how this could be best achieved?

Link to comment
Share on other sites

This is amazing. A huge thank you to TeamDragonPunk and Alex for sharing this. It's invaluable!

 

My brief experience so far has been consistent with both Solariz and Zingfarn's statements:

 

* I can view object members if-and-only-if I have the source code included within my solution. They appear immediately after hitting the '.' key as expected.

 

* Auto-completing variable names is functional, but only activates if I hit ctrl+J to view auto-complete suggestions.

 

* Syntax highlighting is working very well. I noticed one class was colourless at first but later turned dark green to match the others (On further testing, I have found that these colours are applied after file parsing has completed so it's working correctly). This is a personal statement rather than a functionality issue, but I feel the dark green used for classes and the green used for comments are too similar.

 

Thanks again!

 

System: Windows 10 w/ Visual Studio 2012 installed.

Edited by thehword
Link to comment
Share on other sites

This is amazing. A huge thank you to TeamDragonPunk and Alex for sharing this. It's invaluable!

 

My brief experience so far has been consistent with both Solariz and Zingfarn's statements:

 

* I can view object members if-and-only-if I have the source code included within my solution. They appear immediately after hitting the '.' key as expected.

 

* Auto-completing variable names is functional, but only activates if I hit ctrl+J to view auto-complete suggestions.

 

* Syntax highlighting is working very well. I noticed one class was colourless at first but later turned dark green to match the others (On further testing, I have found that these colours are applied after file parsing has completed so it's working correctly). This is a personal statement rather than a functionality issue, but I feel the dark green used for classes and the green used for comments are too similar.

 

Thanks again!

 

System: Windows 10 w/ Visual Studio 2012 installed.

 

TheHWord, glad it is working for you (to some limited degree). Alex is about to release another version with changes to maintain the DOM structure between loading projects. So, hopefully, the work-around is that you'll have to load a new "default mod" every time you start Modbuddy, and then'll you'll have the full functionality in your existing mod that no longer has game files. Hopefully, Firaxis will will be able to implement the fix @fxsRMcFall described above. Unfortunately, it will be too expensive to keep trying solutions beyond this... especially if this ever gets included in the official Firaxis ModBuddy SDK download and is no longer an issue. We have the budget to fortunately keep Alex on the team for a few more months, and then after that, it will be up to community donations for any specific functionality request.

Link to comment
Share on other sites

It's cool to see this Unrealscript language service integrated into Modbuddy!

As far as needing the base game files present to work properly, that is pretty standard and I expect Alex's hands are somewhat tied there by the language service interfaces. Modbuddy already avoids including base game *.u files if you haven't made changes, it should also be made to avoid including the base game source files in the same circumstance. That way, you can have the base game source files there to make the parser happy without worrying about an inefficient mod upload.

Edit 2 April :

Added ProcessDirectories task, which I removed initially because of the missleading comment above it : "remove empty directories". In fact this tasks is quite more important since it copies the mod from SDK to Game folder...

Edit n°1478 :

 

I finally learned more (for my own good) about MSBuild to get a better batch-free solution than the one i posted initially.

 

Pros :

- Move all directories in Src elsewhere, except Src\ProjectName.

This means we can include XComGame, but also Core, Engine, etc. and even another mod's source files used as dependency to get auto-completion and easily accessible doc/code for everything.

- Files are moved back in the project if build fails

- Copy every files included in the project (except those moved before of course) to the mod folder, in the same relative directory (vanilla build target used to copy all .txt files to the root for some reason).

 

Cons :

- Does not work if this extension is still parsing files (can't move them if used). If you do it, build will fail (no more harm).

- Does not move-back external source directories if build was canceled, maybe MSBuild provides a way to launch a target/task on cancel but i found nothing about it on google or the slowass MSDN mess.

 

Troubleshooting :

- If you canceled the build (don't do that ! ), project will be in inconsistent state, rebuilding should fix it (even if it fails, as long as you don't cancel).

If for unknown reason, this didn't work, move back the external source files by hand. Those are in "tmp" folder, within the solution folder (where your *.XCOM_sln file is).

 

Note : Only tested on Windows (Seven x64)

 

Replace (after backup) ...\XCOM 2 SDK\Binaries\Win32\ModBuddy\Extensions\Application\XCOM2.targets by this :

 

 

 

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask TaskName="Firaxis.VisualStudio.Tasks.XCOM2.GenerateModInfo"
              AssemblyFile="$(MSBuildLocalExtensionPath)\XCOM2.Tasks.dll" />
    <UsingTask TaskName="Firaxis.VisualStudio.Tasks.XCOM2.ProcessDirectories"
              AssemblyFile="$(MSBuildLocalExtensionPath)\XCOM2.Tasks.dll" />
    <UsingTask TaskName="Firaxis.VisualStudio.Tasks.XCOM2.CompileScripts"
              AssemblyFile="$(MSBuildLocalExtensionPath)\XCOM2.Tasks.dll" />
    <UsingTask TaskName="Firaxis.VisualStudio.Tasks.XCOM2.CompileShaders"
              AssemblyFile="$(MSBuildLocalExtensionPath)\XCOM2.Tasks.dll" />

    <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Default</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">XCOM 2</Platform>
    </PropertyGroup>

    <PropertyGroup>
        <StartAction>Program</StartAction>
        <StartProgram>$(XCOM2_GamePath)\..\Binaries\Win64\Launcher\StartDebugging.bat</StartProgram>
    </PropertyGroup>

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Default|XCOM 2' ">
        <OutputPath>.</OutputPath>
    </PropertyGroup>

    <PropertyGroup>
        <ProjectDir Condition="'$(BuildPath)'==''">$(MSBuildProjectDirectory)</ProjectDir>
        <ModsDir>$(XCOM2_UserPath)\Mods\</ModsDir>
        <OutputDir>$(ModsDir)$(SafeName)\</OutputDir>
    </PropertyGroup>
    
    
    <PropertyGroup>
        <TempDir>$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))\tmp</TempDir>
    </PropertyGroup>
    
    
    <!--
    Move SourcePath directory to DestinationPath
    -->
    <UsingTask
        TaskName="MoveDirectory"
        TaskFactory="CodeTaskFactory"
        AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
        <ParameterGroup>
            <SourcePath ParameterType="System.String" Required="true" />
            <DestinationPath ParameterType="System.String" Required="true" />
        </ParameterGroup>
        <Task>
          <Using Namespace="System"/>
          <Using Namespace="System.IO"/>
          <Code Type="Fragment" Language="cs">
            <![CDATA[
                Directory.Move(SourcePath, DestinationPath);
            ]]>
          </Code>
        </Task>
    </UsingTask>
    
    
    <!--
    Deletes directory (must be empty).
    -->
    <UsingTask
        TaskName="DeleteDirectory"
        TaskFactory="CodeTaskFactory"
        AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
        <ParameterGroup>
            <Path ParameterType="System.String" Required="true" />
        </ParameterGroup>
        <Task>
          <Using Namespace="System"/>
          <Using Namespace="System.IO"/>
          <Code Type="Fragment" Language="cs">
            <![CDATA[
                Directory.Delete(Path);
            ]]>
          </Code>
        </Task>
    </UsingTask>
    
    
    <!--
    Returns directories (non recursive) in given path.
    -->
    <UsingTask
        TaskName="GetDirectories"
        TaskFactory="CodeTaskFactory"
        AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
        <ParameterGroup>
            <Path ParameterType="System.String" Required="true" />
            <Result ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
        </ParameterGroup>
        <Task>
          <Using Namespace="System"/>
          <Using Namespace="System.IO"/>
          <Code Type="Fragment" Language="cs">
            <![CDATA[
                String[] dirs = Directory.GetDirectories(Path);
                Result = new TaskItem[dirs.Length];
                for( int i = 0; i < dirs.Length; i++ ) {
                    Result[i] = new TaskItem( dirs[i] );
                }
            ]]>
          </Code>
        </Task>
    </UsingTask>
    
    
    
    <Target Name="Clean">
        <Message Importance="High" Text="Cleaning..." />
        <RemoveDir Directories="$(OutputDir)" />
    </Target>
    
    
    
    <Target Name="ReBuild">
        <Message Importance="High" Text="Rebuilding..." />
        <CallTarget Targets="Clean" />
        <CallTarget Targets="Default" />
    </Target>
    
    
    <!-- Required -->
    <Target Name="GetFrameworkPaths" />

    
    
  <Target Name="_CheckProperties">
    <!--<Error Text="Civ5Path must be defined. Use the Project Properties window to set it to the location where Civlization 5 is installed."
                         Condition="('$(Civ5Path)' == '')" />

        <Error Text="Civ5UserPath must be defined. Use the Project Properties window to set it to the location where Civlization 5 Mods are installed."
                         Condition="('$(Civ5UserPath)' == '')" />-->
  </Target>
    
    
    
    <Target Name="Default" DependsOnTargets="Build">
        <!-- Do nothing.-->
        <!-- All actual work is done in the "Build" task. -->
    </Target>
    
    
    
    <Target Name="Build">
        <Message Importance="High" Text="Building..." />
        
        <CallTarget Targets="MoveOutExternalSourceFiles" />
        <CallTarget Targets="CopyFilesToOutput" />
        <CallTarget Targets="GenerateModInfo" />
        <CallTarget Targets="CompileScripts" />
        <CallTarget Targets="CompileShaders" />
        <CallTarget Targets="CopyOutputToGame" />
        <CallTarget Targets="MoveInExternalSourceFiles" />
        
        <OnError ExecuteTargets="MoveInExternalSourceFiles" />
        <!-- TODO something like <OnCancel ExecuteTargets="MoveInExternalSourceFiles" /> if possible -->
    </Target>
    
    
    
    <Target Name="MoveOutExternalSourceFiles">
        <Message Importance="High" Text="Moving external source outside the project folder..." />
        
        <MakeDir Directories="$(TempDir);$(TempDir)\Src"/>
    
        <GetDirectories Path="$(MSBuildProjectDirectory)\Src">
            <Output ItemName="SrcDirectories" TaskParameter="Result" />
        </GetDirectories>
        
        <ItemGroup>
            <SrcDirectories>
                <RelativePath>$([MSBuild]::MakeRelative($(MSBuildProjectDirectory), %(Identity)))</RelativePath>
            </SrcDirectories>
        </ItemGroup>
        
        <MoveDirectory
            SourcePath="@(SrcDirectories)"
            DestinationPath="$(TempDir)\%(RelativePath)"
            Condition=" '%(RelativePath)' != 'Src\$(MSBuildProjectName)' " />
        
        <!--
        <Message Importance="High" Text="
            SrcDirectories.Identity = @(SrcDirectories->'%(Identity)')
            SrcDirectories.RelativePath = @(SrcDirectories->'%(RelativePath)')
        " />
        -->
    </Target>
    
    
    
    <Target Name="MoveInExternalSourceFiles">
        <Message Importance="High" Text="Moving external source files back into project folder..." />
        
        <!-- ensure path exists or GetDirectories will fail -->
        <MakeDir Directories="$(TempDir);$(TempDir)\Src"/>
        
        <GetDirectories Path="$(TempDir)\Src">
            <Output ItemName="TempSrcDirectories" TaskParameter="Result" />
        </GetDirectories>
        
        <ItemGroup>
            <TempSrcDirectories>
                <RelativePath>$([MSBuild]::MakeRelative($(TempDir), %(Identity)))</RelativePath>
            </TempSrcDirectories>
        </ItemGroup>
        
        <MoveDirectory SourcePath="@(TempSrcDirectories)" DestinationPath="$(MSBuildProjectDirectory)\%(RelativePath)" />
        
        <DeleteDirectory Path="$(TempDir)\Src" />
        <DeleteDirectory Path="$(TempDir)" />
        
        <!--
        <Message Importance="High" Text="
            TempSrcDirectories.Identity = @(TempSrcDirectories->'%(Identity)')
            TempSrcDirectories.RelativePath = @(TempSrcDirectories->'%(RelativePath)')
        " />
        -->
    </Target>
    
    
    
    <Target Name="CopyFilesToOutput">
        <Message Importance="High" Text="Copying project files to output mod folder..." />
        <!-- Copy all files included in the project (ie: Content item) that still exist -->
        <Copy SourceFiles="@(Content)" DestinationFiles="$(OutputDir)%(Content.Identity)" Condition=" Exists('@(Content)') " />
    </Target>
    
    
    
    <Target Name="GenerateModInfo">
        <Message Importance="High" Text="Generating Mod info file..." />
        <GenerateModInfo
      ID="$(Guid)"
      Name="$(Name)"
      Description="$(Description)"
      TargetPath="$(OutputDir)$(SafeName).XComMod"
      SolutionDir="$(SolutionDir)"
      GamePath="$(XCOM2_GamePath)"
      UserPath="$(XCOM2_UserPath)"/>
    </Target>
    
    
    
    <Target Name="CompileScripts">
        <Message Importance="High" Text="Compiling Scripts..." />
        <CompileScripts
      ModSafeName="$(SafeName)"
      SolutionName="$(SolutionName)"
      SolutionDir="$(SolutionDir)"
      OutputDir="$(OutputDir)"
      Config="$(Configuration)"/>
    </Target>
    
    
    
    <Target Name="CompileShaders">
        <Message Importance="High" Text="Compiling Shaders..." />
        <CompileShaders
      ModSafeName="$(SafeName)"
      SolutionName="$(SolutionName)"
      SolutionDir="$(SolutionDir)"
      OutputDir="$(OutputDir)"/>
    </Target>
    
    
    <Target Name="CopyOutputToGame">
        <Message Importance="High" Text="Copying output to game folder..." />
        <ProcessDirectories
      Directories="$(OutputDir)"
      GamePath="$(XCOM2_GamePath)"
      UserPath="$(XCOM2_UserPath)"
      ModName="$(SafeName)"
      DeleteBaseFolder="false"/>
    </Target>
    
</Project>

NB : Thanks a lot for this extension by the way !

Edited by OVNI
Link to comment
Share on other sites

Sounds amazing, ovni. A stupid question, perhaps. How do I set it up in the first place? Just copy xcom/src into mod/SRC?

Yes you import files from XCOM 2 SDK\Development\SrcOrig in your project.

I don't think ModBuddy allows to import folders directly, so you'll have to create empty folders first within ModBuddy (Eg: Engine, then Engine>Classes), then import existing files from SrcOrig (they should be copied in the project when importing).

Also, I didn't try yet, but it should be possible to make/modify a project template (cf XCOM 2 SDK\Binaries\Win32\ModBuddy\Extensions\Application\ ) to automatically setup new projects.

NB : Symbolic links works flawlessly, so if you have multiple mod projects, you might want to replace folders by symlinks to save space and/or keep them in sync with SDK.

Link to comment
Share on other sites

 

Sounds amazing, ovni. A stupid question, perhaps. How do I set it up in the first place? Just copy xcom/src into mod/SRC?

Yes you import files from XCOM 2 SDK\Development\SrcOrig in your project.

I don't think ModBuddy allows to import folders directly, so you'll have to create empty folders first within ModBuddy (Eg: Engine, then Engine>Classes), then import existing files from SrcOrig (they should be copied in the project when importing).

Also, I didn't try yet, but it should be possible to make/modify a project template (cf XCOM 2 SDK\Binaries\Win32\ModBuddy\Extensions\Application\ ) to automatically setup new projects.

NB : Symbolic links works flawlessly, so if you have multiple mod projects, you might want to replace folders by symlinks to save space and/or keep them in sync with SDK.

 

 

OVNI, first off, THANK YOU! This is an incredible work around, and I admittedly didn't know enough about what goes on "behind the scenes" to suggest this! Before you get too far though, you may want to try Alex's new work-around using DOM sharing. There are pros and cons to both, but I don't want to waste your time if his solutions works for you. He'll be releasing it in the next few days

Link to comment
Share on other sites

I must say I love this work and passion from the community. This is the one thing that I hated about Modbuddy and by having no intellisense it slowed down development time by tenfold or evenmore.

 

I partly solved this issue for myself a timeback by making a custom version of Alberoris work (http://forums.nexusmods.com/index.php?/topic/3774940-mod-buddy-intellisense-scripts/) but had problem with sharing the solution where it failed to load and a lot of other issue and abandoned the project because it was to time consuming. Still currently using this solution since it give me basic intellisense support.

I have great hope for this project! Waiting in excitement!

Edited by tjnome
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...