aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/scripts/vscripts/_vscript.gnut
blob: 52b69c5da9bd88f15cbd5f2d25a8da9af4aadac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
untyped

//========== Copyright � 2008, Valve Corporation, All rights reserved. ========

global function UniqueString
global function EntFire
global function __DumpScope


int __uniqueStringId = 0
string function UniqueString( string str = "" )
{
	return str + "_us" + __uniqueStringId++;
}

function EntFire( target, action, value = null, delay = 0.0, activator = null )
{
	if ( !value )
	{
		value = "";
	}

	local caller = null;
	if ( "self" in this )
	{
		caller = this.self;
		if ( !activator )
		{
			activator = this.self;
		}
	}

	DoEntFire( string( target ), string( action ), string( value ), delay, activator, caller );
}

//---------------------------------------------------------
// Text dump this scope's contents to the console.
//---------------------------------------------------------
void function __DumpScope( int depth, var Table )
{
	local indent=function( count )
	{
		local i;
		for( i = 0 ; i < count ; i++ )
		{
			print("   ");
		}
	}

    foreach(key, value in Table)
    {
		indent(depth);
		print( key );
        switch (type(value))
        {
            case "table":
				print("(TABLE)\n");
				indent(depth);
                print("{\n");
                __DumpScope( depth + 1, value);
				indent(depth);
                print("}");
                break;
            case "array":
				print("(ARRAY)\n");
				indent(depth);
                print("[\n")
                __DumpScope( depth + 1, value);
				indent(depth);
                print("]");
                break;
            case "string":
                print(" = \"");
                print(value);
                print("\"");
                break;
            default:
                print(" = ");
                print(value);
                break;
        }
        print("\n");
	}
}