… | |
… | |
1362 | $map->{last_save} = $cf::RUNTIME; |
1362 | $map->{last_save} = $cf::RUNTIME; |
1363 | |
1363 | |
1364 | $map->load_header |
1364 | $map->load_header |
1365 | or return; |
1365 | or return; |
1366 | |
1366 | |
1367 | if ($map->should_reset) { |
1367 | if ($map->should_reset && 0) {#d#TODO# disabled, crashy (locking issue?) |
1368 | # doing this can freeze the server in a sync job, obviously |
1368 | # doing this can freeze the server in a sync job, obviously |
1369 | #$cf::WAIT_FOR_TICK->wait; |
1369 | #$cf::WAIT_FOR_TICK->wait; |
1370 | $map->reset; |
1370 | $map->reset; |
1371 | undef $guard; |
1371 | undef $guard; |
1372 | return find $path; |
1372 | return find $path; |
… | |
… | |
1748 | return if UNIVERSAL::isa $self->map, "ext::map_link"; |
1748 | return if UNIVERSAL::isa $self->map, "ext::map_link"; |
1749 | |
1749 | |
1750 | $self->{_link_pos} ||= [$self->map->{path}, $self->x, $self->y] |
1750 | $self->{_link_pos} ||= [$self->map->{path}, $self->x, $self->y] |
1751 | if $self->map; |
1751 | if $self->map; |
1752 | |
1752 | |
1753 | $self->enter_map ($LINK_MAP || link_map, 20, 20); |
1753 | $self->enter_map ($LINK_MAP || link_map, 10, 10); |
1754 | } |
1754 | } |
1755 | |
1755 | |
1756 | sub cf::object::player::leave_link { |
1756 | sub cf::object::player::leave_link { |
1757 | my ($self, $map, $x, $y) = @_; |
1757 | my ($self, $map, $x, $y) = @_; |
1758 | |
1758 | |
… | |
… | |
1899 | sub cf::object::player::enter_exit { |
1899 | sub cf::object::player::enter_exit { |
1900 | my ($self, $exit) = @_; |
1900 | my ($self, $exit) = @_; |
1901 | |
1901 | |
1902 | return unless $self->type == cf::PLAYER; |
1902 | return unless $self->type == cf::PLAYER; |
1903 | |
1903 | |
|
|
1904 | if ($exit->slaying eq "/!") { |
|
|
1905 | #TODO: this should de-fi-ni-te-ly not be a sync-job |
|
|
1906 | cf::sync_job { prepare_random_map $exit }; |
|
|
1907 | } |
|
|
1908 | |
|
|
1909 | my $slaying = cf::map::normalise $exit->slaying, $exit->map && $exit->map->path; |
|
|
1910 | my $hp = $exit->stats->hp; |
|
|
1911 | my $sp = $exit->stats->sp; |
|
|
1912 | |
1904 | $self->enter_link; |
1913 | $self->enter_link; |
1905 | |
1914 | |
1906 | (async { |
1915 | (async { |
1907 | $self->deactivate_recursive; # just to be sure |
1916 | $self->deactivate_recursive; # just to be sure |
1908 | unless (eval { |
1917 | unless (eval { |
1909 | prepare_random_map $exit |
1918 | $self->goto ($slaying, $hp, $sp); |
1910 | if $exit->slaying eq "/!"; |
|
|
1911 | |
|
|
1912 | my $path = new_from_path cf::map $exit->slaying, $exit->map && $exit->map->path; |
|
|
1913 | $self->goto ($path, $exit->stats->hp, $exit->stats->sp); |
|
|
1914 | |
1919 | |
1915 | 1; |
1920 | 1; |
1916 | }) { |
1921 | }) { |
1917 | $self->message ("Something went wrong deep within the crossfire server. " |
1922 | $self->message ("Something went wrong deep within the crossfire server. " |
1918 | . "I'll try to bring you back to the map you were before. " |
1923 | . "I'll try to bring you back to the map you were before. " |