void LoadMap()
{
    CRules@ rules = LoadRules("Rules/Solo/WarTut/gamemode.cfg");
    CMap@ map = LoadMap("Maps/tutorial_war.png");

    if (rules !is null)
    {
        rules.set_string("default class", "builder");
    }
}

CBlob@ placeSign( Vec2f pos, const string& in text )
{
    CBlob@ sign = server_CreateBlob( "sign", -1, pos );

    if (sign !is null)
    {
        sign.set_string("text", text );
    }

    return sign;
}

void onInit( CMap@ this )
{
    getMap().SetDayTime(0.99);
    placeSign( this.getTileWorldPosition( Vec2f(6,30) ), "You have awaken in a desolate fortress.\n\nThe last thing you remember is singing up for the King's Army.\n\nUse [A] and [S] to move." );
    placeSign( this.getTileWorldPosition( Vec2f(16,30) ), "Seems there is some rubble in your way.\n\nUse [RMB] to dig." );
    placeSign( this.getTileWorldPosition( Vec2f(30,30) ), "This lantern will be useful.\n\nPress [C] to pick up and drop objects." );
    placeSign( this.getTileWorldPosition( Vec2f(36,38) ), "These spikes are dangerous if you jump on them, harmless if you walk cautiously. Be careful!\n\nPress [W] to jump." );
    placeSign( this.getTileWorldPosition( Vec2f(12,36) ), "Scrape the walls to slow your decent down this pit." );
    placeSign( this.getTileWorldPosition( Vec2f(11,46) ), "Watch your step!\n\nTap [W] to hop. Hold [W] to jump farther." );
    server_CreateBlob( "Entities/Special/WAR/Trading/TradingPost.cfg", 0, getMap().getTileWorldPosition( Vec2f(250,57))  );
    server_CreateBlob( "Entities/Special/WAR/WAR_base/WAR_base.cfg", 0, getMap().getTileWorldPosition( Vec2f(270,57))  );
    server_CreateBlob( "Entities/Special/Solo/Arthur/Arthur.cfg", 0, getMap().getTileWorldPosition( Vec2f(20,20))  );
    server_CreateBlob( "Entities/Items/Lantern/Lantern.cfg", 0, getMap().getTileWorldPosition( Vec2f(7,30))  );
}

void onTick( CMap@ this )
{
    int time = getMap().getTimeSinceStart();
}

void onRender( CMap@ this )
{
    const int time = getMap().getTimeSinceStart();
    const int endTime = getTicksASecond() * 4;

    if (time < endTime) {
        GUI::DrawText( "WELCOME TO KING ARTHUR'S GOLD!", Vec2f( getScreenWidth()/2 - 70, getScreenHeight()/2 - 60 ), SColor((1.0f - (time / endTime))*255, 255, 255, 255) );
    }
}
