Daimonin Lua Core reference - map

Automatically generated 2022-03-05 21:19:03

Attributes

integer map.ambient_brightness (readonly)
integer map.ambient_darkness (readonly)
integer map.difficulty (readonly)
integer map.enter_x (readonly)
integer map.enter_y (readonly)
integer map.height (readonly)
string map.message (readonly)
string map.name (readonly)
string map.orig_path (readonly)
string map.path (readonly)
integer map.reset_interval (readonly)
integer map.status (readonly)
integer map.width (readonly)

Back to the index


Flags

map.f_fixed_login (readonly)
map.f_fixed_rtime (readonly)
map.f_no_save (readonly)
map.f_noharm
map.f_nomagic
map.f_nopriest
map.f_nosummon
map.f_outdoor (readonly)
map.f_permdeath (readonly)
map.f_pvp
map.f_ultimatedeath (readonly)
map.f_ultradeath (readonly)

Back to the index


Functions

map:ActivateConnection(connected, activator, originator)

Parameter types:
connected: object (required)
activator: object (optional)
originator: object (optional)

Activates a connection on another map.
map is (of course) the map to activate on.
connected is the object (lever, etc) which started the process.
activator and originator (both optional) are objects which caused
connected to be activated (eg, activator might be the player who
pulled the lever).
The connection activated on map will be the same one that
connected is connected to on its map (eg, if connected has
connection 1, connection 1 will be activated on map.
Note that this method does /not/ actually trigger connected. It
is assumed that that has already been done (ie, by a player).
Instead, this method merely passes on the fact that connected has
been triggered to the connection network on another map.

Back to the index


map:CreateObject(arch_name, x, y)

Parameter types:
arch_name: string (required)
x: integer (required)
y: integer (required)

Back to the index


map:Delete(seconds, reload)

Parameter types:
seconds: unknown (required)

Resets the map (remove it from memory, release all objects,
teleport any players on it back to their respawn).
seconds is an optional number. A positive value causes the map to
reset in that many seconds (players on the map will get a
countdown every 30s or every s for the last 10). A negative value
causes the map to reset according to it's normal timeout). Zero
(default) causes an immediate reset.
reload is an optional boolean. True causes the map to instantly
reload when it resets (and players will not go to their respawn).
Return : nil

Back to the index


map:GetBrightnessOnSquare(x, y, mode)

Parameter types:
x: integer (required)
y: integer (required)
mode: integer (optional)

Returns the brightness level on the specified square. If
mode == 0 (default) the brightness is returned as a value between
0 and 7 as in map.darkness. If mode is 1, the value returned is
in the internal higher-resolution scale, usually somewhere
between 0-1280 (compare with map.light_level.) Since this scale
is uncapped, it is possible to sense a light source in full
daylight (map.darkness=7) with mode==1

Back to the index


map:GetFirstObjectOnSquare(x, y)

Parameter types:
x: integer (required)
y: integer (required)

Gets the bottom object on the tile. Use obj.above to browse objs

Back to the index


map:HasConnection(connection)

Parameter types:
connection: integer (required)

Checks if map has connection.
If it does, a numerical table of the connected objects is
If it doesn't, the return is nil.

Back to the index


map:IsAnyPlayerOnMap(tiling)

Parameter types:
tiling: unknown (required)

Checks if at least one player is on the map.
Tiling is optional. If true we also check the upto eight
surrounding maps.
Returns true if any player is found, false otherwise.
A looping script, or a script triggered repeatedly by a timer, will stop
the map from being saved, even if all players have left the map. This
means the script continues forever and the map remains in memory. This
function allows the script to clean up and exit (or to kill the timer)
when all players have left.

Back to the index


map:IsWallOnSquare(x, y)

Parameter types:
x: integer (required)
y: integer (required)

returns true if the square at x,y is a wall

Back to the index


map:MapTileAt(x, y)

Parameter types:
x: integer (required)
y: integer (required)

Back to the index


map:Message(x, y, distance, message, color, except1, except2)

Parameter types:
x: integer (required)
y: integer (required)
distance: integer (required)
message: string (required)
color: integer (optional)
except1: object (optional)
except2: object (optional)

Writes a message to all players on a map, except the two
exceptions if specified.
Starting point x,y for all players in distance
color should be one of the game.COLOR_xxx constants.
default color is game.COLOR_BLUE | game.COLOR_UNIQUE

Back to the index


map:PlaySound(x, y, soundnumber, soundtype)

Parameter types:
x: integer (required)
y: integer (required)
soundnumber: integer (required)
soundtype: integer (optional)

play the sound on the map, sounding like it comes from the given
x,y coordinates.
If soundtype is game.SOUNDTYPE_NORMAL (the default), then
soundnumber should be one of the game.SOUND_xxx constants
If soundtype is game.SOUNDTYPE_SPELL, then the sound number
should be a spell number, to play the sound of that spell

Back to the index


map:PlayersOnMap()

Returns a table of all the players on map, or nil.

Back to the index


map:ReadyInheritedMap(path, mode)

Parameter types:
path: string (required)
mode: integer (optional)

Loads the map pointed to by path into memory with the same status
(multi, unique, or instance) as the old map.

TODO: This is likely broken for
for advanced use, for now it should always be an absolute path).
mode is an optional number. Use one of:
game.MAP_CHECK - don't load the map if it isn't in memory,
returns nil if the map wasn't in memory.
game.MAP_NEW - if the map is already in memory, force an
immediate reset; then (re)load it.
Return : map pointer to map, or nil

Back to the index


map:Save()

Save the map.
Return : nil

Back to the index


map:SetDarkness()

Parameter types:
: integer (required)

Sets the map-wide darkness to value.
value should be one of the game.MAP_DARKNESS_* constants, where:
game.MAP_DARKNESS_TOTAL : 'true' darkness. Info about parts of
the map the player cannot see is not
even sent to the client, meaning this
is the only kind of map darkness that
can be used as a gameplay element;
all others are prone to client-side
'cheats'.
game.MAP_DARKNESS_MIN : the darkest map darkness other than
true darkness.
game.MAP_DARKNESS_MAX : the brightest map darkness (full
daylight).

TODO: This needs an overhaul. Probably it should be Mi|ii: where 2 args
sets the map's ambient light levels (as now) and 4 args sets the
msp's floor light levels.

Back to the index