--- deliantra/server/ext/nimbus.ext 2006/12/30 10:16:10 1.3 +++ deliantra/server/ext/nimbus.ext 2009/01/02 16:41:32 1.13 @@ -1,4 +1,4 @@ -#! perl +#! perl # mandatory # handle the nimbus map and other stuff @@ -74,39 +74,12 @@ $ob->message ("You start to feel dizzy.\n"); $ob->message ("The world around you blurs.\n"); $ob->message ("\n"); - } - - my $path = sprintf "%s/%s/%s/%s", - cf::localdir, cf::playerdir, $ob->name, "nimbus"; - if ($ob->map->path ne $path) { - my $nimbus = cf::map::find_map "/schmorp/nimbus"; - $nimbus->path ($path); - $nimbus->unique (1); - - $pl->savebed ($path, 24, 12); + $pl->savebed ("/nimbus", 24, 12); } }, ); -sub teleport { - my ($pl, $map, $x, $y) = @_; - - return if $pl->ob->map->path eq $map - && abs ($pl->ob->x - $x) <= 1 - && abs ($pl->ob->y - $y) <= 1; - - my $portal = cf::object::new "exit"; - - $portal->slaying ($map); - $portal->stats->hp ($x); - $portal->stats->sp ($y); - - $portal->apply ($pl->ob); - - $portal->destroy; -} - cf::object::attachment nimbus_exit => on_trigger => sub { my ($self, $ob) = @_; @@ -131,23 +104,21 @@ @savebed = ("/scorn/taverns/inn", 10, 5); } - $pl->savebed (@savebed); - my $map = $ob->map; + $pl->savebed (@savebed); - teleport $pl, @savebed; - - # should make this a temporary map and let cf deal with it - unlink $map->path; - unlink $map->path . ".pst"; - - $map->delete_map; - - $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); - - $ob->message ("You feel as if you woke up from a dream.\n"); - $ob->message ("You have a headache.\n"); - $ob->message ("Maybe you should have a drink.\n"); + cf::async { + $Coro::current->{desc} = "nimbus exit"; + $ob->goto (@savebed); + + $map->nuke; + + #$pl->play_sound (cf::sound::find "player_dies"); + + $ob->message ("You feel as if you woke up from a dream.\n" + . "You have a headache.\n" + . "Maybe you should have a drink.\n"); + }; cf::override; },