Games-Axmud
view release on metacpan or search on metacpan
lib/Games/Axmud/Obj/Map.pm view on Meta::CPAN
$uncertainExitObj = $self->worldModelObj->ivShow(
'exitModelHash',
$uncertainExitNum,
);
if ($uncertainExitObj) {
$self->worldModelObj->convertUncertainExit(
TRUE, # Update Automapper windows now
$uncertainExitObj,
$self->currentRoom,
);
}
}
}
}
}
}
}
if (! $successFlag) {
# In 'update' mode, for a movement in a primary direction, create a new room at the
# specified location, make it the current room, give it the properties of the
# Locator task's current room, and update the map
if (
! $self->createNewRoom(
$regionmapObj, # Use the same region as the current room
$xPosBlocks, # Co-ordinates of room on the region's grid
$yPosBlocks,
$zPosBlocks,
undef, # Don't change GA::Win::Map->mode
TRUE, # New room is current room
TRUE, # New room takes properties from Locator
$self->currentRoom,
$dir, # Connect rooms together...
$mapDir, # ('undef' if $dir is a non-primary direction)
$exitObj, # ...using existing exit (if set)
$bypassFlag, # Force a two-way exit, if the flag is TRUE
)
) {
return undef;
}
# Check the world model for Axbasic scripts and, if any are found, execute them
if ($self->worldModelObj->allowModelScriptFlag) {
foreach my $script ($self->worldModelObj->newRoomScriptList) {
$self->session->pseudoCmd('runscript ' . $script);
}
}
}
return 1;
}
sub createNewRoom {
# Called by $self->moveKnownDirSeen, ->autoProcessNewRoom and ->reactRandomExit
# Also called by GA::Win::Map->enableCanvasPopupMenu, ->canvasEventHandler,
# ->addFirstRoomCallback, ->addRoomAtBlockCallback
# Creates a new room - adding a new object to the world model. At the moment, new rooms can
# only be created when the automapper window is open, but this function checks for that
# (just in case of future changes)
# If the process fails, deletes the world model object (if already created) and displays an
# error
#
# Expected arguments
# $regionmapObj - The GA::Obj::Regionmap in which the new room will be created. Usually
# (but not always) matches the regionmap visible in the automapper
# window for this session
# $xPosBlocks, $yPosBlocks, $zPosBlocks
# - The coordinates of the new room on the regionmap's grid
#
# Optional arguments
# $mode - The new automapper window's ->mode after the room has been created. If
# 'undef', the window's ->mode isn't changed
# $currentFlag - If set to TRUE, the new room is made the current location (if FALSE
# or 'undef', the current location isn't changed)
# $updateFlag - If set to TRUE, the room's properties are updated to match those of
# the Locator task's current room (depending on certain flags, and
# only when $currentFlag is TRUE; otherwise set to FALSE or 'undef')
# $connectRoomObj - The room from which the character just departed ('undef' if not known)
# $dir - The command used to move (e.g. 'n', 'enter well' - matches
# GA::Obj::Exit->dir) ('undef' if unknown)
# $mapDir - How the exit is drawn on the map - one of Axmud's standard primary
# directions (e.g. 'north', 'south', 'up) ('undef' if unknown)
# $exitObj - The GA::Obj::Exit through which the character moved (if 'undef', a new
# exit object can be created)
# $forceFlag - If TRUE, the exit object is automatically converted into a two-way
# exit, if possible (if FALSE or 'undef', the usual settings apply)
#
# Return values
# 'undef' on improper arguments or if the new room isn't created
# Otherwise returns the GA::ModelObj::Room created
my (
$self, $regionmapObj, $xPosBlocks, $yPosBlocks, $zPosBlocks, $mode, $currentFlag,
$updateFlag, $connectRoomObj, $dir, $mapDir, $exitObj, $forceFlag, $check,
) = @_;
# Local variables
my (
$mergeFlag, $text, $result, $newRoomObj, $filePath, $virtualPath, $choice,
@matchList, @selectList, @otherRoomList, @labelList,
);
# Check for improper arguments
if (
! defined $regionmapObj || ! defined $xPosBlocks || ! defined $yPosBlocks
|| ! defined $zPosBlocks || defined $check
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->createNewRoom', @_);
}
# Compare the Locator tasks's current room against other rooms (but don't bother if the
# task is expecting more room statements)
if ($updateFlag && $self->mapWin && $self->session->locatorTask->moveList <= 1) {
# If auto-rescue mode has been activated and if this new room is to be created in the
( run in 1.249 second using v1.01-cache-2.11-cpan-39bf76dae61 )