ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/item-slag-ex.ext
Revision: 1.3
Committed: Mon Apr 21 06:35:26 2008 UTC (16 years, 1 month ago) by root
Branch: MAIN
CVS Tags: rel-2_6, rel-2_7, rel-2_71, rel-2_54, rel-2_55, rel-2_56, rel-2_52, rel-2_53, rel-2_61
Changes since 1.2: +1 -1 lines
Log Message:
refactor decrease_ob* into ->decrease method.

File Contents

# User Rev Content
1 root 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 elmex 1.2 type => cf::MISC_OBJECT,
9     subtype => 1,
10 root 1.1 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 elmex 1.2 $_->destroy (1) for $caul->inv;
19 root 1.1 $self->handle_apply_yield;
20 root 1.3 $self->decrease;
21 root 1.1 $who->message ("You cleaned the " . $caul->name, cf::NDI_UNIQUE);
22    
23     } else {
24     $who->message ("Couldn't find cauldron to clean on the ground.", cf::NDI_UNIQUE);
25     }
26    
27     cf::override 1;
28     },
29     );
30 elmex 1.2
31     1