diff options
Diffstat (limited to '')
-rw-r--r-- | Server/Plugins/APIDump/Classes/BlockEntities.lua | 1433 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Geometry.lua | 2593 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Network.lua | 635 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Plugins.lua | 1084 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/Projectiles.lua | 454 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Classes/WebAdmin.lua | 229 |
6 files changed, 5677 insertions, 751 deletions
diff --git a/Server/Plugins/APIDump/Classes/BlockEntities.lua b/Server/Plugins/APIDump/Classes/BlockEntities.lua index 4e19e03c0..3f3552c99 100644 --- a/Server/Plugins/APIDump/Classes/BlockEntities.lua +++ b/Server/Plugins/APIDump/Classes/BlockEntities.lua @@ -1,5 +1,160 @@ return { + cBeaconEntity = + { + Desc = [[ + A beacon entity is a {{cBlockEntityWithItems}} descendant that represents a beacon + in the world. + ]], + Functions = + { + CalculatePyramidLevel = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Calculate the amount of layers the pyramid below the beacon has.", + }, + GetBeaconLevel = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the beacon level. (0 - 4)", + }, + GetPrimaryEffect = + { + Returns = + { + { + Name = "EffectType", + Type = "cEntityEffect#eType", + }, + }, + Notes = "Returns the primary effect.", + }, + GetSecondaryEffect = + { + Returns = + { + { + Name = "EffectType", + Type = "cEntityEffect#eType", + }, + }, + Notes = "Returns the secondary effect.", + }, + GiveEffects = + { + Notes = "Give the near-players the effects.", + }, + IsActive = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Is the beacon active?", + }, + IsBeaconBlocked = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Is the beacon blocked by non-transparent blocks that are higher than the beacon?", + }, + IsMineralBlock = + { + IsStatic = true, + Params = + { + { + Name = "BlockType", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the block is a diamond block, a golden block, an iron block or an emerald block.", + }, + IsValidEffect = + { + IsStatic = true, + Params = + { + { + Name = "EffectType", + Type = "cEntityEffect#eType", + }, + { + Name = "BeaconLevel", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the effect can be used.", + }, + SetPrimaryEffect = + { + Params = + { + { + Name = "EffectType", + Type = "cEntityEffect#eType", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Select the primary effect. Returns false when the effect is invalid.", + }, + SetSecondaryEffect = + { + Params = + { + { + Name = "EffectType", + Type = "cEntityEffect#eType", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Select the secondary effect. Returns false when the effect is invalid.", + }, + UpdateBeacon = + { + Notes = "Update the beacon.", + }, + }, + Inherits = "cBlockEntityWithItems", + }, cBlockEntity = { Desc = [[ @@ -7,22 +162,111 @@ return or contents of a chest. All block entities are also saved in the chunk data of the chunk they reside in. The cBlockEntity class acts as a common ancestor for all the individual block entities. ]], - Functions = { - 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" }, - GetRelX = { Params = "", Return = "number", Notes = "Returns the relative X coord of the block entity's block within the chunk" }, - GetRelZ = { Params = "", Return = "number", Notes = "Returns the relative Z coord of the block entity's block within the chunk" }, - GetWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world to which the block entity belongs" }, + GetBlockType = + { + Returns = + { + { + Name = "BLOCKTYPE", + Type = "number", + }, + }, + Notes = "Returns the blocktype which is represented by this blockentity. This is the primary means of type-identification", + }, + GetChunkX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the chunk X-coord of the block entity's chunk", + }, + GetChunkZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the chunk Z-coord of the block entity's chunk", + }, + GetPos = + { + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns the name of the parent class, or empty string if no parent class.", + }, + GetPosX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the block X-coord of the block entity's block", + }, + GetPosY = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the block Y-coord of the block entity's block", + }, + GetPosZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the block Z-coord of the block entity's block", + }, + GetRelX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the relative X coord of the block entity's block within the chunk", + }, + GetRelZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the relative Z coord of the block entity's block within the chunk", + }, + GetWorld = + { + Returns = + { + { + Type = "cWorld", + }, + }, + Notes = "Returns the world to which the block entity belongs", + }, }, }, - cBlockEntityWithItems = { Desc = [[ @@ -32,51 +276,95 @@ return number, or by XY coords within the grid. If a UI window is opened for this block entity, the item storage is monitored for changes and the changes are immediately sent to clients of the UI window. ]], - - Inherits = "cBlockEntity", - Functions = { - GetContents = { Params = "", Return = "{{cItemGrid}}", Notes = "Returns the cItemGrid object representing the items stored within this block entity" }, + GetContents = + { + Returns = + { + { + Type = "cItemGrid", + }, + }, + Notes = "Returns the cItemGrid object representing the items stored within this block entity", + }, GetSlot = { - { 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" }, + { + Params = + { + { + Name = "SlotNum", + Type = "number", + }, + }, + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the cItem for the specified slot number. Returns nil for invalid slot numbers", + }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + }, + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the cItem for the specified slot coords. Returns nil for invalid slot coords", + }, }, SetSlot = { - { 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" }, + { + Params = + { + { + Name = "SlotNum", + Type = "number", + }, + { + Name = "cItem", + Type = "cItem", + }, + }, + Notes = "Sets the cItem for the specified slot number. Ignored if invalid slot number", + }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "cItem", + Type = "cItem", + }, + }, + Notes = "Sets the cItem for the specified slot coords. Ignored if invalid slot coords", + }, }, }, + Inherits = "cBlockEntity", }, - - cBeaconEntity = - { - Desc = [[ - A beacon entity is a {{cBlockEntityWithItems}} descendant that represents a beacon - in the world. - ]], - - Inherits = "cBlockEntityWithItems", - - Functions = - { - 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." }, - }, - }, - cBrewingstandEntity = { Desc = [[ @@ -86,26 +374,154 @@ return ]], Functions = { - 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}}", 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" }, + GetBrewingTimeLeft = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the time until the current items finishes brewing, in ticks", + }, + GetIndgredientSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the ingredient slot", + }, + GetLeftBottleSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the left bottle slot", + }, + GetMiddleBottleSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the middle bottle slot", + }, + GetResultItem = + { + Params = + { + { + Name = "SlotNumber", + Type = "number", + }, + }, + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the expected result item for the given slot number.", + }, + GetRightBottleSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the right bottle slot", + }, + GetTimeBrewed = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the time that the current items has been brewing, in ticks", + }, + SetIngredientSlot = + { + Params = + { + { + Name = "Ingredient", + Type = "cItem", + }, + }, + Notes = "Sets the item in the ingredient bottle slot", + }, + SetLeftBottleSlot = + { + Params = + { + { + Name = "LeftSlot", + Type = "cItem", + }, + }, + Notes = "Sets the item in the left bottle slot", + }, + SetMiddleBottleSlot = + { + Params = + { + { + Name = "MiddleSlot", + Type = "cItem", + }, + }, + Notes = "Sets the item in the middle bottle slot", + }, + SetRightBottleSlot = + { + Params = + { + { + Name = "RightSlot", + Type = "cItem", + }, + }, + Notes = "Sets the item in the right bottle slot", + }, }, Constants = { - bsLeftBottle = { Notes = "Index of the left bottle slot" }, - bsMiddleBottle = { Notes = "Index of the middle bottle slot" }, - bsRightBottle = { Notes = "Index of the right bottle slot" }, - bsIngredient = { Notes = "Index of the ingredient slot" }, - ContentsWidth = { Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents" }, - ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents" }, + bsIngredient = + { + Notes = "Index of the ingredient slot", + }, + bsLeftBottle = + { + Notes = "Index of the left bottle slot", + }, + bsMiddleBottle = + { + Notes = "Index of the middle bottle slot", + }, + bsRightBottle = + { + Notes = "Index of the right bottle slot", + }, + ContentsHeight = + { + Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents", + }, + ContentsWidth = + { + Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents", + }, }, ConstantGroups = { @@ -115,9 +531,8 @@ return TextBefore = "When using the GetSlot() or SetSlot() function, use these constants for slot index:", }, }, - Inherits = "cBlockEntityWithItems" - }, -- cBrewingstandEntity - + Inherits = "cBlockEntityWithItems", + }, cChestEntity = { Desc = [[ @@ -128,13 +543,16 @@ return To manipulate a chest already in the game, you need to use {{cWorld}}'s callback mechanism with either DoWithChestAt() or ForEachChestInChunk() function. See the code example below ]], - - Inherits = "cBlockEntityWithItems", - Constants = { - ContentsHeight = { Notes = "Height of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}" }, - ContentsWidth = { Notes = "Width of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}" }, + ContentsHeight = + { + Notes = "Height of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}", + }, + ContentsWidth = + { + Notes = "Width of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}", + }, }, AdditionalInfo = { @@ -154,24 +572,67 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), </pre> ]], }, - }, -- AdditionalInfo - }, -- cChestEntity - - + }, + Inherits = "cBlockEntityWithItems", + }, 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" }, + Activate = + { + Notes = "Sets the command block to execute a command in the next tick", + }, + GetCommand = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Retrieves stored command", + }, + GetLastOutput = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Retrieves the last line of output generated by the command block", + }, + GetResult = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Retrieves the result (signal strength) of the last operation", + }, + SetCommand = + { + Params = + { + { + Name = "Command", + Type = "string", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + Notes = "Sets the command", + }, }, - }, -- cCommandBlockEntity - - + Inherits = "cBlockEntity", + }, cDispenserEntity = { Desc = [[ @@ -179,14 +640,66 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), 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." }, + GetShootVector = + { + IsStatic = true, + Params = + { + { + Name = "BlockMeta", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would be facing.", + }, + SpawnProjectileFromDispenser = + { + Params = + { + { + Name = "BlockX", + Type = "number", + }, + { + Name = "BlockY", + Type = "number", + }, + { + Name = "BlockZ", + Type = "number", + }, + { + Name = "Kind", + Type = "cProjectileEntity#eKind", + }, + { + Name = "Speed", + Type = "Vector3d", + }, + { + Name = "Item", + Type = "cItem", + }, + }, + Returns = + { + { + Type = "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.", + }, }, + Inherits = "cDropSpenserEntity", }, - cDropperEntity = { Desc = [[ @@ -197,9 +710,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks). ]], Inherits = "cDropSpenserEntity", - }, -- cDropperEntity - - + }, cDropSpenserEntity = { Desc = [[ @@ -207,19 +718,115 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], Functions = { - Activate = { Params = "", Return = "", Notes = "Sets the block entity to dropspense an item in the next tick" }, - AddDropSpenserDir = { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "BlockX, BlockY, BlockZ", Notes = "Adjusts the block coords to where the dropspenser items materialize" }, - SetRedstonePower = { Params = "IsPowered", Return = "", Notes = "Sets the redstone status of the dropspenser. If the redstone power goes from off to on, the dropspenser will be activated" }, + Activate = + { + Notes = "Sets the block entity to dropspense an item in the next tick", + }, + AddDropSpenserDir = + { + Params = + { + { + Name = "BlockX", + Type = "number", + }, + { + Name = "BlockY", + Type = "number", + }, + { + Name = "BlockZ", + Type = "number", + }, + { + Name = "BlockMeta", + Type = "number", + }, + }, + Returns = + { + { + Name = "BlockX", + Type = "number", + }, + { + Name = "BlockY", + Type = "number", + }, + { + Name = "BlockZ", + Type = "number", + }, + }, + Notes = "Adjusts the block coords to where the dropspenser items materialize", + }, + SetRedstonePower = + { + Params = + { + { + Name = "IsPowered", + Type = "boolean", + }, + }, + Notes = "Sets the redstone status of the dropspenser. If the redstone power goes from off to on, the dropspenser will be activated", + }, }, Constants = { - ContentsWidth = { Notes = "Width (X) of the {{cItemGrid}} representing the contents" }, - ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid}} representing the contents" }, + ContentsHeight = + { + Notes = "Height (Y) of the {{cItemGrid}} representing the contents", + }, + ContentsWidth = + { + Notes = "Width (X) of the {{cItemGrid}} representing the contents", + }, + }, + Inherits = "cBlockEntityWithItems", + }, + cFlowerPotEntity = + { + Desc = [[ + This class represents a flower pot entity in the world. + ]], + Functions = + { + GetItem = + { + Returns = + { + { + Name = "Item", + Type = "cItem", + }, + }, + Notes = "Returns the item in the flower pot.", + }, + IsItemInPot = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Is a flower in the pot?", + }, + SetItem = + { + Params = + { + { + Name = "Item", + Type = "cItem", + }, + }, + Notes = "Set the item in the flower pot", + }, }, - Inherits = "cBlockEntityWithItems"; - }, -- cDropSpenserEntity - - + Inherits = "cBlockEntity", + }, cFurnaceEntity = { Desc = [[ @@ -229,24 +836,132 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], Functions = { - GetCookTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current item finishes cooking, in ticks" }, - GetFuelBurnTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current fuel is depleted, in ticks" }, - GetFuelSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the fuel slot" }, - GetInputSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the input slot" }, - GetOutputSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the output slot" }, - GetTimeCooked = { Params = "", Return = "number", Notes = "Returns the time that the current item has been cooking, in ticks" }, - HasFuelTimeLeft = { Params = "", Return = "bool", Notes = "Returns true if there's time before the current fuel is depleted" }, - SetFuelSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the fuel slot" }, - SetInputSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the input slot" }, - SetOutputSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the output slot" }, + GetCookTimeLeft = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the time until the current item finishes cooking, in ticks", + }, + GetFuelBurnTimeLeft = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the time until the current fuel is depleted, in ticks", + }, + GetFuelSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the fuel slot", + }, + GetInputSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the input slot", + }, + GetOutputSlot = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item in the output slot", + }, + GetTimeCooked = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the time that the current item has been cooking, in ticks", + }, + HasFuelTimeLeft = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if there's time before the current fuel is depleted", + }, + SetFuelSlot = + { + Params = + { + { + Name = "Fuel", + Type = "cItem", + }, + }, + Notes = "Sets the item in the fuel slot", + }, + SetInputSlot = + { + Params = + { + { + Name = "Input", + Type = "cItem", + }, + }, + Notes = "Sets the item in the input slot", + }, + SetOutputSlot = + { + Params = + { + { + Name = "Output", + Type = "cItem", + }, + }, + Notes = "Sets the item in the output slot", + }, }, Constants = { - fsInput = { Notes = "Index of the input slot" }, - fsFuel = { Notes = "Index of the fuel slot" }, - fsOutput = { Notes = "Index of the output slot" }, - ContentsWidth = { Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents" }, - ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents" }, + ContentsHeight = + { + Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents", + }, + ContentsWidth = + { + Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents", + }, + fsFuel = + { + Notes = "Index of the fuel slot", + }, + fsInput = + { + Notes = "Index of the input slot", + }, + fsOutput = + { + Notes = "Index of the output slot", + }, }, ConstantGroups = { @@ -256,10 +971,8 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), TextBefore = "When using the GetSlot() or SetSlot() function, use these constants for slot index:", }, }, - Inherits = "cBlockEntityWithItems" - }, -- cFurnaceEntity - - + Inherits = "cBlockEntityWithItems", + }, cHopperEntity = { Desc = [[ @@ -267,83 +980,359 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], Functions = { - GetOutputBlockPos = { Params = "BlockMeta", Return = "bool, BlockX, BlockY, BlockZ", Notes = "Returns whether the hopper is attached, and if so, the block coords of the block receiving the output items, based on the given meta." }, + GetOutputBlockPos = + { + Params = + { + { + Name = "BlockMeta", + Type = "number", + }, + }, + Returns = + { + { + Name = "IsAttached", + Type = "boolean", + }, + { + Name = "BlockX", + Type = "number", + }, + { + Name = "BlockY", + Type = "number", + }, + { + Name = "BlockZ", + Type = "number", + }, + }, + Notes = "Returns whether the hopper is attached, and if so, the block coords of the block receiving the output items, based on the given meta.", + }, }, Constants = { - ContentsHeight = { Notes = "Height (Y) of the internal {{cItemGrid}} representing the hopper contents." }, - ContentsWidth = { Notes = "Width (X) of the internal {{cItemGrid}} representing the hopper contents." }, - TICKS_PER_TRANSFER = { Notes = "Number of ticks between when the hopper transfers items." }, + ContentsHeight = + { + Notes = "Height (Y) of the internal {{cItemGrid}} representing the hopper contents.", + }, + ContentsWidth = + { + Notes = "Width (X) of the internal {{cItemGrid}} representing the hopper contents.", + }, + TICKS_PER_TRANSFER = + { + Notes = "Number of ticks between when the hopper transfers items.", + }, }, Inherits = "cBlockEntityWithItems", - }, -- cHopperEntity - - + }, cJukeboxEntity = { Desc = [[ This class represents a jukebox in the world. It can play the records, either when the {{cPlayer|player}} uses the record on the jukebox, or when a plugin instructs it to play. ]], - Inherits = "cBlockEntity", Functions = { - EjectRecord = { Params = "", Return = "bool", Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0). Returns true if pickup ejected." }, - GetRecord = { Params = "", Return = "number", Notes = "Returns the record currently present. Zero for no record, E_ITEM_*_DISC for records." }, - IsPlayingRecord = { Params = "", Return = "bool", Notes = "Returns true if the jukebox is playing a record." }, - IsRecordItem = { Params = "ItemType", Return = "bool", Notes = "Returns true if the specified item is a record that can be played." }, - PlayRecord = { Params = "RecordItemType", Return = "bool", Notes = "Plays the specified Record. Return false if the parameter isn't a playable Record (E_ITEM_XXX_DISC). If there is a record already playing, ejects it first." }, - SetRecord = { Params = "number", Return = "", Notes = "Sets the currently present record. Use zero for no record, or E_ITEM_*_DISC for records." }, + EjectRecord = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0). Returns true if pickup ejected.", + }, + GetRecord = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the record currently present. Zero for no record, E_ITEM_*_DISC for records.", + }, + IsPlayingRecord = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the jukebox is playing a record.", + }, + IsRecordItem = + { + Params = + { + { + Name = "ItemType", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified item is a record that can be played.", + }, + PlayRecord = + { + Params = + { + { + Name = "RecordItemType", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Plays the specified Record. Return false if the parameter isn't a playable Record (E_ITEM_XXX_DISC). If there is a record already playing, ejects it first.", + }, + SetRecord = + { + Params = + { + { + Name = "RecordItemType", + Type = "number", + }, + }, + Notes = "Sets the currently present record. Use zero for no record, or E_ITEM_*_DISC for records.", + }, }, - }, -- cJukeboxEntity - - + Inherits = "cBlockEntity", + }, cMobHeadEntity = { Desc = [[ This class represents a mob head block entity in the world. ]], - Inherits = "cBlockEntity", Functions = { - GetOwnerName = { Params = "", Return = "string", Notes = "Returns the player name 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" }, + GetOwnerName = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the player name of the mob head", + }, + GetOwnerTexture = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the player texture of the mob head", + }, + GetOwnerTextureSignature = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the signature of the player texture of the mob head", + }, + GetOwnerUUID = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the player UUID of the mob head", + }, + GetRotation = + { + Returns = + { + { + Type = "eMobHeadRotation", + }, + }, + Notes = "Returns the rotation of the mob head", + }, + GetType = + { + Returns = + { + { + Type = "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" }, + { + Params = + { + { + Name = "cPlayer", + Type = "cPlayer", + }, + }, + Notes = "Set the {{cPlayer|player}} for mob heads with player type", + }, + { + Params = + { + { + Name = "OwnerUUID", + Type = "string", + }, + { + Name = "OwnerName", + Type = "string", + }, + { + Name = "OwnerTexture", + Type = "string", + }, + { + Name = "OwnerTextureSignature", + Type = "string", + }, + }, + Notes = "Sets the player components for the mob heads with player type", + }, + }, + SetRotation = + { + Params = + { + { + Name = "Rotation", + Type = "eMobHeadRotation", + }, + }, + Notes = "Sets the rotation of the mob head.", + }, + SetType = + { + Params = + { + { + Name = "HeadType", + Type = "eMobHeadType", + }, + }, + Notes = "Set the type of the mob head", }, - 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 - - + Inherits = "cBlockEntity", + }, cMobSpawnerEntity = { Desc = [[ This class represents a mob spawner block entity in the world. ]], - Inherits = "cBlockEntity", Functions = { - GetEntity = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the entity type that 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." }, - 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." }, + GetEntity = + { + Returns = + { + { + Name = "MobType", + Type = "Globals#MobType", + }, + }, + Notes = "Returns the entity type that will be spawn by this mob spawner.", + }, + GetNearbyMonsterNum = + { + Params = + { + { + Name = "MobType", + Type = "eMonsterType", + }, + }, + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the amount of this monster type in a 8-block radius (Y: 4-block radius).", + }, + GetNearbyPlayersNum = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the amount of the nearby players in a 16-block radius.", + }, + GetSpawnDelay = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the spawn delay. This is the tick delay that is needed to spawn new monsters.", + }, + ResetTimer = + { + Notes = "Sets the spawn delay to a new random value.", + }, + SetEntity = + { + Params = + { + { + Name = "MobType", + Type = "Globals#MobType", + }, + }, + Notes = "Sets the type of the mob that will be spawned by this mob spawner.", + }, + SetSpawnDelay = + { + Params = + { + { + Name = "SpawnDelayTicks", + Type = "number", + }, + }, + Notes = "Sets the spawn delay.", + }, + SpawnEntity = + { + Notes = "Spawns the entity. This function automaticly change the spawn delay!", + }, + UpdateActiveState = + { + Notes = "Upate the active flag from the mob spawner. This function is called every 5 seconds from the Tick() function.", + }, }, - }, -- cMobSpawnerEntity - - + Inherits = "cBlockEntity", + }, cNoteEntity = { Desc = [[ @@ -355,14 +1344,38 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], Functions = { - GetPitch = { Params = "", Return = "number", Notes = "Returns the current pitch set for the block" }, - IncrementPitch = { Params = "", Return = "", Notes = "Adds 1 to the current pitch. Wraps around to 0 when the pitch cannot go any higher." }, - MakeSound = { Params = "", Return = "", Notes = "Plays the sound for all {{cClientHandle|clients}} near this block." }, - SetPitch = { Params = "Pitch", Return = "", Notes = "Sets a new pitch for the block." }, + GetPitch = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the current pitch set for the block", + }, + IncrementPitch = + { + Notes = "Adds 1 to the current pitch. Wraps around to 0 when the pitch cannot go any higher.", + }, + MakeSound = + { + Notes = "Plays the sound for all {{cClientHandle|clients}} near this block.", + }, + SetPitch = + { + Params = + { + { + Name = "Pitch", + Type = "number", + }, + }, + Notes = "Sets a new pitch for the block.", + }, }, Inherits = "cBlockEntity", - }, -- cNoteEntity - + }, cSignEntity = { Desc = [[ @@ -371,28 +1384,62 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], Functions = { - GetLine = { Params = "LineIndex", Return = "string", Notes = "Returns the specified line. LineIndex is expected between 0 and 3. Returns empty string and logs to server console when LineIndex is invalid." }, - SetLine = { Params = "LineIndex, LineText", Return = "", Notes = "Sets the specified line. LineIndex is expected between 0 and 3. Logs to server console when LineIndex is invalid." }, - SetLines = { Params = "Line1, Line2, Line3, Line4", Return = "", Notes = "Sets all the sign's lines at once." }, - }, - Inherits = "cBlockEntity"; - }, -- cSignEntity - - cFlowerPotEntity = - { - Desc = [[ - This class represents a flower pot entity in the world. - ]], - Functions = - { - IsItemInPot = { Params = "", Return = "bool", Notes = "Is a flower in the pot?" }, - GetItem = { Params = "", Return = "{{cItem|Item}}", Notes = "Returns the item in the flower pot." }, - SetItem = { Params = "{{cItem|Item}}", Return = "", Notes = "Set the item in the flower pot" }, + GetLine = + { + Params = + { + { + Name = "LineIndex", + Type = "number", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the specified line. LineIndex is expected between 0 and 3. Returns empty string and logs to server console when LineIndex is invalid.", + }, + SetLine = + { + Params = + { + { + Name = "LineIndex", + Type = "number", + }, + { + Name = "LineText", + Type = "string", + }, + }, + Notes = "Sets the specified line. LineIndex is expected between 0 and 3. Logs to server console when LineIndex is invalid.", + }, + SetLines = + { + Params = + { + { + Name = "Line1", + Type = "string", + }, + { + Name = "Line2", + Type = "string", + }, + { + Name = "Line3", + Type = "string", + }, + { + Name = "Line4", + Type = "string", + }, + }, + Notes = "Sets all the sign's lines at once. Note that plugins should prefer to use {{cWorld}}:SetSignLines(), so that they can specify the player on whose behalf the sign is being set.", + }, }, - Inherits = "cBlockEntity"; - }, -- cFlowerPotEntity + Inherits = "cBlockEntity", + }, } - - - - diff --git a/Server/Plugins/APIDump/Classes/Geometry.lua b/Server/Plugins/APIDump/Classes/Geometry.lua index b9d9cbd4e..fa0fe995a 100644 --- a/Server/Plugins/APIDump/Classes/Geometry.lua +++ b/Server/Plugins/APIDump/Classes/Geometry.lua @@ -22,49 +22,526 @@ return ]], Functions = { + CalcLineIntersection = + { + { + Params = + { + { + Name = "LineStart", + Type = "Vector3d", + }, + { + Name = "LinePt2", + Type = "Vector3d", + }, + }, + Returns = + { + { + Name = "DoesIntersect", + Type = "boolean", + }, + { + Name = "LineCoeff", + Type = "number", + IsOptional = true, + }, + { + Name = "Face", + Type = "eBlockFace", + IsOptional = true, + }, + }, + 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.", + }, + { + IsStatic = true, + Params = + { + { + Name = "BoxMin", + Type = "number", + }, + { + Name = "BoxMax", + Type = "number", + }, + { + Name = "LineStart", + Type = "Vector3d", + }, + { + Name = "LinePt2", + Type = "Vector3d", + }, + }, + Returns = + { + { + Name = "DoesIntersect", + Type = "boolean", + }, + { + Name = "LineCoeff", + Type = "number", + IsOptional = true, + }, + { + Name = "Face", + Type = "eBlockFace", + IsOptional = 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.", + }, + }, constructor = { - { Params = "MinX, MaxX, MinY, MaxY, MinZ, MaxZ", Return = "cBoundingBox", Notes = "Creates a new bounding box with the specified edges" }, - { 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." }, + { + Params = + { + { + Name = "MinX", + Type = "number", + }, + { + Name = "MaxX", + Type = "number", + }, + { + Name = "MinY", + Type = "number", + }, + { + Name = "MaxY", + Type = "number", + }, + { + Name = "MinZ", + Type = "number", + }, + { + Name = "MaxZ", + Type = "number", + }, + }, + Returns = + { + { + Type = "cBoundingBox", + }, + }, + Notes = "Creates a new bounding box with the specified edges", + }, + { + Params = + { + { + Name = "Min", + Type = "number", + }, + { + Name = "Max", + Type = "number", + }, + }, + Returns = + { + { + Type = "cBoundingBox", + }, + }, + Notes = "Creates a new bounding box with the coords specified as two vectors", + }, + { + Params = + { + { + Name = "Pos", + Type = "Vector3d", + }, + { + Name = "Radius", + Type = "number", + }, + { + Name = "Height", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "OtherBoundingBox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "cBoundingBox", + }, + }, + Notes = "Creates a new copy of the given bounding box. Same result can be achieved by using a simple assignment.", + }, + { + Params = + { + { + Name = "Pos", + Type = "Vector3d", + }, + { + Name = "CubeSideLength", + Type = "number", + }, + }, + Returns = + { + { + Type = "cBoundingBox", + }, + }, + Notes = "Creates a new bounding box as a cube with the specified side length centered around the specified point.", + }, }, - CalcLineIntersection = + DoesIntersect = + { + Params = + { + { + Name = "OtherBoundingBox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the two bounding boxes have an intersection of nonzero volume.", + }, + Expand = + { + Params = + { + { + Name = "ExpandX", + Type = "number", + }, + { + Name = "ExpandY", + Type = "number", + }, + { + Name = "ExpandZ", + Type = "number", + }, + }, + Notes = "Expands this bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each axis).", + }, + GetMax = + { + Returns = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Notes = "Returns the boundary point with the maximum coords", + }, + GetMaxX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the maximum X coord of the bounding box", + }, + GetMaxY = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the maximum Y coord of the bounding box", + }, + GetMaxZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the maximum Z coord of the bounding box", + }, + GetMin = { - { 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]", 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)." }, - GetMax = { Params = "", Return = "{{Vector3d|Point}}", Notes = "Returns the boundary point with the maximum coords" }, - GetMaxX = { Params = "", Return = "number", Notes = "Returns the maximum X coord of the bounding box" }, - GetMaxY = { Params = "", Return = "number", Notes = "Returns the maximum Y coord of the bounding box" }, - GetMaxZ = { Params = "", Return = "number", Notes = "Returns the maximum Z coord of the bounding box" }, - GetMin = { Params = "", Return = "{{Vector3d|Point}}", Notes = "Returns the boundary point with the minimum coords" }, - GetMinX = { Params = "", Return = "number", Notes = "Returns the minimum X coord of the bounding box" }, - GetMinY = { Params = "", Return = "number", Notes = "Returns the minimum Y coord of the bounding box" }, - GetMinZ = { Params = "", Return = "number", Notes = "Returns the minimum Z coord of the bounding box" }, - Intersect = { Params = "{{cBoundingBox|OtherBbox}}", Return = "bool, [{{cBoundingBox|bbox}}]", Notes = "Checks if the intersection between this bounding box and another one is non-empty. Returns false if the intersection is empty, true and a new cBoundingBox representing the intersection of the two boxes." }, + Returns = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Notes = "Returns the boundary point with the minimum coords", + }, + GetMinX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the minimum X coord of the bounding box", + }, + GetMinY = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the minimum Y coord of the bounding box", + }, + GetMinZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the minimum Z coord of the bounding box", + }, + Intersect = + { + Params = + { + { + Name = "OtherBbox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "boolean", + }, + { + Name = "Intersection", + Type = "cBoundingBox", + IsOptional = true, + }, + }, + Notes = "Checks if the intersection between this bounding box and another one is non-empty. Returns false if the intersection is empty, true and a new cBoundingBox representing the intersection of the two boxes.", + }, IsInside = { - { Params = "{{Vector3d|Point}}", Return = "bool", Notes = "Returns true if the specified point is inside (including on the edge) of the box." }, - { 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" }, + { + Params = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside (including on the edge) of the box.", + }, + { + Params = + { + { + Name = "PointX", + Type = "number", + }, + { + Name = "PointY", + Type = "number", + }, + { + Name = "PointZ", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside (including on the edge) of the box.", + }, + { + Params = + { + { + Name = "OtherBoundingBox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if OtherBoundingBox is inside of this box.", + }, + { + Params = + { + { + Name = "OtherBoxMin", + Type = "number", + }, + { + Name = "OtherBoxMax", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the other bounding box, specified by its 2 corners, is inside of this box.", + }, + { + IsStatic = true, + Params = + { + { + Name = "Min", + Type = "number", + }, + { + Name = "Max", + Type = "number", + }, + { + Name = "Point", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners", + }, + { + IsStatic = true, + Params = + { + { + Name = "Min", + Type = "number", + }, + { + Name = "Max", + Type = "number", + }, + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners", + }, }, Move = { - { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Moves the bounding box by the specified offset in each axis" }, - { Params = "{{Vector3d|Offset}}", Return = "", Notes = "Moves the bounding box by the specified offset in each axis" }, + { + Params = + { + { + Name = "OffsetX", + Type = "number", + }, + { + Name = "OffsetY", + Type = "number", + }, + { + Name = "OffsetZ", + Type = "number", + }, + }, + Notes = "Moves the bounding box by the specified offset in each axis", + }, + { + Params = + { + { + Name = "Offset", + Type = "Vector3d", + }, + }, + Notes = "Moves the bounding box by the specified offset in each axis", + }, + }, + Union = + { + Params = + { + { + Name = "OtherBoundingBox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "cBoundingBox", + }, + }, + Notes = "Returns the smallest bounding box that contains both OtherBoundingBox and this bounding box. Note that unlike the strict geometrical meaning of \"union\", this operation actually returns a cBoundingBox.", }, - Union = { Params = "OtherBoundingBox", Return = "cBoundingBox", Notes = "Returns the smallest bounding box that contains both OtherBoundingBox and this bounding box. Note that unlike the strict geometrical meaning of \"union\", this operation actually returns a cBoundingBox." }, }, - }, -- cBoundingBox - - + }, cCuboid = { Desc = [[ @@ -77,51 +554,429 @@ return ]], Functions = { + Assign = + { + { + Params = + { + { + Name = "SrcCuboid", + Type = "cCuboid", + }, + }, + Notes = "Copies all the coords from the src cuboid to this cuboid. Sort-state is ignored.", + }, + { + Params = + { + { + Name = "X1", + Type = "number", + }, + { + Name = "Y1", + Type = "number", + }, + { + Name = "Z1", + Type = "number", + }, + { + Name = "X2", + Type = "number", + }, + { + Name = "Y2", + Type = "number", + }, + { + Name = "Z2", + Type = "number", + }, + }, + Notes = "Assigns all the coords to the specified values. Sort-state is ignored.", + }, + }, + ClampX = + { + Params = + { + { + Name = "MinX", + Type = "number", + }, + { + Name = "MaxX", + Type = "number", + }, + }, + Notes = "Clamps both X coords into the range provided. Sortedness-agnostic.", + }, + ClampY = + { + Params = + { + { + Name = "MinY", + Type = "number", + }, + { + Name = "MaxY", + Type = "number", + }, + }, + Notes = "Clamps both Y coords into the range provided. Sortedness-agnostic.", + }, + ClampZ = + { + Params = + { + { + Name = "MinZ", + Type = "number", + }, + { + Name = "MaxZ", + Type = "number", + }, + }, + Notes = "Clamps both Z coords into the range provided. Sortedness-agnostic.", + }, constructor = { - { Params = "", Return = "cCuboid", Notes = "Creates a new Cuboid object with all-zero coords" }, - { Params = "OtherCuboid", Return = "cCuboid", Notes = "Creates a new Cuboid object as a copy of OtherCuboid" }, - { Params = "{{Vector3i|Point1}}, {{Vector3i|Point2}}", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified points as its corners." }, - { Params = "X, Y, Z", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified point as both its corners (the cuboid has a size of 1 in each direction)." }, - { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified points as its corners." }, + { + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with all-zero coords", + }, + { + Params = + { + { + Name = "OtherCuboid", + Type = "cCuboid", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object as a copy of OtherCuboid", + }, + { + Params = + { + { + Name = "Point1", + Type = "Vector3i", + }, + { + Name = "Point2", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with the specified points as its corners.", + }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with the specified point as both its corners (the cuboid has a size of 1 in each direction).", + }, + { + Params = + { + { + Name = "X1", + Type = "number", + }, + { + Name = "Y1", + Type = "number", + }, + { + Name = "Z1", + Type = "number", + }, + { + Name = "X2", + Type = "number", + }, + { + Name = "Y2", + Type = "number", + }, + { + Name = "Z2", + Type = "number", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with the specified points as its corners.", + }, }, - Assign = + DifX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the difference between the two X coords (X-size minus 1). Assumes sorted.", + }, + DifY = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the difference between the two Y coords (Y-size minus 1). Assumes sorted.", + }, + DifZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the difference between the two Z coords (Z-size minus 1). Assumes sorted.", + }, + DoesIntersect = + { + Params = + { + { + Name = "OtherCuboid", + Type = "cCuboid", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this cuboid has at least one voxel in common with OtherCuboid. Note that edges are considered inclusive. Assumes both sorted.", + }, + Engulf = { - { Params = "SrcCuboid", Return = "", Notes = "Copies all the coords from the src cuboid to this cuboid. Sort-state is ignored." }, - { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "", Notes = "Assigns all the coords to the specified values. Sort-state is ignored." }, - }, - ClampX = { Params = "MinX, MaxX", Return = "", Notes = "Clamps both X coords into the range provided. Sortedness-agnostic." }, - ClampY = { Params = "MinY, MaxY", Return = "", Notes = "Clamps both Y coords into the range provided. Sortedness-agnostic." }, - ClampZ = { Params = "MinZ, MaxZ", Return = "", Notes = "Clamps both Z coords into the range provided. Sortedness-agnostic." }, - DifX = { Params = "", Return = "number", Notes = "Returns the difference between the two X coords (X-size minus 1). Assumes sorted." }, - DifY = { Params = "", Return = "number", Notes = "Returns the difference between the two Y coords (Y-size minus 1). Assumes sorted." }, - DifZ = { Params = "", Return = "number", Notes = "Returns the difference between the two Z coords (Z-size minus 1). Assumes sorted." }, - DoesIntersect = { Params = "OtherCuboid", Return = "bool", Notes = "Returns true if this cuboid has at least one voxel in common with OtherCuboid. Note that edges are considered inclusive. Assumes both sorted." }, - Engulf = { Params = "{{Vector3i|Point}}", Return = "", Notes = "If needed, expands the cuboid to include the specified point. Doesn't shrink. Assumes sorted. " }, - Expand = { Params = "SubMinX, AddMaxX, SubMinY, AddMaxY, SubMinZ, AddMaxZ", Return = "", Notes = "Expands the cuboid by the specified amount in each direction. Works on unsorted cuboids as well. NOTE: this function doesn't check for underflows." }, - GetVolume = { Params = "", Return = "number", Notes = "Returns the volume of the cuboid, in blocks. Note that the volume considers both coords inclusive. Works on unsorted cuboids, too." }, - IsCompletelyInside = { Params = "OuterCuboid", Return = "bool", Notes = "Returns true if this cuboid is completely inside (in all directions) in OuterCuboid. Assumes both sorted." }, + Params = + { + { + Name = "Point", + Type = "Vector3i", + }, + }, + Notes = "If needed, expands the cuboid to include the specified point. Doesn't shrink. Assumes sorted. ", + }, + Expand = + { + Params = + { + { + Name = "SubMinX", + Type = "number", + }, + { + Name = "AddMaxX", + Type = "number", + }, + { + Name = "SubMinY", + Type = "number", + }, + { + Name = "AddMaxY", + Type = "number", + }, + { + Name = "SubMinZ", + Type = "number", + }, + { + Name = "AddMaxZ", + Type = "number", + }, + }, + Notes = "Expands the cuboid by the specified amount in each direction. Works on unsorted cuboids as well. NOTE: this function doesn't check for underflows.", + }, + GetVolume = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the volume of the cuboid, in blocks. Note that the volume considers both coords inclusive. Works on unsorted cuboids, too.", + }, + IsCompletelyInside = + { + Params = + { + { + Name = "OuterCuboid", + Type = "cCuboid", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this cuboid is completely inside (in all directions) in OuterCuboid. Assumes both sorted.", + }, IsInside = { - { Params = "X, Y, Z", Return = "bool", Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted." }, - { Params = "{{Vector3i|Point}}", Return = "bool", Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted." }, - { Params = "{{Vector3d|Point}}", Return = "bool", Notes = "Returns true if the specified point (floating-point coords) is inside this cuboid. Assumes sorted." }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted.", + }, + { + Params = + { + { + Name = "Point", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted.", + }, + { + Params = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point (floating-point coords) is inside this cuboid. Assumes sorted.", + }, + }, + IsSorted = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this cuboid is sorted", + }, + Move = + { + Params = + { + { + Name = "OffsetX", + Type = "number", + }, + { + Name = "OffsetY", + Type = "number", + }, + { + Name = "OffsetZ", + Type = "number", + }, + }, + Notes = "Adds the specified offsets to each respective coord, effectively moving the Cuboid. Sort-state is ignored and preserved.", + }, + Sort = + { + Notes = "Sorts the internal representation so that p1 contains the lesser coords and p2 contains the greater coords.", }, - IsSorted = { Params = "", Return = "bool", Notes = "Returns true if this cuboid is sorted" }, - Move = { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Adds the specified offsets to each respective coord, effectively moving the Cuboid. Sort-state is ignored and preserved." }, - Sort = { Params = "", Return = "" , Notes = "Sorts the internal representation so that p1 contains the lesser coords and p2 contains the greater coords." }, }, Variables = { - p1 = { Type = "{{Vector3i}}", Notes = "The first corner. Usually the lesser of the two coords in each set" }, - p2 = { Type = "{{Vector3i}}", Notes = "The second corner. Usually the larger of the two coords in each set" }, + p1 = + { + Type = "{{Vector3i}}", + Notes = "The first corner. Usually the lesser of the two coords in each set", + }, + p2 = + { + Type = "{{Vector3i}}", + Notes = "The second corner. Usually the larger of the two coords in each set", + }, }, - }, -- cCuboid - - + }, cLineBlockTracer = { - Desc = [[This class provides an easy-to-use interface for tracing lines through individual + Desc = [[ +This class provides an easy-to-use interface for tracing lines through individual blocks in the world. It will call the provided callbacks according to what events it encounters along the way.</p> <p> @@ -131,9 +986,53 @@ various events. See below for further information. ]], Functions = { - 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)" }, + Trace = + { + IsStatic = true, + Params = + { + { + Name = "World", + Type = "cWorld", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "StartX", + Type = "number", + }, + { + Name = "StartY", + Type = "number", + }, + { + Name = "StartZ", + Type = "number", + }, + { + Name = "EndX", + Type = "number", + }, + { + Name = "EndY", + Type = "number", + }, + { + Name = "EndZ", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)", + }, }, - AdditionalInfo = { { @@ -205,26 +1104,23 @@ end </p> ]], }, - }, -- AdditionalInfo - }, -- cLineBlockTracer - - + }, + }, cTracer = { Desc = [[ A cTracer object is used to trace lines in the world. One thing you can use the cTracer for, is tracing what block a player is looking at, but you can do more with it if you want.</p> <p> - The cTracer is still a work in progress.</p> + The cTracer is still a work in progress and is not documented at all.</p> <p> See also the {{cLineBlockTracer}} class for an alternative approach using callbacks. ]], Functions = { - }, - }, -- cTracer - + }, + }, Vector3d = { Desc = [[ @@ -235,67 +1131,489 @@ end ]], Functions = { + Abs = + { + Notes = "Updates each coord to its absolute value.", + }, + abs = + { + Notes = "<b>OBSOLETE</b>, use Abs() instead.", + }, + Clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "Clamps each coord into the specified range.", + }, + clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "<b>OBSOLETE</b>, use Clamp() instead.", + }, constructor = { - { Params = "{{Vector3f}}", Return = "Vector3d", Notes = "Creates a new Vector3d object by copying the coords from the given Vector3f." }, - { 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." }, + { + Params = + { + { + Name = "Vector", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Creates a new Vector3d object by copying the coords from the given Vector3f.", + }, + { + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Creates a new Vector3d object with all its coords set to 0.", + }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Creates a new Vector3d object with its coords set to the specified values.", + }, + }, + Cross = + { + Params = + { + { + Name = "Other", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Other", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the dot product of this vector and the specified vector.", + }, + Equals = + { + Params = + { + { + Name = "AnotherVector", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + { + Name = "AnotherVector", + Type = "Vector3d", + }, + { + Name = "Eps", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords.", + }, + HasNonZeroLength = + { + Returns = + { + { + Type = "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 = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the (euclidean) length of the vector.", + }, + LineCoeffToXYPlane = + { + Params = + { + { + Name = "Vector3d", + Type = "Vector3d", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Vector3d", + Type = "Vector3d", + }, + { + Name = "Y", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Vector3d", + Type = "Vector3d", + }, + { + Name = "X", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Notes = "Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets.", + }, + { + Params = + { + { + Name = "Diff", + Type = "Vector3d", + }, + }, + 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 = + { + Notes = "Changes this vector so that it keeps current direction but is exactly 1 unit long. FIXME: Fails for a zero vector.", + }, + NormalizeCopy = + { + Returns = + { + { + Type = "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.", }, 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." }, + { + Params = + { + { + Name = "ParCoordDivisors", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord divided by the corresponding coord from the given vector.", + }, + { + Params = + { + { + Name = "Divisor", + Type = "number", + }, + }, + Returns = + { + { + Type = "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." }, + { + Params = + { + { + Name = "PerCoordMultiplier", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord multiplied by the corresponding coord from the given vector.", + }, + { + Params = + { + { + Name = "Multiplier", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord multiplied.", + }, + }, + operator_plus = + { + Params = + { + { + Name = "Addend", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d containing the sum of this vector and the specified vector", }, - 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. 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 = + { + { + Name = "Subtrahend", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object containing the difference between this object and the specified vector.", + }, + { + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object that is a negative of this vector (all coords multiplied by -1).", + }, + }, + Set = { - { 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." }, + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Notes = "Sets all the coords in this object.", + }, + SqrLength = + { + Returns = + { + { + Type = "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 = + { + 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 = + { + 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.", }, - 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 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 intersection with the plane." }, + 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 = { - x = { Type = "number", Notes = "The X coord of the vector." }, - y = { Type = "number", Notes = "The Y coord of the vector." }, - z = { Type = "number", Notes = "The Z coord of the vector." }, + x = + { + Type = "number", + Notes = "The X coord of the vector.", + }, + y = + { + Type = "number", + Notes = "The Y coord of the vector.", + }, + z = + { + Type = "number", + Notes = "The Z coord of the vector.", + }, }, - }, -- Vector3d - + }, Vector3f = { Desc = [[ @@ -306,69 +1624,521 @@ end ]], Functions = { + Abs = + { + Notes = "Updates each coord to its absolute value.", + }, + abs = + { + Notes = "<b>OBSOLETE</b>, use Abs() instead.", + }, + Clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "Clamps each coord into the specified range.", + }, + clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "<b>OBSOLETE</b>, use Clamp() instead.", + }, constructor = { - { Params = "", Return = "Vector3f", Notes = "Creates a new Vector3f object with zero coords" }, - { Params = "x, y, z", Return = "Vector3f", Notes = "Creates a new Vector3f object with the specified coords" }, - { Params = "Vector3f", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified vector" }, - { 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}}" }, + { + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Creates a new Vector3f object with zero coords", + }, + { + Params = + { + { + Name = "x", + Type = "number", + }, + { + Name = "y", + Type = "number", + }, + { + Name = "z", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Creates a new Vector3f object with the specified coords", + }, + { + Params = + { + { + Name = "Vector3f", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Creates a new Vector3f object as a copy of the specified vector", + }, + { + Params = + { + { + Name = "Vector3d", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3d}}", + }, + { + Params = + { + { + Name = "Vector3i", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3i}}", + }, + }, + Cross = + { + Params = + { + { + Name = "Other", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that holds the cross product of this vector and the specified vector.", + }, + Dot = + { + Params = + { + { + Name = "Other", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the dot product of this vector and the specified vector.", + }, + Equals = + { + Params = + { + { + Name = "Other", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + { + Name = "Other", + Type = "Vector3f", + }, + { + Name = "Eps", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords.", + }, + HasNonZeroLength = + { + Returns = + { + { + Type = "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 = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the (euclidean) length of this vector", + }, + LineCoeffToXYPlane = + { + Params = + { + { + Name = "Vector3f", + Type = "Vector3f", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Vector3f", + Type = "Vector3f", + }, + { + Name = "Y", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Vector3f", + Type = "Vector3f", + }, + { + Name = "X", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Notes = "Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets.", + }, + { + Params = + { + { + Name = "Diff", + Type = "Vector3f", + }, + }, + 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 = + { + Notes = "Normalizes this vector (makes it 1 unit long while keeping the direction). FIXME: Fails for zero vectors.", + }, + NormalizeCopy = + { + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). FIXME: Fails for zero vectors.", }, 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." }, + { + Params = + { + { + Name = "PerCoordDivisor", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object with each coord divided by the corresponding coord from the given vector.", + }, + { + Params = + { + { + Name = "Divisor", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "PerCoordMultiplier", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that has each of its coords multiplied by the specified number", + }, + { + Params = + { + { + Name = "Multiplier", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Other", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that holds the vector sum of this vector and 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." }, - { 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. 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 = + { + { + Name = "Subtrahend", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that holds the vector differrence between this vector and the specified vector.", + }, + { + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f that is a negative of this vector (all coords multiplied by -1).", + }, + }, + Set = + { + Params = + { + { + Name = "x", + Type = "number", + }, + { + Name = "y", + Type = "number", + }, + { + Name = "z", + Type = "number", + }, + }, + Notes = "Sets all the coords of the vector at once.", + }, + SqrLength = + { + Returns = + { + { + Type = "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 = + { + 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 = "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." }, + 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.", }, - 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." }, + 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 = { - x = { Type = "number", Notes = "The X coord of the vector." }, - y = { Type = "number", Notes = "The Y coord of the vector." }, - z = { Type = "number", Notes = "The Z coord of the vector." }, + x = + { + Type = "number", + Notes = "The X coord of the vector.", + }, + y = + { + Type = "number", + Notes = "The Y coord of the vector.", + }, + z = + { + Type = "number", + Notes = "The Z coord of the vector.", + }, }, - }, -- Vector3f - + }, Vector3i = { Desc = [[ @@ -379,68 +2149,487 @@ end ]], Functions = { + Abs = + { + Notes = "Updates each coord to its absolute value.", + }, + abs = + { + Notes = "<b>OBSOLETE</b>, use Abs() instead.", + }, + Clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "Clamps each coord into the specified range.", + }, + clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "<b>OBSOLETE</b>, use Clamp() instead.", + }, constructor = { - { Params = "", Return = "Vector3i", Notes = "Creates a new Vector3i object with zero coords." }, - { 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}}." }, + { + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Creates a new Vector3i object with zero coords.", + }, + { + Params = + { + { + Name = "x", + Type = "number", + }, + { + Name = "y", + Type = "number", + }, + { + Name = "z", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Creates a new Vector3i object with the specified coords.", + }, + { + Params = + { + { + Name = "Vector3d", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Creates a new Vector3i object with coords copied and floor()-ed from the specified {{Vector3d}}.", + }, + }, + Cross = + { + Params = + { + { + Name = "Other", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Other", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the dot product of this vector and the specified vector.", + }, + Equals = + { + Params = + { + { + Name = "Other", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this vector is exactly the same as the specified vector.", + }, + EqualsEps = + { + Params = + { + { + Name = "Other", + Type = "Vector3i", + }, + { + Name = "Eps", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + Returns = + { + { + Type = "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 = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the vector has at least one coord non-zero.", + }, + Length = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the (euclidean) length of this vector.", + }, + LineCoeffToXYPlane = + { + Params = + { + { + Name = "Vector3i", + Type = "Vector3i", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Vector3i", + Type = "Vector3i", + }, + { + Name = "Y", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Vector3i", + Type = "Vector3i", + }, + { + Name = "X", + Type = "number", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "x", + Type = "number", + }, + { + Name = "y", + Type = "number", + }, + { + Name = "z", + Type = "number", + }, + }, + Notes = "Moves the vector by the specified amount in each axis direction.", + }, + { + Params = + { + { + Name = "Diff", + Type = "Vector3i", + }, + }, + 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 = + { + 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 = + { + Returns = + { + { + Type = "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.", }, 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." }, + { + Params = + { + { + Name = "Divisor", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that has each of its coords divided by the specified number", + }, + { + Params = + { + { + Name = "PerCoordDivisors", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "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." }, + { + Params = + { + { + Name = "Multiplier", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that has each of its coords multiplied by the specified number", + }, + { + Params = + { + { + Name = "PerCoordMultipliers", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "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 = + { + { + Name = "Addend", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3f object that holds the vector sum of this vector and 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." }, - 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 = "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." }, - 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 = + { + { + Name = "Subtrahend", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that holds the vector differrence between this vector and the specified vector.", + }, + { + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i that is a negative of this vector (all coords multiplied by -1).", + }, + }, + Set = + { + Params = + { + { + Name = "x", + Type = "number", + }, + { + Name = "y", + Type = "number", + }, + { + Name = "z", + Type = "number", + }, + }, + Notes = "Sets all the coords of the vector at once", + }, + SqrLength = + { + Returns = + { + { + Type = "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 = "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." }, + 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 = + { + 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.", }, - 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." }, + 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 = { - x = { Type = "number", Notes = "The X coord of the vector." }, - y = { Type = "number", Notes = "The Y coord of the vector." }, - z = { Type = "number", Notes = "The Z coord of the vector." }, + x = + { + Type = "number", + Notes = "The X coord of the vector.", + }, + y = + { + Type = "number", + Notes = "The Y coord of the vector.", + }, + z = + { + Type = "number", + Notes = "The Z coord of the vector.", + }, }, - }, -- Vector3i + }, } - - - - diff --git a/Server/Plugins/APIDump/Classes/Network.lua b/Server/Plugins/APIDump/Classes/Network.lua index 1b102a422..3c47e3c6d 100644 --- a/Server/Plugins/APIDump/Classes/Network.lua +++ b/Server/Plugins/APIDump/Classes/Network.lua @@ -11,8 +11,7 @@ return { cNetwork = { - Desc = - [[ + Desc = [[ This is the namespace for high-level network-related operations. Allows plugins to make TCP connections to the outside world using a callback-based API.</p> <p> @@ -21,12 +20,139 @@ return local Server = cNetwork:Listen(1024, ListenCallbacks); </pre></p> ]], + Functions = + { + Connect = + { + IsStatic = true, + Params = + { + { + Name = "Host", + Type = "string", + }, + { + Name = "Port", + Type = "number", + }, + { + Name = "LinkCallbacks", + Type = "table", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "Port", + Type = "number", + }, + { + Name = "UDPCallbacks", + Type = "table", + }, + }, + Returns = + { + { + Type = "cUDPEndpoint", + }, + }, + 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 = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns all local IP addresses for network interfaces currently available on the machine, as an array-table of strings.", + }, + HostnameToIP = + { + IsStatic = true, + Params = + { + { + Name = "Host", + Type = "string", + }, + { + Name = "LookupCallbacks", + Type = "table", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "Address", + Type = "string", + }, + { + Name = "LookupCallbacks", + Type = "table", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "Port", + Type = "number", + }, + { + Name = "ListenCallbacks", + Type = "table", + }, + }, + Returns = + { + { + Type = "cServerHandle", + }, + }, + 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.", + }, + }, AdditionalInfo = { { Header = "Using callbacks", - Contents = - [[ + Contents = [[ The entire Networking API is callback-based. Whenever an event happens on the network object, a specific plugin-provided function is called. The callbacks are stored in tables which are passed to the API functions, each table contains multiple callbacks for the various situations.</p> @@ -146,11 +272,9 @@ local UDPCallbacks = </pre> ]], }, - { Header = "Example client connection", - Contents = - [[ + Contents = [[ The following example, adapted from the NetworkTest plugin, shows a simple example of a client connection using the cNetwork API. It connects to www.google.com on port 80 (http) and sends a http request for the front page. It dumps the received data to the console.</p> @@ -195,11 +319,9 @@ end </pre> ]], }, - { Header = "Example server implementation", - Contents = - [[ + Contents = [[ The following example, adapted from the NetworkTest plugin, shows a simple example of creating a server listening on a TCP port using the cNetwork API. The server listens on port 9876 and for each incoming connection it sends a welcome message and then echoes back whatever the client has @@ -283,41 +405,38 @@ g_Server = nil </pre> ]], }, - }, -- AdditionalInfo - - Functions = - { - 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 - + }, cServerHandle = { - Desc = - [[ + Desc = [[ This class provides an interface for TCP sockets listening for a connection. In order to listen, the plugin needs to use the {{cNetwork}}:Listen() function to create the listening socket.</p> <p> Note that when Lua garbage-collects this class, the listening socket is closed. Therefore the plugin should keep it referenced in a global variable for as long as it wants the server running. ]], - Functions = { - Close = { Params = "", Return = "", Notes = "Closes the listening socket. No more connections will be accepted, and all current connections will be closed." }, - IsListening = { Params = "", Return = "bool", Notes = "Returns true if the socket is listening." }, + Close = + { + Notes = "Closes the listening socket. No more connections will be accepted, and all current connections will be closed.", + }, + IsListening = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the socket is listening.", + }, }, - }, -- cServerHandle - + }, cTCPLink = { - Desc = - [[ + Desc = [[ This class wraps a single TCP connection, that has been established. Plugins can create these by calling {{cNetwork}}:Connect() to connect to a remote server, or by listening using {{cNetwork}}:Listen() and accepting incoming connections. The links are callback-based - when an event @@ -332,45 +451,202 @@ g_Server = nil network. Note that calling Send() before the TLS handshake finishes is supported, but the data is queued internally and only sent once the TLS handshake is completed. ]], - Functions = { - Close = { Params = "", Return = "", Notes = "Closes the link forcefully (TCP RST). There's no guarantee that the last sent data is even being delivered. See also the Shutdown() method." }, - GetLocalIP = { Params = "", Return = "string", Notes = "Returns the IP address of the local endpoint of the TCP connection." }, - GetLocalPort = { Params = "", Return = "number", Notes = "Returns the port of the local endpoint of the TCP connection." }, - GetRemoteIP = { Params = "", Return = "string", Notes = "Returns the IP address of the remote endpoint of the TCP connection." }, - GetRemotePort = { Params = "", Return = "number", Notes = "Returns the port of the remote endpoint of the TCP connection." }, - Send = { Params = "Data", Return = "", Notes = "Sends the data (raw string) to the remote peer. The data is sent asynchronously and there is no report on the success of the send operation, other than the connection being closed or reset by the underlying OS." }, - Shutdown = { Params = "", Return = "", Notes = "Shuts the socket down for sending data. Notifies the remote peer that there will be no more data coming from us (TCP FIN). The data that is in flight will still be delivered. The underlying socket will be closed when the remote end shuts down as well, or after a timeout." }, - StartTLSClient = { Params = "OwnCert, OwnPrivateKey, OwnPrivateKeyPassword", Return = "true / nil + ErrMsg", Notes = "Starts a TLS handshake on the link, as a client side of the TLS. The Own___ parameters specify the client certificate and its corresponding private key and password; all three parameters are optional and no client certificate is presented to the remote peer if they are not used or all empty. Once the TLS handshake is started by this call, all incoming data is first decrypted before being sent to the OnReceivedData callback, and all outgoing data is queued until the TLS handshake completes, and then sent encrypted over the link. Returns true on success, nil and optional error message on immediate failure.<br/><b>NOTE:</b> The TLS support in the API is currently experimental and shouldn't be considered safe - there's no peer certificate verification and the error reporting is only basic." }, - StartTLSServer = { Params = "Certificate, PrivateKey, PrivateKeyPassword, StartTLSData", Return = "true / nil + ErrMsg", Notes = "Starts a TLS handshake on the link, as a server side of the TLS. The plugin needs to specify the server certificate and its corresponding private key and password. The StartTLSData can contain data that the link has already reported as received but it should be used as part of the TLS handshake. Once the TLS handshake is started by this call, all incoming data is first decrypted before being sent to the OnReceivedData callback, and all outgoing data is queued until the TLS handshake completes, and then sent encrypted over the link. Returns true on success, nil and optional error message on immediate failure.<br/><b>NOTE:</b> The TLS support in the API is currently experimental and shouldn't be considered safe - there's no peer certificate verification and the error reporting is only basic." }, + Close = + { + Notes = "Closes the link forcefully (TCP RST). There's no guarantee that the last sent data is even being delivered. See also the Shutdown() method.", + }, + GetLocalIP = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the IP address of the local endpoint of the TCP connection.", + }, + GetLocalPort = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the port of the local endpoint of the TCP connection.", + }, + GetRemoteIP = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the IP address of the remote endpoint of the TCP connection.", + }, + GetRemotePort = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the port of the remote endpoint of the TCP connection.", + }, + Send = + { + Params = + { + { + Name = "Data", + Type = "string", + }, + }, + Notes = "Sends the data (raw string) to the remote peer. The data is sent asynchronously and there is no report on the success of the send operation, other than the connection being closed or reset by the underlying OS.", + }, + Shutdown = + { + Notes = "Shuts the socket down for sending data. Notifies the remote peer that there will be no more data coming from us (TCP FIN). The data that is in flight will still be delivered. The underlying socket will be closed when the remote end shuts down as well, or after a timeout.", + }, + StartTLSClient = + { + Params = + { + { + Name = "OwnCert", + Type = "string", + }, + { + Name = "OwnPrivateKey", + Type = "string", + }, + { + Name = "OwnPrivateKeyPassword", + Type = "string", + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrorMessage", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a TLS handshake on the link, as a client side of the TLS. The Own___ parameters specify the client certificate and its corresponding private key and password; all three parameters are optional and no client certificate is presented to the remote peer if they are not used or all empty. Once the TLS handshake is started by this call, all incoming data is first decrypted before being sent to the OnReceivedData callback, and all outgoing data is queued until the TLS handshake completes, and then sent encrypted over the link. Returns true on success, nil and optional error message on immediate failure.<br/><b>NOTE:</b> The TLS support in the API is currently experimental and shouldn't be considered safe - there's no peer certificate verification and the error reporting is only basic.", + }, + StartTLSServer = + { + Params = + { + { + Name = "Certificate", + Type = "string", + }, + { + Name = "PrivateKey", + Type = "string", + }, + { + Name = "PrivateKeyPassword", + Type = "string", + }, + { + Name = "StartTLSData", + Type = "string", + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrorMessage", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a TLS handshake on the link, as a server side of the TLS. The plugin needs to specify the server certificate and its corresponding private key and password. The StartTLSData can contain data that the link has already reported as received but it should be used as part of the TLS handshake. Once the TLS handshake is started by this call, all incoming data is first decrypted before being sent to the OnReceivedData callback, and all outgoing data is queued until the TLS handshake completes, and then sent encrypted over the link. Returns true on success, nil and optional error message on immediate failure.<br/><b>NOTE:</b> The TLS support in the API is currently experimental and shouldn't be considered safe - there's no peer certificate verification and the error reporting is only basic.", + }, }, - }, -- cTCPLink - + }, cUDPEndpoint = { - Desc = - [[ + Desc = [[ Represents a UDP socket that is listening for incoming datagrams on a UDP port and can send or broadcast datagrams to other peers on the network. Plugins can create an instance of the endpoint by calling {{cNetwork}}:CreateUDPEndpoint(). The endpoints are callback-based - when a datagram is read from the network, the OnRececeivedData() callback is called with details about the datagram. See the additional information in {{cNetwork}} documentation for details.</p> <p> Note that when Lua garbage-collects this class, the listening socket is closed. Therefore the plugin should keep this object referenced in a global variable for as long as it wants the endpoint open. ]], - Functions = { - Close = { Params = "", Return = "", Notes = "Closes the UDP endpoint. No more datagrams will be reported through the callbacks, the UDP port will be closed." }, - EnableBroadcasts = { Params = "", Return = "", Notes = "Some OSes need this call before they allow UDP broadcasts on an endpoint." }, - GetPort = { Params = "", Return = "number", Notes = "Returns the local port number of the UDP endpoint listening for incoming datagrams. Especially useful if the UDP endpoint was created with auto-assign port (0)." }, - IsOpen = { Params = "", Return = "bool", Notes = "Returns true if the UDP endpoint is listening for incoming datagrams." }, - Send = { Params = "RawData, RemoteHost, RemotePort", Return = "bool", Notes = "Sends the specified raw data (string) to the specified remote host. The RemoteHost can be either a hostname or an IP address; if it is a hostname, the endpoint will queue a DNS lookup first, if it is an IP address, the send operation is executed immediately. Returns true if there was no immediate error, false on any failure. Note that the return value needn't represent whether the packet was actually sent, only if it was successfully queued." }, + Close = + { + Notes = "Closes the UDP endpoint. No more datagrams will be reported through the callbacks, the UDP port will be closed.", + }, + EnableBroadcasts = + { + Notes = "Some OSes need this call before they allow UDP broadcasts on an endpoint.", + }, + GetPort = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the local port number of the UDP endpoint listening for incoming datagrams. Especially useful if the UDP endpoint was created with auto-assign port (0).", + }, + IsOpen = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the UDP endpoint is listening for incoming datagrams.", + }, + Send = + { + Params = + { + { + Name = "RawData", + Type = "string", + }, + { + Name = "RemoteHost", + Type = "string", + }, + { + Name = "RemotePort", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Sends the specified raw data (string) to the specified remote host. The RemoteHost can be either a hostname or an IP address; if it is a hostname, the endpoint will queue a DNS lookup first, if it is an IP address, the send operation is executed immediately. Returns true if there was no immediate error, false on any failure. Note that the return value needn't represent whether the packet was actually sent, only if it was successfully queued.", + }, }, - }, -- cUDPEndpoint - - + }, cUrlClient = { - Desc = - [[ + Desc = [[ Implements high-level asynchronous access to URLs, such as downloading webpages over HTTP(S).</p> <p> Note that unlike other languages' URL access libraries, this class implements asynchronous requests. @@ -391,13 +667,233 @@ g_Server = nil POST and PUT requests), and an Options parameter specifying additional options specific to the protocol used. ]], - + Functions = + { + Delete = + { + IsStatic = true, + Params = + { + { + Name = "URL", + Type = "string", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "Headers", + Type = "table", + IsOptional = true, + }, + { + Name = "RequestBody", + Type = "string", + IsOptional = true, + }, + { + Name = "Options", + Type = "table", + IsOptional = true, + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrorMessagge", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a HTTP DELETE request. Alias for Request(\"DELETE\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.).", + }, + Get = + { + IsStatic = true, + Params = + { + { + Name = "URL", + Type = "string", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "Headers", + Type = "table", + IsOptional = true, + }, + { + Name = "RequestBody", + Type = "string", + IsOptional = true, + }, + { + Name = "Options", + Type = "table", + IsOptional = true, + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrMsg", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a HTTP GET request. Alias for Request(\"GET\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.).", + }, + Post = + { + IsStatic = true, + Params = + { + { + Name = "URL", + Type = "string", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "Headers", + Type = "table", + IsOptional = true, + }, + { + Name = "RequestBody", + Type = "string", + IsOptional = true, + }, + { + Name = "Options", + Type = "table", + IsOptional = true, + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrMsg", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a HTTP POST request. Alias for Request(\"POST\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.).", + }, + Put = + { + IsStatic = true, + Params = + { + { + Name = "URL", + Type = "string", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "Headers", + Type = "table", + IsOptional = true, + }, + { + Name = "RequestBody", + Type = "string", + IsOptional = true, + }, + { + Name = "Options", + Type = "table", + IsOptional = true, + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrMsg", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a HTTP PUT request. Alias for Request(\"PUT\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.).", + }, + Request = + { + IsStatic = true, + Params = + { + { + Name = "Method", + Type = "string", + }, + { + Name = "URL", + Type = "string", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "Headers", + Type = "table", + IsOptional = true, + }, + { + Name = "RequestBody", + Type = "string", + IsOptional = true, + }, + { + Name = "Options", + Type = "table", + IsOptional = true, + }, + }, + Returns = + { + { + Name = "IsSuccess", + Type = "boolean", + }, + { + Name = "ErrMsg", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Starts a request with the specified Method. Returns true on succes, false and error message on immediate failure (unparsable URL etc.).", + }, + }, AdditionalInfo = { { Header = "Simple Callback", - Contents = - [[ + Contents = [[ When you don't need fine control for receiving the requests and are interested only in the result, you can use the simple callback approach. Pass a single function as the Callback parameter, the function will get called when the response is fully processed, either with the body of the response, @@ -418,8 +914,7 @@ cUrlClient:Get(url, }, { Header = "Callback Table", - Contents = - [[ + Contents = [[ To provide complete control over the request and response handling, Cuberite allows plugins to pass a table of callbacks as the Callback parameter. Then the respective functions are called for their respective events during the lifetime of the request and response. This way it is possible to @@ -504,8 +999,7 @@ end }, { Header = "Options", - Contents = - [[ + Contents = [[ The requests support the following options, specified in the optional Options table parameter: <table> <tr><th>Option name</th><th>Description</th></tr> @@ -527,18 +1021,5 @@ end ]], }, }, - - Functions = - { - Delete = { Params = "URL, Callbacks, [Headers], [RequestBody], [Options]", Return = "bool, [ErrMsg]", IsStatic = true, Notes = "Starts a HTTP DELETE request. Alias for Request(\"DELETE\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.)."}, - Get = { Params = "URL, Callbacks, [Headers], [RequestBody], [Options]", Return = "bool, [ErrMsg]", IsStatic = true, Notes = "Starts a HTTP GET request. Alias for Request(\"GET\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.)."}, - Post = { Params = "URL, Callbacks, [Headers], [RequestBody], [Options]", Return = "bool, [ErrMsg]", IsStatic = true, Notes = "Starts a HTTP POST request. Alias for Request(\"POST\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.)."}, - Put = { Params = "URL, Callbacks, [Headers], [RequestBody], [Options]", Return = "bool, [ErrMsg]", IsStatic = true, Notes = "Starts a HTTP PUT request. Alias for Request(\"PUT\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.)."}, - Request = { Params = "Method, URL, Callbacks, [Headers], [RequestBody], [Options]", Return = "bool, [ErrMsg]", IsStatic = true, Notes = "Starts a request with the specified Method. Returns true on succes, false and error message on immediate failure (unparsable URL etc.)."}, - }, - }, -- cUrlClient + }, } - - - - diff --git a/Server/Plugins/APIDump/Classes/Plugins.lua b/Server/Plugins/APIDump/Classes/Plugins.lua index d813f8f0d..2467b412b 100644 --- a/Server/Plugins/APIDump/Classes/Plugins.lua +++ b/Server/Plugins/APIDump/Classes/Plugins.lua @@ -2,34 +2,135 @@ return { cPlugin = { - Desc = [[cPlugin describes a Lua plugin. This page is dedicated to new-style plugins and contain their functions. Each plugin has its own cPlugin object. -]], + Desc = "cPlugin describes a Lua plugin. Each plugin has its own cPlugin object.", Functions = { - GetDirectory = { Return = "string", Notes = "<b>OBSOLETE</b>, use GetFolderName() instead!" }, - GetFolderName = { Params = "", Return = "string", Notes = "Returns the name of the folder where the plugin's files are. (APIDump)" }, - GetLoadError = { Params = "", Return = "string", Notes = "If the plugin failed to load, returns the error message for the failure." }, - GetLocalDirectory = { Notes = "<b>OBSOLETE</b>, use GetLocalFolder instead." }, - GetLocalFolder = { Return = "string", Notes = "Returns the path where the plugin's files are. (Plugins/APIDump)" }, - GetName = { Return = "string", Notes = "Returns the name of the plugin." }, - GetStatus = { Params = "", Return = "{{cPluginManager#PluginStatus|PluginStatus}}", Notes = "Returns the status of the plugin (loaded, disabled, unloaded, error, not found)" }, - GetVersion = { Return = "number", Notes = "Returns the version of the plugin." }, - IsLoaded = { Params = "", Return = "", Notes = "" }, - SetName = { Params = "string", Notes = "Sets the name of the Plugin." }, - SetVersion = { Params = "number", Notes = "Sets the version of the plugin." }, + GetDirectory = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "<b>OBSOLETE</b>, use GetFolderName() instead!", + }, + GetFolderName = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the name of the folder where the plugin's files are. (APIDump)", + }, + GetLoadError = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "If the plugin failed to load, returns the error message for the failure.", + }, + GetLocalDirectory = + { + Notes = "<b>OBSOLETE</b>, use GetLocalFolder instead.", + }, + GetLocalFolder = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the path where the plugin's files are. (Plugins/APIDump)", + }, + GetName = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the name of the plugin.", + }, + GetStatus = + { + Returns = + { + { + Name = "PluginStatus", + Type = "cPluginManager#PluginStatus", + }, + }, + Notes = "Returns the status of the plugin (loaded, disabled, unloaded, error, not found)", + }, + GetVersion = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the version of the plugin.", + }, + IsLoaded = + { + Notes = "", + }, + SetName = + { + Params = + { + { + Name = "PluginApiName", + Type = "string", + }, + }, + Notes = "Sets the API name of the Plugin that is used by {{cPluginManager}}:CallPlugin() to identify the plugin.", + }, + SetVersion = + { + Params = + { + { + Name = "PluginApiVersion", + Type = "number", + }, + }, + Notes = "Sets the API version of the plugin. Currently unused.", + }, }, - }, -- cPlugin - + }, cPluginLua = { Desc = "(<b>OBSOLETE</b>) This class is no longer useful in the API and will be removed as soon as all core plugins are migrated away from it. The {{cPlugin}} class serves as the main plugin instance's interface.", Functions = { - AddWebTab = { Params = "Title, HandlerFn", Return = "", Notes = "<b>OBSOLETE</b> - Use {{cWebAdmin}}:AddWebTab() instead." }, + AddWebTab = + { + Params = + { + { + Name = "Title", + Type = "string", + }, + { + Name = "HandlerFn", + Type = "function", + }, + }, + Notes = "<b>OBSOLETE</b> - Use {{cWebAdmin}}:AddWebTab() instead.", + }, }, Inherits = "cPlugin", - }, -- cPluginLua - + }, cPluginManager = { Desc = [[ @@ -52,143 +153,830 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); { AddHook = { - { 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!" }, + { + IsStatic = true, + Params = + { + { + Name = "HookType", + Type = "cPluginManager#PluginHook", + }, + { + Name = "Callback", + Type = "callback", + IsOptional = 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", + }, }, BindCommand = { - { 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)." }, + { + Params = + { + { + Name = "Command", + Type = "string", + }, + { + Name = "Permission", + Type = "string", + }, + { + Name = "Callback", + Type = "callback", + }, + { + Name = "HelpString", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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).", + }, + { + IsStatic = true, + Params = + { + { + Name = "Command", + Type = "string", + }, + { + Name = "Permission", + Type = "string", + }, + { + Name = "Callback", + Type = "callback", + }, + { + Name = "HelpString", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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]", 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]", 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", 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." }, - GetNumLoadedPlugins = { Params = "", Return = "number", Notes = "Returns the number of loaded plugins (psLoaded only)" }, - GetNumPlugins = { Params = "", Return = "number", Notes = "Returns the number of plugins, including the disabled, errored, unloaded and not-found ones" }, - GetPlugin = { Params = "PluginName", Return = "{{cPlugin}}", Notes = "(<b>DEPRECATED, UNSAFE</b>) Returns a plugin handle of the specified plugin, or nil if such plugin is not loaded. Note thatdue to multithreading the handle is not guaranteed to be safe for use when stored - a single-plugin reload may have been triggered in the mean time for the requested plugin." }, - GetPluginFolderName = { Params = "PluginName", Return = "string", Notes = "Returns the name of the folder from which the plugin was loaded (without the \"Plugins\" part). Used as a plugin's display name." }, - GetPluginsPath = { Params = "", Return = "string", IsStatic = true, Notes = "Returns the path where the individual plugin folders are located. Doesn't include the path separator at the end of the returned string." }, - IsCommandBound = { Params = "Command", Return = "bool", Notes = "Returns true if in-game Command is already bound (by any plugin)" }, - 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 = "", 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." }, - }, - ConstantGroups= - { - CommandResult = + { + IsStatic = true, + Params = + { + { + Name = "Command", + Type = "string", + }, + { + Name = "Callback", + Type = "function", + }, + { + Name = "HelpString", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + IsOptional = 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 = + { + { + Name = "Command", + Type = "string", + }, + { + Name = "Callback", + Type = "function", + }, + { + Name = "HelpString", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + IsOptional = 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).", + }, + }, + CallPlugin = { - Include = "^cr.*", - TextBefore = [[ - Results that the (Force)ExecuteCommand return. This gives information if the command is executed or not and the reason. - ]], + IsStatic = true, + Params = + { + { + Name = "PluginName", + Type = "string", + }, + { + Name = "FunctionName", + Type = "string", + }, + { + Name = "FunctionArgs...", + Type = "...", + IsOptional = true, + }, + }, + Returns = + { + { + Name = "FunctionRets", + Type = "...", + IsOptional = 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 = + { + IsStatic = true, + Params = + { + { + Name = "PluginName", + Type = "string", + }, + { + Name = "CallbackFn", + Type = "function", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + { + Name = "Player", + Type = "cPlayer", + }, + { + Name = "CommandStr", + Type = "string", + }, + }, + Returns = + { + { + Name = "CommandResult", + Type = "cPluginManager#CommandResult", + }, + }, + Notes = "Executes the command as if given by the specified Player. Checks permissions.", + }, + ExecuteConsoleCommand = + { + Params = + { + { + Name = "CommandStr", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + { + Type = "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 = + { + Notes = "<b>OBSOLETE</b>, use RefreshPluginList() instead", + }, + ForceExecuteCommand = + { + Params = + { + { + Name = "Player", + Type = "cPlayer", + }, + { + Name = "CommandStr", + Type = "string", + }, + }, + Returns = + { + { + Name = "CommandResult", + Type = "cPluginManager#CommandResult", + }, + }, + Notes = "Same as ExecuteCommand, but doesn't check permissions", + }, + ForEachCommand = + { + Params = + { + { + Name = "CallbackFn", + Type = "function", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + { + Name = "CallbackFn", + Type = "function", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "CallbackFn", + Type = "function", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + 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 = + { + IsStatic = true, + Returns = + { + { + Type = "cPluginManager", + }, + }, + Notes = "Returns the single instance of the plugin manager", + }, + GetAllPlugins = + { + Returns = + { + { + Type = "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 = + { + { + Name = "Command", + Type = "string", + }, + }, + Returns = + { + { + Name = "Permission", + Type = "string", + }, + }, + Notes = "Returns the permission needed for executing the specified command", + }, + GetCurrentPlugin = + { + Returns = + { + { + Type = "cPlugin", + }, + }, + Notes = "Returns the {{cPlugin}} object for the calling plugin. This is the same object that the Initialize function receives as the argument.", + }, + GetNumLoadedPlugins = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the number of loaded plugins (psLoaded only)", + }, + GetNumPlugins = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the number of plugins, including the disabled, errored, unloaded and not-found ones", + }, + GetPlugin = + { + Params = + { + { + Name = "PluginName", + Type = "string", + }, + }, + Returns = + { + { + Type = "cPlugin", + }, + }, + Notes = "(<b>DEPRECATED, UNSAFE</b>) Returns a plugin handle of the specified plugin, or nil if such plugin is not loaded. Note thatdue to multithreading the handle is not guaranteed to be safe for use when stored - a single-plugin reload may have been triggered in the mean time for the requested plugin.", + }, + GetPluginFolderName = + { + Params = + { + { + Name = "PluginName", + Type = "string", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the name of the folder from which the plugin was loaded (without the \"Plugins\" part). Used as a plugin's display name.", + }, + GetPluginsPath = + { + IsStatic = true, + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the path where the individual plugin folders are located. Doesn't include the path separator at the end of the returned string.", + }, + IsCommandBound = + { + Params = + { + { + Name = "Command", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if in-game Command is already bound (by any plugin)", + }, + IsConsoleCommandBound = + { + Params = + { + { + Name = "Command", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if console Command is already bound (by any plugin)", + }, + IsPluginLoaded = + { + Params = + { + { + Name = "PluginName", + Type = "string", + }, + }, + Notes = "Returns true if the specified plugin is loaded.", + }, + LoadPlugin = + { + Params = + { + { + Name = "PluginFolder", + Type = "string", + }, + }, + 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 = + { + 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 = + { + Notes = "Refreshes the list of plugins to include all folders inside the Plugins folder (potentially new disabled plugins)", + }, + ReloadPlugins = + { + Notes = "Reloads all active plugins", + }, + UnloadPlugin = + { + Params = + { + { + Name = "PluginName", + Type = "string", + }, + }, + Notes = "Queues the specified plugin to be unloaded. To avoid deadlocks, the unloading happens in the main tick thread asynchronously.", }, }, Constants = { - crBlocked = { Notes = "When a plugin stopped the command using the OnExecuteCommand hook" }, - crError = { Notes = "When the command handler for the given command results in an error" }, - crExecuted = { Notes = "When the command is successfully executed." }, - crNoPermission = { Notes = "When the player doesn't have permission to execute the given command." }, - crUnknownCommand = { Notes = "When the given command doesn't exist." }, - HOOK_BLOCK_SPREAD = { Notes = "Called when a block spreads based on world conditions" }, - HOOK_BLOCK_TO_PICKUPS = { Notes = "Called when a block has been dug and is being converted to pickups. The server has provided the default pickups and the plugins may modify them." }, - HOOK_BREWING_COMPLETING = { "Called before a brewing stand completes a brewing process." }, - HOOK_BREWING_COMPLETED = { "Called when a brewing stand completed a brewing process." }, - HOOK_CHAT = { Notes = "Called when a client sends a chat message that is not a command. The plugin may modify the chat message" }, - HOOK_CHUNK_AVAILABLE = { Notes = "Called when a chunk is loaded or generated and becomes available in the {{cWorld|world}}." }, - HOOK_CHUNK_GENERATED = { Notes = "Called after a chunk is generated. A plugin may do last modifications on the generated chunk before it is handed of to the {{cWorld|world}}." }, - HOOK_CHUNK_GENERATING = { Notes = "Called before a chunk is generated. A plugin may override some parts of the generation algorithm." }, - HOOK_CHUNK_UNLOADED = { Notes = "Called after a chunk has been unloaded from a {{cWorld|world}}." }, - HOOK_CHUNK_UNLOADING = { Notes = "Called before a chunk is unloaded from a {{cWorld|world}}. The chunk has already been saved." }, - HOOK_COLLECTING_PICKUP = { Notes = "Called when a player is about to collect a pickup." }, - HOOK_CRAFTING_NO_RECIPE = { Notes = "Called when a player has items in the crafting slots and the server cannot locate any recipe. Plugin may provide a recipe." }, - HOOK_DISCONNECT = { Notes = "Called after the player has disconnected." }, - HOOK_ENTITY_ADD_EFFECT = { Notes = "Called when an effect is being added to an {{cEntity|entity}}. Plugin may refuse the effect." }, - HOOK_ENTITY_CHANGED_WORLD = { Notes = "Called after a entity has changed the world." }, - HOOK_ENTITY_CHANGING_WORLD = { Notes = "Called before a entity has changed the world. Plugin may disallow a entity to change the world." }, - HOOK_ENTITY_TELEPORT = { Notes = "Called when an {{cEntity|entity}} is being teleported. Plugin may refuse the teleportation." }, - HOOK_EXECUTE_COMMAND = { Notes = "Called when a client sends a chat message that is recognized as a command, before handing that command to the regular command handler. A plugin may stop the command from being handled. This hook is called even when the player doesn't have permissions for the command." }, - HOOK_EXPLODED = { Notes = "Called after an explosion has been processed in a {{cWorld|world}}." }, - HOOK_EXPLODING = { Notes = "Called before an explosion is processed in a {{cWorld|world}}. A plugin may alter the explosion parameters or cancel the explosion altogether." }, - HOOK_HANDSHAKE = { Notes = "Called when a Handshake packet is received from a client." }, - HOOK_HOPPER_PULLING_ITEM = { Notes = "Called when a hopper is pulling an item from the container above it." }, - HOOK_HOPPER_PUSHING_ITEM = { Notes = "Called when a hopper is pushing an item into the container it is aimed at." }, - HOOK_KILLED = { Notes = "Called when an entity has been killed." }, - HOOK_KILLING = { Notes = "Called when an entity has just been killed. A plugin may resurrect the entity by setting its health to above zero." }, - HOOK_LOGIN = { Notes = "Called when a Login packet is sent to the client, before the client is queued for authentication." }, - HOOK_PLAYER_ANIMATION = { Notes = "Called when a client send the Animation packet." }, - HOOK_PLAYER_BREAKING_BLOCK = { Notes = "Called when a player is about to break a block. A plugin may cancel the event." }, - HOOK_PLAYER_BROKEN_BLOCK = { Notes = "Called after a player has broken a block." }, - HOOK_PLAYER_DESTROYED = { Notes = "Called when the {{cPlayer}} object is destroyed - a player has disconnected." }, - HOOK_PLAYER_EATING = { Notes = "Called when the player starts eating a held item. Plugins may abort the eating." }, - HOOK_PLAYER_FISHED = { Notes = "Called when the player reels the fishing rod back in, after the server decides the player's fishing reward." }, - HOOK_PLAYER_FISHING = { Notes = "Called when the player reels the fishing rod back in, plugins may alter the fishing reward." }, - HOOK_PLAYER_FOOD_LEVEL_CHANGE = { Notes = "Called when the player's food level is changing. Plugins may refuse the change." }, - HOOK_PLAYER_JOINED = { Notes = "Called when the player entity has been created. It has not yet been fully initialized." }, - HOOK_PLAYER_LEFT_CLICK = { Notes = "Called when the client sends the LeftClick packet." }, - HOOK_PLAYER_MOVING = { Notes = "Called when the player has moved and the movement is now being applied." }, - HOOK_PLAYER_PLACED_BLOCK = { Notes = "Called when the player has just placed a block" }, - HOOK_PLAYER_PLACING_BLOCK = { Notes = "Called when the player is about to place a block. A plugin may cancel the event." }, - HOOK_PLAYER_RIGHT_CLICK = { Notes = "Called when the client sends the RightClick packet." }, - HOOK_PLAYER_RIGHT_CLICKING_ENTITY = { Notes = "Called when the client sends the UseEntity packet." }, - HOOK_PLAYER_SHOOTING = { Notes = "Called when the player releases the mouse button to fire their bow." }, - HOOK_PLAYER_SPAWNED = { Notes = "Called after the player entity has been created. The entity is fully initialized and is spawning in the {{cWorld|world}}." }, - HOOK_PLAYER_TOSSING_ITEM = { Notes = "Called when the player is tossing the held item (keypress Q)" }, - HOOK_PLAYER_USED_BLOCK = { Notes = "Called after the player has right-clicked a block" }, - HOOK_PLAYER_USED_ITEM = { Notes = "Called after the player has right-clicked with a usable item in their hand." }, - HOOK_PLAYER_USING_BLOCK = { Notes = "Called when the player is about to use (right-click) a block" }, - HOOK_PLAYER_USING_ITEM = { Notes = "Called when the player is about to right-click with a usable item in their hand." }, - HOOK_PLUGINS_LOADED = { Notes = "Called after all plugins have loaded." }, - HOOK_PLUGIN_MESSAGE = { Notes = "Called when a PluginMessage packet is received from a client." }, - HOOK_POST_CRAFTING = { Notes = "Called after a valid recipe has been chosen for the current contents of the crafting grid. Plugins may modify the recipe." }, - HOOK_PRE_CRAFTING = { Notes = "Called before a recipe is searched for the current contents of the crafting grid. Plugins may provide a recipe and cancel the built-in search." }, - HOOK_PROJECTILE_HIT_BLOCK = { Notes = "Called when a {{cProjectileEntity|projectile}} hits a block." }, - HOOK_PROJECTILE_HIT_ENTITY = { Notes = "Called when a {{cProjectileEntity|projectile}} hits an {{cEntity|entity}}." }, - HOOK_SERVER_PING = { Notes = "Called when a client pings the server from the server list. Plugins may change the favicon, server description, players online and maximum players values." }, - HOOK_SPAWNED_ENTITY = { Notes = "Called after an entity is spawned in a {{cWorld|world}}. The entity is already part of the world." }, - HOOK_SPAWNED_MONSTER = { Notes = "Called after a mob is spawned in a {{cWorld|world}}. The mob is already part of the world." }, - HOOK_SPAWNING_ENTITY = { Notes = "Called just before an entity is spawned in a {{cWorld|world}}." }, - HOOK_SPAWNING_MONSTER = { Notes = "Called just before a mob is spawned in a {{cWorld|world}}." }, - HOOK_TAKE_DAMAGE = { Notes = "Called when an entity is taking any kind of damage. Plugins may modify the damage value, effects, source or cancel the damage." }, - HOOK_TICK = { Notes = "Called when the main server thread ticks - 20 times a second." }, - HOOK_UPDATED_SIGN = { Notes = "Called after a {{cSignEntity|sign}} text has been updated, either by a player or by any external means." }, - HOOK_UPDATING_SIGN = { Notes = "Called before a {{cSignEntity|sign}} text is updated, either by a player or by any external means." }, - HOOK_WEATHER_CHANGED = { Notes = "Called after the weather has changed." }, - HOOK_WEATHER_CHANGING = { Notes = "Called just before the weather changes" }, - HOOK_WORLD_STARTED = { Notes = "Called when a world has been started." }, - HOOK_WORLD_TICK = { Notes = "Called in each world's tick thread when the game logic is about to tick (20 times a second)." }, - - psDisabled = { Notes = "The plugin is not enabled in settings.ini" }, - psError = { Notes = "The plugin is enabled in settings.ini, but it has run into an error while loading. Use {{cPlugin}}:GetLoadError() to identify the error." }, - psLoaded = { Notes = "The plugin is enabled and loaded." }, - psNotFound = { Notes = "The plugin has been loaded, but is no longer present on disk." }, - psUnloaded = { Notes = "The plugin is enabled in settings.ini, but it has been unloaded (by a command)." }, - }, -- constants - + crBlocked = + { + Notes = "When a plugin stopped the command using the OnExecuteCommand hook", + }, + crError = + { + Notes = "When the command handler for the given command results in an error", + }, + crExecuted = + { + Notes = "When the command is successfully executed.", + }, + crNoPermission = + { + Notes = "When the player doesn't have permission to execute the given command.", + }, + crUnknownCommand = + { + Notes = "When the given command doesn't exist.", + }, + HOOK_BLOCK_SPREAD = + { + Notes = "Called when a block spreads based on world conditions", + }, + HOOK_BLOCK_TO_PICKUPS = + { + Notes = "Called when a block has been dug and is being converted to pickups. The server has provided the default pickups and the plugins may modify them.", + }, + HOOK_BREWING_COMPLETED = + { + "Called when a brewing stand completed a brewing process.", + }, + HOOK_BREWING_COMPLETING = + { + "Called before a brewing stand completes a brewing process.", + }, + HOOK_CHAT = + { + Notes = "Called when a client sends a chat message that is not a command. The plugin may modify the chat message", + }, + HOOK_CHUNK_AVAILABLE = + { + Notes = "Called when a chunk is loaded or generated and becomes available in the {{cWorld|world}}.", + }, + HOOK_CHUNK_GENERATED = + { + Notes = "Called after a chunk is generated. A plugin may do last modifications on the generated chunk before it is handed of to the {{cWorld|world}}.", + }, + HOOK_CHUNK_GENERATING = + { + Notes = "Called before a chunk is generated. A plugin may override some parts of the generation algorithm.", + }, + HOOK_CHUNK_UNLOADED = + { + Notes = "Called after a chunk has been unloaded from a {{cWorld|world}}.", + }, + HOOK_CHUNK_UNLOADING = + { + Notes = "Called before a chunk is unloaded from a {{cWorld|world}}. The chunk has already been saved.", + }, + HOOK_COLLECTING_PICKUP = + { + Notes = "Called when a player is about to collect a pickup.", + }, + HOOK_CRAFTING_NO_RECIPE = + { + Notes = "Called when a player has items in the crafting slots and the server cannot locate any recipe. Plugin may provide a recipe.", + }, + HOOK_DISCONNECT = + { + Notes = "Called after the player has disconnected.", + }, + HOOK_ENTITY_ADD_EFFECT = + { + Notes = "Called when an effect is being added to an {{cEntity|entity}}. Plugin may refuse the effect.", + }, + HOOK_ENTITY_CHANGED_WORLD = + { + Notes = "Called after a entity has changed the world.", + }, + HOOK_ENTITY_CHANGING_WORLD = + { + Notes = "Called before a entity has changed the world. Plugin may disallow a entity to change the world.", + }, + HOOK_ENTITY_TELEPORT = + { + Notes = "Called when an {{cEntity|entity}} is being teleported. Plugin may refuse the teleportation.", + }, + HOOK_EXECUTE_COMMAND = + { + Notes = "Called when a client sends a chat message that is recognized as a command, before handing that command to the regular command handler. A plugin may stop the command from being handled. This hook is called even when the player doesn't have permissions for the command.", + }, + HOOK_EXPLODED = + { + Notes = "Called after an explosion has been processed in a {{cWorld|world}}.", + }, + HOOK_EXPLODING = + { + Notes = "Called before an explosion is processed in a {{cWorld|world}}. A plugin may alter the explosion parameters or cancel the explosion altogether.", + }, + HOOK_HANDSHAKE = + { + Notes = "Called when a Handshake packet is received from a client.", + }, + HOOK_HOPPER_PULLING_ITEM = + { + Notes = "Called when a hopper is pulling an item from the container above it.", + }, + HOOK_HOPPER_PUSHING_ITEM = + { + Notes = "Called when a hopper is pushing an item into the container it is aimed at.", + }, + HOOK_KILLED = + { + Notes = "Called when an entity has been killed.", + }, + HOOK_KILLING = + { + Notes = "Called when an entity has just been killed. A plugin may resurrect the entity by setting its health to above zero.", + }, + HOOK_LOGIN = + { + Notes = "Called when a Login packet is sent to the client, before the client is queued for authentication.", + }, + HOOK_PLAYER_ANIMATION = + { + Notes = "Called when a client send the Animation packet.", + }, + HOOK_PLAYER_BREAKING_BLOCK = + { + Notes = "Called when a player is about to break a block. A plugin may cancel the event.", + }, + HOOK_PLAYER_BROKEN_BLOCK = + { + Notes = "Called after a player has broken a block.", + }, + HOOK_PLAYER_DESTROYED = + { + Notes = "Called when the {{cPlayer}} object is destroyed - a player has disconnected.", + }, + HOOK_PLAYER_EATING = + { + Notes = "Called when the player starts eating a held item. Plugins may abort the eating.", + }, + HOOK_PLAYER_FISHED = + { + Notes = "Called when the player reels the fishing rod back in, after the server decides the player's fishing reward.", + }, + HOOK_PLAYER_FISHING = + { + Notes = "Called when the player reels the fishing rod back in, plugins may alter the fishing reward.", + }, + HOOK_PLAYER_FOOD_LEVEL_CHANGE = + { + Notes = "Called when the player's food level is changing. Plugins may refuse the change.", + }, + HOOK_PLAYER_JOINED = + { + Notes = "Called when the player entity has been created. It has not yet been fully initialized.", + }, + HOOK_PLAYER_LEFT_CLICK = + { + Notes = "Called when the client sends the LeftClick packet.", + }, + HOOK_PLAYER_MOVING = + { + Notes = "Called when the player has moved and the movement is now being applied.", + }, + HOOK_PLAYER_PLACED_BLOCK = + { + Notes = "Called when the player has just placed a block", + }, + HOOK_PLAYER_PLACING_BLOCK = + { + Notes = "Called when the player is about to place a block. A plugin may cancel the event.", + }, + HOOK_PLAYER_RIGHT_CLICK = + { + Notes = "Called when the client sends the RightClick packet.", + }, + HOOK_PLAYER_RIGHT_CLICKING_ENTITY = + { + Notes = "Called when the client sends the UseEntity packet.", + }, + HOOK_PLAYER_SHOOTING = + { + Notes = "Called when the player releases the mouse button to fire their bow.", + }, + HOOK_PLAYER_SPAWNED = + { + Notes = "Called after the player entity has been created. The entity is fully initialized and is spawning in the {{cWorld|world}}.", + }, + HOOK_PLAYER_TOSSING_ITEM = + { + Notes = "Called when the player is tossing the held item (keypress Q)", + }, + HOOK_PLAYER_USED_BLOCK = + { + Notes = "Called after the player has right-clicked a block", + }, + HOOK_PLAYER_USED_ITEM = + { + Notes = "Called after the player has right-clicked with a usable item in their hand.", + }, + HOOK_PLAYER_USING_BLOCK = + { + Notes = "Called when the player is about to use (right-click) a block", + }, + HOOK_PLAYER_USING_ITEM = + { + Notes = "Called when the player is about to right-click with a usable item in their hand.", + }, + HOOK_PLUGIN_MESSAGE = + { + Notes = "Called when a PluginMessage packet is received from a client.", + }, + HOOK_PLUGINS_LOADED = + { + Notes = "Called after all plugins have loaded.", + }, + HOOK_POST_CRAFTING = + { + Notes = "Called after a valid recipe has been chosen for the current contents of the crafting grid. Plugins may modify the recipe.", + }, + HOOK_PRE_CRAFTING = + { + Notes = "Called before a recipe is searched for the current contents of the crafting grid. Plugins may provide a recipe and cancel the built-in search.", + }, + HOOK_PROJECTILE_HIT_BLOCK = + { + Notes = "Called when a {{cProjectileEntity|projectile}} hits a block.", + }, + HOOK_PROJECTILE_HIT_ENTITY = + { + Notes = "Called when a {{cProjectileEntity|projectile}} hits an {{cEntity|entity}}.", + }, + HOOK_SERVER_PING = + { + Notes = "Called when a client pings the server from the server list. Plugins may change the favicon, server description, players online and maximum players values.", + }, + HOOK_SPAWNED_ENTITY = + { + Notes = "Called after an entity is spawned in a {{cWorld|world}}. The entity is already part of the world.", + }, + HOOK_SPAWNED_MONSTER = + { + Notes = "Called after a mob is spawned in a {{cWorld|world}}. The mob is already part of the world.", + }, + HOOK_SPAWNING_ENTITY = + { + Notes = "Called just before an entity is spawned in a {{cWorld|world}}.", + }, + HOOK_SPAWNING_MONSTER = + { + Notes = "Called just before a mob is spawned in a {{cWorld|world}}.", + }, + HOOK_TAKE_DAMAGE = + { + Notes = "Called when an entity is taking any kind of damage. Plugins may modify the damage value, effects, source or cancel the damage.", + }, + HOOK_TICK = + { + Notes = "Called when the main server thread ticks - 20 times a second.", + }, + HOOK_UPDATED_SIGN = + { + Notes = "Called after a {{cSignEntity|sign}} text has been updated, either by a player or by any external means.", + }, + HOOK_UPDATING_SIGN = + { + Notes = "Called before a {{cSignEntity|sign}} text is updated, either by a player or by any external means.", + }, + HOOK_WEATHER_CHANGED = + { + Notes = "Called after the weather has changed.", + }, + HOOK_WEATHER_CHANGING = + { + Notes = "Called just before the weather changes", + }, + HOOK_WORLD_STARTED = + { + Notes = "Called when a world has been started.", + }, + HOOK_WORLD_TICK = + { + Notes = "Called in each world's tick thread when the game logic is about to tick (20 times a second).", + }, + psDisabled = + { + Notes = "The plugin is not enabled in settings.ini", + }, + psError = + { + Notes = "The plugin is enabled in settings.ini, but it has run into an error while loading. Use {{cPlugin}}:GetLoadError() to identify the error.", + }, + psLoaded = + { + Notes = "The plugin is enabled and loaded.", + }, + psNotFound = + { + Notes = "The plugin has been loaded, but is no longer present on disk.", + }, + psUnloaded = + { + Notes = "The plugin is enabled in settings.ini, but it has been unloaded (by a command).", + }, + }, ConstantGroups = { - Hooks = + CommandResult = + { + Include = + { + "^cr.*", + }, + TextBefore = "Results that the (Force)ExecuteCommand functions return. This gives information whether the command was executed or not, and the reason.", + }, + PluginHook = { - Include = {"HOOK_.*"}, + Include = + { + "HOOK_.*", + }, TextBefore = [[ These constants identify individual hooks. To register the plugin to receive notifications on hooks, use the cPluginManager:AddHook() function. For detailed description of each hook, see the <a href='index.html#hooks'> @@ -196,18 +984,14 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); }, PluginStatus = { - Include = {"ps.*"}, + Include = + { + "ps.*", + }, TextBefore = [[ These constants are used to report status of individual plugins. Use {{cPlugin}}:GetStatus() to query the status of a plugin; use cPluginManager::ForEachPlugin() to iterate over plugins.]], }, - CommandResult = - { - Include = {"cr.*"}, - TextBefore = [[ - These constants are returned by the ExecuteCommand() function to identify the exact outcome of the - operation.]], - }, }, - }, -- cPluginManager + }, } diff --git a/Server/Plugins/APIDump/Classes/Projectiles.lua b/Server/Plugins/APIDump/Classes/Projectiles.lua index b94706f0f..b92f6d2a8 100644 --- a/Server/Plugins/APIDump/Classes/Projectiles.lua +++ b/Server/Plugins/APIDump/Classes/Projectiles.lua @@ -7,24 +7,115 @@ 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." }, - SetDamageCoeff = { Params = "number", Return = "", Notes = "Sets the damage coefficient. The damage dealt by this arrow is multiplied by this coeff" }, - SetIsCritical = { Params = "bool", Return = "", Notes = "Sets the IsCritical flag on the arrow. Critical arrow deal additional damage" }, - SetPickupState = { Params = "PickupState", Return = "", Notes = "Sets the pickup state (one of the psXXX constants, above)" }, + CanPickup = + { + Params = + { + { + Name = "Player", + Type = "cPlayer", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified player can pick the arrow when it's on the ground", + }, + GetBlockHit = + { + Desc = "Gets the block arrow is in", + Returns = + { + { + Type = "Vector3i", + }, + }, + }, + GetDamageCoeff = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the damage coefficient stored within the arrow. The damage dealt by this arrow is multiplied by this coeff", + }, + GetPickupState = + { + Returns = + { + { + Type = "cArrowEntity#ePickupState", + }, + }, + Notes = "Returns the pickup state (one of the psXXX constants, above)", + }, + IsCritical = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the arrow should deal critical damage. Based on the bow charge when the arrow was shot.", + }, + SetDamageCoeff = + { + Params = + { + { + Name = "DamageCoeff", + Type = "number", + }, + }, + Notes = "Sets the damage coefficient. The damage dealt by this arrow is multiplied by this coeff", + }, + SetIsCritical = + { + Params = + { + { + Name = "IsCritical", + Type = "boolean", + }, + }, + Notes = "Sets the IsCritical flag on the arrow. Critical arrow deal additional damage", + }, + SetPickupState = + { + Params = + { + { + Name = "PickupState", + Type = "cArrowEntity#ePickupState", + }, + }, + Notes = "Sets the pickup state (one of the psXXX constants, above)", + }, }, Constants = { - psInCreative = { Notes = "The arrow can be picked up only by players in creative gamemode" }, - psInSurvivalOrCreative = { Notes = "The arrow can be picked up by players in survival or creative gamemode" }, - psNoPickup = { Notes = "The arrow cannot be picked up at all" }, + psInCreative = + { + Notes = "The arrow can be picked up only by players in creative gamemode", + }, + psInSurvivalOrCreative = + { + Notes = "The arrow can be picked up by players in survival or creative gamemode", + }, + psNoPickup = + { + Notes = "The arrow cannot be picked up at all", + }, }, ConstantGroups = { - PickupState = + ePickupState = { Include = "ps.*", TextBefore = [[ @@ -34,9 +125,7 @@ return }, }, Inherits = "cProjectileEntity", - }, -- cArrowEntity - - + }, cExpBottleEntity = { Desc = [[ @@ -44,146 +133,325 @@ return ]], Functions = { + }, Inherits = "cProjectileEntity", - }, -- cExpBottleEntity - - + }, cFireChargeEntity = { Desc = [[ Represents a fire charge that has been shot by a Blaze or a {{cDispenserEntity|Dispenser}}. A subclass of the {{cProjectileEntity}}. ]], - Functions = {}, - Inherits = "cProjectileEntity", - }, -- cFireChargeEntity - + Functions = + { + }, + Inherits = "cProjectileEntity", + }, cFireworkEntity = { Desc = [[ Represents a firework rocket. ]], - Functions = + Functions = + { + GetItem = { - GetItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that has been used to create the firework rocket. The item's m_FireworkItem member contains all the firework-related data." }, - GetTicksToExplosion = { Params = "", Return = "number", Notes = "Returns the number of ticks left until the firework explodes." }, - SetItem = { Params = "{{cItem}}", Return = "", Notes = "Sets a new item to be used for the firework." }, - SetTicksToExplosion = { Params = "NumTicks", Return = "", Notes = "Sets the number of ticks left until the firework explodes." }, + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Returns the item that has been used to create the firework rocket. The item's m_FireworkItem member contains all the firework-related data.", }, - - Inherits = "cProjectileEntity", - }, -- cFireworkEntity - - - cFloater = - { - Desc = "", - Functions = {}, + GetTicksToExplosion = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the number of ticks left until the firework explodes.", + }, + SetItem = + { + Params = + { + { + Name = "FireworkItem", + Type = "cItem", + }, + }, + Notes = "Sets a new item to be used for the firework.", + }, + SetTicksToExplosion = + { + Params = + { + { + Name = "NumTicks", + Type = "number", + }, + }, + Notes = "Sets the number of ticks left until the firework explodes.", + }, + }, Inherits = "cProjectileEntity", - }, -- cFloater - - + }, cGhastFireballEntity = { Desc = "", - Functions = {}, - Inherits = "cProjectileEntity", - }, -- cGhastFireballEntity - + Functions = + { + }, + Inherits = "cProjectileEntity", + }, cProjectileEntity = { 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." }, - 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." }, + GetCreator = + { + Returns = + { + { + Type = "cEntity", + }, + }, + Notes = "Returns the entity who created this projectile. May return nil.", + }, + GetCreatorName = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the name of the player that created the projectile. Will be empty for non-player creators", + }, + GetCreatorUniqueID = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the unique ID of the entity who created this projectile, or {{cEntity#INVALID_ID|cEntity.INVALID_ID}} if the projectile wasn't created by an entity.", + }, + GetMCAClassName = + { + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the string that identifies the projectile type (class name) in MCA files", + }, + GetProjectileKind = + { + Returns = + { + { + Type = "cProjectileEntity#eKind", + }, + }, + Notes = "Returns the kind of this projectile (pkXXX constant)", + }, + IsInGround = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this projectile has hit the ground.", + }, }, Constants = { - pkArrow = { Notes = "The projectile is an {{cArrowEntity|arrow}}" }, - pkEgg = { Notes = "The projectile is a {{cThrownEggEntity|thrown egg}}" }, - pkEnderPearl = { Notes = "The projectile is a {{cThrownEnderPearlEntity|thrown enderpearl}}" }, - pkExpBottle = { Notes = "The projectile is a {{cExpBottleEntity|thrown exp bottle}}" }, - pkFireCharge = { Notes = "The projectile is a {{cFireChargeEntity|fire charge}}" }, - pkFirework = { Notes = "The projectile is a (flying) {{cFireworkEntity|firework}}" }, - pkFishingFloat = { Notes = "The projectile is a {{cFloater|fishing float}}" }, - pkGhastFireball = { Notes = "The projectile is a {{cGhastFireballEntity|ghast fireball}}" }, - pkSnowball = { Notes = "The projectile is a {{cThrownSnowballEntity|thrown snowball}}" }, - pkSplashPotion = { Notes = "The projectile is a {{cSplashPotionEntity|thrown splash potion}}" }, - pkWitherSkull = { Notes = "The projectile is a {{cWitherSkullEntity|wither skull}}" }, + pkArrow = + { + Notes = "The projectile is an {{cArrowEntity|arrow}}", + }, + pkEgg = + { + Notes = "The projectile is a {{cThrownEggEntity|thrown egg}}", + }, + pkEnderPearl = + { + Notes = "The projectile is a {{cThrownEnderPearlEntity|thrown enderpearl}}", + }, + pkExpBottle = + { + Notes = "The projectile is a {{cExpBottleEntity|thrown exp bottle}}", + }, + pkFireCharge = + { + Notes = "The projectile is a {{cFireChargeEntity|fire charge}}", + }, + pkFirework = + { + Notes = "The projectile is a (flying) {{cFireworkEntity|firework}}", + }, + pkFishingFloat = + { + Notes = "The projectile is a {{cFloater|fishing float}}", + }, + pkGhastFireball = + { + Notes = "The projectile is a {{cGhastFireballEntity|ghast fireball}}", + }, + pkSnowball = + { + Notes = "The projectile is a {{cThrownSnowballEntity|thrown snowball}}", + }, + pkSplashPotion = + { + Notes = "The projectile is a {{cSplashPotionEntity|thrown splash potion}}", + }, + pkWitherSkull = + { + Notes = "The projectile is a {{cWitherSkullEntity|wither skull}}", + }, }, ConstantGroups = { - ProjectileKind = + eKind = { Include = "pk.*", TextBefore = "The following constants are used to distinguish between the different projectile kinds:", }, }, Inherits = "cEntity", - }, -- cProjectileEntity - - + }, cSplashPotionEntity = { Desc = [[ Represents a thrown splash potion. ]], - Functions = + Functions = + { + GetEntityEffect = + { + Returns = + { + { + Type = "cEntityEffect", + }, + }, + Notes = "Returns the entity effect in this potion", + }, + GetEntityEffectType = + { + Returns = + { + { + Type = "cEntityEffect", + }, + }, + Notes = "Returns the effect type of this potion", + }, + GetItem = + { + Returns = + { + { + Type = "cItem", + }, + }, + Notes = "Gets the potion item that was thrown.", + }, + GetPotionColor = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the color index of the particles emitted by this potion", + }, + SetEntityEffect = { - GetEntityEffect = { Params = "", Return = "{{cEntityEffect}}", Notes = "Returns the entity effect in this potion" }, - GetEntityEffectType = { Params = "", Return = "{{cEntityEffect|Entity effect type}}", Notes = "Returns the effect type of this potion" }, - GetPotionColor = { Params = "", Return = "number", Notes = "Returns the color index of the particles emitted by this potion" }, - GetItem = { Params = "", Return = "{{cItem}}", Notes = "Gets the potion item that was thrown." }, - SetEntityEffect = { Params = "{{cEntityEffect}}", Return = "", Notes = "Sets the entity effect for this potion" }, - SetEntityEffectType = { Params = "{{cEntityEffect|Entity effect type}}", Return = "", Notes = "Sets the effect type of this potion" }, - SetPotionColor = { Params = "number", Return = "", Notes = "Sets the color index of the particles for this potion" }, + Params = + { + { + Name = "EntityEffect", + Type = "cEntityEffect", + }, + }, + Notes = "Sets the entity effect for this potion", }, + SetEntityEffectType = + { + Params = + { + { + Name = "EntityEffectType", + Type = "cEntityEffect#eType", + }, + }, + Notes = "Sets the effect type of this potion", + }, + SetPotionColor = + { + Params = + { + { + Name = "PotionColor", + Type = "number", + }, + }, + Notes = "Sets the color index of the particles for this potion", + }, + }, Inherits = "cProjectileEntity", - }, -- cSplashPotionEntity - - + }, cThrownEggEntity = { Desc = [[ Represents a thrown egg. ]], - Functions = {}, - Inherits = "cProjectileEntity", - }, -- cThrownEggEntity - + Functions = + { + }, + Inherits = "cProjectileEntity", + }, cThrownEnderPearlEntity = { Desc = "Represents a thrown ender pearl.", - Functions = {}, - Inherits = "cProjectileEntity", - }, -- cThrownEnderPearlEntity - + Functions = + { + }, + Inherits = "cProjectileEntity", + }, cThrownSnowballEntity = { Desc = "Represents a thrown snowball.", - Functions = {}, - Inherits = "cProjectileEntity", - }, -- cThrownSnowballEntity - + Functions = + { + }, + Inherits = "cProjectileEntity", + }, cWitherSkullEntity = { Desc = "Represents a wither skull being shot.", - Functions = {}, + Functions = + { + + }, Inherits = "cProjectileEntity", - }, -- cWitherSkullEntity + }, } - - - - diff --git a/Server/Plugins/APIDump/Classes/WebAdmin.lua b/Server/Plugins/APIDump/Classes/WebAdmin.lua index ec37d9308..faa81dc82 100644 --- a/Server/Plugins/APIDump/Classes/WebAdmin.lua +++ b/Server/Plugins/APIDump/Classes/WebAdmin.lua @@ -5,31 +5,165 @@ return Desc = "", Functions = { - 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", 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." }, + AddWebTab = + { + IsStatic = true, + Params = + { + { + Name = "Title", + Type = "string", + }, + { + Name = "UrlPath", + Type = "string", + }, + { + Name = "HandlerFn", + Type = "function", + }, + }, + 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 = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "URL", + Type = "string", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the string that is the path of the base webadmin (\"../../../webadmin\") relative to the given URL.", + }, + GetContentTypeFromFileExt = + { + IsStatic = true, + Params = + { + { + Name = "FileExt", + Type = "string", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "Input", + Type = "string", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + 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 = + { + IsStatic = true, + Params = + { + { + Name = "HTTPRequest", + Type = "Request", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + 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 = + { + Returns = + { + { + Type = "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 = + { + IsStatic = true, + Params = + { + { + Name = "Input", + Type = "string", + }, + }, + Returns = + { + { + Type = "string", + }, + }, + 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 = + { + 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 - - + }, HTTPFormData = { Desc = "This class stores data for one form element for a {{HTTPRequest|HTTP request}}.", Variables = { - Name = { Type = "string", Notes = "Name of the form element" }, - Type = { Type = "string", Notes = "Type of the data (usually empty)" }, - Value = { Type = "string", Notes = "Value of the form element. Contains the raw data as sent by the browser." }, + Name = + { + Type = "string", + Notes = "Name of the form element", + }, + Type = + { + Type = "string", + Notes = "Type of the data (usually empty)", + }, + Value = + { + Type = "string", + Notes = "Value of the form element. Contains the raw data as sent by the browser.", + }, }, - }, -- HTTPFormData - - + }, HTTPRequest = { Desc = [[ @@ -39,32 +173,55 @@ return ]], Constants = { - FormData = { Notes = "Array-table of {{HTTPFormData}}, contains the values of individual form elements submitted by the client" }, - Params = { Notes = "Map-table of parameters given to the request in the URL (?param=value); if a form uses GET method, this is the same as FormData. For each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value." }, - PostParams = { Notes = "Map-table of data posted through a FORM - either a GET or POST method. Logically the same as FormData, but in a map-table format (for each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value)." }, + Params = + { + Notes = "Map-table of parameters given to the request in the URL (?param=value); if a form uses GET method, this is the same as FormData. For each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value.", + }, + FormData = + { + Notes = "Array-table of {{HTTPFormData}}, contains the values of individual form elements submitted by the client", + }, + PostParams = + { + Notes = "Map-table of data posted through a FORM - either a GET or POST method. Logically the same as FormData, but in a map-table format (for each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value).", + }, }, - Variables = { - Method = { Type = "string", Notes = "The HTTP method used to make the request. Usually GET or POST." }, - Path = { Type = "string", Notes = "The Path part of the URL (excluding the parameters)" }, - URL = { Type = "string", Notes = "The entire URL used for the request." }, - Username = { Type = "string", Notes = "Name of the logged-in user." }, + Method = + { + Type = "string", + Notes = "The HTTP method used to make the request. Usually GET or POST.", + }, + Path = + { + Type = "string", + Notes = "The Path part of the URL (excluding the parameters)", + }, + URL = + { + Type = "string", + Notes = "The entire URL used for the request.", + }, + 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. + 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." }, + Request = + { + Type = "HTTPRequest", + Notes = "The request for which the template is being built.", + }, }, - }, -- HTTPTemplateRequest + }, } - - - - |