]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/sandbox.qc
0e20901ace6e96260429600c9a3d4e7de8887cc1
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / sandbox.qc
1 MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
2 {
3         if(MUTATOR_RETURNVALUE) // command was already handled?
4                 return 0;
5         if(cmd_name == "g_sandbox")
6         {
7                 if(cmd_argc < 2)
8                 {
9                         print_to(self, "Sandbox mode is active. For more information, use 'g_sandbox help'");
10                         return 1;
11                 }
12
13                 if(argv(1) == "help")
14                 {
15                         print_to(self, "You can use the following sandbox commands:");
16                         return 1;
17                 }
18                 else if(argv(1) == "spawn")
19                 {
20                         // spawn a new object with the default settings
21
22                         entity e;
23                         e = spawn();
24                         makevectors(self.v_angle);
25                         traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 250, MOVE_NOMONSTERS, self);
26                         setorigin(e, trace_endpos);
27                         setmodel(e, "models/vehicles-static/raptor.md3");
28
29                         return 1;
30                 }
31         }
32         return 0;
33 }
34
35 MUTATOR_DEFINITION(sandbox)
36 {
37         MUTATOR_HOOK(SV_ParseClientCommand, sandbox_PlayerCommand, CBC_ORDER_ANY);
38
39         return 0;
40 }