… | |
… | |
255 | last; |
255 | last; |
256 | } |
256 | } |
257 | }); |
257 | }); |
258 | } |
258 | } |
259 | |
259 | |
260 | # "Quitting will delete your character PERMANENTLY. If you are sure you want to do this, then use the quit_character command instead of quit." |
260 | cf::register_command quit => sub { |
261 | # "Quitting will delete your character.\nAre you sure you want to quit (y/n):" |
261 | my ($ob, $arg) = @_; |
262 | # quit, quit_character, save |
262 | |
|
|
263 | $ob->reply (undef, |
|
|
264 | "Quitting will delete your character PERMANENTLY: It will be gone forever and any progress will be lost. " |
|
|
265 | . "If you are sure you want to do this, then use the quit_character command instead of quit.", |
|
|
266 | cf::NDI_UNIQUE | cf::NDI_RED); |
|
|
267 | }; |
|
|
268 | |
|
|
269 | cf::register_command quit_character => sub { |
|
|
270 | my ($ob, $arg) = @_; |
|
|
271 | |
|
|
272 | my $pl = $ob->contr; |
|
|
273 | |
|
|
274 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to PERMANENTLY delete your character and all associated data (y/n)?", sub { |
|
|
275 | if ($_[0] !~ /^[yY]/) { |
|
|
276 | $ob->reply (undef, |
|
|
277 | "Ok, not not quitting then.", |
|
|
278 | cf::NDI_UNIQUE | cf::NDI_RED); |
|
|
279 | } else { |
|
|
280 | $ob->reply (undef, |
|
|
281 | "Ok, quitting, hope to see you again.", |
|
|
282 | cf::NDI_UNIQUE | cf::NDI_RED); |
|
|
283 | $pl->ns->flush; |
|
|
284 | $pl->quit_character; |
|
|
285 | } |
|
|
286 | }); |
|
|
287 | }; |
263 | |
288 | |
264 | cf::object->attach ( |
289 | cf::object->attach ( |
265 | type => cf::SAVEBED, |
290 | type => cf::SAVEBED, |
266 | on_apply => sub { |
291 | on_apply => sub { |
267 | my ($bed, $ob) = @_; |
292 | my ($bed, $ob) = @_; |