#! perl # this module implements a rate limited converter, the hp attribute # will stop the player for hp seconds. And the player is just able to drop 1 item # on it at a time. our %TIMED_CONV_TIMERS; cf::object->attach ( type => cf::CONVERTER, subtype => 2, on_drop_on => sub { my ($table, $obj, $orig) = @_; return unless $obj->number_of > 0; if ($obj->number_of > 1) { my $rest = $obj->split ($obj->number_of - 1); $orig->insert ($rest); } $orig->speed_left ($orig->speed_left - ($table->stats->hp * (8 * $orig->speed))); $orig->message ( "You work hard changing items while the " . $table->name . " does it's work." . "Hstats->hp . " seconds.>", cf::NDI_UNIQUE | cf::NDI_REPLY); }, on_move_trigger => sub { my ($trap, $vict, $orig) = @_; # make the converter not work when the player is not at the same spot: unless ($orig->x == $trap->x && $orig->y == $trap->y && $orig->is_player && $vict->number_of == 1) { cf::override 1; return; } }, );