Difference between revisions of "Modding:level object (0.9.9.7)"

From DoomRL Wiki

Jump to: navigation, search
(Created page with "This page is pending. The below is a dump from earlier versions. === Flags === {{drltable|Level Flags|2|{{Table2Col |es=background: #333; |c1=font-family:monospace; text-a...")
 
Line 1: Line 1:
This page is pending.  The below is a dump from earlier versions.
+
The ''level'' object in DoomRL pulls triple duty: it stores and publishes properties relevant to the current level, it provides access to the [[Modding:level API|level API]] which includes procedures from Lua, DoomRL, and valkyrie, and through clever use of metatables it exposes the light, cell type, and HP arrays stored in the valkyrie ''LuaMapNode'' object.
  
 
+
== Properties ==
=== Flags ===
+
{{drltable|Properties |3|{{Table3Col
{{drltable|Level Flags|2|{{Table2Col
+
 
   |es=background: #333;
 
   |es=background: #333;
 
   |c1=font-family:monospace; text-align:right; vertical-align:top; padding:0px 2px;
 
   |c1=font-family:monospace; text-align:right; vertical-align:top; padding:0px 2px;
 
   |c2=padding:0px 2px;
 
   |c2=padding:0px 2px;
   |LF_NOHOMING|Causes homing phase devices to act like normal phase devices.
+
   |c3=padding:0px 2px;
   |LF_UNIQUEITEM|Used by the level generation code to keep track of whether a unique item has dropped on the current level (in order to prevent multiple uniques from dropping on one level). This flag also causes a level feeling to occur indicating that a unique item is present.
+
   |status              |{{modarg|word}}|This is for use by level designers and is preserved after a level is exited.
   |LF_BONUS|This flag is automatically set for so-called special levels like [[Halls of Carnage]]. (It is not set for those special levels like [[Hellgate]] that replace normal levels, only by those reached from red stairs.)
+
  |name                |{{modarg|string}}|This is the level name as displayed on the HUD.
   |LF_RESPAWN|Causes monsters to randomly respawn as when playing the game on Nightmare!
+
   |name_number        |{{modarg|word}}|This controls the "LevX" part of the level name. If zero, it won't be displayed.
  |LF_NORESPAWN|Prevents the Nightmare! respawn feature.
+
   |danger_level        |{{modarg|word}}|Level generation parameter that usually corresponds to depth.
   |LF_NUKED|This flag is automatically set when the level is nuked.
+
   |style              |{{modarg|byte}}  |The style (tile set) used by the level generation functions.
   |LF_NONUKE|Causes the thermonuclear bomb to have no effect when it is used. It is not respected by other nuke effects.
+
   |<u>id</u>          |{{modarg|string}}|The id of the current level
  |LF_ITEMSVISIBLE|Allows the player to see all items on the level (as with a [[Computer Map]]).
+
   |<u>special_exit</u> |{{modarg|string}}|The id of the level that red stairs lead to
   |LF_BEINGSVISIBLE|Allows the player to see all beings on the level (as with a [[Tracking Map]]).
+
 
   |}}
 
   |}}
 
}}
 
}}
  
== Properties ==
+
=== Flags ===
These are properties of the global Level variable. They are changed by the engine as the player moves from level to level. For some of the read-only properties, rawset can be used to create a lua property that shadows the pascal property, tricking APIs that are implemented in lua. This is particularly useful for tricking the generator API into using a custom style.
+
{{Template:Light_Flags}}
{|class="wikitable" style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
+
{{Template:Level_Flags}}
! colspan="3" style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Level'''
+
{{Table3Col
+
  |es=background: #333;
+
  |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
+
  |c2=vertical-align:top; padding:0px 2px;
+
  |c3=padding:0px 2px;
+
  |Word|status|This is for use by level designers. It is preferred to access it through Level.result.
+
  |string|name|This is the level name as displayed on the HUD.
+
  |Byte|name_number|This controls the "LevX" part of the level name. If zero, it won't be displayed.
+
  |Byte|danger_level|Level generation parameter that corresponds to depth.
+
  |Byte|style|The style (tile set) used by the level generation functions. This property is read-only.
+
  |string|special_exit|The sid of the level that red stairs lead to on the current level number. This property is read-only.
+
  |string|special_name|The sid of the current level prototype or the empty string for random levels. This property is read-only.
+
  |DWord|item_array_size|Length of the sparse array that stores all the items on the level. This property is read-only.
+
  |DWord|being_array_size|Length of the sparse array that stores all the beings on the level. This property is read-only.
+
}}
+
|}
+

Revision as of 20:03, 23 December 2012

The level object in DoomRL pulls triple duty: it stores and publishes properties relevant to the current level, it provides access to the level API which includes procedures from Lua, DoomRL, and valkyrie, and through clever use of metatables it exposes the light, cell type, and HP arrays stored in the valkyrie LuaMapNode object.

Properties

Properties
status word This is for use by level designers and is preserved after a level is exited.
name string This is the level name as displayed on the HUD.
name_number word This controls the "LevX" part of the level name. If zero, it won't be displayed.
danger_level word Level generation parameter that usually corresponds to depth.
style byte The style (tile set) used by the level generation functions.
id string The id of the current level
special_exit string The id of the level that red stairs lead to

Flags

Light Flags
LFEXPLORED This flag is set for explored cells. It can be modified to create computer map-like effects or Angel of Darkness-like effects.
LFVISIBLE This flag is set for cells in the player's current LOS. This flag is automatically recalculated on every player action. It may be useful to manually modify this flag if LOS needs to be updated more often.
LFLIGHTED This flag is always set on the same cells as LFVISIBLE; both flags must be set for a cell to be visible.
LFDAMAGE This is a bookkeeping flag for shotgun area-of-effect. Cells are set with this flag if they are calculated as in the shotgun blast but haven't yet been processed.
LFFRESH This is a bookkeeping flag for explosions. New corpses are set with this flag to keep them from being immediately destroyed. This flag can also be set to make any cell indestructible, but it may be cleared by the engine.
LFPERMANENT This flag marks a cell as being indestructible.
LFCORNER This flag only exists in debug builds of DoomRL. It identifies a cell that is visible but that enemies will not return fire from, ie, corner shooting.
LFBLOOD This flag marks a cell as being bloody. Bloody cells can only have cosmetic differences.
LFNOSPAWN
LFMARKER1
LFMARKER2
Level Flags
LF_NOHOMING Causes homing phase devices to act like normal phase devices.
LF_UNIQUEITEM Used by the level generation code to keep track of whether a unique item has dropped on the current level (in order to prevent multiple uniques from dropping on one level). This flag also causes a level feeling to occur indicating that a unique item is present.
LF_BONUS This flag is automatically set for so-called special levels like Halls of Carnage. (It is not set for those special levels like Hellgate that replace normal levels, only by those reached from red stairs.)
LF_SCRIPT This flag is automatically set for scripted levels, ie levels defined with the level blueprint.
LF_NORESPAWN Prevents the Nightmare! respawn feature.
LF_NUKED This flag is automatically set when the level is nuked.
LF_NONUKE Causes the thermonuclear bomb to have no effect when it is used. It is not respected by other nuke effects.
LF_ITEMSVISIBLE Allows the player to see all items on the level (as with a Computer Map).
LF_BEINGSVISIBLE Allows the player to see all beings on the level (as with a Tracking Map).
LF_RESPAWN Causes monsters to randomly respawn as when playing the game on Nightmare!
LF_SHARPFLUID  ???
Personal tools