… | |
… | |
51 | } |
51 | } |
52 | } |
52 | } |
53 | |
53 | |
54 | # called when the player will likely die (modulo explore mode) |
54 | # called when the player will likely die (modulo explore mode) |
55 | # but before any stats/exp is changed |
55 | # but before any stats/exp is changed |
56 | cf::attach_to_players |
56 | cf::player->attach ( |
57 | on_death => sub { |
57 | on_death => sub { |
58 | my ($pl) = @_; |
58 | my ($pl) = @_; |
59 | my $ob = $pl->ob; |
59 | my $ob = $pl->ob; |
60 | |
60 | |
61 | # save player stats and experience to restore it later |
61 | # save player stats and experience to restore it later |
… | |
… | |
85 | $nimbus->unique (1); |
85 | $nimbus->unique (1); |
86 | |
86 | |
87 | $pl->savebed ($path, 24, 12); |
87 | $pl->savebed ($path, 24, 12); |
88 | } |
88 | } |
89 | }, |
89 | }, |
90 | ; |
90 | ); |
91 | |
91 | |
92 | sub teleport { |
92 | sub teleport { |
93 | my ($pl, $map, $x, $y) = @_; |
93 | my ($pl, $map, $x, $y) = @_; |
94 | |
94 | |
95 | return if $pl->ob->map->path eq $map |
95 | return if $pl->ob->map->path eq $map |
… | |
… | |
105 | $portal->apply ($pl->ob); |
105 | $portal->apply ($pl->ob); |
106 | |
106 | |
107 | $portal->destroy; |
107 | $portal->destroy; |
108 | } |
108 | } |
109 | |
109 | |
110 | cf::register_attachment nimbus_exit => |
110 | cf::object::attachment nimbus_exit => |
111 | on_trigger => sub { |
111 | on_trigger => sub { |
112 | my ($self, $ob) = @_; |
112 | my ($self, $ob) = @_; |
113 | |
113 | |
114 | my $pl = $ob->contr; |
114 | my $pl = $ob->contr; |
115 | my @savebed; |
115 | my @savebed; |