… | |
… | |
64 | |
64 | |
65 | unless ($ob->{in_nimbus}) { |
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->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 | |
74 | |
… | |
… | |
81 | my $path = sprintf "%s/%s/%s/%s", |
81 | my $path = sprintf "%s/%s/%s/%s", |
82 | cf::localdir, cf::playerdir, $ob->name, "nimbus"; |
82 | cf::localdir, cf::playerdir, $ob->name, "nimbus"; |
83 | |
83 | |
84 | if ($ob->map->path ne $path) { |
84 | if ($ob->map->path ne $path) { |
85 | my $nimbus = cf::map::find "/schmorp/nimbus"; |
85 | my $nimbus = cf::map::find "/schmorp/nimbus"; |
86 | $nimbus->set_path ($path); |
86 | $nimbus->path ($path); |
87 | $nimbus->set_unique (1); |
87 | $nimbus->unique (1); |
88 | |
88 | |
89 | $pl->set_savebed ($path, 24, 12); |
89 | $pl->savebed ($path, 24, 12); |
90 | } |
90 | } |
91 | }, |
91 | }, |
92 | ; |
92 | ; |
93 | |
93 | |
94 | sub teleport { |
94 | sub teleport { |
… | |
… | |
98 | && abs ($pl->ob->x - $x) <= 1 |
98 | && abs ($pl->ob->x - $x) <= 1 |
99 | && abs ($pl->ob->y - $y) <= 1; |
99 | && abs ($pl->ob->y - $y) <= 1; |
100 | |
100 | |
101 | my $portal = cf::object::new "exit"; |
101 | my $portal = cf::object::new "exit"; |
102 | |
102 | |
103 | $portal->set_slaying ($map); |
103 | $portal->slaying ($map); |
104 | $portal->set_hp ($x); |
104 | $portal->hp ($x); |
105 | $portal->set_sp ($y); |
105 | $portal->sp ($y); |
106 | |
106 | |
107 | $portal->apply ($pl->ob); |
107 | $portal->apply ($pl->ob); |
108 | |
108 | |
109 | $portal->free; |
109 | $portal->free; |
110 | } |
110 | } |
… | |
… | |
131 | |
131 | |
132 | } else { |
132 | } else { |
133 | @savebed = ("/scorn/taverns/inn", 10, 5); |
133 | @savebed = ("/scorn/taverns/inn", 10, 5); |
134 | } |
134 | } |
135 | |
135 | |
136 | $pl->set_savebed (@savebed); |
136 | $pl->savebed (@savebed); |
137 | |
137 | |
138 | my $map = $ob->map; |
138 | my $map = $ob->map; |
139 | |
139 | |
140 | teleport $pl, @savebed; |
140 | teleport $pl, @savebed; |
141 | |
141 | |
142 | # should make this a temporary map and let cf deal with it |
142 | # should make this a temporary map and let cf deal with it |
143 | unlink $map->path; |
143 | unlink $map->path; |
144 | unlink $map->path . ".pst"; |
144 | unlink $map->path . ".pst"; |
145 | unlink $map->path . ".cfperl"; |
|
|
146 | |
145 | |
147 | $map->delete_map; |
146 | $map->delete_map; |
148 | |
147 | |
149 | $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); |
148 | $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); |
150 | |
149 | |
… | |
… | |
154 | |
153 | |
155 | cf::override; |
154 | cf::override; |
156 | }, |
155 | }, |
157 | ; |
156 | ; |
158 | |
157 | |
159 | cf::attach_to_maps #TODO#d# remove, onyl for upgrading old to new nimbus |
|
|
160 | on_upgrade => sub { |
|
|
161 | my ($map) = @_; |
|
|
162 | |
|
|
163 | if ($map->path =~ /\/nimbus$/) { |
|
|
164 | warn "NIMBUS UPGRADE ", $map->path, "\n"; |
|
|
165 | |
|
|
166 | (grep length $_->slaying, $map->at (11, 1))[0]->attach (nimbus_exit => restore => 1); |
|
|
167 | |
|
|
168 | for my $x (37 .. 58) { |
|
|
169 | for my $y (32 .. 53) { |
|
|
170 | $_->remove for $map->at ($x, $y); |
|
|
171 | |
|
|
172 | my $portal = cf::object::new "well"; |
|
|
173 | |
|
|
174 | $portal->set_name ("free ride, courtesy of your friendly upgrade script"); |
|
|
175 | $portal->set_slaying ($map->path); |
|
|
176 | $portal->set_hp (1); |
|
|
177 | $portal->set_sp (1); |
|
|
178 | |
|
|
179 | $portal->insert_ob_in_map_at ($map, undef, cf::INS_ABOVE_FLOOR_ONLY, $x, $y); |
|
|
180 | } |
|
|
181 | } |
|
|
182 | } |
|
|
183 | }, |
|
|
184 | ; |
|
|
185 | |
|
|