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

Comparing cf.schmorp.de/maps/perl/nimbus.ext (file contents):
Revision 1.7 by root, Tue Mar 21 02:06:23 2006 UTC vs.
Revision 1.11 by root, Sat Apr 8 14:53:12 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines