diff options
Diffstat (limited to 'Server')
-rw-r--r-- | Server/Plugins/APIDump/APIDesc.lua | 354 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/BlockEntities.lua | 110 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Geometry.lua | 113 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Network.lua | 12 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Plugins.lua | 18 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Projectiles.lua | 22 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/WebAdmin.lua | 25 | ||||
-rw-r--r-- | Server/Plugins/APIDump/main_APIDump.lua | 118 |
8 files changed, 512 insertions, 260 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index a09d4b37d..40bda49d7 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -5,7 +5,7 @@ -g_APIDesc = +return { Classes = { @@ -105,7 +105,13 @@ g_APIDesc = { Params = "BlockType", Return = "number", Notes = "Counts the number of occurences of the specified blocktype contained in the area." }, { Params = "BlockType, BlockMeta", Return = "number", Notes = "Counts the number of occurrences of the specified blocktype + blockmeta combination contained in the area." }, }, - Create = { Params = "SizeX, SizeY, SizeZ, [DataTypes]", Return = "", Notes = "Initializes this BlockArea to an empty area of the specified size and origin of {0, 0, 0}. Any previous contents are lost." }, + Create = + { + { Params = "SizeX, SizeY, SizeZ", Return = "", Notes = "Initializes this BlockArea to an empty area of the specified size and origin of {0, 0, 0}. Datatypes are set to baTypes + baMetas. Any previous contents are lost." }, + { Params = "SizeX, SizeY, SizeZ, DataTypes", Return = "", Notes = "Initializes this BlockArea to an empty area of the specified size and origin of {0, 0, 0}. Any previous contents are lost." }, + { Params = "{{Vector3i|Size}}", Return = "", Notes = "Creates a new area of the specified size. Datatypes are set to baTypes + baMetas. Origin is set to all zeroes. BlockTypes are set to air, block metas to zero, blocklights to zero and skylights to full light." }, + { Params = "{{Vector3i|Size}}, DataTypes", Return = "", Notes = "Creates a new area of the specified size and contents. Origin is set to all zeroes. BlockTypes are set to air, block metas to zero, blocklights to zero and skylights to full light." }, + }, Crop = { Params = "AddMinX, SubMaxX, AddMinY, SubMaxY, AddMinZ, SubMaxZ", Return = "", Notes = "Crops the specified number of blocks from each border. Modifies the size of this blockarea object." }, DumpToRawFile = { Params = "FileName", Return = "", Notes = "Dumps the raw data into a file. For debugging purposes only." }, Expand = { Params = "SubMinX, AddMaxX, SubMinY, AddMaxY, SubMinZ, AddMaxZ", Return = "", Notes = "Expands the specified number of blocks from each border. Modifies the size of this blockarea object. New blocks created with this operation are filled with zeroes." }, @@ -157,9 +163,12 @@ g_APIDesc = MirrorYZNoMeta = { Params = "", Return = "", Notes = "Mirrors this block area around the YZ plane. Doesn't modify blocks' metas." }, Read = { + { Params = "World, {{cCuboid|Cuboid}}", Return = "bool", Notes = "Reads the area from World, returns true if successful. baTypes and baMetas are read." }, { Params = "World, {{cCuboid|Cuboid}}, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" }, + { Params = "World, {{Vector3i|Point1}}, {{Vector3i|Point2}}", Return = "bool", Notes = "Reads the area from World, returns true if successful. baTypes and baMetas are read." }, { Params = "World, {{Vector3i|Point1}}, {{Vector3i|Point2}}, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" }, - { Params = "World, X1, X2, Y1, Y2, Z1, Z2, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" }, + { Params = "World, MinX, MaxX, MinY, MaxY, MinZ, MaxZ", Return = "bool", Notes = "Reads the area from World, returns true if successful. baTypes and baMetas are read." }, + { Params = "World, MinX, MaxX, MinY, MaxY, MinZ, MaxZ, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" }, }, RelLine = { @@ -170,7 +179,7 @@ g_APIDesc = RotateCCWNoMeta = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, counter-clockwise (east -> north). Doesn't modify blocks' metas." }, RotateCW = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, clockwise (north -> east). Modifies blocks' metas (if present) to match." }, RotateCWNoMeta = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, clockwise (north -> east). Doesn't modify blocks' metas." }, - SaveToSchematicFile = { Params = "FileName", Return = "", Notes = "Saves the current contents to a schematic file. Returns true if successful." }, + SaveToSchematicFile = { Params = "FileName", Return = "boolean", Notes = "Saves the current contents to a schematic file. Returns true if successful." }, SaveToSchematicString = { Params = "", Return = "string", Notes = "Saves the current contents to a string (in a .schematic file format). Returns the data if successful, nil if failed." }, SetBlockLight = { Params = "BlockX, BlockY, BlockZ, BlockLight", Return = "", Notes = "Sets the blocklight at the specified absolute coords" }, SetBlockMeta = { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified absolute coords" }, @@ -194,7 +203,9 @@ g_APIDesc = }, Write = { + { Params = "World, {{Vector3i|MinPoint}}", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful. baTypes and baMetas are written." }, { Params = "World, {{Vector3i|MinPoint}}, DataTypes", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful" }, + { Params = "World, MinX, MinY, MinZ", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful. baTypes and baMetas are written." }, { Params = "World, MinX, MinY, MinZ, DataTypes", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful" }, }, }, @@ -396,19 +407,19 @@ g_APIDesc = ]], Functions = { - CanBeTerraformed = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns true if the block is suitable to be changed by a generator" }, - FullyOccupiesVoxel = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block fully occupies its voxel." }, - Get = { Params = "Type", Return = "{{cBlockInfo}}", Notes = "(STATIC) Returns the {{cBlockInfo}} structure for the specified type." }, - GetBlockHeight = { Params = "Type", Return = "number", Notes = "(STATIC) Returns the block's hitbox height." }, - GetLightValue = { Params = "Type", Return = "number", Notes = "(STATIC) Returns how much light the specified block emits on its own." }, - GetPlaceSound = { Params = "Type", Return = "", Notes = "(STATIC) Returns the name of the sound that is played when placing the block." }, - GetSpreadLightFalloff = { Params = "Type", Return = "number", Notes = "(STATIC) Returns how much light the specified block consumes." }, - IsOneHitDig = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block will be destroyed after a single hit." }, - IsPistonBreakable = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether a piston can break the specified block." }, - IsSnowable = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block can hold snow atop." }, - IsSolid = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block is solid." }, - IsTransparent = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block is transparent." }, - RequiresSpecialTool = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block requires a special tool to drop." }, + CanBeTerraformed = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns true if the block is suitable to be changed by a generator" }, + FullyOccupiesVoxel = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether the specified block fully occupies its voxel." }, + Get = { Params = "Type", Return = "{{cBlockInfo}}", IsStatic = true, Notes = "Returns the {{cBlockInfo}} structure for the specified type." }, + GetBlockHeight = { Params = "Type", Return = "number", IsStatic = true, Notes = "Returns the block's hitbox height." }, + GetLightValue = { Params = "Type", Return = "number", IsStatic = true, Notes = "Returns how much light the specified block emits on its own." }, + GetPlaceSound = { Params = "Type", Return = "", IsStatic = true, Notes = "Returns the name of the sound that is played when placing the block." }, + GetSpreadLightFalloff = { Params = "Type", Return = "number", IsStatic = true, Notes = "Returns how much light the specified block consumes." }, + IsOneHitDig = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether the specified block will be destroyed after a single hit." }, + IsPistonBreakable = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether a piston can break the specified block." }, + IsSnowable = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether the specified block can hold snow atop." }, + IsSolid = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether the specified block is solid." }, + IsTransparent = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether the specified block is transparent." }, + RequiresSpecialTool = { Params = "Type", Return = "bool", IsStatic = true, Notes = "Returns whether the specified block requires a special tool to drop." }, }, Variables = { @@ -438,9 +449,9 @@ g_APIDesc = Black = { Notes = "" }, Blue = { Notes = "" }, Bold = { Notes = "" }, - Color = { Notes = "The first character of the color-code-sequence, �" }, + Color = { Notes = "The first character of the color-code-sequence, §" }, DarkPurple = { Notes = "" }, - Delimiter = { Notes = "The first character of the color-code-sequence, �" }, + Delimiter = { Notes = "The first character of the color-code-sequence, §" }, Gold = { Notes = "" }, Gray = { Notes = "" }, Green = { Notes = "" }, @@ -521,7 +532,7 @@ g_APIDesc = SetUseDefaultHeight = { Params = "bool", Return = "", Notes = "Sets the chunk to use default height generator or not" }, SetUseDefaultStructures = { Params = "bool", Return = "", Notes = "Sets the chunk to use default structures or not" }, UpdateHeightmap = { Params = "", Return = "", Notes = "Updates the heightmap to match current contents. The plugins should do that if they modify the contents and don't modify the heightmap accordingly; Cuberite expects (and checks in Debug mode) that the heightmap matches the contents when the cChunkDesc is returned from a plugin." }, - WriteBlockArea = { Params = "{{cBlockArea|BlockArea}}, MinRelX, MinRelY, MinRelZ", Return = "", Notes = "Writes data from the block area into the chunk" }, + WriteBlockArea = { Params = "{{cBlockArea|BlockArea}}, MinRelX, MinRelY, MinRelZ, [{{cBlockArea#eMergeStrategy|MergeStrategy}}]", Return = "", Notes = "Writes data from the block area into the chunk" }, }, AdditionalInfo = { @@ -570,7 +581,7 @@ end Functions = { - GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." }, + GenerateOfflineUUID = { Params = "Username", Return = "string", IsStatic = true, Notes = "Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." }, GetClientBrand = { Params = "", Return = "string", Notes = "Returns the brand that the client has sent in their MC|Brand plugin message." }, GetIPString = { Params = "", Return = "string", Notes = "Returns the IP address of the connection, as a string. Only the address part is returned, without the port number." }, GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." }, @@ -583,7 +594,7 @@ end GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" }, GetRequestedViewDistance = { Params = "", Return = "number", Notes = "Returns the view distance that the player request, not the used view distance." }, HasPluginChannel = { Params = "ChannelName", Return = "bool", Notes = "Returns true if the client has registered to receive messages on the specified plugin channel." }, - IsUUIDOnline = { Params = "UUID", Return = "bool", Notes = "(STATIC) Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false."}, + IsUUIDOnline = { Params = "UUID", Return = "bool", IsStatic = true, Notes = "Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false."}, Kick = { Params = "Reason", Return = "", Notes = "Kicks the user with the specified reason" }, SendPluginMessage = { Params = "Channel, Message", Return = "", Notes = "Sends the plugin message on the specified channel." }, SetClientBrand = { Params = "ClientBrand", Return = "", Notes = "Sets the value of the client's brand. Normally this value is received from the client by a MC|Brand plugin message, this function lets plugins overwrite the value." }, @@ -632,7 +643,7 @@ end constructor = { { Params = "", Return = "", Notes = "Creates an empty chat message" }, - { Params = "Text", Return = "", Notes = "Creates a chat message containing the specified text, parsed by the ParseText() function. This allows easy migration from old chat messages." }, + { Params = "Text, [MessageType]", Return = "", Notes = "Creates a chat message containing the specified text, parsed by the ParseText() function. This allows easy migration from old chat messages." }, }, AddRunCommandPart = { Params = "Text, Command, [Style]", Return = "self", Notes = "Adds a text which, when clicked, runs the specified command. Chaining." }, AddShowAchievementPart = { Params = "PlayerName, AchievementName, [Style]", Return = "", Notes = "Adds a text that represents the 'Achievement get' message." }, @@ -645,7 +656,7 @@ end GetAdditionalMessageTypeData = { Params = "", Return = "string", Notes = "Returns the AdditionalData associated with the message, such as the sender's name for mtPrivateMessage" }, GetMessageType = { Params = "", Return = "MessageType", Notes = "Returns the MessageType (mtXXX constant) that is associated with this message. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.)" }, ParseText = { Params = "Text", Return = "self", Notes = "Adds text, while recognizing http and https URLs and old-style formatting codes (\"@2\"). Chaining." }, - SetMessageType = { Params = "MessageType, AdditionalData", Return = "self", Notes = "Sets the MessageType (mtXXX constant) that is associated with this message. Also sets the additional data (string) associated with the message, which is specific for the message type - such as the sender's name for mtPrivateMessage. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.). Chaining." }, + SetMessageType = { Params = "MessageType, [AdditionalData]", Return = "self", Notes = "Sets the MessageType (mtXXX constant) that is associated with this message. Also sets the additional data (string) associated with the message, which is specific for the message type - such as the sender's name for mtPrivateMessage. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.). Chaining." }, UnderlineUrls = { Params = "", Return = "self", Notes = "Makes all URL parts contained in the message underlined. Doesn't affect parts added in the future. Chaining." }, }, @@ -747,10 +758,10 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") Functions = { - md5 = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the md5 hash of the data, returns it as a raw (binary) string of 16 characters." }, - md5HexString = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the md5 hash of the data, returns it as a hex-encoded string of 32 characters." }, - sha1 = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the sha1 hash of the data, returns it as a raw (binary) string of 20 characters." }, - sha1HexString = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the sha1 hash of the data, returns it as a hex-encoded string of 40 characters." }, + md5 = { Params = "Data", Return = "string", IsStatic = true, Notes = "Calculates the md5 hash of the data, returns it as a raw (binary) string of 16 characters." }, + md5HexString = { Params = "Data", Return = "string", IsStatic = true, Notes = "Calculates the md5 hash of the data, returns it as a hex-encoded string of 32 characters." }, + sha1 = { Params = "Data", Return = "string", IsStatic = true, Notes = "Calculates the sha1 hash of the data, returns it as a raw (binary) string of 20 characters." }, + sha1HexString = { Params = "Data", Return = "string", IsStatic = true, Notes = "Calculates the sha1 hash of the data, returns it as a hex-encoded string of 40 characters." }, }, }, -- cCryptoHash @@ -778,12 +789,14 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") { Params = "StringSpec", Return = "cEnchantments", Notes = "Creates a new cEnchantments object filled with enchantments based on the string description" }, }, operator_eq = { Params = "OtherEnchantments", Return = "bool", Notes = "Returns true if this enchantments object has the same enchantments as OtherEnchantments." }, + Add = { Params = "{{cEnchantments|Other}}", Return = "", Notes = "Adds the enchantments contained in Other into this object. Existing enchantments are preserved, unless Other specifies a different level, in which case the level is changed to the Other's one." }, AddFromString = { Params = "StringSpec", Return = "", Notes = "Adds the enchantments in the string description into the object. If a specified enchantment already existed, it is overwritten." }, Clear = { Params = "", Return = "", Notes = "Removes all enchantments" }, + Count = { Params = "", Return = "number", Notes = "Get the count of enchantments contained within the class" }, GetLevel = { Params = "EnchantmentNumID", Return = "number", Notes = "Returns the level of the specified enchantment stored in this object; 0 if not stored" }, IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if the object stores no enchantments" }, - SetLevel = { Params = "EnchantmentNumID, Level", Return = "", Notes = "Sets the level for the specified enchantment, adding it if not stored before or removing it if level < = 0" }, - StringToEnchantmentID = { Params = "EnchantmentTextID", Return = "number", Notes = "(static) Returns the enchantment numerical ID, -1 if not understood. Case insensitive. Also understands plain numbers." }, + SetLevel = { Params = "EnchantmentNumID, Level", Return = "", Notes = "Sets the level for the specified enchantment, adding it if not stored before, or removing it if Level < = 0" }, + StringToEnchantmentID = { Params = "EnchantmentTextID", Return = "number", IsStatic = true, Notes = "Returns the enchantment numerical ID, -1 if not understood. Case insensitive. Also understands plain numbers." }, ToString = { Params = "", Return = "string", Notes = "Returns the string description of all the enchantments stored in this object, in numerical-ID form" }, }, Constants = @@ -856,10 +869,10 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") AddSpeedX = { Params = "AddX", Return = "", Notes = "Adds the specified amount of speed in the X axis direction." }, AddSpeedY = { Params = "AddY", Return = "", Notes = "Adds the specified amount of speed in the Y axis direction." }, AddSpeedZ = { Params = "AddZ", Return = "", Notes = "Adds the specified amount of speed in the Z axis direction." }, - ArmorCoversAgainst = { Params = "{{cEntity|AttackerEntity}}, DamageType, RawDamage", Return = "number", Notes = "Returns the points out of a_RawDamage that the currently equipped armor would cover." }, - Destroy = { Params = "", Return = "", Notes = "Schedules the entity to be destroyed" }, + ArmorCoversAgainst = { Params = "DamageType", Return = "boolean", Notes = "Returns whether armor will protect against the specified damage type" }, + Destroy = { Params = "[ShouldBroadcast]", Return = "", Notes = "Schedules the entity to be destroyed; if ShouldBroadcast is not present or set to true, broadcasts the DestroyEntity packet" }, GetAirLevel = { Params = "", Return = "number", Notes = "Returns the air level (number of ticks of air left). Note, this function is only updated with mobs or players." }, - GetArmorCoverAgainst = { Params = "AttackerEntity, DamageType, RawDamage", Return = "number", Notes = "Returns the number of hitpoints out of RawDamage that the currently equipped armor would cover. See {{TakeDamageInfo}} for more information on attack damage." }, + GetArmorCoverAgainst = { Params = "{{cEntity|AttackerEntity}}, DamageType, RawDamage", Return = "number", Notes = "Returns the number of hitpoints out of RawDamage that the currently equipped armor would cover. See {{TakeDamageInfo}} for more information on attack damage." }, GetChunkX = { Params = "", Return = "number", Notes = "Returns the X-coord of the chunk in which the entity is placed" }, GetChunkZ = { Params = "", Return = "number", Notes = "Returns the Z-coord of the chunk in which the entity is placed" }, GetClass = { Params = "", Return = "string", Notes = "Returns the classname of the entity, such as \"cSpider\" or \"cPickup\"" }, @@ -930,10 +943,11 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") KilledBy = { Notes = "FIXME: Remove this from API" }, MoveToWorld = { - { Params = "{{cWorld|World}}, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world's spawn point. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions)." }, - { Params = "WorldName, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world's spawn point. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions)." }, - { Params = "{{cWorld|World}}, ShouldSendRespawn, {{Vector3d|Position}}", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions). The Position parameter specifies the location that the entity should be placed in, in the new world." }, + { Params = "{{cWorld|World}}, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world's spawn point. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions). <b>OBSOLETE</b>, use ScheduleMoveToWorld() instead." }, + { Params = "WorldName, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world's spawn point. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions). <b>OBSOLETE</b>, use ScheduleMoveToWorld() instead." }, + { Params = "{{cWorld|World}}, ShouldSendRespawn, {{Vector3d|Position}}", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions). The Position parameter specifies the location that the entity should be placed in, in the new world. <b>OBSOLETE</b>, use ScheduleMoveToWorld() instead." }, }, + ScheduleMoveToWorld = { Params = "{{cWorld|World}}, NewPosition, [ShouldSetPortalCooldown]", Return = "", Notes = "Schedules a MoveToWorld call to occur on the next Tick of the entity. If ShouldSetPortalCooldown is false (default), doesn't set any portal cooldown, if it is true, the default portal cooldown is applied to the entity." }, SetGravity = { Params = "Gravity", Return = "", Notes = "Sets the number that is used as the gravity for physics simulation. 1G (9.78) by default." }, SetHeadYaw = { Params = "HeadPitch", Return = "", Notes = "Sets the head pitch (FIXME: Rename to SetHeadPitch() )." }, SetHealth = { Params = "Hitpoints", Return = "", Notes = "Sets the entity's health to the specified amount of hitpoints. Doesn't broadcast any hurt animation. Doesn't kill the entity if health drops below zero. Use the TakeDamage() function instead for taking damage." }, @@ -1005,6 +1019,19 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") }, }, + cEntityEffect = + { + -- TODO: Description + Functions = + { + GetPotionColor = { Params = "ItemDamage", Return = "number", IsStatic = true, Notes = "Returns the potion color (used by the client for visuals), based on the potion's damage value" }, + GetPotionEffectDuration = { Params = "ItemDamage", Return = "number", IsStatic = true, Notes = "Returns the effect duration, in ticks, based on the potion's damage value" }, + GetPotionEffectIntensity = { Params = "ItemDamage", Return = "short", IsStatic = true, Notes = "Retrieves the intensity level from the potion's damage value. Returns 0 for level I potions, 1 for level II potions." }, + GetPotionEffectType = { Params = "ItemDamage", Return = "{{cEntityEffect#eType}}", IsStatic = true, Notes = "Translates the potion's damage value into the entity effect that the potion gives" }, + IsPotionDrinkable = { Params = "ItemDamage", Return = "boolean", IsStatic = true, Notes = "Returns true if the potion with the given damage is drinkable" }, + }, + }, + cFile = { Desc = [[ @@ -1016,24 +1043,24 @@ cFile:DeleteFile("/usr/bin/virus.exe"); ]], Functions = { - ChangeFileExt = { Params = "FileName, NewExt", Return = "string", Notes = "(STATIC) Returns FileName with its extension changed to NewExt. NewExt may begin with a dot, but needn't, the result is the same in both cases (the first dot, if present, is ignored). FileName may contain path elements, extension is recognized as the last dot after the last path separator in the string." }, - Copy = { Params = "SrcFileName, DstFileName", Return = "bool", Notes = "(STATIC) Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." }, - CreateFolder = { Params = "FolderPath", Return = "bool", Notes = "(STATIC) Creates a new folder. Returns true if successful. Only a single level can be created at a time, use CreateFolderRecursive() to create multiple levels of folders at once." }, - CreateFolderRecursive = { Params = "FolderPath", Return = "bool", Notes = "(STATIC) Creates a new folder, creating its parents if needed. Returns true if successful." }, - Delete = { Params = "Path", Return = "bool", Notes = "(STATIC) Deletes the specified file or folder. Returns true if successful. Only deletes folders that are empty.<br/><b>NOTE</b>: If you already know if the object is a file or folder, use DeleteFile() or DeleteFolder() explicitly." }, - DeleteFile = { Params = "FilePath", Return = "bool", Notes = "(STATIC) Deletes the specified file. Returns true if successful." }, - DeleteFolder = { Params = "FolderPath", Return = "bool", Notes = "(STATIC) Deletes the specified file or folder. Returns true if successful. Only deletes folders that are empty." }, - DeleteFolderContents = { Params = "FolderPath", Return = "bool", Notes = "(STATIC) Deletes everything from the specified folder, recursively. The specified folder stays intact. Returns true if successful." }, - Exists = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified file or folder exists.<br/><b>OBSOLETE</b>, use IsFile() or IsFolder() instead" }, - GetExecutableExt = { Params = "", Return = "string", Notes = "(STATIC) Returns the customary executable extension (including the dot) used by the current platform (\".exe\" on Windows, empty string on Linux). " }, - GetFolderContents = { Params = "FolderName", Return = "array table of strings", Notes = "(STATIC) Returns the contents of the specified folder, as an array table of strings. Each filesystem object is listed. Use the IsFile() and IsFolder() functions to determine the object type." }, - GetLastModificationTime = { Params = "Path", Return = "number", Notes = "(STATIC) Returns the last modification time (in current timezone) of the specified file or folder. Returns zero if file not found / not accessible. The returned value is in the same units as values returned by os.time()." }, - GetPathSeparator = { Params = "", Return = "string", Notes = "(STATIC) Returns the primary path separator used by the current platform. Returns \"\\\" on Windows and \"/\" on Linux. Note that the platform or CRT may support additional path separators, those are not reported." }, - GetSize = { Params = "FileName", Return = "number", Notes = "(STATIC) Returns the size of the file, or -1 on failure." }, - IsFile = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing file." }, - IsFolder = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing folder." }, - ReadWholeFile = { Params = "FileName", Return = "string", Notes = "(STATIC) Returns the entire contents of the specified file. Returns an empty string if the file cannot be opened." }, - Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "(STATIC) Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." }, + ChangeFileExt = { Params = "FileName, NewExt", Return = "string", IsStatic = true, Notes = "Returns FileName with its extension changed to NewExt. NewExt may begin with a dot, but needn't, the result is the same in both cases (the first dot, if present, is ignored). FileName may contain path elements, extension is recognized as the last dot after the last path separator in the string." }, + Copy = { Params = "SrcFileName, DstFileName", Return = "bool", IsStatic = true, Notes = "Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." }, + CreateFolder = { Params = "FolderPath", Return = "bool", IsStatic = true, Notes = "Creates a new folder. Returns true if successful. Only a single level can be created at a time, use CreateFolderRecursive() to create multiple levels of folders at once." }, + CreateFolderRecursive = { Params = "FolderPath", Return = "bool", IsStatic = true, Notes = "Creates a new folder, creating its parents if needed. Returns true if successful." }, + Delete = { Params = "Path", Return = "bool", IsStatic = true, Notes = "Deletes the specified file or folder. Returns true if successful. Only deletes folders that are empty.<br/><b>NOTE</b>: If you already know if the object is a file or folder, use DeleteFile() or DeleteFolder() explicitly." }, + DeleteFile = { Params = "FilePath", Return = "bool", IsStatic = true, Notes = "Deletes the specified file. Returns true if successful." }, + DeleteFolder = { Params = "FolderPath", Return = "bool", IsStatic = true, Notes = "Deletes the specified file or folder. Returns true if successful. Only deletes folders that are empty." }, + DeleteFolderContents = { Params = "FolderPath", Return = "bool", IsStatic = true, Notes = "Deletes everything from the specified folder, recursively. The specified folder stays intact. Returns true if successful." }, + Exists = { Params = "Path", Return = "bool", IsStatic = true, Notes = "Returns true if the specified file or folder exists.<br/><b>OBSOLETE</b>, use IsFile() or IsFolder() instead" }, + GetExecutableExt = { Params = "", Return = "string", IsStatic = true, Notes = "Returns the customary executable extension (including the dot) used by the current platform (\".exe\" on Windows, empty string on Linux). " }, + GetFolderContents = { Params = "FolderName", Return = "array table of strings", IsStatic = true, Notes = "Returns the contents of the specified folder, as an array table of strings. Each filesystem object is listed. Use the IsFile() and IsFolder() functions to determine the object type." }, + GetLastModificationTime = { Params = "Path", Return = "number", IsStatic = true, Notes = "Returns the last modification time (in current timezone) of the specified file or folder. Returns zero if file not found / not accessible. The returned value is in the same units as values returned by os.time()." }, + GetPathSeparator = { Params = "", Return = "string", IsStatic = true, Notes = "Returns the primary path separator used by the current platform. Returns \"\\\" on Windows and \"/\" on Linux. Note that the platform or CRT may support additional path separators, those are not reported." }, + GetSize = { Params = "FileName", Return = "number", IsStatic = true, Notes = "Returns the size of the file, or -1 on failure." }, + IsFile = { Params = "Path", Return = "bool", IsStatic = true, Notes = "Returns true if the specified path points to an existing file." }, + IsFolder = { Params = "Path", Return = "bool", IsStatic = true, Notes = "Returns true if the specified path points to an existing folder." }, + ReadWholeFile = { Params = "FileName", Return = "string", IsStatic = true, Notes = "Returns the entire contents of the specified file. Returns an empty string if the file cannot be opened." }, + Rename = { Params = "OrigPath, NewPath", Return = "bool", IsStatic = true, Notes = "Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." }, }, }, -- cFile @@ -1051,6 +1078,19 @@ cFile:DeleteFile("/usr/bin/virus.exe"); Inherits = "cEntity", }, + + cHangingEntity = + { + -- TODO: Description + Inherits = "cEntity", + Functions = + { + GetFacing = { Params = "", Return = "{{Globals#eBlockFace|BlockFace}}", Notes = "Returns the direction in which the entity is facing." }, + SetFacing = { Params = "{{Globals#eBlockFace|BlockFace}}", Return = "", Notes = "Set the direction in which the entity is facing." }, + }, + }, + + cIniFile = { Desc = [[ @@ -1115,6 +1155,7 @@ ValueName0=SomeOtherValue DeleteValueByID = { Params = "KeyID, ValueID", Return = "bool", Notes = "Deletes the specified value. Returns true if successful." }, FindKey = { Params = "KeyName", Return = "number", Notes = "Returns the KeyID for the specified key name, or the noID constant if the key doesn't exist." }, FindValue = { Params = "KeyID, ValueName", Return = "numebr", Notes = "Returns the ValueID for the specified value name, or the noID constant if the specified key doesn't contain a value of that name." }, + Flush = { Params = "", Return = "boolean", Notes = "Writes the data stored in the object to the file that was last associated with the object (ReadFile() or WriteFile()). Returns true on success, false on failure." }, GetHeaderComment = { Params = "CommentID", Return = "string", Notes = "Returns the specified header comment, or an empty string if such comment doesn't exist" }, GetKeyComment = { @@ -1136,21 +1177,21 @@ ValueName0=SomeOtherValue }, GetValue = { - { Params = "KeyName, ValueName", Return = "string", Notes = "Returns the value of the specified name under the specified key. Returns an empty string if the value doesn't exist." }, - { Params = "KeyID, ValueID", Return = "string", Notes = "Returns the value of the specified name under the specified key. Returns an empty string if the value doesn't exist." }, + { Params = "KeyName, ValueName, [DefaultValue]", Return = "string", Notes = "Returns the value of the specified name under the specified key. Returns DefaultValue (empty string if not given) if the value doesn't exist." }, + { Params = "KeyID, ValueID, [DefaultValue]", Return = "string", Notes = "Returns the value of the specified name under the specified key. Returns DefaultValue (empty string if not given) if the value doesn't exist." }, }, - GetValueB = { Params = "KeyName, ValueName", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. Returns false if the value doesn't exist." }, - GetValueF = { Params = "KeyName, ValueName", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. Returns zero if the value doesn't exist." }, - GetValueI = { Params = "KeyName, ValueName", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. Returns zero if the value doesn't exist." }, + GetValueB = { Params = "KeyName, ValueName, [DefaultValue]", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. Returns DefaultValue (false if not given) if the value doesn't exist." }, + GetValueF = { Params = "KeyName, ValueName, [DefaultValue]", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. Returns DefaultValue (zero if not given) if the value doesn't exist." }, + GetValueI = { Params = "KeyName, ValueName, [DefaultValue]", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. Returns DefaultValue (zero if not given) if the value doesn't exist." }, GetValueName = { - { Params = "KeyID, ValueID", Return = "string", Notes = "Returns the name of the specified value Inverse for FindValue()." }, - { Params = "KeyName, ValueID", Return = "string", Notes = "Returns the name of the specified value Inverse for FindValue()." }, + { Params = "KeyID, ValueID", Return = "string", Notes = "Returns the name of the value specified by its ID. Inverse for FindValue()." }, + { Params = "KeyName, ValueID", Return = "string", Notes = "Returns the name of the value specified by its ID. Inverse for FindValue()." }, }, - GetValueSet = { Params = "KeyName, ValueName, Default", Return = "string", Notes = "Returns the value of the specified name under the specified key. If the value doesn't exist, creates it with the specified default." }, - GetValueSetB = { Params = "KeyName, ValueName, Default", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. If the value doesn't exist, creates it with the specified default." }, - GetValueSetF = { Params = "KeyName, ValueName, Default", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. If the value doesn't exist, creates it with the specified default." }, - GetValueSetI = { Params = "KeyName, ValueName, Default", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. If the value doesn't exist, creates it with the specified default." }, + GetValueSet = { Params = "KeyName, ValueName, [DefaultValue]", Return = "string", Notes = "Returns the value of the specified name under the specified key. If the value doesn't exist, creates it with the specified default (empty string if not given)." }, + GetValueSetB = { Params = "KeyName, ValueName, [DefaultValue]", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. If the value doesn't exist, creates it with the specified default (false if not given)." }, + GetValueSetF = { Params = "KeyName, ValueName, [DefaultValue]", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. If the value doesn't exist, creates it with the specified default (zero if not given)." }, + GetValueSetI = { Params = "KeyName, ValueName, [DefaultValue]", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. If the value doesn't exist, creates it with the specified default (zero if not given)." }, HasValue = { Params = "KeyName, ValueName", Return = "bool", Notes = "Returns true if the specified value is present." }, ReadFile = { Params = "FileName, [AllowExampleFallback]", Return = "bool", Notes = "Reads the values from the specified file. Previous in-memory contents are lost. If the file cannot be opened, and AllowExample is true, another file, \"filename.example.ini\", is loaded and then saved as \"filename.ini\". Returns true if successful, false if not." }, SetValue = @@ -1208,6 +1249,7 @@ end }, -- AdditionalInfo }, -- cIniFile + cInventory = { Desc = [[This object is used to store the items that a {{cPlayer|cPlayer}} has. It also keeps track of what item the player has currently selected in their hotbar. @@ -1245,10 +1287,15 @@ These ItemGrids are available in the API and can be manipulated by the plugins, GetOwner = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player whose inventory this object represents" }, GetSlot = { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the contents of the specified slot. Note that the returned item is read-only" }, HasItems = { Params = "{{cItem|cItem}}", Return = "bool", Notes = "Returns true if there are at least as many items of the specified type as in the parameter" }, - HowManyCanFit = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that can fit in the storage, including empty slots" }, + HowManyCanFit = + { + { Params = "{{cItem|ItemStack}}, [AllowNewStacks]", Return = "number", Notes = "Returns number of items out of a_ItemStack that can fit in the storage. If AllowNewStacks is false, only considers slots already containing the specified item. AllowNewStacks defaults to true if not given." }, + { Params = "{{cItem|ItemStack}}, BeginSlotNum, EndSlotNum, [AllowNewStacks]", Return = "number", Notes = "Returns how many items of the specified type would fit into the slot range specified. If AllowNewStacks is false, only considers slots already containing the specified item. AllowNewStacks defaults to true if not given." }, + }, HowManyItems = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that are currently stored" }, RemoveItem = { Params = "{{cItem}}", Return = "number", Notes = "Removes the specified item from the inventory, as many as possible, up to the item's m_ItemCount. Returns the number of items that were removed." }, RemoveOneEquippedItem = { Params = "", Return = "", Notes = "Removes one item from the hotbar's currently selected slot" }, + SendEquippedSlot = { Params = "", Return = "", Notes = "Sends the equipped item slot to the client" }, SetArmorSlot = { Params = "ArmorSlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified armor slot contents" }, SetEquippedSlotNum = { Params = "EquippedSlotNum", Return = "", Notes = "Sets the currently selected hotbar slot number" }, SetHotbarSlot = { Params = "HotbarSlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified hotbar slot contents" }, @@ -1277,6 +1324,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, }, }, -- cInventory + cItem = { Desc = [[ @@ -1298,7 +1346,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, constructor = { { Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" }, - { Params = "ItemType, Count, Damage, EnchantmentString, CustomName, Lore", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default), enchantments (non-enchanted by default), CustomName (empty by default) and Lore (string, empty by default)" }, + { Params = "ItemType, [Count], [Damage], [EnchantmentString], [CustomName], [Lore]", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default), enchantments (non-enchanted by default), CustomName (empty by default) and Lore (string, empty by default)" }, { Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" }, } , AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." }, @@ -1318,7 +1366,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." }, GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" }, EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." }, - IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function is used in the anvil inventory with book enchantments. So it checks the \"only book enchantments\" too. Example: You can only enchant a hoe with a book." }, + IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is enchantable. If WithBook is true, the function is used in the anvil inventory with book enchantments. So it checks the \"only book enchantments\" too. Example: You can only enchant a hoe with a book." }, }, Variables = { @@ -1374,6 +1422,20 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3"); }, }, -- cItem + + cItemFrame = + { + -- TODO: Description + Functions = + { + GetItem = { Params = "", Return = "const cItem", Notes = "Returns the item in the frame" }, + GetItemRotation = { Params = "", Return = "number", Notes = "Returns the rotation from the item in the frame" }, + SetItem = { Params = "{{cItem|Item}}", Return = "", Notes = "Set the item in the frame" }, + SetItemRotation = { Params = "ItemRotation", Return = "", Notes = "Set the rotation from the item in the frame" }, + }, + }, + + cItemGrid = { Desc = [[This class represents a 2D array of items. It is used as the underlying storage and API for all cases that use a grid of items: @@ -1391,15 +1453,15 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3"); ]], Functions = { - AddItem = { Params = "{{cItem|cItem}}, [AllowNewStacks]", Return = "number", Notes = "Adds an item to the storage; if AllowNewStacks is true (default), will also create new stacks in empty slots. Returns the number of items added" }, - AddItems = { Params = "{{cItems|cItems}}, [AllowNewStacks]", Return = "number", Notes = "Same as AddItem, but for several items at once" }, + AddItem = { Params = "{{cItem|ItemStack}}, [AllowNewStacks], [PrioritarySlot]", Return = "number", Notes = "Adds as many items out of ItemStack as can fit. If AllowNewStacks is set to false, only existing stacks can be topped up. If AllowNewStacks is set to true (default), empty slots can be used for the rest. If PrioritarySlot is set to a non-negative value, then the corresponding slot will be used first (if empty or compatible with added items). If PrioritarySlot is set to -1 (default), regular order applies. Returns the number of items that fit." }, + AddItems = { Params = "{{cItems|ItemStackList}}, [AllowNewStacks], [PrioritarySlot]", Return = "number", Notes = "Same as AddItem, but works on an entire list of item stacks. The a_ItemStackList is modified to reflect the leftover items. If a_AllowNewStacks is set to false, only existing stacks can be topped up. If AllowNewStacks is set to true, empty slots can be used for the rest. If PrioritarySlot is set to a non-negative value, then the corresponding slot will be used first (if empty or compatible with added items). If PrioritarySlot is set to -1 (default), regular order applies. Returns the total number of items that fit." }, ChangeSlotCount = { { Params = "SlotNum, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid SlotNum" }, { Params = "X, Y, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid slot coords" }, }, Clear = { Params = "", Return = "", Notes = "Empties all slots" }, - CopyToItems = { Params = "{{cItems|cItems}}", Return = "", Notes = "Copies all non-empty slots into the cItems object provided; original cItems contents are preserved" }, + CopyToItems = { Params = "{{cItems}}", Return = "", Notes = "Copies all non-empty slots into the {{cItems}} object provided; original cItems contents are preserved as well." }, DamageItem = { { Params = "SlotNum, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" }, @@ -1420,15 +1482,15 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3"); GetNumSlots = { Params = "", Return = "number", Notes = "Returns the total number of slots in the grid (Width * Height)" }, GetSlot = { - { Params = "SlotNumber", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, - { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, + { Params = "SlotNumber", Return = "{{cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, + { Params = "X, Y", Return = "{{cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, }, GetSlotCoords = { Params = "SlotNum", Return = "number, number", Notes = "Returns the X and Y coords for the specified SlotNumber. Returns \"-1, -1\" on invalid SlotNumber" }, GetSlotNum = { Params = "X, Y", Return = "number", Notes = "Returns the SlotNumber for the specified slot coords. Returns -1 on invalid coords" }, GetWidth = { Params = "", Return = "number", Notes = "Returns the X dimension of the grid" }, - HasItems = { Params = "{{cItem|cItem}}", Return = "bool", Notes = "Returns true if there are at least as many items of the specified type as in the parameter" }, - HowManyCanFit = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that can fit in the storage, including empty slots" }, - HowManyItems = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that are currently stored" }, + HasItems = { Params = "{{cItem}}", Return = "bool", Notes = "Returns true if there are at least as many items of the specified type as in the parameter" }, + HowManyCanFit = { Params = "{{cItem}}, [AllowNewStacks]", Return = "number", Notes = "Returns the number of the specified items that can fit in the storage. If AllowNewStacks is true (default), includes empty slots in the returned count." }, + HowManyItems = { Params = "{{cItem}}", Return = "number", Notes = "Returns the number of the specified items that are currently stored" }, IsSlotEmpty = { { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" }, @@ -1437,13 +1499,15 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3"); RemoveItem = { Params = "{{cItem}}", Return = "number", Notes = "Removes the specified item from the grid, as many as possible, up to the item's m_ItemCount. Returns the number of items that were removed." }, RemoveOneItem = { - { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, - { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, + { Params = "SlotNum", Return = "{{cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, + { Params = "X, Y", Return = "{{cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, }, SetSlot = { - { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, - { Params = "X, Y, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, + { Params = "SlotNum, {{cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, + { Params = "SlotNum, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the specified slot to the specified item" }, + { Params = "X, Y, {{cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, + { Params = "X, Y, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the specified slot to the specified item" }, }, }, AdditionalInfo = @@ -1738,12 +1802,12 @@ a_Player:OpenWindow(Window); ]], Functions = { - AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", Notes = "(STATIC) Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp. Accepts both short or dashed UUIDs. " }, - GetPlayerNameFromUUID = { Params = "UUID, [UseOnlyCached]", Return = "PlayerName", Notes = "(STATIC) Returns the playername that corresponds to the given UUID, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the UUID is not in the cache. The UUID can be either short or dashed. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." }, - GetUUIDFromPlayerName = { Params = "PlayerName, [UseOnlyCached]", Return = "UUID", Notes = "(STATIC) Returns the (short) UUID that corresponds to the given playername, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the playername is not in the cache. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." }, - GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", Return = "table", Notes = "(STATIC) Returns a table that contains the map, 'PlayerName' -> '(short) UUID', for all valid playernames in the input array-table. PlayerNames not recognized will not be set in the returned map. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." }, - MakeUUIDDashed = { Params = "UUID", Return = "DashedUUID", Notes = "(STATIC) Converts the UUID to a dashed format (\"01234567-8901-2345-6789-012345678901\"). Accepts both dashed or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." }, - MakeUUIDShort = { Params = "UUID", Return = "ShortUUID", Notes = "(STATIC) Converts the UUID to a short format (without dashes, \"01234567890123456789012345678901\"). Accepts both dashed or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." }, + AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", IsStatic = true, Notes = "Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp. Accepts both short or dashed UUIDs. " }, + GetPlayerNameFromUUID = { Params = "UUID, [UseOnlyCached]", Return = "PlayerName", IsStatic = true, Notes = "Returns the playername that corresponds to the given UUID, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the UUID is not in the cache. The UUID can be either short or dashed. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." }, + GetUUIDFromPlayerName = { Params = "PlayerName, [UseOnlyCached]", Return = "UUID", IsStatic = true, Notes = "Returns the (short) UUID that corresponds to the given playername, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the playername is not in the cache. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." }, + GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", Return = "table", IsStatic = true, Notes = "Returns a table that contains the map, 'PlayerName' -> '(short) UUID', for all valid playernames in the input array-table. PlayerNames not recognized will not be set in the returned map. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." }, + MakeUUIDDashed = { Params = "UUID", Return = "DashedUUID", IsStatic = true, Notes = "Converts the UUID to a dashed format (\"01234567-8901-2345-6789-012345678901\"). Accepts both dashed or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." }, + MakeUUIDShort = { Params = "UUID", Return = "ShortUUID", IsStatic = true, Notes = "Converts the UUID to a short format (without dashes, \"01234567890123456789012345678901\"). Accepts both dashed or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." }, }, }, @@ -1762,14 +1826,14 @@ a_Player:OpenWindow(Window); SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of the monster. You see the name over the monster. If you want to disable the custom name, simply set an empty string." }, IsCustomNameAlwaysVisible = { Params = "", Return = "bool", Notes = "Is the custom name of this monster always visible? If not, you only see the name when you sight the mob." }, SetCustomNameAlwaysVisible = { Params = "bool", Return = "", Notes = "Sets the custom name visiblity of this monster. If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name." }, - FamilyFromType = { Params = "{{Globals#MobType|MobType}}", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "(STATIC) Returns the mob family ({{cMonster#MobFamily|mfXXX}} constants) based on the mob type ({{Globals#MobType|mtXXX}} constants)" }, + FamilyFromType = { Params = "{{Globals#MobType|MobType}}", Return = "{{cMonster#MobFamily|MobFamily}}", IsStatic = true, Notes = "Returns the mob family ({{cMonster#MobFamily|mfXXX}} constants) based on the mob type ({{Globals#MobType|mtXXX}} constants)" }, GetMobFamily = { Params = "", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "Returns this mob's family ({{cMonster#MobFamily|mfXXX}} constant)" }, GetMobType = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the type of this mob ({{Globals#MobType|mtXXX}} constant)" }, - GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", Notes = "(STATIC) Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." }, - MobTypeToString = { Params = "{{Globals#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{Globals#MobType|mtXXX}} constant), or empty string if unknown type." }, - MobTypeToVanillaName = { Params = "{{Globals#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the vanilla name of the given mob type, or empty string if unknown type." }, + GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", IsStatic = true, Notes = "Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." }, + MobTypeToString = { Params = "{{Globals#MobType|MobType}}", Return = "string", IsStatic = true, Notes = "Returns the string representing the given mob type ({{Globals#MobType|mtXXX}} constant), or empty string if unknown type." }, + MobTypeToVanillaName = { Params = "{{Globals#MobType|MobType}}", Return = "string", IsStatic = true, Notes = "Returns the vanilla name of the given mob type, or empty string if unknown type." }, MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" }, - StringToMobType = { Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{Globals#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." }, + StringToMobType = { Params = "string", Return = "{{Globals#MobType|MobType}}", IsStatic = true, Notes = "Returns the mob type ({{Globals#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." }, GetRelativeWalkSpeed = { Params = "", Return = "number", Notes = "Returns the relative walk speed of this mob. Standard is 1.0" }, SetRelativeWalkSpeed = { Params = "number", Return = "", Notes = "Sets the relative walk speed of this mob. Standard is 1.0" }, SetAge = { Params = "number", Return = "", Notes = "Sets the age of the monster" }, @@ -1879,16 +1943,16 @@ a_Player:OpenWindow(Window); ]], Functions = { - TeleportToEntity = { Return = "" }, - TeleportTo = { Return = "" }, + AddEntityEffect = { Params = "{{cEntityEffect|EffectType}}, EffectDurationTicks, EffectIntensity, DistanceModifier", Return = "", Notes = "Applies an entity effect. Checks with plugins if they allow the addition. EffectIntensity is the level of the effect (0 = Potion I, 1 = Potion II, etc). DistanceModifier is the scalar multiplied to the potion duration (only applies to splash potions)." }, + ClearEntityEffects = { Return = "", Notes = "Removes all currently applied entity effects" }, + GetHealth = { Return = "number" }, + HasEntityEffect = { Return = "bool", Params = "{{cEntityEffect|EffectType}}", Notes = "Returns true, if the supplied entity effect type is currently applied" }, Heal = { Return = "" }, - TakeDamage = { Return = "" }, KilledBy = { Return = "" }, - GetHealth = { Return = "number" }, - AddEntityEffect = { Params = "{{cEntityEffect|EffectType}}", Return = "", Notes = "Applies an entity effect" }, RemoveEntityEffect = { Params = "{{cEntityEffect|EffectType}}", Return = "", Notes = "Removes a currently applied entity effect" }, - HasEntityEffect = { Return = "bool", Params = "{{cEntityEffect|EffectType}}", Notes = "Returns true, if the supplied entity effect type is currently applied" }, - ClearEntityEffects = { Return = "", Notes = "Removes all currently applied entity effects" }, + TakeDamage = { Return = "" }, + TeleportToEntity = { Return = "" }, + TeleportTo = { Return = "" }, }, Inherits = "cEntity", }, -- cPawn @@ -1922,7 +1986,7 @@ a_Player:OpenWindow(Window); Functions = { AddFoodExhaustion = { Params = "Exhaustion", Return = "", Notes = "Adds the specified number to the food exhaustion. Only positive numbers expected." }, - CalcLevelFromXp = { Params = "XPAmount", Return = "number", Notes = "(STATIC) Returns the level which is reached with the specified amount of XP. Inverse of XpForLevel()." }, + CalcLevelFromXp = { Params = "XPAmount", Return = "number", IsStatic = true, Notes = "Returns the level which is reached with the specified amount of XP. Inverse of XpForLevel()." }, CanFly = { Return = "bool", Notes = "Returns if the player is able to fly." }, CloseWindow = { Params = "[CanRefuse]", Return = "", Notes = "Closes the currently open UI window. If CanRefuse is true (default), the window may refuse the closing." }, CloseWindowIfID = { Params = "WindowID, [CanRefuse]", Return = "", Notes = "Closes the currently open UI window if its ID matches the given ID. If CanRefuse is true (default), the window may refuse the closing." }, @@ -1983,7 +2047,7 @@ a_Player:OpenWindow(Window); LoadRank = { Params = "", Return = "", Notes = "Reloads the player's rank, message visuals and permissions from the {{cRankManager}}, based on the player's current rank." }, MoveTo = { Params = "{{Vector3d|NewPosition}}", Return = "Tries to move the player into the specified position." }, OpenWindow = { Params = "{{cWindow|Window}}", Return = "", Notes = "Opens the specified UI window for the player." }, - PermissionMatches = { Params = "Permission, Template", Return = "bool", Notes = "(STATIC) Returns true if the specified permission matches the specified template. The template may contain wildcards." }, + PermissionMatches = { Params = "Permission, Template", Return = "bool", IsStatic = true, Notes = "Returns true if the specified permission matches the specified template. The template may contain wildcards." }, PlaceBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "bool", Notes = "Places a block while impersonating the player. The {{OnPlayerPlacingBlock|HOOK_PLAYER_PLACING_BLOCK}} hook is called before the placement, and if it succeeds, the block is placed and the {{OnPlayerPlacedBlock|HOOK_PLAYER_PLACED_BLOCK}} hook is called. Returns true iff the block is successfully placed. Assumes that the block is in a currently loaded chunk." }, Respawn = { Params = "", Return = "", Notes = "Restores the health, extinguishes fire, makes visible and sends the Respawn packet." }, SendBlocksAround = { Params = "BlockX, BlockY, BlockZ, [Range]", Return = "", Notes = "Sends all the world's blocks in Range from the specified coords to the player, as a BlockChange packet. Range defaults to 1 (only one block sent)." }, @@ -2021,7 +2085,7 @@ a_Player:OpenWindow(Window); TossHeldItem = { Params = "[Amount]", Return = "", Notes = "Tosses the item held by the cursor, then the player is in a UI window. Amount defaults to 1." }, TossPickup = { Params = "{{cItem|Item}}", Return = "", Notes = "Tosses a pickup newly created from the specified item." }, Unfreeze = { Params = "", Return = "", Notes = "Allows the player to move again, canceling the effects of Freeze()" }, - XpForLevel = { Params = "XPLevel", Return = "number", Notes = "(STATIC) Returns the total amount of XP needed for the specified XP level. Inverse of CalcLevelFromXp()." }, + XpForLevel = { Params = "XPLevel", Return = "number", IsStatic = true, Notes = "Returns the total amount of XP needed for the specified XP level. Inverse of CalcLevelFromXp()." }, }, Constants = { @@ -2130,16 +2194,16 @@ a_Player:OpenWindow(Window); DoWithPlayerByUUID = { Params = "PlayerUUID, CallbackFunction", Return = "bool", Notes = "If there is the player with the uuid, calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." }, ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" }, ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cWorld|cWorld}})</pre>" }, - Get = { Params = "", Return = "Root object", Notes = "(STATIC) This function returns the cRoot object." }, - GetBrewingRecipe = { Params = "{{cItem|cItem}}, {{cItem|cItem}}", Return = "{{cItem|cItem}}", Notes = "(STATIC) Returns the result item, if a recipe has been found. If no recipe is found, returns no value." }, - GetBuildCommitID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: <CommitHash>\"." }, - GetBuildDateTime = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: <DateTime-iso8601>\"." }, - GetBuildID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." }, - GetBuildSeriesName = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the series name of the build (for example \"Cuberite Windows x64 Master\"). For unofficial local builds, returns the string \"local build\"." }, + Get = { Params = "", Return = "Root object", IsStatic = true, Notes = "This function returns the cRoot object." }, + GetBrewingRecipe = { Params = "{{cItem|cItem}}, {{cItem|cItem}}", Return = "{{cItem|cItem}}", IsStatic = true, Notes = "Returns the result item, if a recipe has been found. If no recipe is found, returns no value." }, + GetBuildCommitID = { Params = "", Return = "string", IsStatic = true, Notes = "For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: <CommitHash>\"." }, + GetBuildDateTime = { Params = "", Return = "string", IsStatic = true, Notes = "For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: <DateTime-iso8601>\"." }, + GetBuildID = { Params = "", Return = "string", IsStatic = true, Notes = "For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." }, + GetBuildSeriesName = { Params = "", Return = "string", IsStatic = true, Notes = "For official builds (Travis CI / Jenkins) it returns the series name of the build (for example \"Cuberite Windows x64 Master\"). For unofficial local builds, returns the string \"local build\"." }, GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" }, GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." }, - GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", Notes = "(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." }, - GetFurnaceRecipe = { Params = "{{cItem|InItem}}", Return = "{{cItem|OutItem}}, NumTicks, {{cItem|InItem}}", Notes = "(STATIC) Returns the furnace recipe for smelting the specified input. If a recipe is found, returns the smelted result, the number of ticks required for the smelting operation, and the input consumed (note that Cuberite supports smelting M items into N items and different smelting rates). If no recipe is found, returns no value." }, + GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", IsStatic = true, Notes = "Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." }, + GetFurnaceRecipe = { Params = "{{cItem|InItem}}", Return = "{{cItem|OutItem}}, NumTicks, {{cItem|InItem}}", IsStatic = true, Notes = "Returns the furnace recipe for smelting the specified input. If a recipe is found, returns the smelted result, the number of ticks required for the smelting operation, and the input consumed (note that Cuberite supports smelting M items into N items and different smelting rates). If no recipe is found, returns no value." }, GetPhysicalRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of physical RAM that the entire Cuberite process is using, in KiB. Negative if the OS doesn't support this query." }, GetPluginManager = { Params = "", Return = "{{cPluginManager|cPluginManager}}", Notes = "Returns the cPluginManager object." }, GetPrimaryServerVersion = { Params = "", Return = "number", Notes = "Returns the servers primary server version." }, @@ -2223,11 +2287,13 @@ end ]], Functions = { + DoesAllowMultiLogin = { Params = "", Return = "boolean", Notes = "Returns true if players can log in multiple times from the same account (normally used for debugging), false if only one player per name is allowed." }, GetDescription = { Return = "string", Notes = "Returns the server description set in the settings.ini." }, GetMaxPlayers = { Return = "number", Notes = "Returns the max amount of players who can join the server." }, GetNumPlayers = { Return = "number", Notes = "Returns the amount of players online." }, GetServerID = { Return = "string", Notes = "Returns the ID of the server?" }, IsHardcore = { Params = "", Return = "bool", Notes = "Returns true if the server is hardcore (players get banned on death)." }, + IsPlayerInQueue = { Params = "Username", Return = "boolean", Notes = "Returns true if the specified player is queued to be transferred to a World." }, SetMaxPlayers = { Params = "number", Notes = "Sets the max amount of players who can join." }, ShouldAuthenticate = { Params = "", Return = "bool", Notes = "Returns true iff the server is set to authenticate players (\"online mode\")." }, }, @@ -2280,6 +2346,7 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress") }, }, -- cTeam + cTNTEntity = { Desc = "This class manages a TNT entity.", @@ -2287,11 +2354,12 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress") { Explode = { Return = "", Notes = "Explode the tnt." }, GetFuseTicks = { Return = "number", Notes = "Returns the fuse ticks until the tnt will explode." }, - SetFuseTicks = { Return = "number", Notes = "Set the fuse ticks until the tnt will explode." }, + SetFuseTicks = { Params = "number", Notes = "Set the fuse ticks until the tnt will explode." }, }, Inherits = "cEntity", }, -- cTNTEntity + cUrlParser = { Desc = [[ @@ -2301,10 +2369,10 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress") ]], Functions = { - GetDefaultPort = { Params = "Scheme", Return = "number", Notes = "(STATIC) Returns the default port that should be used for the given scheme (protocol). Returns zero if the scheme is not known." }, - IsKnownScheme = { Params = "Scheme", Return = "bool", Notes = "(STATIC) Returns true if the scheme (protocol) is recognized by the parser." }, - Parse = { Params = "URL", Return = "Scheme, Username, Password, Host, Port, Path, Query, Fragment", Notes = "(STATIC) Returns the individual parts of the URL. Parts that are not explicitly specified in the URL are empty, the default port for the scheme is used. If parsing fails, the function returns nil and an error message." }, - ParseAuthorityPart = { Params = "AuthPart", Return = "Username, Password, Host, Port", Notes = "(STATIC) Parses the Authority part of the URL. Parts that are not explicitly specified in the AuthPart are returned empty, the port is returned zero. If parsing fails, the function returns nil and an error message." }, + GetDefaultPort = { Params = "Scheme", Return = "number", IsStatic = true, Notes = "Returns the default port that should be used for the given scheme (protocol). Returns zero if the scheme is not known." }, + IsKnownScheme = { Params = "Scheme", Return = "bool", IsStatic = true, Notes = "Returns true if the scheme (protocol) is recognized by the parser." }, + Parse = { Params = "URL", Return = "Scheme, Username, Password, Host, Port, Path, Query, Fragment", IsStatic = true, Notes = "Returns the individual parts of the URL. Parts that are not explicitly specified in the URL are empty, the default port for the scheme is used. If parsing fails, the function returns nil and an error message." }, + ParseAuthorityPart = { Params = "AuthPart", Return = "Username, Password, Host, Port", IsStatic = true, Notes = "Parses the Authority part of the URL. Parts that are not explicitly specified in the AuthPart are returned empty, the port is returned zero. If parsing fails, the function returns nil and an error message." }, }, AdditionalInfo = { @@ -2335,12 +2403,14 @@ end }, }, -- cUrlParser + cWebPlugin = { Desc = "", Functions = {}, }, -- cWebPlugin + cWindow = { Desc = [[ @@ -2363,10 +2433,11 @@ end GetWindowID = { Params = "", Return = "number", Notes = "Returns the ID of the window, as used by the network protocol" }, GetWindowTitle = { Params = "", Return = "string", Notes = "Returns the window title that will be displayed to the player" }, GetWindowType = { Params = "", Return = "number", Notes = "Returns the type of the window, one of the constants in the table above" }, + GetWindowTypeName = { Params = "", Return = "string", Notes = "Returns the textual representation of the window's type, such as \"minecraft:chest\"." }, IsSlotInPlayerHotbar = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player hotbar" }, IsSlotInPlayerInventory = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory or in the hotbar. Note that this returns false for armor slots!" }, IsSlotInPlayerMainInventory = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory" }, - SetProperty = { Params = "PropertyID, PropartyValue, {{cPlayer|Player}}", Return = "", Notes = "Sends the UpdateWindowProperty (0x69) packet to the specified player; or to all players who are viewing this window if Player is not specified or nil." }, + SetProperty = { Params = "PropertyID, PropartyValue, [{{cPlayer|Player}}]", Return = "", Notes = "Updates a numerical property associated with the window. Typically used for furnace progressbars. Sends the UpdateWindowProperty packet to the specified Player, or to all current clients of the window if Player is not specified." }, SetSlot = { Params = "{{cPlayer|Player}}, SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the contents of the specified slot for the specified player. Ignored if the slot number is invalid" }, SetWindowTitle = { Params = "string", Return = "", Notes = "Sets the window title that will be displayed to the player" }, }, @@ -2387,6 +2458,7 @@ end }, }, -- cWindow + cWorld = { Desc = [[ @@ -2424,7 +2496,7 @@ end { AreCommandBlocksEnabled = { Params = "", Return = "bool", Notes = "Returns whether command blocks are enabled on the (entire) server" }, BroadcastBlockAction = { Params = "BlockX, BlockY, BlockZ, ActionByte1, ActionByte2, BlockType, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Broadcasts the BlockAction packet to all clients who have the appropriate chunk loaded (except ExcludeClient). The contents of the packet are specified by the parameters for the call, the blocktype needn't match the actual block that is present in the world data at the specified location." }, - BroadcastChat = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the Message to all players in this world, except the optional ExcludeClient. No formatting is done by the server." }, + BroadcastChat = { Params = "Message, [{{cClientHandle|ExcludeClient}}], [ChatPrefix]", Return = "", Notes = "Sends the Message to all players in this world, except the optional ExcludeClient. No formatting is done by the server." }, BroadcastChatDeath = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Gray [DEATH] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For when a player dies." }, BroadcastChatFailure = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a command that failed to run because of insufficient permissions, etc." }, BroadcastChatFatal = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Red [FATAL] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a plugin that crashed, or similar." }, @@ -2477,7 +2549,11 @@ end { Params = "BlockX, BlockY, BlockZ", Return = "BLOCKTYPE", Notes = "Returns the block type of the block at the specified coords, or 0 if the appropriate chunk is not loaded." }, { Params = "{{Vector3i|BlockCoords}}", Return = "BLOCKTYPE", Notes = "Returns the block type of the block at the specified coords, or 0 if the appropriate chunk is not loaded." }, }, - GetBlockBlockLight = { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the amount of block light at the specified coords, or 0 if the appropriate chunk is not loaded." }, + GetBlockBlockLight = + { + { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the amount of block light at the specified coords, or 0 if the appropriate chunk is not loaded." }, + { Params = "{{Vector3i|Pos}", Return = "number", Notes = "Returns the amount of block light at the specified coords, or 0 if the appropriate chunk is not loaded." }, + }, GetBlockInfo = { Params = "BlockX, BlockY, BlockZ", Return = "BlockValid, BlockType, BlockMeta, BlockSkyLight, BlockBlockLight", Notes = "Returns the complete block info for the block at the specified coords. The first value specifies if the block is in a valid loaded chunk, the other values are valid only if BlockValid is true." }, GetBlockMeta = { @@ -2557,10 +2633,10 @@ end { Params = "{{cCuboid|Cuboid}}, EMCSBiome", Return = "bool", Notes = "Sets the biome in the cuboid specified. Returns true if successful, false if any of the chunks were unloaded. The cuboid needn't be sorted." }, }, SetBiomeAt = { Params = "BlockX, BlockZ, EMCSBiome", Return = "bool", Notes = "Sets the biome at the specified block coords. Returns true if successful, false otherwise." }, - SetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block at the specified coords, replaces the block entities for the previous block type, creates a new block entity for the new block, if appropriate, and wakes up the simulators. This is the preferred way to set blocks, as opposed to FastSetBlock(), which is only to be used under special circumstances." }, + SetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta, [ShouldSendToClients]", Return = "", Notes = "Sets the block at the specified coords, replaces the block entities for the previous block type, creates a new block entity for the new block, if appropriate, and wakes up the simulators. This is the preferred way to set blocks, as opposed to FastSetBlock(), which is only to be used under special circumstances. If ShouldSendToClients is true (default), the change is broadcast to all players who have this chunk loaded; if false, the change is made server-side only." }, SetBlockMeta = { - { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "", Notes = "Sets the meta for the block at the specified coords." }, + { Params = "BlockX, BlockY, BlockZ, BlockMeta, [ShouldMarkChunkDirty], [ShouldSendToClients]", Return = "", Notes = "Sets the meta for the block at the specified coords. If ShouldMarkChunkDirty is true (default), the chunk is marked dirty and will be saved later on. If ShouldSendToClients is true (default), the change is broadcast to all clients who have the chunk loaded, if false, the change is kept server-side only." }, { Params = "{{Vector3i|BlockCoords}}, BlockMeta", Return = "", Notes = "Sets the meta for the block at the specified coords." }, }, SetChunkAlwaysTicked = { Params = "ChunkX, ChunkZ, IsAlwaysTicked", Return = "", Notes = "Sets the chunk to always be ticked even when it doesn't contain any clients. IsAlwaysTicked set to true turns forced ticking on, set to false turns it off. Every call with 'true' should be paired with a later call with 'false', otherwise the ticking won't stop. Multiple actions can request ticking independently, the ticking will continue until the last call with 'false'. Note that when the chunk unloads, it loses the value of this flag." }, @@ -2589,12 +2665,12 @@ end ShouldLavaSpawnFire = { Params = "", Return = "bool", Notes = "Returns true if the world is configured to spawn fires near lava (world.ini: [Physics].ShouldLavaSpawnFire value)" }, SpawnItemPickups = { - { Params = "{{cItems|Pickups}}, X, Y, Z, FlyAwaySpeed", Return = "", Notes = "Spawns the specified pickups at the position specified. The FlyAway speed is used to initialize the random speed in which the pickups fly away from the spawn position." }, - { Params = "{{cItems|Pickups}}, X, Y, Z, SpeedX, SpeedY, SpeedZ", Return = "", Notes = "Spawns the specified pickups at the position specified. All the pickups fly away from the spawn position using the specified speed." }, + { Params = "{{cItems|Pickups}}, X, Y, Z, [FlyAwaySpeed], [IsPlayerCreated]", Return = "", Notes = "Spawns the specified pickups at the position specified. The FlyAwaySpeed is a coefficient (default: 1) used to initialize the random speed in which the pickups fly away from the spawn position. The IsPlayerCreated parameter (default: false) is used to initialize the created {{cPickup}} object's IsPlayerCreated value." }, + { Params = "{{cItems|Pickups}}, X, Y, Z, SpeedX, SpeedY, SpeedZ, [IsPlayerCreated]", Return = "", Notes = "Spawns the specified pickups at the position specified. All the pickups fly away from the spawn position using the specified speed. The IsPlayerCreated parameter (default: false) is used to initialize the created {{cPickup}} object's IsPlayerCreated value." }, }, - SpawnMinecart = { Params = "X, Y, Z, MinecartType, Item, BlockHeight", Return = "number", Notes = "Spawns a minecart at the specific coordinates. MinecartType is the item type of the minecart. If the minecart is an empty minecart then the given item is the block inside the minecart, and blockheight is the distance of the block and the minecart." }, - SpawnBoat = { Params = "X, Y, Z", Return = "number", Notes = "Spawns a boat at the specific coordinates." }, - SpawnMob = { Params = "X, Y, Z, {{cMonster|MonsterType}}, [Baby]", Return = "EntityID", Notes = "Spawns the specified type of mob at the specified coords. If the Baby parameter is true, the mob will be a baby. Returns the EntityID of the creates entity, or -1 on failure. " }, + SpawnMinecart = { Params = "X, Y, Z, MinecartType, [{{cItem|Item}}], [BlockHeight]", Return = "EntityID", Notes = "Spawns a minecart at the specific coordinates. MinecartType is the item type of the minecart. If the minecart is an empty minecart then the given Item (default: empty) is the block to be displayed inside the minecart, and BlockHeight (default: 1) is the relative distance of the block from the minecart. Returns the entity ID of the new minecart, or {{cEntity#NO_ID|cEntity.NO_ID}} if no minecart was created." }, + SpawnBoat = { Params = "X, Y, Z", Return = "EntityID", Notes = "Spawns a boat at the specific coordinates. Returns the entity ID of the new boat, or {{cEntity#NO_ID|cEntity.NO_ID}} if no boat was created." }, + SpawnMob = { Params = "X, Y, Z, {{cMonster|MonsterType}}, [IsBaby]", Return = "EntityID", Notes = "Spawns the specified type of mob at the specified coords. If the Baby parameter is true, the mob will be a baby. Returns the EntityID of the creates entity, or -1 on failure. " }, SpawnFallingBlock = { Params = "X, Y, Z, BlockType, BlockMeta", Return = "EntityID", Notes = "Spawns an {{cFallingBlock|Falling Block}} entity at the specified coords with the given block type/meta" }, SpawnExperienceOrb = { Params = "X, Y, Z, Reward", Return = "EntityID", Notes = "Spawns an {{cExpOrb|experience orb}} at the specified coords, with the given reward" }, SpawnPrimedTNT = { Params = "X, Y, Z, FuseTicks, InitialVelocityCoeff", Return = "", Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse ticks. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value." }, @@ -2669,6 +2745,7 @@ World:ForEachEntity( }, -- AdditionalInfo }, -- cWorld + ItemCategory = { Desc = [[ @@ -2677,18 +2754,18 @@ World:ForEachEntity( ]], Functions = { - IsArmor = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of an armor." }, - IsAxe = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of an axe." }, - IsBoots = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of boots." }, - IsMinecart = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a minecart." }, - IsChestPlate = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a chestplate." }, - IsHelmet = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a helmet." }, - IsHoe = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a hoe." }, - IsLeggings = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a leggings." }, - IsPickaxe = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a pickaxe." }, - IsShovel = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a shovel." }, - IsSword = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a sword." }, - IsTool = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a tool (axe, hoe, pickaxe, shovel or FIXME: sword)" }, + IsArmor = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of an armor." }, + IsAxe = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of an axe." }, + IsBoots = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of boots." }, + IsMinecart = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a minecart." }, + IsChestPlate = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a chestplate." }, + IsHelmet = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a helmet." }, + IsHoe = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a hoe." }, + IsLeggings = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a leggings." }, + IsPickaxe = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a pickaxe." }, + IsShovel = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a shovel." }, + IsSword = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a sword." }, + IsTool = { Params = "ItemType", Return = "bool", IsStatic = true, Notes = "Returns true if the specified item type is any kind of a tool (axe, hoe, pickaxe, shovel or FIXME: sword)" }, }, AdditionalInfo = { @@ -2708,6 +2785,7 @@ end }, }, -- ItemCategory + lxp = { Desc = [[ @@ -2814,6 +2892,7 @@ Parser:close(); }, -- AdditionalInfo }, -- lxp + sqlite3 = { Desc = [[ @@ -2843,6 +2922,7 @@ myDB:close() }, }, + TakeDamageInfo = { Desc = [[ @@ -2879,6 +2959,7 @@ end }, -- AdditionalInfo }, -- TakeDamageInfo + tolua = { Desc = [[ @@ -2899,6 +2980,7 @@ end }, }, -- tolua + Globals = { Desc = [[ diff --git a/Server/Plugins/APIDump/Classes/BlockEntities.lua b/Server/Plugins/APIDump/Classes/BlockEntities.lua index f3e53351b..4e19e03c0 100644 --- a/Server/Plugins/APIDump/Classes/BlockEntities.lua +++ b/Server/Plugins/APIDump/Classes/BlockEntities.lua @@ -13,6 +13,7 @@ return GetBlockType = { Params = "", Return = "BLOCKTYPE", Notes = "Returns the blocktype which is represented by this blockentity. This is the primary means of type-identification" }, GetChunkX = { Params = "", Return = "number", Notes = "Returns the chunk X-coord of the block entity's chunk" }, GetChunkZ = { Params = "", Return = "number", Notes = "Returns the chunk Z-coord of the block entity's chunk" }, + GetPos = { Params = "", Return = "{{Vector3i}}", Notes = "Returns the name of the parent class, or empty string if no parent class." }, GetPosX = { Params = "", Return = "number", Notes = "Returns the block X-coord of the block entity's block" }, GetPosY = { Params = "", Return = "number", Notes = "Returns the block Y-coord of the block entity's block" }, GetPosZ = { Params = "", Return = "number", Notes = "Returns the block Z-coord of the block entity's block" }, @@ -36,16 +37,16 @@ return Functions = { - GetContents = { Params = "", Return = "{{cItemGrid|cItemGrid}}", Notes = "Returns the cItemGrid object representing the items stored within this block entity" }, + GetContents = { Params = "", Return = "{{cItemGrid}}", Notes = "Returns the cItemGrid object representing the items stored within this block entity" }, GetSlot = { - { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the cItem for the specified slot number. Returns nil for invalid slot numbers" }, - { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Returns the cItem for the specified slot coords. Returns nil for invalid slot coords" }, + { Params = "SlotNum", Return = "{{cItem}}", Notes = "Returns the cItem for the specified slot number. Returns nil for invalid slot numbers" }, + { Params = "X, Y", Return = "{{cItem}}", Notes = "Returns the cItem for the specified slot coords. Returns nil for invalid slot coords" }, }, SetSlot = { - { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the cItem for the specified slot number. Ignored if invalid slot number" }, - { Params = "X, Y, {{cItem|cItem}}", Return = "", Notes = "Sets the cItem for the specified slot coords. Ignored if invalid slot coords" }, + { Params = "SlotNum, {{cItem}}", Return = "", Notes = "Sets the cItem for the specified slot number. Ignored if invalid slot number" }, + { Params = "X, Y, {{cItem}}", Return = "", Notes = "Sets the cItem for the specified slot coords. Ignored if invalid slot coords" }, }, }, }, @@ -53,7 +54,7 @@ return cBeaconEntity = { Desc = [[ - A beacon entity is a {{cBlockEntityWithItems|cBlockEntityWithItems}} descendant that represents a beacon + A beacon entity is a {{cBlockEntityWithItems}} descendant that represents a beacon in the world. ]], @@ -61,18 +62,18 @@ return Functions = { - IsActive = { Params = "", Return = "bool", Notes = "Is the beacon active?" }, - GetBeaconLevel = { Params = "", Return = "number", Notes = "Returns the beacon level. (0 - 4)" }, - GetPrimaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the primary effect." }, - GetSecondaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the secondary effect." }, - SetPrimaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the primary effect. Returns false when the effect is invalid." }, - SetSecondaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the secondary effect. Returns false when the effect is invalid." }, CalculatePyramidLevel = { Params = "", Return = "number", Notes = "Calculate the amount of layers the pyramid below the beacon has." }, + GetBeaconLevel = { Params = "", Return = "number", Notes = "Returns the beacon level. (0 - 4)" }, + GetPrimaryEffect = { Params = "", Return = "{{cEntityEffect#eType|EffectType}}", Notes = "Returns the primary effect." }, + GetSecondaryEffect = { Params = "", Return = "{{cEntityEffect#eType|EffectType}}", Notes = "Returns the secondary effect." }, + GiveEffects = { Params = "", Return = "", Notes = "Give the near-players the effects." }, + IsActive = { Params = "", Return = "bool", Notes = "Is the beacon active?" }, IsBeaconBlocked = { Params = "", Return = "bool", Notes = "Is the beacon blocked by non-transparent blocks that are higher than the beacon?" }, + IsMineralBlock = { Params = "BLOCKTYPE", Return = "bool", IsStatic = true, Notes = "Returns true if the block is a diamond block, a golden block, an iron block or an emerald block." }, + IsValidEffect = { Params = "{{cEntityEffect#eType|EffectType}}, BeaconLevel", Return = "boolean", IsStatic = true, Notes = "Returns true if the effect can be used." }, + SetPrimaryEffect = { Params = "{{cEntityEffect#eType|EffectType}}", Return = "bool", Notes = "Select the primary effect. Returns false when the effect is invalid." }, + SetSecondaryEffect = { Params = "{{cEntityEffect#eType|EffectType}}", Return = "bool", Notes = "Select the secondary effect. Returns false when the effect is invalid." }, UpdateBeacon = { Params = "", Return = "", Notes = "Update the beacon." }, - GiveEffects = { Params = "", Return = "", Notes = "Give the near-players the effects." }, - IsMineralBlock = { Params = "BLOCKTYPE", Return = "bool", Notes = "Returns true if the block is a diamond block, a golden block, an iron block or an emerald block." }, - IsValidEffect = { Params = "EffectType", Return = "bool", Notes = "Returns true if the effect can be used." }, }, }, @@ -87,15 +88,15 @@ return { GetBrewingTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current items finishes brewing, in ticks" }, GetTimeBrewed = { Params = "", Return = "number", Notes = "Returns the time that the current items has been brewing, in ticks" }, - GetLeftBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the left bottle slot" }, - GetMiddleBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the middle bottle slot" }, - GetRightBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the right bottle slot" }, - GetIndgredientSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the ingredient slot" }, - GetResultItem = { Params = "number", Return = "{{cItem|cItem}}", Notes = "Returns the expected result item for the given slot number." }, - SetLeftBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the left bottle slot" }, - SetMiddleBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the middle bottle slot" }, - SetRightBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the right bottle slot" }, - SetIngredientSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the ingredient bottle slot" }, + GetLeftBottleSlot = { Params = "", Return = "{{cItem}}", Notes = "Returns the item in the left bottle slot" }, + GetMiddleBottleSlot = { Params = "", Return = "{{cItem}}", Notes = "Returns the item in the middle bottle slot" }, + GetRightBottleSlot = { Params = "", Return = "{{cItem}}", Notes = "Returns the item in the right bottle slot" }, + GetIndgredientSlot = { Params = "", Return = "{{cItem}}", Notes = "Returns the item in the ingredient slot" }, + GetResultItem = { Params = "number", Return = "{{cItem}}", Notes = "Returns the expected result item for the given slot number." }, + SetLeftBottleSlot = { Params = "{{cItem|LeftSlot}}", Return = "", Notes = "Sets the item in the left bottle slot" }, + SetMiddleBottleSlot = { Params = "{{cItem|MiddleSlot}}", Return = "", Notes = "Sets the item in the middle bottle slot" }, + SetRightBottleSlot = { Params = "{{cItem|RightSlot}}", Return = "", Notes = "Sets the item in the right bottle slot" }, + SetIngredientSlot = { Params = "{{cItem|Ingredient}}", Return = "", Notes = "Sets the item in the ingredient bottle slot" }, }, Constants = { @@ -154,16 +155,36 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], }, }, -- AdditionalInfo - }, + }, -- cChestEntity + + + cCommandBlockEntity = + { + Inherits = "cBlockEntity", + Functions = + { + Activate = { Params = "", Return = "", Notes = "Sets the command block to execute a command in the next tick" }, + GetCommand = { Params = "", Return = "string", Notes = "Retrieves stored command" }, + GetLastOutput = { Params = "", Return = "string", Notes = "Retrieves the last line of output generated by the command block" }, + GetResult = { Params = "", Return = "number", Notes = "Retrieves the result (signal strength) of the last operation" }, + SetCommand = { Params = "Cmd", Return = "string", Notes = "Sets the command" }, + }, + }, -- cCommandBlockEntity + cDispenserEntity = { Desc = [[ This class represents a dispenser block entity in the world. Most of this block entity's - functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents - the behavior common with a {{cDropperEntity|dropper}} entity. + functionality is implemented in the {{cDropSpenserEntity}} class that represents + the behavior common with the {{cDropperEntity|dropper}} block entity. ]], Inherits = "cDropSpenserEntity", + Functions = + { + GetShootVector = { Params = "BlockMeta", Return = "{{Vector3d}}", IsStatic = true, Notes = "Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would be facing." }, + SpawnProjectileFromDispenser = { Params = "BlockX, BlockY, BlockZ, {{cProjectileEntity#eKind|Kind}}, Speed, {{cItem|Item}}", Return = "number", Notes = "Spawns a projectile of the given kind in front of the dispenser with the specified speed. Returns the UniqueID of the spawned projectile, or {{cEntity#INVALID_ID|cEntity.INVALID_ID}} on failure." }, + }, }, cDropperEntity = @@ -178,6 +199,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cDropSpenserEntity", }, -- cDropperEntity + cDropSpenserEntity = { Desc = [[ @@ -197,6 +219,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cBlockEntityWithItems"; }, -- cDropSpenserEntity + cFurnaceEntity = { Desc = [[ @@ -236,6 +259,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cBlockEntityWithItems" }, -- cFurnaceEntity + cHopperEntity = { Desc = [[ @@ -254,6 +278,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cBlockEntityWithItems", }, -- cHopperEntity + cJukeboxEntity = { Desc = [[ @@ -272,6 +297,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), }, }, -- cJukeboxEntity + cMobHeadEntity = { Desc = [[ @@ -280,18 +306,23 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cBlockEntity", Functions = { - SetType = { Params = "eMobHeadType", Return = "", Notes = "Set the type of the mob head" }, - SetRotation = { Params = "eMobHeadRotation", Return = "", Notes = "Sets the rotation of the mob head" }, - SetOwner = { Params = "cPlayer", Return = "", Notes = "Set the {{cPlayer|player}} for mob heads with player type" }, - GetType = { Params = "", Return = "eMobHeadType", Notes = "Returns the type of the mob head" }, - GetRotation = { Params = "", Return = "eMobHeadRotation", Notes = "Returns the rotation of the mob head" }, GetOwnerName = { Params = "", Return = "string", Notes = "Returns the player name of the mob head" }, - GetOwnerUUID = { Params = "", Return = "string", Notes = "Returns the player UUID of the mob head" }, GetOwnerTexture = { Params = "", Return = "string", Notes = "Returns the player texture of the mob head" }, GetOwnerTextureSignature = { Params = "", Return = "string", Notes = "Returns the signature of the player texture of the mob head" }, + GetOwnerUUID = { Params = "", Return = "string", Notes = "Returns the player UUID of the mob head" }, + GetRotation = { Params = "", Return = "eMobHeadRotation", Notes = "Returns the rotation of the mob head" }, + GetType = { Params = "", Return = "eMobHeadType", Notes = "Returns the type of the mob head" }, + SetOwner = + { + { Params = "cPlayer", Return = "", Notes = "Set the {{cPlayer|player}} for mob heads with player type" }, + { Params = "OwnerUUID, OwnerName, OwnerTexture, OwnerTextureSignature", Return = "", Notes = "Sets the player components for the mob heads with player type" }, + }, + SetRotation = { Params = "eMobHeadRotation", Return = "", Notes = "Sets the rotation of the mob head" }, + SetType = { Params = "eMobHeadType", Return = "", Notes = "Set the type of the mob head" }, }, }, -- cMobHeadEntity + cMobSpawnerEntity = { Desc = [[ @@ -300,18 +331,19 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cBlockEntity", Functions = { - UpdateActiveState = { Params = "", Return = "", Notes = "Upate the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function." }, - ResetTimer = { Params = "", Return = "", Notes = "Sets the spawn delay to a new random value." }, - SpawnEntity = { Params = "", Return = "", Notes = "Spawns the entity. This function automaticly change the spawn delay!" }, GetEntity = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the entity type that will be spawn by this mob spawner." }, - SetEntity = { Params = "{{Globals#MobType|MobType}}", Return = "", Notes = "Sets the entity type who will be spawn by this mob spawner." }, + GetNearbyMonsterNum = { Params = "EntityType", Return = "number", Notes = "Returns the amount of this monster type in a 8-block radius (Y: 4-block radius)." }, + GetNearbyPlayersNum = { Params = "", Return = "number", Notes = "Returns the amount of the nearby players in a 16-block radius." }, GetSpawnDelay = { Params = "", Return = "number", Notes = "Returns the spawn delay. This is the tick delay that is needed to spawn new monsters." }, + ResetTimer = { Params = "", Return = "", Notes = "Sets the spawn delay to a new random value." }, + SetEntity = { Params = "{{Globals#MobType|MobType}}", Return = "", Notes = "Sets the entity type who will be spawn by this mob spawner." }, SetSpawnDelay = { Params = "number", Return = "", Notes = "Sets the spawn delay." }, - GetNearbyPlayersNum = { Params = "", Return = "number", Notes = "Returns the amount of the nearby players in a 16-block radius." }, - GetNearbyMonsterNum = { Params = "", Return = "number", Notes = "Returns the amount of this monster type in a 8-block radius (Y: 4-block radius)." }, + SpawnEntity = { Params = "", Return = "", Notes = "Spawns the entity. This function automaticly change the spawn delay!" }, + UpdateActiveState = { Params = "", Return = "", Notes = "Upate the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function." }, }, }, -- cMobSpawnerEntity + cNoteEntity = { Desc = [[ diff --git a/Server/Plugins/APIDump/Classes/Geometry.lua b/Server/Plugins/APIDump/Classes/Geometry.lua index e068e227f..b9d9cbd4e 100644 --- a/Server/Plugins/APIDump/Classes/Geometry.lua +++ b/Server/Plugins/APIDump/Classes/Geometry.lua @@ -28,11 +28,12 @@ return { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}", Return = "cBoundingBox", Notes = "Creates a new bounding box with the coords specified as two vectors" }, { Params = "{{Vector3d|Pos}}, Radius, Height", Return = "cBoundingBox", Notes = "Creates a new bounding box from the position given and radius (X/Z) and height. Radius is added from X/Z to calculate the maximum coords and subtracted from X/Z to get the minimum; minimum Y is set to Pos.y and maxumim Y to Pos.y plus Height. This corresponds with how {{cEntity|entities}} are represented in Minecraft." }, { Params = "OtherBoundingBox", Return = "cBoundingBox", Notes = "Creates a new copy of the given bounding box. Same result can be achieved by using a simple assignment." }, + { Params = "{{Vector3d|Pos}}, CubeSideLength", Return = "{{cBoundingBox}}", Notes = "Creates a new bounding box as a cube with the specified side length centered around the specified point." }, }, CalcLineIntersection = { { Params = "{{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, [LineCoeff, Face]", Notes = "Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected." }, - { Params = "{{Vector3d|BoxMin}}, {{Vector3d|BoxMax}}, {{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, [LineCoeff, Face]", Notes = "(STATIC) Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box specified as its minimum and maximum coords. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected." }, + { Params = "{{Vector3d|BoxMin}}, {{Vector3d|BoxMax}}, {{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, [LineCoeff, Face]", IsStatic = true, Notes = "Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box specified as its minimum and maximum coords. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected." }, }, DoesIntersect = { Params = "OtherBoundingBox", Return = "bool", Notes = "Returns true if the two bounding boxes have an intersection of nonzero volume." }, Expand = { Params = "ExpandX, ExpandY, ExpandZ", Return = "", Notes = "Expands this bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each axis)." }, @@ -51,6 +52,8 @@ return { Params = "PointX, PointY, PointZ", Return = "bool", Notes = "Returns true if the specified point is inside (including on the edge) of the box." }, { Params = "OtherBoundingBox", Return = "bool", Notes = "Returns true if OtherBoundingBox is inside of this box." }, { Params = "{{Vector3d|OtherBoxMin}}, {{Vector3d|OtherBoxMax}}", Return = "bool", Notes = "Returns true if the other bounding box, specified by its 2 corners, is inside of this box." }, + { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}, {{Vector3d|Point}}", Return = "boolean", IsStatic = true, Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners" }, + { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}, X, Y, Z", Return = "boolean", IsStatic = true, Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners" }, }, Move = { @@ -128,7 +131,7 @@ various events. See below for further information. ]], Functions = { - Trace = { Params = "{{cWorld}}, Callbacks, StartX, StartY, StartZ, EndX, EndY, EndZ", Return = "bool", Notes = "(STATIC) Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)" }, + Trace = { Params = "{{cWorld}}, Callbacks, StartX, StartY, StartZ, EndX, EndY, EndZ", Return = "bool", IsStatic = true, Notes = "Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)" }, }, AdditionalInfo = @@ -238,30 +241,52 @@ end { Params = "", Return = "Vector3d", Notes = "Creates a new Vector3d object with all its coords set to 0." }, { Params = "X, Y, Z", Return = "Vector3d", Notes = "Creates a new Vector3d object with its coords set to the specified values." }, }, - operator_div = { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d with each coord divided by the specified number." }, - operator_mul = { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d with each coord multiplied." }, - operator_sub = { Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d containing the difference between this object and the specified vector." }, + operator_div = + { + { Params = "{{Vector3d}}", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object with each coord divided by the corresponding coord from the given vector." }, + { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d object with each coord divided by the specified number." }, + }, + operator_mul = + { + { Params = "{{Vector3d}}", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object with each coord multiplied by the corresponding coord from the given vector." }, + { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d object with each coord multiplied." }, + }, operator_plus = {Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d containing the sum of this vector and the specified vector" }, + operator_sub = + { + { Params = "{{Vector3d}}", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object containing the difference between this object and the specified vector." }, + { Params = "", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object that is a negative of this vector (all coords multiplied by -1)." }, + }, abs = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use Abs() instead." }, clamp = { Params = "min, max", Return = "", Notes = "<b>OBSOLETE</b>, use Clamp() instead." }, Abs = { Params = "", Return = "", Notes = "Updates each coord to its absolute value." }, Clamp = { Params = "min, max", Return = "", Notes = "Clamps each coord into the specified range." }, Cross = { Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d that is a {{http://en.wikipedia.org/wiki/Cross_product|cross product}} of this vector and the specified vector." }, Dot = { Params = "Vector3d", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." }, - Equals = { Params = "Vector3d", Return = "bool", Notes = "Returns true if this vector is exactly equal to the specified vector." }, + Equals = { Params = "Vector3d", Return = "bool", Notes = "Returns true if this vector is exactly equal to the specified vector. Note that this is subject to (possibly imprecise) floating point math." }, + EqualsEps = { Params = "{{Vector3d|Rhs}}, Eps", Return = "boolean", Notes = "Returns true if the differences between each corresponding coords of this vector and the one specified, are less than the specified Eps." }, + Floor = { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords." }, + HasNonZeroLength = { Params = "", Return = "boolean", Notes = "Returns true if the vector has at least one coord non-zero. Note that this is subject to (possibly imprecise) floating point math." }, Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of the vector." }, LineCoeffToXYPlane = { Params = "Vector3d, Z", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection." }, LineCoeffToXZPlane = { Params = "Vector3d, Y", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection." }, LineCoeffToYZPlane = { Params = "Vector3d, X", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection." }, + Move = + { + { Params = "X, Y, Z", Return = "", Notes = "Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets." }, + { Params = "{{Vector3d|Diff}}", Return = "", Notes = "Adds the specified vector to this vector. Is slightly better performant than adding with a \"+\" because this doesn't create a new object for the result." }, + }, Normalize = { Params = "", Return = "", Notes = "Changes this vector so that it keeps current direction but is exactly 1 unit long. FIXME: Fails for a zero vector." }, - NormalizeCopy = { Params = "", Return = "Vector3d", Notes = "Returns a new vector that has the same directino as this but is exactly 1 unit long. FIXME: Fails for a zero vector." }, + NormalizeCopy = { Params = "", Return = "Vector3d", Notes = "Returns a new vector that has the same direction as this but is exactly 1 unit long. FIXME: Fails for a zero vector." }, Set = { Params = "X, Y, Z", Return = "", Notes = "Sets all the coords in this object." }, SqrLength = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison. " }, + TurnCCW = { Params = "", Return = "", Notes = "Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down." }, + TurnCW = { Params = "", Return = "", Notes = "Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down." }, }, Constants = { EPS = { Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al)." }, - NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersectino with the plane." }, + NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane." }, }, Variables = { @@ -289,25 +314,52 @@ end { Params = "{{Vector3d}}", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3d}}" }, { Params = "{{Vector3i}}", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3i}}" }, }, + operator_div = + { + { Params = "{{Vector3f}}", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object with each coord divided by the corresponding coord from the given vector." }, + { Params = "number", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object with each coord divided by the specified number." }, + }, operator_mul = { - { Params = "number", Return = "Vector3f", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the specified number" }, - { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the respective coord of the specified vector." }, + { Params = "number", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the specified number" }, + { Params = "{{Vector3f}}", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the respective coord of the specified vector." }, }, operator_plus = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector." }, - operator_sub = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector differrence between this vector and the specified vector." }, + operator_sub = + { + { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector differrence between this vector and the specified vector." }, + { Params = "", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f that is a negative of this vector (all coords multiplied by -1)." }, + }, abs = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use Abs() instead." }, clamp = { Params = "min, max", Return = "", Notes = "<b>OBSOLETE</b>, use Clamp() instead." }, Abs = { Params = "", Return = "", Notes = "Updates each coord to its absolute value." }, Clamp = { Params = "min, max", Return = "", Notes = "Clamps each coord into the specified range." }, Cross = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the cross product of this vector and the specified vector." }, Dot = { Params = "Vector3f", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." }, - Equals = { Params = "Vector3f", Return = "bool", Notes = "Returns true if the specified vector is exactly equal to this vector." }, + Equals = { Params = "Vector3f", Return = "bool", Notes = "Returns true if the specified vector is exactly equal to this vector. Note that this is subject to (possibly imprecise) floating point math." }, + EqualsEps = { Params = "{{Vector3f|Rhs}}, Eps", Return = "boolean", Notes = "Returns true if the differences between each corresponding coords of this vector and the one specified, are less than the specified Eps." }, + Floor = { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords." }, + HasNonZeroLength = { Params = "", Return = "boolean", Notes = "Returns true if the vector has at least one coord non-zero. Note that this is subject to (possibly imprecise) floating point math." }, Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector" }, + LineCoeffToXYPlane = { Params = "Vector3f, Z", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection." }, + LineCoeffToXZPlane = { Params = "Vector3f, Y", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection." }, + LineCoeffToYZPlane = { Params = "Vector3f, X", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection." }, + Move = + { + { Params = "X, Y, Z", Return = "", Notes = "Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets." }, + { Params = "{{Vector3f|Diff}}", Return = "", Notes = "Adds the specified vector to this vector. Is slightly better performant than adding with a \"+\" because this doesn't create a new object for the result." }, + }, Normalize = { Params = "", Return = "", Notes = "Normalizes this vector (makes it 1 unit long while keeping the direction). FIXME: Fails for zero vectors." }, NormalizeCopy = { Params = "", Return = "Vector3f", Notes = "Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). FIXME: Fails for zero vectors." }, Set = { Params = "x, y, z", Return = "", Notes = "Sets all the coords of the vector at once." }, SqrLength = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison." }, + TurnCCW = { Params = "", Return = "", Notes = "Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down." }, + TurnCW = { Params = "", Return = "", Notes = "Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down." }, + }, + Constants = + { + EPS = { Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al)." }, + NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane." }, }, Variables = { @@ -333,6 +385,22 @@ end { Params = "x, y, z", Return = "Vector3i", Notes = "Creates a new Vector3i object with the specified coords." }, { Params = "{{Vector3d}}", Return = "Vector3i", Notes = "Creates a new Vector3i object with coords copied and floor()-ed from the specified {{Vector3d}}." }, }, + operator_div = + { + { Params = "number", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords divided by the specified number" }, + { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords divided by the respective coord of the specified vector." }, + }, + operator_mul = + { + { Params = "number", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords multiplied by the specified number" }, + { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords multiplied by the respective coord of the specified vector." }, + }, + operator_plus = { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector." }, + operator_sub = + { + { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3i object that holds the vector differrence between this vector and the specified vector." }, + { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new Vector3i that is a negative of this vector (all coords multiplied by -1)." }, + }, abs = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use Abs() instead." }, clamp = { Params = "min, max", Return = "", Notes = "<b>OBSOLETE</b>, use Clamp() instead." }, Abs = { Params = "", Return = "", Notes = "Updates each coord to its absolute value." }, @@ -340,10 +408,29 @@ end Cross = { Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d that is a {{http://en.wikipedia.org/wiki/Cross_product|cross product}} of this vector and the specified vector." }, Dot = { Params = "Vector3d", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." }, Equals = { Params = "Vector3i", Return = "bool", Notes = "Returns true if this vector is exactly the same as the specified vector." }, + EqualsEps = { Params = "{{Vector3i|Rhs}}, Eps", Return = "boolean", Notes = "Returns true if the differences between each corresponding coords of this vector and the one specified, are less than the specified Eps. Normally not too useful for integer-only vectors, but still included for API completeness." }, + Floor = { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords. Normally not too useful with integer-only vectors, but still included for API completeness." }, + HasNonZeroLength = { Params = "", Return = "boolean", Notes = "Returns true if the vector has at least one coord non-zero." }, Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector." }, - Move = { Params = "x, y, z", Return = "", Notes = "Moves the vector by the specified amount in each axis direction." }, + LineCoeffToXYPlane = { Params = "Vector3i, Z", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection." }, + LineCoeffToXZPlane = { Params = "Vector3i, Y", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection." }, + LineCoeffToYZPlane = { Params = "Vector3i, X", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection." }, + Move = + { + { Params = "x, y, z", Return = "", Notes = "Moves the vector by the specified amount in each axis direction." }, + { Params = "{{Vector3i|Diff}}", Return = "", Notes = "Adds the specified vector to this vector. Is slightly better performant than adding with a \"+\" because this doesn't create a new object for the result." }, + }, + Normalize = { Params = "", Return = "", Notes = "Normalizes this vector (makes it 1 unit long while keeping the direction). Quite useless for integer-only vectors, since the normalized vector will almost always truncate to zero vector. FIXME: Fails for zero vectors." }, + NormalizeCopy = { Params = "", Return = "Vector3f", Notes = "Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). Quite useless for integer-only vectors, since the normalized vector will almost always truncate to zero vector. FIXME: Fails for zero vectors." }, Set = { Params = "x, y, z", Return = "", Notes = "Sets all the coords of the vector at once" }, SqrLength = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison." }, + TurnCCW = { Params = "", Return = "", Notes = "Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down." }, + TurnCW = { Params = "", Return = "", Notes = "Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down." }, + }, + Constants = + { + EPS = { Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al). Quite useless with integer-only vector." }, + NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane." }, }, Variables = { diff --git a/Server/Plugins/APIDump/Classes/Network.lua b/Server/Plugins/APIDump/Classes/Network.lua index 483ce1f88..74f0a6488 100644 --- a/Server/Plugins/APIDump/Classes/Network.lua +++ b/Server/Plugins/APIDump/Classes/Network.lua @@ -287,12 +287,12 @@ g_Server = nil Functions = { - Connect = { Params = "Host, Port, LinkCallbacks", Return = "bool", Notes = "(STATIC) Begins establishing a (client) TCP connection to the specified host. Uses the LinkCallbacks table to report progress, success, errors and incoming data. Returns false if it fails immediately (bad port value, bad hostname format), true otherwise. Host can be either an IP address or a hostname." }, - CreateUDPEndpoint = { Params = "Port, UDPCallbacks", Return = "{{cUDPEndpoint|UDPEndpoint}}", Notes = "(STATIC) Creates a UDP endpoint that listens for incoming datagrams on the specified port, and can be used to send or broadcast datagrams. Uses the UDPCallbacks to report incoming datagrams or errors. If the endpoint cannot be created, the OnError callback is called with the error details and the returned endpoint will report IsOpen() == false. The plugin needs to store the returned endpoint object for as long as it needs the UDP port open; if the endpoint is garbage-collected by Lua, the socket will be closed and no more incoming data will be reported.<br>If the Port is zero, the OS chooses an available UDP port for the endpoint; use {{cUDPEndpoint}}:GetPort() to query the port number in such case." }, - EnumLocalIPAddresses = { Params = "", Return = "array-table of strings", Notes = "(STATIC) Returns all local IP addresses for network interfaces currently available on the machine." }, - HostnameToIP = { Params = "Host, LookupCallbacks", Return = "bool", Notes = "(STATIC) Begins a DNS lookup to find the IP address(es) for the specified host. Uses the LookupCallbacks table to report progress, success or errors. Returns false if it fails immediately (bad hostname format), true if the lookup started successfully. Host can be either a hostname or an IP address." }, - IPToHostname = { Params = "Address, LookupCallbacks", Return = "bool", Notes = "(STATIC) Begins a reverse-DNS lookup to find out the hostname for the specified IP address. Uses the LookupCallbacks table to report progress, success or errors. Returns false if it fails immediately (bad address format), true if the lookup started successfully." }, - Listen = { Params = "Port, ListenCallbacks", Return = "{{cServerHandle|ServerHandle}}", Notes = "(STATIC) Starts listening on the specified port. Uses the ListenCallbacks to report incoming connections or errors. Returns a {{cServerHandle}} object representing the server. If the listen operation failed, the OnError callback is called with the error details and the returned server handle will report IsListening() == false. The plugin needs to store the server handle object for as long as it needs the server running, if the server handle is garbage-collected by Lua, the listening socket will be closed and all current connections dropped." }, + Connect = { Params = "Host, Port, LinkCallbacks", Return = "bool", IsStatic = true, Notes = "Begins establishing a (client) TCP connection to the specified host. Uses the LinkCallbacks table to report progress, success, errors and incoming data. Returns false if it fails immediately (bad port value, bad hostname format), true otherwise. Host can be either an IP address or a hostname." }, + CreateUDPEndpoint = { Params = "Port, UDPCallbacks", Return = "{{cUDPEndpoint|UDPEndpoint}}", IsStatic = true, Notes = "Creates a UDP endpoint that listens for incoming datagrams on the specified port, and can be used to send or broadcast datagrams. Uses the UDPCallbacks to report incoming datagrams or errors. If the endpoint cannot be created, the OnError callback is called with the error details and the returned endpoint will report IsOpen() == false. The plugin needs to store the returned endpoint object for as long as it needs the UDP port open; if the endpoint is garbage-collected by Lua, the socket will be closed and no more incoming data will be reported.<br>If the Port is zero, the OS chooses an available UDP port for the endpoint; use {{cUDPEndpoint}}:GetPort() to query the port number in such case." }, + EnumLocalIPAddresses = { Params = "", Return = "array-table of strings", IsStatic = true, Notes = "Returns all local IP addresses for network interfaces currently available on the machine." }, + HostnameToIP = { Params = "Host, LookupCallbacks", Return = "bool", IsStatic = true, Notes = "Begins a DNS lookup to find the IP address(es) for the specified host. Uses the LookupCallbacks table to report progress, success or errors. Returns false if it fails immediately (bad hostname format), true if the lookup started successfully. Host can be either a hostname or an IP address." }, + IPToHostname = { Params = "Address, LookupCallbacks", Return = "bool", IsStatic = true, Notes = "Begins a reverse-DNS lookup to find out the hostname for the specified IP address. Uses the LookupCallbacks table to report progress, success or errors. Returns false if it fails immediately (bad address format), true if the lookup started successfully." }, + Listen = { Params = "Port, ListenCallbacks", Return = "{{cServerHandle|ServerHandle}}", IsStatic = true, Notes = "Starts listening on the specified port. Uses the ListenCallbacks to report incoming connections or errors. Returns a {{cServerHandle}} object representing the server. If the listen operation failed, the OnError callback is called with the error details and the returned server handle will report IsListening() == false. The plugin needs to store the server handle object for as long as it needs the server running, if the server handle is garbage-collected by Lua, the listening socket will be closed and all current connections dropped." }, }, }, -- cNetwork diff --git a/Server/Plugins/APIDump/Classes/Plugins.lua b/Server/Plugins/APIDump/Classes/Plugins.lua index c86adc087..ee56f88de 100644 --- a/Server/Plugins/APIDump/Classes/Plugins.lua +++ b/Server/Plugins/APIDump/Classes/Plugins.lua @@ -52,29 +52,29 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); { AddHook = { - { Params = "{{cPluginManager#Hooks|HookType}}, [HookFunction]", Return = "", Notes = "(STATIC) Informs the plugin manager that it should call the specified function when the specified hook event occurs. If a function is not specified, a default global function name is looked up, based on the hook type" }, - { Params = "{{cPlugin|Plugin}}, {{cPluginManager#Hooks|HookType}}, [HookFunction]", Return = "", Notes = "(STATIC, <b>DEPRECATED</b>) Informs the plugin manager that it should call the specified function when the specified hook event occurs. If a function is not specified, a default function name is looked up, based on the hook type. NOTE: This format is deprecated and the server outputs a warning if it is used!" }, + { Params = "{{cPluginManager#Hooks|HookType}}, [HookFunction]", Return = "", IsStatic = true, Notes = "Informs the plugin manager that it should call the specified function when the specified hook event occurs. If a function is not specified, a default global function name is looked up, based on the hook type" }, + { Params = "{{cPlugin|Plugin}}, {{cPluginManager#Hooks|HookType}}, [HookFunction]", Return = "", IsStatic = true, Notes = "(<b>DEPRECATED</b>) Informs the plugin manager that it should call the specified function when the specified hook event occurs. If a function is not specified, a default function name is looked up, based on the hook type. NOTE: This format is deprecated and the server outputs a warning if it is used!" }, }, BindCommand = { - { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split, {{cPlayer|Player}})</pre> The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." }, + { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", IsStatic = true, Notes = "Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split, {{cPlayer|Player}})</pre> The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." }, { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split, {{cPlayer|Player}})</pre> The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." }, }, BindConsoleCommand = { - { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split)</pre> The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." }, + { Params = "Command, Callback, HelpString", Return = "[bool]", IsStatic = true, Notes = "Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split)</pre> The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." }, { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split)</pre> The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." }, }, - CallPlugin = { Params = "PluginName, FunctionName, [FunctionArgs...]", Return = "[FunctionRets]", Notes = "(STATIC) Calls the specified function in the specified plugin, passing all the given arguments to it. If it succeeds, it returns all the values returned by that function. If it fails, returns no value at all. Note that only strings, numbers, bools, nils, API classes and simple tables can be used for parameters and return values; functions cannot be copied across plugins." }, - DoWithPlugin = { Params = "PluginName, CallbackFn", Return = "bool", Notes = "(STATIC) Calls the CallbackFn for the specified plugin, if found. A plugin can be found even if it is currently unloaded, disabled or errored, the callback should check the plugin status. If the plugin is not found, this function returns false, otherwise it returns the bool value that the callback has returned. The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function ({{cPlugin|Plugin}})</pre>" }, + CallPlugin = { Params = "PluginName, FunctionName, [FunctionArgs...]", Return = "[FunctionRets]", IsStatic = true, Notes = "Calls the specified function in the specified plugin, passing all the given arguments to it. If it succeeds, it returns all the values returned by that function. If it fails, returns no value at all. Note that only strings, numbers, bools, nils, API classes and simple tables can be used for parameters and return values; functions cannot be copied across plugins." }, + DoWithPlugin = { Params = "PluginName, CallbackFn", Return = "bool", IsStatic = true, Notes = "Calls the CallbackFn for the specified plugin, if found. A plugin can be found even if it is currently unloaded, disabled or errored, the callback should check the plugin status. If the plugin is not found, this function returns false, otherwise it returns the bool value that the callback has returned. The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function ({{cPlugin|Plugin}})</pre>" }, ExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "{{cPluginManager#CommandResult|CommandResult}}", Notes = "Executes the command as if given by the specified Player. Checks permissions." }, ExecuteConsoleCommand = { Params = "CommandStr", Return = "bool, string", Notes = "Executes the console command as if given by the admin on the console. If the command is successfully executed, returns true and the text that would be output to the console normally. On error it returns false and an error message." }, FindPlugins = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use RefreshPluginList() instead"}, ForceExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "{{cPluginManager#CommandResult|CommandResult}}", Notes = "Same as ExecuteCommand, but doesn't check permissions" }, ForEachCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function(Command, Permission, HelpString)</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." }, ForEachConsoleCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindConsoleCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function (Command, HelpString)</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." }, - ForEachPlugin = { Params = "CallbackFn", Return = "bool", Notes = "(STATIC) Calls the CallbackFn function for each plugin that is currently discovered by Cuberite (including disabled, unloaded and errrored plugins). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function ({{cPlugin|Plugin}})</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." }, - Get = { Params = "", Return = "cPluginManager", Notes = "(STATIC) Returns the single instance of the plugin manager" }, + ForEachPlugin = { Params = "CallbackFn", Return = "bool", IsStatic = true, Notes = "Calls the CallbackFn function for each plugin that is currently discovered by Cuberite (including disabled, unloaded and errrored plugins). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function ({{cPlugin|Plugin}})</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." }, + Get = { Params = "", Return = "cPluginManager", IsStatic = true, Notes = "Returns the single instance of the plugin manager" }, GetAllPlugins = { Params = "", Return = "table", Notes = "Returns a table (dictionary) of all plugins, [name => value], where value is a valid {{cPlugin}} if the plugin is loaded, or the bool value false if the plugin is not loaded." }, GetCommandPermission = { Params = "Command", Return = "Permission", Notes = "Returns the permission needed for executing the specified command" }, GetCurrentPlugin = { Params = "", Return = "{{cPlugin}}", Notes = "Returns the {{cPlugin}} object for the calling plugin. This is the same object that the Initialize function receives as the argument." }, @@ -87,7 +87,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); IsConsoleCommandBound = { Params = "Command", Return = "bool", Notes = "Returns true if console Command is already bound (by any plugin)" }, IsPluginLoaded = { Params = "PluginName", Return = "", Notes = "Returns true if the specified plugin is loaded." }, LoadPlugin = { Params = "PluginFolder", Return = "", Notes = "(<b>DEPRECATED</b>) Loads a plugin from the specified folder. NOTE: Loading plugins may be an unsafe operation and may result in a deadlock or a crash. This API is deprecated and might be removed." }, - LogStackTrace = { Params = "", Return = "", Notes = "(STATIC) Logs a current stack trace of the Lua engine to the server console log. Same format as is used when the plugin fails." }, + LogStackTrace = { Params = "", Return = "", IsStatic = true, Notes = "Logs a current stack trace of the Lua engine to the server console log. Same format as is used when the plugin fails." }, RefreshPluginList = { Params = "", Return = "", Notes = "Refreshes the list of plugins to include all folders inside the Plugins folder (potentially new disabled plugins)" }, ReloadPlugins = { Params = "", Return = "", Notes = "Reloads all active plugins" }, UnloadPlugin = { Params = "PluginName", Return = "", Notes = "Queues the specified plugin to be unloaded. To avoid deadlocks, the unloading happens in the main tick thread asynchronously." }, diff --git a/Server/Plugins/APIDump/Classes/Projectiles.lua b/Server/Plugins/APIDump/Classes/Projectiles.lua index e6d347313..b94706f0f 100644 --- a/Server/Plugins/APIDump/Classes/Projectiles.lua +++ b/Server/Plugins/APIDump/Classes/Projectiles.lua @@ -8,6 +8,7 @@ return Functions = { CanPickup = { Params = "{{cPlayer|Player}}", Return = "bool", Notes = "Returns true if the specified player can pick the arrow when it's on the ground" }, + GetBlockHit = { Params = "", Returns = "{{Vector3i}}", Desc = "Gets the block arrow is in" }, GetDamageCoeff = { Params = "", Return = "number", Notes = "Returns the damage coefficient stored within the arrow. The damage dealt by this arrow is multiplied by this coeff" }, GetPickupState = { Params = "", Return = "PickupState", Notes = "Returns the pickup state (one of the psXXX constants, above)" }, IsCritical = { Params = "", Return = "bool", Notes = "Returns true if the arrow should deal critical damage. Based on the bow charge when the arrow was shot." }, @@ -35,6 +36,7 @@ return Inherits = "cProjectileEntity", }, -- cArrowEntity + cExpBottleEntity = { Desc = [[ @@ -46,6 +48,7 @@ return Inherits = "cProjectileEntity", }, -- cExpBottleEntity + cFireChargeEntity = { Desc = [[ @@ -55,7 +58,8 @@ return Functions = {}, Inherits = "cProjectileEntity", }, -- cFireChargeEntity - + + cFireworkEntity = { Desc = [[ @@ -72,6 +76,7 @@ return Inherits = "cProjectileEntity", }, -- cFireworkEntity + cFloater = { Desc = "", @@ -79,6 +84,7 @@ return Inherits = "cProjectileEntity", }, -- cFloater + cGhastFireballEntity = { Desc = "", @@ -86,13 +92,16 @@ return Inherits = "cProjectileEntity", }, -- cGhastFireballEntity + cProjectileEntity = { - Desc = "", + Desc = "Base class for all projectiles, such as arrows and fireballs.", Functions = { GetCreator = { Params = "", Return = "{{cEntity}} descendant", Notes = "Returns the entity who created this projectile. May return nil." }, - GetMCAClassName = { Params = "", Return = "string", Notes = "Returns the string that identifies the projectile type (class name) in MCA files" }, + GetCreatorName = { Params = "", Return = "string", Notes = "Returns the name of the player that created the projectile. Will be empty for non-player creators" }, + GetCreatorUniqueID = { Params = "", Return = "number", Notes = "Returns the unique ID of the entity who created this projectile, or {{cEntity#NO_ID|cEntity.NO_ID}} if the projectile wasn't created by an entity." }, + GetMCAClassName = { Params = "", Return = "string", Notes = "Returns the string that identifies the projectile type (class name) in MCA files" }, GetProjectileKind = { Params = "", Return = "ProjectileKind", Notes = "Returns the kind of this projectile (pkXXX constant)" }, IsInGround = { Params = "", Return = "bool", Notes = "Returns true if this projectile has hit the ground." }, }, @@ -121,6 +130,7 @@ return Inherits = "cEntity", }, -- cProjectileEntity + cSplashPotionEntity = { Desc = [[ @@ -139,6 +149,7 @@ return Inherits = "cProjectileEntity", }, -- cSplashPotionEntity + cThrownEggEntity = { Desc = [[ @@ -148,13 +159,15 @@ return Inherits = "cProjectileEntity", }, -- cThrownEggEntity + cThrownEnderPearlEntity = { Desc = "Represents a thrown ender pearl.", Functions = {}, Inherits = "cProjectileEntity", }, -- cThrownEnderPearlEntity - + + cThrownSnowballEntity = { Desc = "Represents a thrown snowball.", @@ -162,6 +175,7 @@ return Inherits = "cProjectileEntity", }, -- cThrownSnowballEntity + cWitherSkullEntity = { Desc = "Represents a wither skull being shot.", diff --git a/Server/Plugins/APIDump/Classes/WebAdmin.lua b/Server/Plugins/APIDump/Classes/WebAdmin.lua index a9d92b069..ec37d9308 100644 --- a/Server/Plugins/APIDump/Classes/WebAdmin.lua +++ b/Server/Plugins/APIDump/Classes/WebAdmin.lua @@ -5,14 +5,14 @@ return Desc = "", Functions = { - AddWebTab = { Params = "Title, UrlPath, HandlerFn", Return = "", Notes = "(STATIC) Adds a new web tab to webadmin. The tab uses \"Title\" as its display string and is identified in the URL using the UrlPath (https://server.domain.com/webadmin/{PluginName}/{UrlPath}). The HandlerFn is the callback function that is called when the admin accesses the page, it has the following signature:<br/><pre class=\"prettyprint lang-lua\">function ({{a_Request|HTTPRequest}}, a_UrlPath)<br/> return Content, ContentType<br/>end</pre> URLPath must not contain a '/', the recommendation is to use only 7-bit-clean ASCII character set." }, - GetAllWebTabs = { Params = "", Return = "array-table", Notes = "(STATIC) Returns an array-table with each item describing a web tab, for all web tabs registered in the WebAdmin, for all plugins. The returned table has the following format:<br/><pre class=\"prettyprint lang-lua\">{<br/> {<br/> PluginName = \"Plugin's API name\",<br/> UrlPath = \"UrlPath given to AddWebTab\",<br/> Title = \"Title given to AddWebTab\",<br/> },<br/> ...<br/>}"}, - GetBaseURL = { Params = "URL", Return = "string", Notes = "(STATIC) Returns the string that is the path of the base webadmin (\"../../../webadmin\") relative to the given URL." }, - GetContentTypeFromFileExt = { Params = "FileExt", Return = "string", Notes = "(STATIC) Returns the content-type that should be used for files with the specified extension (without the dot), such as \"text/plain\" for the \"txt\" extension. If the extension is not known, returns an empty string." }, - GetHTMLEscapedString = { Params = "string", Return = "string", Notes = "(STATIC) Gets the HTML-escaped representation of a requested string. This is useful for user input and game data that is not guaranteed to be escaped already." }, - GetPage = { Params = "{{Request|HTTPRequest}}", Return = "table", Notes = "(STATIC) Returns the (inner HTML) page contents for the specified request. Calls the appropriate WebTab handler registered via AddWebTab() and returns the information from that plugin wrapped in a table with the following structure:<br/><pre class=\"prettyprint lang-lua\">{<br/> Content = \"\", -- Content returned by the plugin<br/> ContentType = \"\", -- Content type returned by the plugin, or \"text/html\" if none returned<br/> UrlPath = \"\", -- UrlPath decoded from the request<br/> TabTitle = \"\", -- Title of the tab that handled the request, as given to AddWebTab()<br/> PluginName = \"\", -- API name of the plugin that handled the request<br/> PluginFolder = \"\", -- Folder name (= display name) of the plugin that handled the request<br/>}</pre>This function is mainly used in the webadmin template file." }, + AddWebTab = { Params = "Title, UrlPath, HandlerFn", Return = "", IsStatic = true, Notes = "Adds a new web tab to webadmin. The tab uses \"Title\" as its display string and is identified in the URL using the UrlPath (https://server.domain.com/webadmin/{PluginName}/{UrlPath}). The HandlerFn is the callback function that is called when the admin accesses the page, it has the following signature:<br/><pre class=\"prettyprint lang-lua\">function ({{a_Request|HTTPRequest}}, a_UrlPath)<br/> return Content, ContentType<br/>end</pre> URLPath must not contain a '/', the recommendation is to use only 7-bit-clean ASCII character set." }, + GetAllWebTabs = { Params = "", Return = "array-table", IsStatic = true, Notes = "Returns an array-table with each item describing a web tab, for all web tabs registered in the WebAdmin, for all plugins. The returned table has the following format:<br/><pre class=\"prettyprint lang-lua\">{<br/> {<br/> PluginName = \"Plugin's API name\",<br/> UrlPath = \"UrlPath given to AddWebTab\",<br/> Title = \"Title given to AddWebTab\",<br/> },<br/> ...<br/>}"}, + GetBaseURL = { Params = "URL", Return = "string", IsStatic = true, Notes = "Returns the string that is the path of the base webadmin (\"../../../webadmin\") relative to the given URL." }, + GetContentTypeFromFileExt = { Params = "FileExt", Return = "string", IsStatic = true, Notes = "Returns the content-type that should be used for files with the specified extension (without the dot), such as \"text/plain\" for the \"txt\" extension. If the extension is not known, returns an empty string." }, + GetHTMLEscapedString = { Params = "string", Return = "string", IsStatic = true, Notes = "Gets the HTML-escaped representation of a requested string. This is useful for user input and game data that is not guaranteed to be escaped already." }, + GetPage = { Params = "{{Request|HTTPRequest}}", Return = "table", IsStatic = true, Notes = "Returns the (inner HTML) page contents for the specified request. Calls the appropriate WebTab handler registered via AddWebTab() and returns the information from that plugin wrapped in a table with the following structure:<br/><pre class=\"prettyprint lang-lua\">{<br/> Content = \"\", -- Content returned by the plugin<br/> ContentType = \"\", -- Content type returned by the plugin, or \"text/html\" if none returned<br/> UrlPath = \"\", -- UrlPath decoded from the request<br/> TabTitle = \"\", -- Title of the tab that handled the request, as given to AddWebTab()<br/> PluginName = \"\", -- API name of the plugin that handled the request<br/> PluginFolder = \"\", -- Folder name (= display name) of the plugin that handled the request<br/>}</pre>This function is mainly used in the webadmin template file." }, GetPorts = { Params = "", Return = "string", Notes = "Returns a comma-separated list of ports on which the webadmin is configured to listen. Note that this list does include ports that may currently be unavailable (another server was already listening on them prior to launching Cuberite)." }, - GetURLEncodedString = { Params = "string", Return = "string", Notes = "(STATIC) Returns the string given to it escaped by URL encoding, which makes the string suitable for transmission in an URL. Invalid characters are turned into \"%xy\" values." }, + GetURLEncodedString = { Params = "string", Return = "string", IsStatic = true, Notes = "Returns the string given to it escaped by URL encoding, which makes the string suitable for transmission in an URL. Invalid characters are turned into \"%xy\" values." }, Reload = { Params = "", Return = "", Notes = "Reloads the webadmin's config - the allowed logins, the template script and the login page. Note that reloading will not change the \"enabled\" state of the server, and it will not update listening ports. Existing WebTabs will be kept registered even after the reload." }, }, }, -- cWebAdmin @@ -52,6 +52,17 @@ return Username = { Type = "string", Notes = "Name of the logged-in user." }, }, }, -- HTTPRequest + + + HTTPTemplateRequest = + { + Desc = [[This class is used only in the WebAdmin template script as the parameter to the function that provides the template. + ]], + Variables = + { + Request = { Type = "HTTPRequest", Notes = "The request for which the template is being built." }, + }, + }, -- HTTPTemplateRequest } diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua index 4d8f58483..429a563df 100644 --- a/Server/Plugins/APIDump/main_APIDump.lua +++ b/Server/Plugins/APIDump/main_APIDump.lua @@ -47,6 +47,7 @@ end +--- Returns the API currently detected from the global environment local function CreateAPITables() --[[ We want an API table of the following shape: @@ -133,8 +134,7 @@ local function CreateAPITables() if ( (v ~= _G) and -- don't want the global namespace (v ~= _G.packages) and -- don't want any packages - (v ~= _G[".get"]) and - (v ~= g_APIDesc) + (v ~= _G[".get"]) ) then if (type(v) == "table") then local cls = ParseClass(i, v) @@ -166,13 +166,16 @@ end -local function WriteArticles(f) +--- Writes links to articles in a bullet format into the output HTML file +-- f is the output file stream +-- a_APIDesc is the API description as read from APIDesc.lua +local function WriteArticles(f, a_APIDesc) f:write([[ <a name="articles"><h2>Articles</h2></a> <p>The following articles provide various extra information on plugin development</p> <ul> ]]); - for _, extra in ipairs(g_APIDesc.ExtraPages) do + for _, extra in ipairs(a_APIDesc.ExtraPages) do local SrcFileName = g_PluginFolder .. "/" .. extra.FileName; if (cFile:IsFile(SrcFileName)) then local DstFileName = "API/" .. extra.FileName; @@ -333,6 +336,11 @@ end +--- Writes all hooks into HTML output file as links in a sorted bullet list, as well as the individual hook HTML files +-- f is the output HTML index file +-- a_Hooks is an array of hook descriptions +-- a_UndocumentedHooks is a table that will be filled with the names of hooks that are not documented +-- a_HookNav is the HTML code for the menu on the left that is constant for all hook pages local function WriteHooks(f, a_Hooks, a_UndocumentedHooks, a_HookNav) f:write([[ <a name="hooks"><h2>Hooks</h2></a> @@ -372,13 +380,16 @@ end -local function ReadDescriptions(a_API) +--- Fills the API in a_API table with descriptions from a_Desc +-- a_API is the API detected from current global environment +-- a_Desc is the description loaded from APIDesc.lua and Classes files +local function ReadDescriptions(a_API, a_Desc) -- Returns true if the class of the specified name is to be ignored local function IsClassIgnored(a_ClsName) - if (g_APIDesc.IgnoreClasses == nil) then + if (a_Desc.IgnoreClasses == nil) then return false; end - for _, name in ipairs(g_APIDesc.IgnoreClasses) do + for _, name in ipairs(a_Desc.IgnoreClasses) do if (a_ClsName:match(name)) then return true; end @@ -388,15 +399,15 @@ local function ReadDescriptions(a_API) -- Returns true if the function is to be ignored local function IsFunctionIgnored(a_ClassName, a_FnName) - if (g_APIDesc.IgnoreFunctions == nil) then + if (a_Desc.IgnoreFunctions == nil) then return false; end - if (((g_APIDesc.Classes[a_ClassName] or {}).Functions or {})[a_FnName] ~= nil) then + if (((a_Desc.Classes[a_ClassName] or {}).Functions or {})[a_FnName] ~= nil) then -- The function is documented, don't ignore return false; end local FnName = a_ClassName .. "." .. a_FnName; - for _, name in ipairs(g_APIDesc.IgnoreFunctions) do + for _, name in ipairs(a_Desc.IgnoreFunctions) do if (FnName:match(name)) then return true; end @@ -406,10 +417,10 @@ local function ReadDescriptions(a_API) -- Returns true if the constant (specified by its fully qualified name) is to be ignored local function IsConstantIgnored(a_CnName) - if (g_APIDesc.IgnoreConstants == nil) then + if (a_Desc.IgnoreConstants == nil) then return false; end; - for _, name in ipairs(g_APIDesc.IgnoreConstants) do + for _, name in ipairs(a_Desc.IgnoreConstants) do if (a_CnName:match(name)) then return true; end @@ -419,10 +430,10 @@ local function ReadDescriptions(a_API) -- Returns true if the member variable (specified by its fully qualified name) is to be ignored local function IsVariableIgnored(a_VarName) - if (g_APIDesc.IgnoreVariables == nil) then + if (a_Desc.IgnoreVariables == nil) then return false; end; - for _, name in ipairs(g_APIDesc.IgnoreVariables) do + for _, name in ipairs(a_Desc.IgnoreVariables) do if (a_VarName:match(name)) then return true; end @@ -471,7 +482,7 @@ local function ReadDescriptions(a_API) end end - local APIDesc = g_APIDesc.Classes[cls.Name]; + local APIDesc = a_Desc.Classes[cls.Name]; if (APIDesc ~= nil) then APIDesc.IsExported = true; cls.Desc = APIDesc.Desc; @@ -493,8 +504,8 @@ local function ReadDescriptions(a_API) local DoxyFunctions = {}; -- This will contain all the API functions together with their documentation - local function AddFunction(a_Name, a_Params, a_Return, a_Notes) - table.insert(DoxyFunctions, {Name = a_Name, Params = a_Params, Return = a_Return, Notes = a_Notes}); + local function AddFunction(a_Name, a_Params, a_Return, a_IsStatic, a_Notes) + table.insert(DoxyFunctions, {Name = a_Name, Params = a_Params, Return = a_Return, IsStatic = a_IsStatic, Notes = a_Notes}); end if (APIDesc.Functions ~= nil) then @@ -512,11 +523,11 @@ local function ReadDescriptions(a_API) -- Description is available if (FnDesc[1] == nil) then -- Single function definition - AddFunction(func.Name, FnDesc.Params, FnDesc.Return, FnDesc.Notes); + AddFunction(func.Name, FnDesc.Params, FnDesc.Return, FnDesc.IsStatic, FnDesc.Notes); else -- Multiple function overloads for _, desc in ipairs(FnDesc) do - AddFunction(func.Name, desc.Params, desc.Return, desc.Notes); + AddFunction(func.Name, desc.Params, desc.Return, desc.IsStatic, desc.Notes); end -- for k, desc - FnDesc[] end FnDesc.IsExported = true; @@ -722,7 +733,10 @@ end -local function ReadHooks(a_Hooks) +--- Fills the hooks in a_Hooks with their descriptions from a_Descs +-- a_Hooks is an array of hooks detected from current global environment +-- a_Descs is the description read from APIDesc.lua and Hooks files +local function ReadHooks(a_Hooks, a_Descs) --[[ a_Hooks = { { Name = "HOOK_1"}, @@ -732,7 +746,7 @@ local function ReadHooks(a_Hooks) We want to add hook descriptions to each hook in this array --]] for _, hook in ipairs(a_Hooks) do - local HookDesc = g_APIDesc.Hooks[hook.Name]; + local HookDesc = a_Descs.Hooks[hook.Name]; if (HookDesc ~= nil) then for key, val in pairs(HookDesc) do hook[key] = val; @@ -764,10 +778,14 @@ local function WriteHtmlClass(a_ClassAPI, a_ClassMenu) end cf:write("<table>\n<tr><th>Name</th><th>Parameters</th><th>Return value</th><th>Notes</th></tr>\n"); for _, func in ipairs(a_Functions) do + local StaticClause = "" + if (func.IsStatic) then + StaticClause = "(STATIC) " + end cf:write("<tr><td>", func.Name, "</td>\n"); cf:write("<td>", LinkifyString(func.Params or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n"); cf:write("<td>", LinkifyString(func.Return or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n"); - cf:write("<td>", LinkifyString(func.Notes or "<i>(undocumented)</i>", (a_InheritedName or a_ClassAPI.Name)), "</td></tr>\n"); + cf:write("<td>", StaticClause .. LinkifyString(func.Notes or "<i>(undocumented)</i>", (a_InheritedName or a_ClassAPI.Name)), "</td></tr>\n"); end cf:write("</table>\n"); end @@ -996,6 +1014,10 @@ end +--- Writes all classes into HTML output file as links in a sorted bullet list, as well as the individual class HTML files +-- f is the output file +-- a_API is the API detected from current environment enriched with descriptions +-- a_ClassMenu is the HTML code for the menu on the left that is constant for all class pages local function WriteClasses(f, a_API, a_ClassMenu) f:write([[ <a name="classes"><h2>Class index</h2></a> @@ -1021,7 +1043,7 @@ local function ListUndocumentedObjects(API, UndocumentedHooks) local f = io.open("API/_undocumented.lua", "w"); if (f ~= nil) then f:write("\n-- This is the list of undocumented API objects, automatically generated by APIDump\n\n"); - f:write("g_APIDesc =\n{\n\tClasses =\n\t{\n"); + f:write("return\n{\n\tClasses =\n\t{\n"); for _, cls in ipairs(API) do local HasFunctions = ((cls.UndocumentedFunctions ~= nil) and (#cls.UndocumentedFunctions > 0)); local HasConstants = ((cls.UndocumentedConstants ~= nil) and (#cls.UndocumentedConstants > 0)); @@ -1105,10 +1127,10 @@ end --- Lists the API objects that are documented but not available in the API: -local function ListUnexportedObjects() +local function ListUnexportedObjects(a_APIDesc) f = io.open("API/_unexported-documented.txt", "w"); if (f ~= nil) then - for clsname, cls in pairs(g_APIDesc.Classes) do + for clsname, cls in pairs(a_APIDesc.Classes) do if not(cls.IsExported) then -- The whole class is not exported f:write("class\t" .. clsname .. "\n"); @@ -1128,7 +1150,7 @@ local function ListUnexportedObjects() end -- for j, fn - cls.Functions[] end end - end -- for i, cls - g_APIDesc.Classes[] + end -- for i, cls - a_APIDesc.Classes[] f:close(); end end @@ -1252,7 +1274,7 @@ end -local function DumpAPIHtml(a_API) +local function DumpAPIHtml(a_API, a_Descs) LOG("Dumping all available functions and constants to API subfolder..."); -- Create the output folder @@ -1286,7 +1308,7 @@ local function DumpAPIHtml(a_API) return (Hook1.Name < Hook2.Name); end ); - ReadHooks(Hooks); + ReadHooks(Hooks, a_Descs); -- Create a "class index" file, write each class as a link to that file, -- then dump class contents into class-specific file @@ -1342,7 +1364,7 @@ local function DumpAPIHtml(a_API) <hr /> ]]); - WriteArticles(f); + WriteArticles(f, a_Descs); WriteClasses(f, a_API, ClassMenu); WriteHooks(f, Hooks, UndocumentedHooks, HookNav); @@ -1363,7 +1385,7 @@ local function DumpAPIHtml(a_API) -- List the documentation problems: LOG("Listing leftovers..."); ListUndocumentedObjects(a_API, UndocumentedHooks); - ListUnexportedObjects(); + ListUnexportedObjects(a_Descs); ListMissingPages(); WriteStats(f); @@ -1614,18 +1636,20 @@ end --- Prepares the API and Globals tables containing the documentation +-- Returns the API and Globals desc table, containing the Classes and Hooks subtables with descriptions, +-- and the apiDesc table containing the descriptions only in their original format. local function PrepareApi() -- Load the API descriptions from the Classes and Hooks subfolders: -- This needs to be done each time the command is invoked because the export modifies the tables' contents - dofile(g_PluginFolder .. "/APIDesc.lua") - if (g_APIDesc.Classes == nil) then - g_APIDesc.Classes = {}; + local apiDesc = dofile(g_PluginFolder .. "/APIDesc.lua") + if (apiDesc.Classes == nil) then + apiDesc.Classes = {}; end - if (g_APIDesc.Hooks == nil) then - g_APIDesc.Hooks = {}; + if (apiDesc.Hooks == nil) then + apiDesc.Hooks = {}; end - LoadAPIFiles("/Classes/", g_APIDesc.Classes); - LoadAPIFiles("/Hooks/", g_APIDesc.Hooks); + LoadAPIFiles("/Classes/", apiDesc.Classes); + LoadAPIFiles("/Hooks/", apiDesc.Hooks); -- Reset the stats: g_TrackedPages = {}; -- List of tracked pages, to be checked later whether they exist. Each item is an array of referring pagenames. @@ -1662,9 +1686,9 @@ local function PrepareApi() -- Read in the descriptions: LOG("Reading descriptions..."); - ReadDescriptions(API); + ReadDescriptions(API, apiDesc); - return API, Globals + return API, Globals, apiDesc end @@ -1675,13 +1699,13 @@ local function DumpApi() LOG("Dumping the API...") -- Match the currently exported API with the available documentation: - local API, Globals = PrepareApi() + local API, Globals, descs = PrepareApi() -- Check that the API lists the inheritance properly, report any problems to a file: CheckAPIDescendants(API) -- Dump all available API objects in HTML format into a subfolder: - DumpAPIHtml(API); + DumpAPIHtml(API, descs); -- Dump all available API objects in format used by ZeroBraneStudio API descriptions: DumpAPIZBS(API) @@ -1737,18 +1761,20 @@ local function HandleCmdApiCheck(a_Split, a_EntireCmd) end -- Load the API stats as a Lua file, process into usable dictionary: + -- The _undocumented.lua file format has changed from "g_APIDesc = {}" to "return {}" + -- To support both versions, we execute the function in a sandbox and check both its return value and the sandbox globals local Loaded, Msg = loadstring(OfficialStats) if not(Loaded) then return true, "Cannot load official stats: " .. (Msg or "<unknown error>") end - local OfficialStatsDict = {} - setfenv(Loaded, OfficialStatsDict) - local IsSuccess, ErrMsg = pcall(Loaded) + local sandbox = {} + setfenv(Loaded, sandbox) + local IsSuccess, OfficialUndocumented = pcall(Loaded) if not(IsSuccess) then - return true, "Cannot parse official stats: " .. tostring(ErrMsg or "<unknown error>") + return true, "Cannot parse official stats: " .. tostring(OfficialUndocumented or "<unknown error>") end local Parsed = {} - for clsK, clsV in pairs(OfficialStatsDict.g_APIDesc.Classes) do + for clsK, clsV in pairs((sandbox.g_APIDesc or OfficialUndocumented).Classes) do -- Check return value OR sandbox global, whichever is present local cls = { Desc = not(clsV.Desc), -- set to true if the Desc was not documented in the official docs |