ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dmcommands.ext
(Generate patch)

Comparing deliantra/server/ext/dmcommands.ext (file contents):
Revision 1.17 by pippijn, Fri Mar 2 13:32:50 2007 UTC vs.
Revision 1.25 by root, Tue Dec 23 06:58:23 2008 UTC

1#! perl 1#! perl # mandatory
2 2
3# wizard commands 3# wizard commands
4
5cf::register_command shutdown => sub {
6 my ($ob, $arg) = @_;
7 return $ob->reply (undef, "Sorry, you can't shutdown the server.")
8 unless $ob->flag (cf::FLAG_WIZ);
9
10 my $name = $ob->name;
11 cf::cleanup ("dm '$name' initiated shutdown" . ($arg ? " with reason: $arg" : "."), 0);
12
13 1
14};
4 15
5cf::register_command kick => sub { 16cf::register_command kick => sub {
6 my ($ob, $arg) = @_; 17 my ($ob, $arg) = @_;
7 return unless $ob->flag (cf::FLAG_WIZ); 18 return unless $ob->flag (cf::FLAG_WIZ);
8 19
30 my ($ob, $arg) = @_; 41 my ($ob, $arg) = @_;
31 42
32 return unless $ob->may ("command_teleport"); 43 return unless $ob->may ("command_teleport");
33 44
34 cf::async { 45 cf::async {
46 $Coro::current->{desc} = "teleport $arg";
47
35 my $other = cf::player::find $arg 48 my $other = cf::player::find $arg
36 or return $ob->reply (undef, "$arg: no such player."); 49 or return $ob->reply (undef, "$arg: no such player.");
37 50
38 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); 51 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y);
39 }; 52 };
80cf::register_command wizlook => sub { 93cf::register_command wizlook => sub {
81 my ($ob, $arg) = @_; 94 my ($ob, $arg) = @_;
82 95
83 return unless $ob->may ("command_wizlook"); 96 return unless $ob->may ("command_wizlook");
84 97
85 $ob->clear_los; 98 my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZLOOK);
86 99
87 $ob->reply (undef, "You can temporarily see through walls."); 100 $ob->flag (cf::FLAG_WIZLOOK, $new_val);
101
102 $ob->contr->do_los (1);
103
104 $ob->reply (undef,
105 $new_val
106 ? "You can now look through walls."
107 : "You will now see the same thing as you would normally.",
108 );
88 109
89 1 110 1
90}; 111};
91 112
92cf::register_command reset => sub { 113cf::register_command reset => sub {
98 119
99 my @pl = $map->players; 120 my @pl = $map->players;
100 $_->enter_link for @pl; 121 $_->enter_link for @pl;
101 cf::async { 122 cf::async {
102 my $name = $map->visible_name; 123 my $name = $map->visible_name;
124 $Coro::current->{desc} = "reset $name";
103 125
104 $map->reset; 126 $map->reset;
105 $_->leave_link for @pl; 127 $_->leave_link for @pl;
106 128
107 $ob->reply (undef, "$name was reset."); 129 $ob->reply (undef, "$name was reset.");
108 }; 130 };
131
132 1
133};
134
135cf::register_command observe => sub {
136 my ($ob, $arg) = @_;
137
138 return unless $ob->may ("command_observe");
139
140 my $other = cf::player::find_active $arg;
141 $ob->contr->set_observe ($other ? $other->ob : undef);
109 142
110 1 143 1
111}; 144};
112 145
113for my $command (qw(summon arrest banish)) { 146for my $command (qw(summon arrest banish)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines