ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/slag_ex.ext
Revision: 1.1
Committed: Mon Jul 16 14:49:01 2007 UTC (16 years, 10 months ago) by elmex
Branch: MAIN
Log Message:
added handle_apply_yield to cfperl.xs and renamed
cfperl::invoke_results => cf::invoke_results.
also added the new slag ex(tm) extension

File Contents

# User Rev Content
1 elmex 1.1 #! perl
2    
3     # this module implements slag ex(tm):
4     # when it is applied by a player the cauldron below it will
5     # be cleaned (all items in it will be removed)
6    
7     cf::object->attach (
8     type => 79,
9     subtype => 11,
10     on_apply => sub {
11     my ($self, $who) = @_;
12    
13     my ($caul) =
14     grep { $_->flag (cf::FLAG_IS_CAULDRON) }
15     $who->map->at ($who->x, $who->y);
16    
17     if ($caul) {
18     for ($caul->inv) {
19     $_->remove;
20     $_->destroy (1);
21     }
22     $self->handle_apply_yield;
23     $self->decrease_ob_nr (1);
24     $who->message ("You cleaned the " . $caul->name, cf::NDI_UNIQUE);
25    
26     } else {
27     $who->message ("Couldn't find cauldron to clean.", cf::NDI_UNIQUE);
28     }
29    
30     cf::override 1;
31     push @cf::invoke_results, 1;
32     },
33     );