ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/nimbus.ext
(Generate patch)

Comparing deliantra/maps/perl/nimbus.ext (file contents):
Revision 1.9 by root, Fri Mar 31 20:21:19 2006 UTC vs.
Revision 1.12 by root, Fri Aug 25 15:07:43 2006 UTC

1#! perl 1#! perl
2#CONVERSION: PARTIAL
2 3
3# handle the nimbus map and other stuff 4# handle the nimbus map and other stuff
4 5
5my @STATS = qw( 6my @STATS = qw(
6 Str Dex Con Wis Cha Int Pow 7 Str Dex Con Wis Cha Int Pow
53 } 54 }
54} 55}
55 56
56# called when the player will likely die (modulo explore mode) 57# called when the player will likely die (modulo explore mode)
57# but before any stats/exp is changed 58# but before any stats/exp is changed
58sub on_player_death { 59cf::attach_to_players
60 on_death => sub {
59 my ($ob) = @_; 61 my ($pl) = @_;
62 my $ob = $pl->ob;
60 63
61 my $pl = $ob->contr; 64 # save player stats and experience to restore it later
62 65
63 # save player stats and experience to restore it later 66 unless ($ob->{in_nimbus}) {
67 my $save = {
68 stats => stats_get $ob->stats,
69 orig_stats => stats_get $pl->orig_stats,
70 savebed => [$pl->get_savebed],
71 skill_exp => skills_get $ob,
72 };
64 73
65 my $save = { 74 $ob->{in_nimbus} = $save;
66 stats => stats_get $ob->stats,
67 orig_stats => stats_get $pl->orig_stats,
68 savebed => [$pl->get_savebed],
69 skill_exp => skills_get $ob,
70 };
71 75
72 unless ($ob->{in_nimbus}) { 76 $ob->message ("\n");
73 $ob->{in_nimbus} = $save; 77 $ob->message ("You start to feel dizzy.\n");
78 $ob->message ("The world around you blurs.\n");
79 $ob->message ("\n");
80 }
74 81
75 my $path = sprintf "%s/%s/%s/%s", 82 my $path = sprintf "%s/%s/%s/%s",
76 cf::localdir, cf::playerdir, $ob->name, "nimbus"; 83 cf::localdir, cf::playerdir, $ob->name, "nimbus";
77 84
85 if ($ob->map->path ne $path) {
78 my $nimbus = cf::map::get_map "/schmorp/nimbus"; 86 my $nimbus = cf::map::get_map "/schmorp/nimbus";
79 $nimbus->set_path ($path); 87 $nimbus->set_path ($path);
80 $nimbus->set_unique (1); 88 $nimbus->set_unique (1);
81 89
82 $pl->set_savebed ($path, 24, 12); 90 $pl->set_savebed ($path, 24, 12);
83 91 }
84 $ob->message ("\n");
85 $ob->message ("You start to feel dizzy.\n");
86 $ob->message ("The world around you blurs.\n");
87 $ob->message ("\n");
88 } 92 },
89 93;
90 0
91}
92 94
93sub teleport { 95sub teleport {
94 my ($pl, $map, $x, $y) = @_; 96 my ($pl, $map, $x, $y) = @_;
95 97
96 return if $pl->ob->map->path eq $map 98 return if $pl->ob->map->path eq $map
107 109
108 $portal->free; 110 $portal->free;
109} 111}
110 112
111sub on_trigger { 113sub on_trigger {
112 my ($event) = @_; 114 my ($event, $porter, $ob) = @_;
115
113 my $options = $event->{options}; 116 my $options = $event->options;
114 my $ob = $event->{activator};
115 my $pl = $ob->contr; 117 my $pl = $ob->contr;
116 my @savebed; 118 my @savebed;
117 119
118 if (my $save = delete $ob->{in_nimbus}) { 120 if (my $save = delete $ob->{in_nimbus}) {
119 @savebed = @{$save->{savebed}}; 121 @savebed = @{$save->{savebed}};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines