MapUpgrader

The MapUpgrader tool is a CSharp program on the .NET that aims to port Half-Life mods to Sven Co-op and Seven Kewp by extension


Scripting

The MapUpgrader tool currently supports only Python and is not embedable so the user requires to have a Python installation for it to work.

We'll be using Python for the introduction.

First script

Create your first .py script in Upgrades/ and give it a proper name.


Type Hints

Python is dynamic typing so the C# program is passing on the real class to python without any kind of wrapper.

When running the program on debug mode it will generate some scripts in Upgrades/netapi which contains some classes for type hints

    
from netapi.NET import *
    
  

Registering context

Unlikely the other generated API. the UpgradeContext class is used in python and passed on to the program.

When the program is loaded it will call the method named "context" which should return a class "UpgradeContext"

    
def context() -> UpgradeContext:

    opfor: UpgradeContext = UpgradeContext();

    UpgradeContext.Mod = "gearbox";

    UpgradeContext.Title = "Opposing Force";

    UpgradeContext.Description = "Half-Life: Opposing-Force expansion";

    UpgradeContext.urls = [
        "https://store.steampowered.com/app/50/HalfLife_Opposing_Force/"
    ];

    return opfor;
    
  

In future updates it will support other scripting languages. this program could have been pure C# but i did it this way for the sake of learning.

Considered languages:

  • AngelScript
  • C# itself as scripting
  • Lua
  • JavaScript
  • As pointed previously i just want to learn and experiment. you can just pick your favorite and go for it