From 401e31fdc00aa74af2a721e81831e019992c957f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 24 Sep 2013 22:41:29 +0200 Subject: APIDump: Documented the cBoundingBox class. --- MCServer/Plugins/APIDump/APIDesc.lua | 37 ++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 86256e4b3..b750bf74c 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -311,8 +311,41 @@ g_APIDesc = cBoundingBox = { - Desc = "", - Functions = {}, + Desc = [[ + Represents two sets of coordinates, minimum and maximum for each direction; thus defining an + axis-aligned cuboid with floating-point boundaries. It supports operations changing the size and + position of the box, as well as querying whether a point or another BoundingBox is inside the box.

+

+ All the points within the coordinate limits (inclusive the edges) are considered "inside" the box. + However, for intersection purposes, if the intersection is "sharp" in any coord (min1 == max2, i. e. + zero volume), the boxes are considered non-intersecting.

+ ]], + Functions = + { + 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." }, + }, + CalcLineIntersection = { Params = "{{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, LineCoeff, Face", Notes = "Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected.
TODO: Lua binding for this function is wrong atm." }, + 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)." }, + 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." }, + }, + 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" }, + }, + 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." }, + }, Constants = {}, }, -- cgit v1.2.3 From 8ca8c84ee52b4edf914a2e2563204b7a86723263 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 25 Sep 2013 08:43:01 +0200 Subject: APIDump: Updated cClientHandle documentation --- MCServer/Plugins/APIDump/APIDesc.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index b750bf74c..973e189d5 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -429,25 +429,27 @@ g_APIDesc = cClientHandle = { Desc = [[ - A cClientHandle represents technical aspect of a connected player - their game client connection. + A cClientHandle represents the technical aspect of a connected player - their game client + connection. Internally, it handles all the incoming and outgoing packets, the chunks that are to be + sent to the client, ping times etc. ]], Functions = { GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" }, - GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client" }, + GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned." }, GetUniqueID = { Params = "", Return = "number", Notes = "Returns the UniqueID of the client used to identify the client in the server" }, GetUsername = { Params = "", Return = "string", Notes = "Returns the username that the client has provided" }, GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" }, Kick = { Params = "Reason", Return = "", Notes = "Kicks the user with the specified reason" }, SetUsername = { Params = "Name", Return = "", Notes = "Sets the username" }, SetViewDistance = { Params = "ViewDistance", Return = "", Notes = "Sets the viewdistance (number of chunks loaded for the player in each direction)" }, - SendBlockChange = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sends a block to the client. This can be used to create fake blocks." }, + SendBlockChange = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sends a BlockChange packet to the client. This can be used to create fake blocks only for that player." }, }, Constants = { - MAX = { Notes = "10" }, - MIN = { Notes = "4" }, + MAX_VIEW_DISTANCE = { Notes = "The maximum value of the view distance" }, + MIN_VIEW_DISTANCE = { Notes = "The minimum value of the view distance" }, }, }, -- cgit v1.2.3 From 0b8f47face8299964e496c2bcf1b2230677d6c99 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 25 Sep 2013 09:02:49 +0200 Subject: Removed cChunkDesc::SetChunkCoords() from Lua API. --- source/Bindings.cpp | 38 +------------------------------------- source/Bindings.h | 2 +- source/Generating/ChunkDesc.h | 6 +++--- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 24289865a..70a1f5a40 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 09/21/13 17:37:22. +** Generated automatically by tolua++-1.0.92 on 09/25/13 09:02:22. */ #ifndef __cplusplus @@ -26163,41 +26163,6 @@ static int tolua_AllToLua_cChunkDesc_GetChunkZ00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: SetChunkCoords of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetChunkCoords00 -static int tolua_AllToLua_cChunkDesc_SetChunkCoords00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetChunkCoords'", NULL); -#endif - { - self->SetChunkCoords(a_ChunkX,a_ChunkZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetChunkCoords'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: FillBlocks of class cChunkDesc */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillBlocks00 static int tolua_AllToLua_cChunkDesc_FillBlocks00(lua_State* tolua_S) @@ -30554,7 +30519,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_beginmodule(tolua_S,"cChunkDesc"); tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cChunkDesc_GetChunkX00); tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cChunkDesc_GetChunkZ00); - tolua_function(tolua_S,"SetChunkCoords",tolua_AllToLua_cChunkDesc_SetChunkCoords00); tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cChunkDesc_FillBlocks00); tolua_function(tolua_S,"SetBlockTypeMeta",tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00); tolua_function(tolua_S,"GetBlockTypeMeta",tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00); diff --git a/source/Bindings.h b/source/Bindings.h index 0fa3665a3..32a8797e8 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 09/21/13 17:37:22. +** Generated automatically by tolua++-1.0.92 on 09/25/13 09:02:23. */ /* Exported function */ diff --git a/source/Generating/ChunkDesc.h b/source/Generating/ChunkDesc.h index 41b85a814..067d8494a 100644 --- a/source/Generating/ChunkDesc.h +++ b/source/Generating/ChunkDesc.h @@ -36,13 +36,13 @@ public: cChunkDesc(int a_ChunkX, int a_ChunkZ); ~cChunkDesc(); + void SetChunkCoords(int a_ChunkX, int a_ChunkZ); + // tolua_begin int GetChunkX(void) const { return m_ChunkX; } int GetChunkZ(void) const { return m_ChunkZ; } - void SetChunkCoords(int a_ChunkX, int a_ChunkZ); - void FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); void SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); void GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta); @@ -74,7 +74,7 @@ public: /// Writes the block area into the chunk, with its origin set at the specified relative coords. Area's data overwrite everything in the chunk. void WriteBlockArea(const cBlockArea & a_BlockArea, int a_RelX, int a_RelY, int a_RelZ, cBlockArea::eMergeStrategy a_MergeStrategy = cBlockArea::msOverwrite); - /// Reads an area from the chunk into a cBlockArea + /// Reads an area from the chunk into a cBlockArea, blocktypes and blockmetas void ReadBlockArea(cBlockArea & a_Dest, int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ); /// Returns the maximum height value in the heightmap -- cgit v1.2.3 From 6d1580bd3949c8dab90d27544147950396f0187b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 25 Sep 2013 09:03:53 +0200 Subject: APIDump: Updated cChunkDesc docs. --- MCServer/Plugins/APIDump/APIDesc.lua | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 973e189d5..1d259b984 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -398,17 +398,40 @@ g_APIDesc = Functions = { FillBlocks = { Params = "BlockType, BlockMeta", Return = "", Notes = "Fills the entire chunk with the specified blocks" }, + FillRelCuboid = + { + { Params = "{{cCuboid|RelCuboid}}, BlockType, BlockMeta", Return = "", Notes = "Fills the cuboid, specified in relative coords, by the specified block type and block meta. The cuboid may reach outside of the chunk, only the part intersecting with this chunk is filled." }, + { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta", Return = "", Notes = "Fills the cuboid, specified in relative coords, by the specified block type and block meta. The cuboid may reach outside of the chunk, only the part intersecting with this chunk is filled." }, + }, + FloorRelCuboid = + { + { Params = "{{cCuboid|RelCuboid}}, BlockType, BlockMeta", Return = "", Notes = "Fills those blocks of the cuboid (specified in relative coords) that are considered non-floor (air, water) with the specified block type and meta. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, + { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta", Return = "", Notes = "Fills those blocks of the cuboid (specified in relative coords) that are considered non-floor (air, water) with the specified block type and meta. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, + }, GetBiome = { Params = "RelX, RelZ", Return = "EMCSBiome", Notes = "Returns the biome at the specified relative coords" }, GetBlockMeta = { Params = "RelX, RelY, RelZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified relative coords" }, GetBlockType = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified relative coords" }, GetBlockTypeMeta = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified relative coords" }, + GetChunkX = { Params = "", Return = "number", Notes = "Returns the X coord of the chunk contained." }, + GetChunkZ = { Params = "", Return = "number", Notes = "Returns the Z coord of the chunk contained." }, GetHeight = { Params = "RelX, RelZ", Return = "number", Notes = "Returns the height at the specified relative coords" }, + GetMaxHeight = { Params = "", Return = "number", Notes = "Returns the maximum height contained in the heightmap." }, IsUsingDefaultBiomes = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default biome generator" }, IsUsingDefaultComposition = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default composition generator" }, IsUsingDefaultFinish = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default finishers" }, IsUsingDefaultHeight = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default height generator" }, IsUsingDefaultStructures = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default structures" }, - ReadBlockArea = { Params = "BlockArea, MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ", Return = "", Notes = "Reads data from the chunk into the block area object" }, + RandomFillRelCuboid = + { + { Params = "{{cCuboid|RelCuboid}}, BlockType, BlockMeta, RandomSeed, ChanceOutOf10k", Return = "", Notes = "Fills the specified relative cuboid with block type and meta in random locations. RandomSeed is used for the random number genertion (same seed produces same results); ChanceOutOf10k specifies the density (how many out of every 10000 blocks should be filled). Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, + { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta, RandomSeed, ChanceOutOf10k", Return = "", Notes = "Fills the specified relative cuboid with block type and meta in random locations. RandomSeed is used for the random number genertion (same seed produces same results); ChanceOutOf10k specifies the density (how many out of every 10000 blocks should be filled). Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, + }, + ReadBlockArea = { Params = "{{cBlockArea|BlockArea}}, MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ", Return = "", Notes = "Reads data from the chunk into the block area object. Block types and metas are processed." }, + ReplaceRelCuboid = + { + { Params = "{{cCuboid|RelCuboid}}, SrcType, SrcMeta, DstType, DstMeta", Return = "", Notes = "Replaces all SrcType+SrcMeta blocks in the cuboid (specified in relative coords) with DstType+DstMeta blocks. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, + { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, SrcType, SrcMeta, DstType, DstMeta", Return = "", Notes = "Replaces all SrcType+SrcMeta blocks in the cuboid (specified in relative coords) with DstType+DstMeta blocks. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, + }, SetBiome = { Params = "RelX, RelZ, EMCSBiome", Return = "", Notes = "Sets the biome at the specified relative coords" }, SetBlockMeta = { Params = "RelX, RelY, RelZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified relative coords" }, SetBlockType = { Params = "RelX, RelY, RelZ, BlockType", Return = "", Notes = "Sets the block type at the specified relative coords" }, @@ -419,7 +442,7 @@ g_APIDesc = SetUseDefaultFinish = { Params = "bool", Return = "", Notes = "Sets the chunk to use default finishers or not" }, SetUseDefaultHeight = { Params = "bool", Return = "", Notes = "Sets the chunk to use default height generator or not" }, SetUseDefaultStructures = { Params = "bool", Return = "", Notes = "Sets the chunk to use default structures or not" }, - WriteBlockArea = { Params = "BlockArea, MinRelX, MinRelY, MinRelZ", Return = "", Notes = "Writes data from the block area into the chunk" }, + WriteBlockArea = { Params = "{{cBlockArea|BlockArea}}, MinRelX, MinRelY, MinRelZ", Return = "", Notes = "Writes data from the block area into the chunk" }, }, Constants = { -- cgit v1.2.3 From fe9be5b8bec4b68cb13e6b5370b00fdc26d06278 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 25 Sep 2013 09:15:48 +0200 Subject: APIDump: Updated cBlockArea docs. --- MCServer/Plugins/APIDump/APIDesc.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 1d259b984..efe0fc43f 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -157,10 +157,13 @@ g_APIDesc = SetBlockMeta = { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified absolute coords" }, SetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ, SkyLight", Return = "", Notes = "Sets the skylight at the specified absolute coords" }, SetBlockType = { Params = "BlockX, BlockY, BlockZ, BlockType", Return = "", Notes = "Sets the block type at the specified absolute coords" }, + SetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block type and meta at the specified absolute coords" }, + SetOrigin = { Params = "OriginX, OriginY, OriginZ", Return = "", Notes = "Resets the origin for the absolute coords. Only affects how absolute coords are translated into relative coords." }, SetRelBlockLight = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockLight", Return = "", Notes = "Sets the blocklight at the specified relative coords" }, SetRelBlockMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified relative coords" }, SetRelBlockSkyLight = { Params = "RelBlockX, RelBlockY, RelBlockZ, SkyLight", Return = "", Notes = "Sets the skylight at the specified relative coords" }, SetRelBlockType = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockType", Return = "", Notes = "Sets the block type at the specified relative coords" }, + SetRelBlockTypeMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block type and meta at the specified relative coords" }, Write = { Params = "World, MinX, MinY, MinZ, DataTypes", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful" }, }, Constants = -- cgit v1.2.3 From 1c0f47704f81f06923fac2ad995e74ae972da6b3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 26 Sep 2013 21:28:23 +0200 Subject: APIDump: completed cChestEntity docs. --- MCServer/Plugins/APIDump/APIDesc.lua | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index efe0fc43f..69e1e213d 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -376,17 +376,46 @@ g_APIDesc = Desc = [[ A chest entity is a {{cBlockEntityWithItems|cBlockEntityWithItems}} descendant that represents a chest in the world. Note that doublechests consist of two separate cChestEntity objects, they do not collaborate - in any way. + in any way.

+

+ The chest entity can be created by the plugins only in the {{OnChunkGenerating}} and + {{OnChunkGenerated}} hooks, as part of the new chunk being generated. Plugins may generate chests + with contents in this way.

+

+ 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", Functions = { + constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cChestEntity", Notes = "Creates a new cChestEntity object. To be used only in the chunk generating hooks {{OnChunkGenerating}} and {{OnChunkGenerated}}." }, }, 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}}" }, }, + AdditionalInfo = + { + { + Header = "Code example", + Contents = [[ + The following example code sets the top-left item of each chest in the same chunk as Player to + 64 * diamond: +

+-- Player is a {{cPlayer}} object instance
+local World = Player:GetWorld();
+World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
+	function (ChestEntity)
+		ChestEntity:SetSlot(0, 0, cItem(E_ITEM_DIAMOND, 64));
+	end
+);
+
+ ]], + }, + }, -- AdditionalInfo }, cChunkDesc = -- cgit v1.2.3 From b4c7b1879385932706734e30926b362b1aea1c09 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 26 Sep 2013 21:37:15 +0200 Subject: APIDump: Completed cCraftingGrid's documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 69e1e213d..333d1abe3 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -511,16 +511,21 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), cCraftingGrid = { Desc = [[ - cCraftingGrid represents the player's crafting grid. It is used only in + cCraftingGrid represents the player's crafting grid. It is used in {{OnCraftingNoRecipe|OnCraftingNoRecipe}}, {{OnPostCrafting|OnPostCrafting}} and {{OnPreCrafting|OnPreCrafting}} hooks. Plugins may use it to inspect the items the player placed - on their crafting grid. + on their crafting grid.

+

+ Also, an object of this type is used in {{cCraftingRecipe}}'s ConsumeIngredients() function for + specifying the exact number of ingredients to consume in that recipe; plugins may use this to + apply the crafting recipe.

]], Functions = { + constructor = { Params = "Width, Height", Return = "cCraftingGrid", Notes = "Creates a new CraftingGrid object. This new crafting grid is not related to any player, but may be needed for {{cCraftingRecipe}}'s ConsumeIngredients function." }, Clear = { Params = "", Return = "", Notes = "Clears the entire grid" }, - ConsumeGrid = { Params = "{{cCraftingGrid|CraftingGrid}}", Return = "", Notes = "Consumes items specified in CraftingGrid from the current contents" }, + ConsumeGrid = { Params = "{{cCraftingGrid|CraftingGrid}}", Return = "", Notes = "Consumes items specified in CraftingGrid from the current contents. Used internally by {{cCraftingRecipe}}'s ConsumeIngredients() function, but available to plugins, too." }, Dump = { Params = "", Return = "", Notes = "DEBUG build: Dumps the contents of the grid to the log. RELEASE build: no action" }, GetHeight = { Params = "", Return = "number", Notes = "Returns the height of the grid" }, GetItem = { Params = "x, y", Return = "{{cItem|cItem}}", Notes = "Returns the item at the specified coords" }, -- cgit v1.2.3 From aeb44b5e66e0e88ca1a69a16282423eae444b47b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 26 Sep 2013 21:58:18 +0200 Subject: APIDump: Completed cCuboid docs. --- MCServer/Plugins/APIDump/APIDesc.lua | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 333d1abe3..c628efbc7 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -576,15 +576,37 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), cCuboid = { Desc = [[ - cCuboid offers some native support for integral-boundary cuboids. A cuboid simply consists of two - {{vector3i}}-s. It offers some extra functions for sorting and checking if a point is inside the - cuboid. + cCuboid offers some native support for integral-boundary cuboids. A cuboid internally consists of + two {{Vector3i}}s. By default the cuboid doesn't make any assumptions about the defining points, + but for most of the operations in the cCuboid class, the p1 member variable is expected to be the + minima and the p2 variable the maxima. The Sort() function guarantees this condition.

+

+ The Cuboid considers both its edges inclusive.

]], Functions = { - Sort = { Return = "" }, - IsInside = { Return = "bool" }, - IsInside = { Return = "bool" }, + constructor = + { + { Params = "OtheCuboid", 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." }, + }, + Assign = { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "", Notes = "Assigns all the coords stored in the cuboid. Sort-state is ignored." }, + 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." }, + IsCompletelyInside = { Params = "OuterCuboid", Return = "bool", 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." }, + }, + 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." }, + Sort = { Params = "", Return = "" , Notes = "Sorts the internal representation so that p1 contains the lesser coords and p2 contains the greater coords." }, }, Variables = { -- cgit v1.2.3 From 271bbdd7ac15c5fa8de90797016243747b000231 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 27 Sep 2013 15:10:55 +0200 Subject: APIDump: Documented cServer --- MCServer/Plugins/APIDump/APIDesc.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index c628efbc7..7f10b0072 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1402,10 +1402,15 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); cServer = { - Desc = [[cServer is typically only used by plugins to broadcast a chat message to all players in the server. Natively however, cServer accepts connections from clients and adds those clients to the game. + Desc = [[cServer is typically only used by plugins to broadcast a chat message(Now replaced by the {{cRoot|cRoot}} BroadcastChat function) to all players in the server. Natively however, cServer accepts connections from clients and adds those clients to the game. ]], Functions = { + GetDescription = { Return = "string", Notes = "Returns the server description set in the settings.ini." }, + GetMaxPlayers = { Return = "number", Notes = "Returns the max amount of players who can join the server." }, + SetMaxPlayers = { Params = "number", Notes = "Sets the max amount of players who can join." }, + GetNumPlayers = { Return = "number", Notes = "Returns the amount of players online." }, + GetServerID = { Return = "string", Notes = "Returns the ID of the server?" }, }, Constants = { -- cgit v1.2.3 From e5d5896a24695e25278db230a3e909022087d2e2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 27 Sep 2013 16:31:48 +0200 Subject: Fixed a typo in cEntity doxycomments. --- source/Entities/Entity.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h index a2c99d2a0..c7c362b40 100644 --- a/source/Entities/Entity.h +++ b/source/Entities/Entity.h @@ -234,16 +234,16 @@ public: /// Returns the curently equipped weapon; empty item if none virtual cItem GetEquippedWeapon(void) const { return cItem(); } - /// Returns the currently equipped helmet; empty item if nonte + /// Returns the currently equipped helmet; empty item if none virtual cItem GetEquippedHelmet(void) const { return cItem(); } - /// Returns the currently equipped chestplate; empty item if nonte + /// Returns the currently equipped chestplate; empty item if none virtual cItem GetEquippedChestplate(void) const { return cItem(); } - /// Returns the currently equipped leggings; empty item if nonte + /// Returns the currently equipped leggings; empty item if none virtual cItem GetEquippedLeggings(void) const { return cItem(); } - /// Returns the currently equipped boots; empty item if nonte + /// Returns the currently equipped boots; empty item if none virtual cItem GetEquippedBoots(void) const { return cItem(); } /// Called when the health drops below zero. a_Killer may be NULL (environmental damage) -- cgit v1.2.3 From 5e7e4b3a2837e5d1bd27e24f09dd598d9b9643d2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 27 Sep 2013 16:32:44 +0200 Subject: APIDump: Updated cEntity docs. --- MCServer/Plugins/APIDump/APIDesc.lua | 148 +++++++++++++++++++++++++++-------- 1 file changed, 115 insertions(+), 33 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 7f10b0072..0318c69ea 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -691,67 +691,149 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), cEntity = { - Desc = [[A cEntity object represents an object in the world, it has a position and orientation. cEntity is an abstract class, and can not be instantiated directly, instead, all entities are implemented as subclasses. The cEntity class works as the common interface for the operations that all (most) entities support. -

-

All cEntity objects have an Entity Type so it can be determined what kind of entity it is efficiently. Entities also have a class inheritance awareness, they know their class name, their parent class' name and can decide if there is a class within their inheritance chain. Since these functions operate on strings, they are slightly slower than checking the entity type directly, on the other hand, they are more specific (compare etMob vs "cSpider" class name). -

-

Note that you should not store a cEntity object between two hooks' calls, because MCServer may remove that entity in between the calls. If you need to refer to an entity later, use its UniqueID and {{cWorld|cWorld}}'s entity manipulation functions to access the entity. + Desc = [[ + A cEntity object represents an object in the world, it has a position and orientation. cEntity is an + abstract class, and can not be instantiated directly, instead, all entities are implemented as + subclasses. The cEntity class works as the common interface for the operations that all (most) + entities support.

+

+ All cEntity objects have an Entity Type so it can be determined what kind of entity it is + efficiently. Entities also have a class inheritance awareness, they know their class name, + their parent class' name and can decide if there is a class within their inheritance chain. + Since these functions operate on strings, they are slightly slower than checking the entity type + directly, on the other hand, they are more specific directly. To check if the entity is a spider, + you need to call IsMob(), then cast the object to {{cMonster}} and finally compare + {{cMonster}}:GetMonsterType() to mtSpider. GetClass(), on the other hand, returns "cSpider" + directly.

+

+ Note that you should not store a cEntity object between two hooks' calls, because MCServer may + despawn / remove that entity in between the calls. If you need to refer to an entity later, use its + UniqueID and {{cWorld|cWorld}}'s entity manipulation functions DoWithEntityByID(), ForEachEntity() + or ForEachEntityInChunk() to access the entity again.

]], Functions = { + AddPosition = + { + { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Moves the entity by the specified amount in each axis direction" }, + { Params = "{{Vector3d|Offset}}", Return = "", Notes = "Moves the entity by the specified amount in each direction" }, + }, + AddPosX = { Params = "OffsetX", Return = "", Notes = "Moves the entity by the specified amount in the X axis direction" }, + AddPosY = { Params = "OffsetY", Return = "", Notes = "Moves the entity by the specified amount in the Y axis direction" }, + AddPosZ = { Params = "OffsetZ", Return = "", Notes = "Moves the entity by the specified amount in the Z axis direction" }, + AddSpeed = + { + { Params = "AddX, AddY, AddZ", Return = "", Notes = "Adds the specified amount of speed in each axis direction." }, + { Params = "{{Vector3d|Add}}", Return = "", Notes = "Adds the specified amount of speed in each axis direction." }, + }, + AddSpeedX = { Params = "AddX", Return = "", Notes = "Adds the specified amount of speed in the X axis direction." }, + AddSpeedY = { Params = "AddY", Return = "", Notes = "Adds the specified amount of speed in the Y axis direction." }, + AddSpeedZ = { Params = "AddZ", Return = "", Notes = "Adds the specified amount of speed in the Z axis direction." }, Destroy = { Params = "", Return = "", Notes = "Schedules the entity to be destroyed" }, + GetArmorCoverAgainst = { Params = "AttackerEntity, DamageType, RawDamage", Return = "number", Notes = "Returns the number of hitpoints out of RawDamage that the currently equipped armor would cover. See {{TakeDamageInfo}} for more information on attack damage." }, GetChunkX = { Params = "", Return = "number", Notes = "Returns the X-coord of the chunk in which the entity is placed" }, - GetChunkY = { Params = "", Return = "number", Notes = "Returns the Y-coord of the chunk in which the entity is placed" }, GetChunkZ = { Params = "", Return = "number", Notes = "Returns the Z-coord of the chunk in which the entity is placed" }, - GetClass = { Params = "", Return = "string", Notes = "Returns the classname of the entity, such as \"spider\" or \"pickup\"" }, + GetClass = { Params = "", Return = "string", Notes = "Returns the classname of the entity, such as \"cSpider\" or \"cPickup\"" }, GetClassStatic = { Params = "", Return = "string", Notes = "Returns the entity classname that this class implements. Each descendant overrides this function. Is static" }, - GetEntityType = { Params = "", Return = "cEntity.eEntityType", Notes = "Returns the type of the entity, one of the etXXX constants" }, + GetEntityType = { Params = "", Return = "eEntityType", Notes = "Returns the type of the entity, one of the etXXX constants. Note that to check specific entity type, you should use one of the IsXXX functions instead of comparing the value returned by this call." }, + GetEquippedBoots = { Params = "", Return = "{{cItem}}", Notes = "Returns the boots that the entity has equipped. Returns an empty cItem if no boots equipped or not applicable." }, + GetEquippedChestplate = { Params = "", Return = "{{cItem}}", Notes = "Returns the chestplate that the entity has equipped. Returns an empty cItem if no chestplate equipped or not applicable." }, + GetEquippedHelmet = { Params = "", Return = "{{cItem}}", Notes = "Returns the helmet that the entity has equipped. Returns an empty cItem if no helmet equipped or not applicable." }, + GetEquippedLeggings = { Params = "", Return = "{{cItem}}", Notes = "Returns the leggings that the entity has equipped. Returns an empty cItem if no leggings equipped or not applicable." }, + GetEquippedWeapon = { Params = "", Return = "{{cItem}}", Notes = "Returns the weapon that the entity has equipped. Returns an empty cItem if no weapon equipped or not applicable." }, + GetGravity = { Params = "", Return = "number", Notes = "Returns the number that is used as the gravity for physics simulation. 1G (9.78) by default." }, + GetHeadYaw = { Params = "", Return = "number", Notes = "Returns the pitch of the entity's head (FIXME: Rename to GetHeadPitch() )." }, + GetHealth = { Params = "", Return = "number", Notes = "Returns the current health of the entity." }, + GetHeight = { Params = "", Return = "number", Notes = "Returns the height (Y size) of the entity" }, + GetKnockbackAmountAgainst = { Params = "ReceiverEntity", Return = "number", Notes = "Returns the amount of knockback that the currently equipped items would cause when attacking the ReceiverEntity." }, GetLookVector = { Params = "", Return = "Vector3f", Notes = "Returns the vector that defines the direction in which the entity is looking" }, + GetMass = { Params = "", Return = "number", Notes = "Returns the mass of the entity. Currently unused." }, + GetMaxHealth = { Params = "", Return = "number", Notes = "Returns the maximum number of hitpoints this entity is allowed to have." }, GetParentClass = { Params = "", Return = "string", Notes = "Returns the name of the direct parent class for this entity" }, GetPitch = { Params = "", Return = "number", Notes = "Returns the pitch (nose-down rotation) of the entity" }, + GetPosition = { Params = "", Return = "Vector3d", Notes = "Returns the entity's pivot position as a 3D vector" }, GetPosX = { Params = "", Return = "number", Notes = "Returns the X-coord of the entity's pivot" }, GetPosY = { Params = "", Return = "number", Notes = "Returns the Y-coord of the entity's pivot" }, GetPosZ = { Params = "", Return = "number", Notes = "Returns the Z-coord of the entity's pivot" }, - GetPosition = { Params = "", Return = "Vector3d", Notes = "Returns the entity's pivot position as a 3D vector" }, - GetRoll = { Params = "", Return = "number", Notes = "Returns the roll (sideways rotation) of the entity" }, - GetRot = { Params = "", Return = "Vector3f", Notes = "Returns the entire rotation vector (Rotation, Pitch, Roll)" }, - GetRotation = { Params = "", Return = "number", Notes = "Returns the rotation (direction) of the entity" }, + GetRawDamageAgainst = { Params = "ReceiverEntity", Return = "number", Notes = "Returns the raw damage that this entity's equipment would cause when attacking the ReceiverEntity. This includes this entity's weapon {{cEnchantments|enchantments}}, but excludes the receiver's armor or potion effects. See {{TakeDamageInfo}} for more information on attack damage." }, + GetRoll = { Params = "", Return = "number", Notes = "Returns the roll (sideways rotation) of the entity. Currently unused." }, + GetRot = { Params = "", Return = "{{Vector3f}}", Notes = "Returns the entire rotation vector (Yaw, Pitch, Roll)" }, + GetRotation = { Params = "", Return = "number", Notes = "Returns the yaw (direction) of the entity. FIXME: Rename to GetYaw()." }, GetSpeed = { Params = "", Return = "Vector3d", Notes = "Returns the complete speed vector of the entity" }, GetSpeedX = { Params = "", Return = "number", Notes = "Returns the X-part of the speed vector" }, GetSpeedY = { Params = "", Return = "number", Notes = "Returns the Y-part of the speed vector" }, GetSpeedZ = { Params = "", Return = "number", Notes = "Returns the Z-part of the speed vector" }, - GetUniqueID = { Params = "", Return = "number", Notes = "Returns the ID that uniquely identifies the entity" }, + GetUniqueID = { Params = "", Return = "number", Notes = "Returns the ID that uniquely identifies the entity within the running server. Note that this ID is not persisted to the data files." }, + GetWidth = { Params = "", Return = "number", Notes = "Returns the width (X and Z size) of the entity." }, GetWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world where the entity resides" }, + Heal = { Params = "Hitpoints", Return = "", Notes = "Heals the specified number of hitpoints. Hitpoints is expected to be a positive number." }, IsA = { Params = "ClassName", Return = "bool", Notes = "Returns true if the entity class is a descendant of the specified class name, or the specified class itself" }, - IsCrouched = { Params = "", Return = "bool", Notes = "Returns true if the entity is crouched. False for entities that don't support crouching" }, - IsDestroyed = { Params = "", Return = "bool", Notes = "Returns true if the entity has been destroyed and is awaiting removal from the internal structures" }, - IsMinecart = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a minecart" }, - IsMob = { Params = "", Return = "bool", Notes = "Returns true if the entity represents any mob" }, + IsBoat = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cBoat|boat}}." }, + IsCrouched = { Params = "", Return = "bool", Notes = "Returns true if the entity is crouched. Always false for entities that don't support crouching." }, + IsDestroyed = { Params = "", Return = "bool", Notes = "Returns true if the entity has been destroyed and is awaiting removal from the internal structures." }, + IsMinecart = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cMinecart|minecart}}" }, + IsMob = { Params = "", Return = "bool", Notes = "Returns true if the entity represents any {{cMonster|mob}}." }, IsOnFire = { Params = "", Return = "bool", Notes = "Returns true if the entity is on fire" }, - IsPickup = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a pickup" }, - IsPlayer = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a player" }, - IsTNT = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a TNT entity" }, + IsPickup = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cPickup|pickup}}." }, + IsPlayer = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cPlayer|player}}" }, IsRclking = { Params = "", Return = "bool", Notes = "Currently unimplemented" }, - IsSprinting = { Params = "", Return = "bool", Notes = "Returns true if the entity is sprinting. ENtities that cannot sprint return always false" }, + IsRiding = { Params = "", Return = "bool", Notes = "Returns true if the entity is attached to (riding) another entity." }, + IsSprinting = { Params = "", Return = "bool", Notes = "Returns true if the entity is sprinting. Entities that cannot sprint return always false" }, + IsTNT = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cTNTEntity|TNT entity}}" }, + KilledBy = { Notes = "FIXME: Remove this from API" }, + SetGravity = { Params = "Gravity", Return = "", Notes = "Sets the number that is used as the gravity for physics simulation. 1G (9.78) by default." }, + SetHeadYaw = { Params = "HeadPitch", Return = "", Notes = "Sets the head pitch (FIXME: Rename to SetHeadPitch() )." }, + SetHealth = { Params = "Hitpoints", Return = "", Notes = "Sets the entity's health to the specified amount of hitpoints. Doesn't broadcast any hurt animation. Doesn't kill the entity if health drops below zero. Use the TakeDamage() function instead for taking damage." }, + SetHeight = { Params = "", Return = "", Notes = "FIXME: Remove this from API" }, + SetMass = { Params = "Mass", Return = "", Notes = "Sets the mass of the entity. Currently unused." }, + SetMaxHealth = { Params = "MaxHitpoints", Return = "", Notes = "Sets the maximum hitpoints of the entity. If current health is above MaxHitpoints, it is capped to MaxHitpoints." }, SetPitch = { Params = "number", Return = "", Notes = "Sets the pitch (nose-down rotation) of the entity" }, + SetPitchFromSpeed = { Params = "", Return = "", Notes = "Sets the entity pitch to match its speed (entity looking forwards as it moves)" }, + SetPosition = + { + { Params = "PosX, PosY, PosZ", Return = "", Notes = "Sets all three coords of the entity's pivot" }, + { Params = "{{Vector3d|Vector3d}}", Return = "", Notes = "Sets all three coords of the entity's pivot" }, + }, SetPosX = { Params = "number", Return = "", Notes = "Sets the X-coord of the entity's pivot" }, SetPosY = { Params = "number", Return = "", Notes = "Sets the Y-coord of the entity's pivot" }, SetPosZ = { Params = "number", Return = "", Notes = "Sets the Z-coord of the entity's pivot" }, - SetPosition = { Params = "X, Y, Z", Return = "", Notes = "Sets all three coords of the entity's pivot" }, - SetPosition = { Params = "{{Vector3d|Vector3d}}", Return = "", Notes = ":::" }, - SetRoll = { Params = "number", Return = "", Notes = "Sets the roll (sideways rotation) of the entity" }, - SetRot = { Params = "{{Vector3f|Vector3f}}", Return = "", Notes = "Sets the entire rotation vector (Rotation, Pitch, Roll)" }, - SetRotation = { Params = "number", Return = "", Notes = "Sets the rotation (direction) of the entity" }, + SetRoll = { Params = "number", Return = "", Notes = "Sets the roll (sideways rotation) of the entity. Currently unused." }, + SetRot = { Params = "{{Vector3f|Rotation}}", Return = "", Notes = "Sets the entire rotation vector (Yaw, Pitch, Roll)" }, + SetRotation = { Params = "number", Return = "", Notes = "Sets the yaw (direction) of the entity. FIXME: Rename to SetYaw()." }, + SetRotationFromSpeed = { Params = "", Return = "", Notes = "Sets the entity's yaw to match its current speed (entity looking forwards as it moves). (FIXME: Rename to SetYawFromSpeed)" }, + SetSpeed = + { + { Params = "SpeedX, SpeedY, SpeedZ", Return = "", Notes = "Sets the current speed of the entity" }, + { Params = "{{Vector3d|Speed}}", Return = "", Notes = "Sets the current speed of the entity" }, + }, + SetSpeedX = { Params = "SpeedX", Return = "", Notes = "Sets the X component of the entity speed" }, + SetSpeedY = { Params = "SpeedY", Return = "", Notes = "Sets the Y component of the entity speed" }, + SetSpeedZ = { Params = "SpeedZ", Return = "", Notes = "Sets the Z component of the entity speed" }, + SetWidth = { Params = "", Return = "", Notes = "FIXME: Remove this from API" }, + StartBurning = { Params = "NumTicks", Return = "", Notes = "Sets the entity on fire for the specified number of ticks. If entity is on fire already, makes it burn for either NumTicks or the number of ticks left from the previous fire, whichever is larger." }, + SteerVehicle = { Params = "ForwardAmount, SidewaysAmount", Return = "", Notes = "Applies the specified steering to the vehicle this entity is attached to. Ignored if not attached to any entity." }, + StopBurning = { Params = "", Return = "", Notes = "Extinguishes the entity fire, cancels all fire timers." }, + TakeDamage = + { + { Params = "AttackerEntity", Return = "", Notes = "Causes this entity to take damage that AttackerEntity would inflict. Includes their weapon and this entity's armor." }, + { Params = "DamageType, AttackerEntity, RawDamage, KnockbackAmount", Return = "", Notes = "Causes this entity to take damage of the specified type, from the specified attacker (may be nil). The final damage is calculated from RawDamage using the currently equipped armor." }, + { Params = "DamageType, ArrackerEntity, RawDamage, FinalDamage, KnockbackAmount", Return = "", Notes = "Causes this entity to take damage of the specified type, from the specified attacker (may be nil). The values are wrapped into a {{TakeDamageInfo}} structure and applied directly." }, + }, + TeleportToCoords = { Params = "PosX, PosY, PosZ", Return = "", Notes = "Teleports the entity to the specified coords." }, + TeleportToEntity = { Params = "DestEntity", Return = "", Notes = "Teleports this entity to the specified destination entity." }, }, Constants = { - etEntity = { Notes = "N" }, - etPlayer = { Notes = "{{cPlayer|cPlayer" }, - etPickup = { Notes = "{{cPickup|cPickup" }, - etMob = { Notes = "{{cMonster|cMonster}} and descendan" }, - etFallingBlock = { Notes = "{{cFallingBlock|cFallingBlock" }, - etMinecart = { Notes = "{{cMinecart|cMinecart" }, - etTNT = { Notes = "{{cTNTEntity|cTNTEntity" }, + etBoat = { Notes = "The entity is a {{cBoat}}" }, + etEntity = { Notes = "No further specialization available" }, + etFallingBlock = { Notes = "The entity is a {{cFallingBlock}}" }, + etMob = { Notes = "The entity is a {{cMonster}} descendant" }, + etMonster = { Notes = "The entity is a {{cMonster}} descendant" }, + etMinecart = { Notes = "The entity is a {{cMinecart}} descendant" }, + etPlayer = { Notes = "The entity is a {{cPlayer}}" }, + etPickup = { Notes = "The entity is a {{cPickup}}" }, + etProjectile = { Notes = "The entity is a {{cProjectile}} descendant" }, + etTNT = { Notes = "The entity is a {{cTNTEntity}}" }, }, }, -- cgit v1.2.3 From cc5c56d545c0735d28a99b89d4970bd507608f7f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 28 Sep 2013 20:36:01 +0100 Subject: Minor startup streamlining * LOGD'd unneeded debugging messages, streamlining startup + Added a basic timer for how long in seconds it took to start up + Added two checks for plural (plugin/s, second/s) --- source/CraftingRecipes.cpp | 4 +- source/FurnaceRecipe.cpp | 4 +- source/Generating/ComposableGenerator.cpp | 2 +- source/GroupManager.cpp | 8 ++-- source/PluginManager.cpp | 10 +++-- source/Root.cpp | 64 ++++++++++++++++++++----------- source/Server.cpp | 7 ++-- source/WebAdmin.cpp | 2 +- 8 files changed, 60 insertions(+), 41 deletions(-) diff --git a/source/CraftingRecipes.cpp b/source/CraftingRecipes.cpp index 13a8ac1e0..9dc471781 100644 --- a/source/CraftingRecipes.cpp +++ b/source/CraftingRecipes.cpp @@ -310,7 +310,7 @@ void cCraftingRecipes::GetRecipe(const cPlayer * a_Player, const cCraftingGrid & void cCraftingRecipes::LoadRecipes(void) { - LOG("-- Loading crafting recipes from crafting.txt --"); + LOGD("Loading crafting recipes from crafting.txt..."); ClearRecipes(); // Load the crafting.txt file: @@ -338,7 +338,7 @@ void cCraftingRecipes::LoadRecipes(void) } AddRecipeLine(LineNum, Recipe); } // for itr - Split[] - LOG("-- %d crafting recipes loaded from crafting.txt --", m_Recipes.size()); + LOG("Loaded %d crafting recipes", m_Recipes.size()); } diff --git a/source/FurnaceRecipe.cpp b/source/FurnaceRecipe.cpp index 8b1ee09a2..2e2276981 100644 --- a/source/FurnaceRecipe.cpp +++ b/source/FurnaceRecipe.cpp @@ -51,7 +51,7 @@ cFurnaceRecipe::~cFurnaceRecipe() void cFurnaceRecipe::ReloadRecipes(void) { ClearRecipes(); - LOG("-- Loading furnace recipes --"); + LOGD("Loading furnace recipes..."); std::ifstream f; char a_File[] = "furnace.txt"; @@ -175,7 +175,7 @@ void cFurnaceRecipe::ReloadRecipes(void) { LOGERROR("ERROR: FurnaceRecipe, syntax error" ); } - LOG("Got %u furnace recipes, and %u fuels.", m_pState->Recipes.size(), m_pState->Fuel.size()); + LOG("Loaded %u furnace recipes and %u fuels", m_pState->Recipes.size(), m_pState->Fuel.size()); } diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp index 0852f559e..e2a8df11b 100644 --- a/source/Generating/ComposableGenerator.cpp +++ b/source/Generating/ComposableGenerator.cpp @@ -294,7 +294,7 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) ); CacheSize = 4; } - LOGINFO("Using a cache for Heightgen of size %d.", CacheSize); + LOGD("Using a cache for Heightgen of size %d.", CacheSize); m_UnderlyingHeightGen = m_HeightGen; m_HeightGen = new cHeiGenCache(m_UnderlyingHeightGen, CacheSize); } diff --git a/source/GroupManager.cpp b/source/GroupManager.cpp index cef32dd58..b79fde9dc 100644 --- a/source/GroupManager.cpp +++ b/source/GroupManager.cpp @@ -43,7 +43,7 @@ cGroupManager::~cGroupManager() cGroupManager::cGroupManager() : m_pState( new sGroupManagerState ) { - LOG("-- Loading Groups --"); + LOGD("-- Loading Groups --"); cIniFile IniFile("groups.ini"); if (!IniFile.ReadFile()) { @@ -57,7 +57,7 @@ cGroupManager::cGroupManager() std::string KeyName = IniFile.GetKeyName( i ); cGroup* Group = GetGroup( KeyName.c_str() ); - LOG("Loading group: %s", KeyName.c_str() ); + LOGD("Loading group: %s", KeyName.c_str() ); Group->SetName( KeyName ); char Color = IniFile.GetValue( KeyName, "Color", "-" )[0]; @@ -73,7 +73,6 @@ cGroupManager::cGroupManager() for( unsigned int i = 0; i < Split.size(); i++) { Group->AddCommand( Split[i] ); - //LOG("%s", Split[i].c_str() ); } } @@ -84,7 +83,6 @@ cGroupManager::cGroupManager() for( unsigned int i = 0; i < Split.size(); i++) { Group->AddPermission( Split[i] ); - //LOGINFO("Permission: %s", Split[i].c_str() ); } } @@ -98,7 +96,7 @@ cGroupManager::cGroupManager() } } } - LOG("-- Groups Successfully Loaded --"); + LOGD("-- Groups Successfully Loaded --"); } diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp index 93ee71926..862c6d32b 100644 --- a/source/PluginManager.cpp +++ b/source/PluginManager.cpp @@ -95,7 +95,7 @@ void cPluginManager::FindPlugins(void) void cPluginManager::ReloadPluginsNow(void) { - LOG("Loading plugins"); + LOG("-- Loading Plugins --"); m_bReloadPlugins = false; UnloadPluginsNow(); @@ -135,11 +135,15 @@ void cPluginManager::ReloadPluginsNow(void) if (GetNumPlugins() == 0) { - LOG("No plugins loaded"); + LOG("-- No Plugins Loaded --"); + } + else if ((GetNumPlugins() > 1) || (GetNumPlugins() == 0)) + { + LOG("-- Loaded %i Plugins --", GetNumPlugins()); } else { - LOG("Loaded %i plugin(s)", GetNumPlugins()); + LOG("-- Loaded 1 Plugin --"); } } diff --git a/source/Root.cpp b/source/Root.cpp index 3933535f1..24ff77e42 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -21,6 +21,7 @@ #include "../iniFile/iniFile.h" #include +#include @@ -91,6 +92,17 @@ void cRoot::InputThread(void * a_Params) void cRoot::Start(void) { + time_t timer; + struct tm y2k; + double seconds; + double finishseconds; + + y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0; + y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1; + + time(&timer); + seconds = difftime(timer,mktime(&y2k)); + cDeadlockDetect dd; delete m_Log; m_Log = new cMCLogger(); @@ -125,7 +137,7 @@ void cRoot::Start(void) LOG("Starting server..."); if (!m_Server->InitServer(IniFile)) { - LOGERROR("Failed to start server, shutting down."); + LOGERROR("Failure starting server, aborting..."); return; } IniFile.WriteFile(); @@ -138,45 +150,51 @@ void cRoot::Start(void) if (WebIniFile.GetValueB("WebAdmin", "Enabled", false)) { - LOG("Creating WebAdmin..."); + LOGD("Creating WebAdmin..."); m_WebAdmin = new cWebAdmin(8080); } - LOG("Loading settings..."); + LOGD("Loading settings..."); m_GroupManager = new cGroupManager(); m_CraftingRecipes = new cCraftingRecipes; m_FurnaceRecipe = new cFurnaceRecipe(); - LOG("Loading worlds..."); + LOGD("Loading worlds..."); LoadWorlds(); - LOG("Loading plugin manager..."); + LOGD("Loading plugin manager..."); m_PluginManager = new cPluginManager(); m_PluginManager->ReloadPluginsNow(); - LOG("Loading MonsterConfig..."); + LOGD("Loading MonsterConfig..."); m_MonsterConfig = new cMonsterConfig; // This sets stuff in motion - LOG("Starting Authenticator..."); + LOGD("Starting Authenticator..."); m_Authenticator.Start(); - LOG("Starting worlds..."); + LOGD("Starting worlds..."); StartWorlds(); - LOG("Starting deadlock detector..."); + LOGD("Starting deadlock detector..."); dd.Start(); - LOG("Starting server..."); + LOGD("Finalising startup..."); m_Server->Start(); #if !defined(ANDROID_NDK) - LOG("Starting InputThread..."); + LOGD("Starting InputThread..."); m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" ); m_InputThread->Start( false ); // We should NOT wait? Otherwise we canīt stop the server from other threads than the input thread #endif - LOG("Initialization done, server running now."); + time(&timer); + finishseconds = difftime(timer,mktime(&y2k)); + finishseconds -= seconds; + + if ((finishseconds > 1) || (finishseconds == 0)) { LOG("Startup complete, took %.f seconds!", finishseconds); } + else { LOG("Startup complete, took 1 second!"); } + while (!m_bStop && !m_bRestart) // These are modified by external threads { cSleep::MilliSleep(1000); @@ -190,37 +208,37 @@ void cRoot::Start(void) LOG("Shutting down server..."); m_Server->Shutdown(); - LOG("Shutting down deadlock detector..."); + LOGD("Shutting down deadlock detector..."); dd.Stop(); - LOG("Stopping world threads..."); + LOGD("Stopping world threads..."); StopWorlds(); - LOG("Stopping authenticator..."); + LOGD("Stopping authenticator..."); m_Authenticator.Stop(); - LOG("Freeing MonsterConfig..."); + LOGD("Freeing MonsterConfig..."); delete m_MonsterConfig; m_MonsterConfig = NULL; - LOG("Stopping WebAdmin..."); + LOGD("Stopping WebAdmin..."); delete m_WebAdmin; m_WebAdmin = NULL; - LOG("Unloading recipes..."); + LOGD("Unloading recipes..."); delete m_FurnaceRecipe; m_FurnaceRecipe = NULL; delete m_CraftingRecipes; m_CraftingRecipes = NULL; - LOG("Forgetting groups..."); + LOGD("Forgetting groups..."); delete m_GroupManager; m_GroupManager = 0; - LOG("Unloading worlds..."); + LOGD("Unloading worlds..."); UnloadWorlds(); - LOG("Stopping plugin manager..."); + LOGD("Stopping plugin manager..."); delete m_PluginManager; m_PluginManager = NULL; cItemHandler::Deinit(); cBlockHandler::Deinit(); - LOG("Destroying server..."); + LOG("Cleaning up..."); //delete HeartBeat; HeartBeat = 0; delete m_Server; m_Server = 0; - LOG("Shutdown done."); + LOG("Shutdown successful!"); } delete m_Log; m_Log = 0; diff --git a/source/Server.cpp b/source/Server.cpp index dd18f8d3d..4283dbfae 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -206,9 +206,8 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) return false; } - LOG("Starting up server."); - LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS); - LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); + LOGD("Compatible clients: %s", MCS_CLIENT_VERSIONS); + LOGD("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever { @@ -292,7 +291,7 @@ void cServer::PrepareKeys(void) // TODO: Save and load key for persistence across sessions // But generating the key takes only a moment, do we even need that? - LOG("Generating protocol encryption keypair..."); + LOGD("Generating protocol encryption keypair..."); time_t CurTime = time(NULL); CryptoPP::RandomPool rng; diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp index 77a5865d3..4f10d80a7 100644 --- a/source/WebAdmin.cpp +++ b/source/WebAdmin.cpp @@ -286,7 +286,7 @@ bool cWebAdmin::Init(int a_Port) } - LOG("Starting WebAdmin on port %i", m_Port); + LOGD("Starting WebAdmin on port %i", m_Port); #ifdef _WIN32 HANDLE hThread = CreateThread( -- cgit v1.2.3 From ebae946f1c42bb3a1af4c33ad8fe00c28f3c8132 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 28 Sep 2013 20:41:26 +0100 Subject: Updated README See for yourself :) --- MCServer/README.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/MCServer/README.txt b/MCServer/README.txt index cd0467ae1..f2611fd04 100644 --- a/MCServer/README.txt +++ b/MCServer/README.txt @@ -1,18 +1,20 @@ /============================\ | Custom Minecraft Server | -| Created by Kevin Bansberg | +| (MCServer) | +| | +| Founder: Kevin Bansberg | | A.K.A. FakeTruth | +| Lead dev: Mattes D | +| A.K.A. _Xoft(o) | +| A.K.A. xoft | | Monsters by Alex Sonek | | A.K.A. Duralex | -| Stuff by Mattes D | -| A.K.A. _Xoft(o) | |============================| -| Info: WWW.MC-SERVER.ORG | -| WWW.AE-C.NET\n") | -| WWW.RBTHINKTANK.COM | +| Info: www.mc-server.org | +| www.ae-c.net | +| www.rbthinktank.com | | Mail: faketruth@gmail.com | \============================/ - -Compatible clients: 1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2 -Compatible protocol versions: 29, 39, 47, 49, 51, 60, 61, 73, 74 +Compatible clients: 1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2, 1.6.3, 1.6.4 +Compatible protocol versions: 29, 39, 47, 49, 51, 60, 61, 73, 74, 77, 78 -- cgit v1.2.3 From 1f9397302c6e4381b86a15c3d28e41c9b199473e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 29 Sep 2013 00:10:42 +0200 Subject: APIDump: Added the possibility to ignore classes. Ignoring Lua builtins. --- MCServer/Plugins/APIDump/APIDesc.lua | 14 +++++++++++++- MCServer/Plugins/APIDump/main.lua | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 0318c69ea..f260731f5 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -710,7 +710,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), despawn / remove that entity in between the calls. If you need to refer to an entity later, use its UniqueID and {{cWorld|cWorld}}'s entity manipulation functions DoWithEntityByID(), ForEachEntity() or ForEachEntityInChunk() to access the entity again.

-]], + ]], Functions = { AddPosition = @@ -1906,6 +1906,18 @@ World:ForEachEntity( }, }, + + IgnoreClasses = + { + "coroutine", + "debug", + "io", + "math", + "package", + "os", + "string", + "table", + }, IgnoreFunctions = { diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 7c200712d..a7b4f7511 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -291,6 +291,19 @@ end function ReadDescriptions(a_API) + -- Returns true if the class of the specified name is to be ignored + local function IsClassIgnored(a_ClsName) + if (g_APIDesc.IgnoreClasses == nil) then + return false; + end + for i, name in ipairs(g_APIDesc.IgnoreClasses) do + if (a_ClsName:match(name)) then + return true; + end + end + return false; + end + -- Returns true if the function (specified by its fully qualified name) is to be ignored local function IsFunctionIgnored(a_FnName) if (g_APIDesc.IgnoreFunctions == nil) then @@ -317,6 +330,20 @@ function ReadDescriptions(a_API) return false; end + -- Remove ignored classes from a_API: + local APICopy = {}; + for i, cls in ipairs(a_API) do + if not(IsClassIgnored(cls.Name)) then + table.insert(APICopy, cls); + else + LOG("Ignoring class " .. cls.Name); + end + end + for i = 1, #a_API do + a_API[i] = APICopy[i]; + end; + + -- Process the documentation for each class: for i, cls in ipairs(a_API) do -- Rename special functions: for j, fn in ipairs(cls.Functions) do -- cgit v1.2.3 From 6fa0361a64ed150ee148f18e10c08635ea16059a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 29 Sep 2013 08:55:31 +0200 Subject: APIDump: Linkified cDropSpenser constants. --- MCServer/Plugins/APIDump/APIDesc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index f260731f5..e026e49d0 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -659,8 +659,8 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), }, Constants = { - ContentsWidth = { Notes = "Width (X) 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" }, + ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid}} representing the contents" }, }, Inherits = "cBlockEntity"; -- cgit v1.2.3 From 425073c4aa111a46ceb9ee2101f98b649c5ca8e8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 29 Sep 2013 08:59:46 +0200 Subject: APIDump: Added more inheritance and linkification. --- MCServer/Plugins/APIDump/APIDesc.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e026e49d0..65d551d7e 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -879,6 +879,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Desc = "", Functions = {}, Constants = {}, + Inherits = "cProjectileEntity", } , cGroup = @@ -1063,10 +1064,10 @@ These ItemGrids are available in the API and can be manipulated by the plugins, Desc = [[This class represents a 2D array of items. It is used as the underlying storage and API for all cases that use a grid of items:
  • Chest contents
  • (TODO) Chest minecart contents
  • -
  • Dispenser contents
  • -
  • Dropper contents
  • -
  • (TODO) Furnace contents (?)
  • -
  • (TODO) Hopper contents
  • +
  • {{cDispenserEntity|Dispenser|| contents
  • +
  • {{cDropperEntity|Dropper}} contents
  • +
  • {{cFurnaceEntity|Furnace}} contents (?)
  • +
  • {{cHopperEntity|Hopper}} contents
  • (TODO) Hopper minecart contents
  • Player Inventory areas
  • (TODO) Trapped chest contents
  • @@ -1225,6 +1226,7 @@ a_Player:OpenWindow(Window); ]], }, }, -- AdditionalInfo + Inherits = "cWindow", }, -- cLuaWindow cMonster = -- cgit v1.2.3 From 9e19d598d0d8767c8de83699ba47dea42237ccd2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 29 Sep 2013 09:09:13 +0200 Subject: APIDump: Fixed overloaded functions' docs. --- MCServer/Plugins/APIDump/APIDesc.lua | 63 +++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 65d551d7e..187fdeb9b 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1078,33 +1078,54 @@ These ItemGrids are available in the API and can be manipulated by the plugins, { AddItem = { Params = "{{cItem|cItem}}, [AllowNewStacks]", Return = "number", Notes = "Adds an item to the storage; if AllowNewStacks is true (default), will also create new stacks in empty slots. Returns the number of items added" }, AddItems = { Params = "{{cItems|cItems}}, [AllowNewStacks]", Return = "number", Notes = "Same as AddItem, but for several items at once" }, - ChangeSlotCount = { Params = "SlotNum, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid SlotNum" }, - ChangeSlotCount = { Params = "X, Y, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid slot coords" }, + ChangeSlotCount = + { + { Params = "SlotNum, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid SlotNum" }, + { Params = "X, Y, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid slot coords" }, + }, Clear = { Params = "", Return = "", Notes = "Empties all slots" }, CopyToItems = { Params = "{{cItems|cItems}}", Return = "", Notes = "Copies all non-empty slots into the cItems object provided; original cItems contents are preserved" }, - DamageItem = { Params = "SlotNum, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" }, - DamageItem = { Params = "X, Y, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" }, - EmptySlot = { Params = "SlotNum", Return = "", Notes = "Destroys the item in the specified slot" }, - EmptySlot = { Params = "X, Y", Return = "", Notes = "Destroys the item in the specified slot" }, + DamageItem = + { + { Params = "SlotNum, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" }, + { Params = "X, Y, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" }, + }, + EmptySlot = + { + { Params = "SlotNum", Return = "", Notes = "Destroys the item in the specified slot" }, + { Params = "X, Y", Return = "", Notes = "Destroys the item in the specified slot" }, + }, GetFirstEmptySlot = { Params = "", Return = "number", Notes = "Returns the SlotNumber of the first empty slot, -1 if all slots are full" }, GetHeight = { Params = "", Return = "number", Notes = "Returns the Y dimension of the grid" }, GetLastEmptySlot = { Params = "", Return = "number", Notes = "Returns the SlotNumber of the last empty slot, -1 if all slots are full" }, GetNextEmptySlot = { Params = "StartFrom", Return = "number", Notes = "Returns the SlotNumber of the first empty slot following StartFrom, -1 if all the following slots are full" }, GetNumSlots = { Params = "", Return = "number", Notes = "Returns the total number of slots in the grid (Width * Height)" }, - GetSlot = { Params = "SlotNumber", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, - GetSlot = { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, + GetSlot = + { + { Params = "SlotNumber", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, + { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" }, + }, GetSlotCoords = { Params = "SlotNum", Return = "number, number", Notes = "Returns the X and Y coords for the specified SlotNumber. Returns \"-1, -1\" on invalid SlotNumber" }, GetSlotNum = { Params = "X, Y", Return = "number", Notes = "Returns the SlotNumber for the specified slot coords. Returns -1 on invalid coords" }, GetWidth = { Params = "", Return = "number", Notes = "Returns the X dimension of the grid" }, HasItems = { Params = "{{cItem|cItem}}", Return = "bool", Notes = "Returns true if there are at least as many items of the specified type as in the parameter" }, HowManyCanFit = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that can fit in the storage, including empty slots" }, HowManyItems = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that are currently stored" }, - IsSlotEmpty = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" }, - IsSlotEmpty = { Params = "X, Y", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" }, - RemoveOneItem = { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, - RemoveOneItem = { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, - SetSlot = { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, - SetSlot = { Params = "X, Y, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, + IsSlotEmpty = + { + { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" }, + { Params = "X, Y", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" }, + }, + RemoveOneItem = + { + { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, + { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" }, + }, + SetSlot = + { + { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, + { Params = "X, Y, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" }, + }, }, Constants = { @@ -1121,13 +1142,19 @@ These ItemGrids are available in the API and can be manipulated by the plugins, Functions = { constructor = { Params = "", Return = "cItems", Notes = "Creates a new cItems object" }, - Add = { Params = "Index, {{cItem|cItem}}", Return = "", Notes = "Adds a new item to the end of the collection" }, - Add = { Params = "Index, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Adds a new item to the end of the collection" }, + Add = + { + { Params = "{{cItem|cItem}}", Return = "", Notes = "Adds a new item to the end of the collection" }, + { Params = "ItemType, ItemCount, ItemDamage", Return = "", Notes = "Adds a new item to the end of the collection" }, + }, Clear = { Params = "", Return = "", Notes = "Removes all items from the collection" }, Delete = { Params = "Index", Return = "", Notes = "Deletes item at the specified index" }, Get = { Params = "Index", Return = "{{cItem|cItem}}", Notes = "Returns the item at the specified index" }, - Set = { Params = "Index, {{cItem|cItem}}", Return = "", Notes = "Sets the item at the specified index to the specified item" }, - Set = { Params = "Index, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the item at the specified index to the specified item" }, + Set = + { + { Params = "Index, {{cItem|cItem}}", Return = "", Notes = "Sets the item at the specified index to the specified item" }, + { Params = "Index, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the item at the specified index to the specified item" }, + }, Size = { Params = "", Return = "number", Notes = "Returns the number of items in the collection" }, }, Constants = -- cgit v1.2.3 From 9c7cfd29ad435d98ab70ad32282b9ec4dac666cd Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 29 Sep 2013 21:37:50 +0100 Subject: Improvements to startup timer As suggested by xoft. Also reverted changes of displayed protocol version. --- source/Root.cpp | 22 +++++++--------------- source/Server.cpp | 4 ++-- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/source/Root.cpp b/source/Root.cpp index 24ff77e42..c33af52ad 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -17,11 +17,11 @@ #include "Protocol/ProtocolRecognizer.h" // for protocol version constants #include "CommandOutput.h" #include "DeadlockDetect.h" +#include "OSSupport/Timer.h" #include "../iniFile/iniFile.h" #include -#include @@ -92,16 +92,9 @@ void cRoot::InputThread(void * a_Params) void cRoot::Start(void) { - time_t timer; - struct tm y2k; - double seconds; - double finishseconds; + cTimer Time; - y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0; - y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1; - - time(&timer); - seconds = difftime(timer,mktime(&y2k)); + long long mseconds = Time.GetNowTime(); cDeadlockDetect dd; delete m_Log; @@ -188,12 +181,11 @@ void cRoot::Start(void) m_InputThread->Start( false ); // We should NOT wait? Otherwise we canīt stop the server from other threads than the input thread #endif - time(&timer); - finishseconds = difftime(timer,mktime(&y2k)); - finishseconds -= seconds; + long long finishmseconds = Time.GetNowTime(); + finishmseconds -= mseconds; - if ((finishseconds > 1) || (finishseconds == 0)) { LOG("Startup complete, took %.f seconds!", finishseconds); } - else { LOG("Startup complete, took 1 second!"); } + if ((finishmseconds > 1) || (finishmseconds == 0)) { LOG("Startup complete, took %i miliseconds!", finishmseconds); } // Milisecs, why not :P + else { LOG("Startup complete, took 1 milisecond!"); } while (!m_bStop && !m_bRestart) // These are modified by external threads { diff --git a/source/Server.cpp b/source/Server.cpp index 4283dbfae..fec8fcd36 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -206,8 +206,8 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) return false; } - LOGD("Compatible clients: %s", MCS_CLIENT_VERSIONS); - LOGD("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); + LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS); + LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever { -- cgit v1.2.3 From ab34da78e7ef249acb01924cf184b7c1fba2ab3a Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 29 Sep 2013 23:39:58 +0100 Subject: Fixed a fire simulator bug Fire now doesn't stay when it isn't on a flammable block. Fixes the "fire creates chandeliers" bug in report #131 --- source/Simulator/FireSimulator.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/source/Simulator/FireSimulator.cpp b/source/Simulator/FireSimulator.cpp index 587f45306..e0b4f1f02 100644 --- a/source/Simulator/FireSimulator.cpp +++ b/source/Simulator/FireSimulator.cpp @@ -221,7 +221,7 @@ void cFireSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) { - if (a_RelY > 0) + if ((a_RelY > 0) && (a_RelY < cChunkDef::Height - 1)) { BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ); if (IsForever(BlockBelow)) @@ -234,10 +234,6 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in return m_BurnStepTimeFuel; } } - if ((a_RelY < cChunkDef::Height - 1) && IsFuel(a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ))) - { - return m_BurnStepTimeFuel; - } for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++) { @@ -251,7 +247,23 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in } } } // for i - gCrossCoords[] - return m_BurnStepTimeNonfuel; + + if ((a_RelY > 0) && (a_RelY < cChunkDef::Height - 1)) + { + // Checked through everything, nothing was flammable + // If block below isn't solid, we can't have fire, otherwise, we have non-fueled fire + BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ); + if (g_BlockIsSolid[BlockBelow]) + { + return m_BurnStepTimeNonfuel; + } + else + { + // SetBlock just to make sure fire doesn't spawn + a_Chunk->UnboundedRelSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); + return 0; + } + } } -- cgit v1.2.3 From 4cbe24d2e89e5f75737be4cd9def525e6a20fb4b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 30 Sep 2013 20:45:13 +0200 Subject: APIDump: Added equality operator renaming. --- MCServer/Plugins/APIDump/main.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index a7b4f7511..300a4d9ce 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -362,6 +362,9 @@ function ReadDescriptions(a_API) elseif (fn.Name == ".sub") then fn.DocID = "operator_sub"; fn.Name = "operator -"; + elseif (fn.Name == ".eq") then + fn.DocID = "operator_sub"; + fn.Name = "operator =="; end end -- cgit v1.2.3 From c4750ef003363a79ac4930f985c4f78002c63642 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 30 Sep 2013 21:15:48 +0100 Subject: Fixed issues --- source/Simulator/FireSimulator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Simulator/FireSimulator.cpp b/source/Simulator/FireSimulator.cpp index e0b4f1f02..da1dc8d15 100644 --- a/source/Simulator/FireSimulator.cpp +++ b/source/Simulator/FireSimulator.cpp @@ -221,7 +221,7 @@ void cFireSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) { - if ((a_RelY > 0) && (a_RelY < cChunkDef::Height - 1)) + if (a_RelY > 0) { BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ); if (IsForever(BlockBelow)) @@ -260,7 +260,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in else { // SetBlock just to make sure fire doesn't spawn - a_Chunk->UnboundedRelSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); + a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); return 0; } } -- cgit v1.2.3 From 20902e125c9b042ff77ddf4419e3eb9474de674e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 30 Sep 2013 21:17:52 +0100 Subject: Removed unneeded statement Also LOGINFO'd "Starting WebAdmin" --- source/Root.cpp | 3 +-- source/WebAdmin.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/Root.cpp b/source/Root.cpp index c33af52ad..abe153b30 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -184,8 +184,7 @@ void cRoot::Start(void) long long finishmseconds = Time.GetNowTime(); finishmseconds -= mseconds; - if ((finishmseconds > 1) || (finishmseconds == 0)) { LOG("Startup complete, took %i miliseconds!", finishmseconds); } // Milisecs, why not :P - else { LOG("Startup complete, took 1 milisecond!"); } + LOG("Startup complete, took %i ms!", finishmseconds); while (!m_bStop && !m_bRestart) // These are modified by external threads { diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp index 4f10d80a7..9d68931af 100644 --- a/source/WebAdmin.cpp +++ b/source/WebAdmin.cpp @@ -286,7 +286,7 @@ bool cWebAdmin::Init(int a_Port) } - LOGD("Starting WebAdmin on port %i", m_Port); + LOGINFO("Starting WebAdmin on port %i", m_Port); #ifdef _WIN32 HANDLE hThread = CreateThread( -- cgit v1.2.3 From 2855a330d4979f7df00ab23bf16ab401c2d0f228 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Tue, 1 Oct 2013 11:48:07 -0600 Subject: Added glass pane as transparent. Removed excess g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE]. --- source/BlockID.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/BlockID.cpp b/source/BlockID.cpp index ecdbc0c34..d91524de5 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -603,6 +603,7 @@ public: g_BlockTransparent[E_BLOCK_FIRE] = true; g_BlockTransparent[E_BLOCK_FLOWER_POT] = true; g_BlockTransparent[E_BLOCK_GLASS] = true; + g_BlockTransparent[E_BLOCK_GLASS_PANE] = true; g_BlockTransparent[E_BLOCK_ICE] = true; g_BlockTransparent[E_BLOCK_IRON_DOOR] = true; g_BlockTransparent[E_BLOCK_LEAVES] = true; @@ -646,7 +647,6 @@ public: g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_OFF] = true; g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_ON] = true; g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true; - g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true; g_BlockOneHitDig[E_BLOCK_RED_MUSHROOM] = true; g_BlockOneHitDig[E_BLOCK_RED_ROSE] = true; g_BlockOneHitDig[E_BLOCK_REEDS] = true; -- cgit v1.2.3 From 02c41b6f1dd8b0a197997c0e73f81d00493ac863 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 2 Oct 2013 08:49:15 +0200 Subject: APIDump: Fixed operator == rename having bad DocID. --- MCServer/Plugins/APIDump/APIDesc.lua | 8 ++++++-- MCServer/Plugins/APIDump/main.lua | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 187fdeb9b..643214de3 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -674,8 +674,12 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ]], Functions = { - constructor = { Params = "", Return = "cEnchantments", Notes = "Creates a new empty cEnchantments object" }, - constructor = { Params = "StringSpec", Return = "cEnchantments", Notes = "Creates a new cEnchantments object filled with enchantments based on the string description" }, + constructor = + { + { Params = "", Return = "cEnchantments", Notes = "Creates a new empty cEnchantments object" }, + { Params = "StringSpec", Return = "cEnchantments", Notes = "Creates a new cEnchantments object filled with enchantments based on the string description" }, + }, + operator_eq = { Params = "OtherEnchantments", Return = "bool", Notes = "Returns true if this enchantments object has the same enchantments as OtherEnchantments." }, AddFromString = { Params = "StringSpec", Return = "", Notes = "Adds the enchantments in the string description into the object. If a specified enchantment already existed, it is overwritten." }, Clear = { Params = "", Return = "", Notes = "Removes all enchantments" }, GetLevel = { Params = "EnchantmentNumID", Return = "number", Notes = "Returns the level of the specified enchantment stored in this object; 0 if not stored" }, diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 300a4d9ce..6dc2f8a3e 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -363,7 +363,7 @@ function ReadDescriptions(a_API) fn.DocID = "operator_sub"; fn.Name = "operator -"; elseif (fn.Name == ".eq") then - fn.DocID = "operator_sub"; + fn.DocID = "operator_eq"; fn.Name = "operator =="; end end -- cgit v1.2.3 From 5ab6003e0fe0f3d9f781dfd7b1e79de7eb407d11 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 2 Oct 2013 08:50:43 +0200 Subject: APIDump: Removed ignored classes logging. --- MCServer/Plugins/APIDump/main.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 6dc2f8a3e..aaeebecbb 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -335,8 +335,6 @@ function ReadDescriptions(a_API) for i, cls in ipairs(a_API) do if not(IsClassIgnored(cls.Name)) then table.insert(APICopy, cls); - else - LOG("Ignoring class " .. cls.Name); end end for i = 1, #a_API do -- cgit v1.2.3 From 0e1e76fa7717a73268cec2534a6dc5c5ff24dc11 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 3 Oct 2013 21:35:17 -0600 Subject: Rain now waters farmland. --- source/Blocks/BlockFarmland.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/Blocks/BlockFarmland.h b/source/Blocks/BlockFarmland.h index 6cab1fa38..16d94d435 100644 --- a/source/Blocks/BlockFarmland.h +++ b/source/Blocks/BlockFarmland.h @@ -42,6 +42,9 @@ public: return; } bool Found = false; + + if (a_World->GetWeather() != eWeather_Rain || a_World->GetBiomeAt(a_BlockX, a_BlockZ) == 1) + { int NumBlocks = Area.GetBlockCount(); BLOCKTYPE * BlockTypes = Area.GetBlockTypes(); for (int i = 0; i < NumBlocks; i++) @@ -55,6 +58,11 @@ public: break; } } + } + else + { + Found = true; + } NIBBLETYPE BlockMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); -- cgit v1.2.3 From d1448d12a052b1ab9edf22447cff621c7e171593 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 3 Oct 2013 21:39:07 -0600 Subject: Added comparison for desert biomes. --- source/Blocks/BlockFarmland.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Blocks/BlockFarmland.h b/source/Blocks/BlockFarmland.h index 16d94d435..5aef10556 100644 --- a/source/Blocks/BlockFarmland.h +++ b/source/Blocks/BlockFarmland.h @@ -43,7 +43,8 @@ public: } bool Found = false; - if (a_World->GetWeather() != eWeather_Rain || a_World->GetBiomeAt(a_BlockX, a_BlockZ) == 1) + int Biome = a_World->GetBiomeAt(a_BlockX, a_BlockZ); + if (a_World->GetWeather() != eWeather_Rain || Biome == biDesert || Biome == biDesertHills) { int NumBlocks = Area.GetBlockCount(); BLOCKTYPE * BlockTypes = Area.GetBlockTypes(); -- cgit v1.2.3 From dcea29ec306b9684604946ee348b59d20af7acb2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 4 Oct 2013 08:38:38 +0200 Subject: Added cWorld::IsWeatherXXX() functions --- source/Bindings.cpp | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++- source/Bindings.h | 2 +- source/World.h | 10 +++- 3 files changed, 143 insertions(+), 3 deletions(-) diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 70a1f5a40..d4a8da840 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 09/25/13 09:02:22. +** Generated automatically by tolua++-1.0.92 on 10/04/13 08:36:37. */ #ifndef __cplusplus @@ -13314,6 +13314,134 @@ static int tolua_AllToLua_cWorld_GetWeather00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: IsWeatherSunny of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherSunny00 +static int tolua_AllToLua_cWorld_IsWeatherSunny00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherSunny'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherSunny(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherSunny'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherRain of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherRain00 +static int tolua_AllToLua_cWorld_IsWeatherRain00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherRain'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherRain(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherRain'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherStorm of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherStorm00 +static int tolua_AllToLua_cWorld_IsWeatherStorm00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherStorm'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherStorm(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherStorm'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherWet of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherWet00 +static int tolua_AllToLua_cWorld_IsWeatherWet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherWet'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherWet(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherWet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: SetNextBlockTick of class cWorld */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetNextBlockTick00 static int tolua_AllToLua_cWorld_SetNextBlockTick00(lua_State* tolua_S) @@ -29902,6 +30030,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"SetWeather",tolua_AllToLua_cWorld_SetWeather00); tolua_function(tolua_S,"ChangeWeather",tolua_AllToLua_cWorld_ChangeWeather00); tolua_function(tolua_S,"GetWeather",tolua_AllToLua_cWorld_GetWeather00); + tolua_function(tolua_S,"IsWeatherSunny",tolua_AllToLua_cWorld_IsWeatherSunny00); + tolua_function(tolua_S,"IsWeatherRain",tolua_AllToLua_cWorld_IsWeatherRain00); + tolua_function(tolua_S,"IsWeatherStorm",tolua_AllToLua_cWorld_IsWeatherStorm00); + tolua_function(tolua_S,"IsWeatherWet",tolua_AllToLua_cWorld_IsWeatherWet00); tolua_function(tolua_S,"SetNextBlockTick",tolua_AllToLua_cWorld_SetNextBlockTick00); tolua_function(tolua_S,"GetMaxSugarcaneHeight",tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00); tolua_function(tolua_S,"GetMaxCactusHeight",tolua_AllToLua_cWorld_GetMaxCactusHeight00); diff --git a/source/Bindings.h b/source/Bindings.h index 32a8797e8..359f5c879 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 09/25/13 09:02:23. +** Generated automatically by tolua++-1.0.92 on 10/04/13 08:36:38. */ /* Exported function */ diff --git a/source/World.h b/source/World.h index dd856fc72..dcb197bd0 100644 --- a/source/World.h +++ b/source/World.h @@ -554,8 +554,16 @@ public: /// Forces a weather change in the next game tick void ChangeWeather (void); - /// Returns the current weather + /// Returns the current weather. Instead of comparing values directly to the weather constants, use IsWeatherXXX() functions, if possible eWeather GetWeather (void) const { return m_Weather; }; + + bool IsWeatherSunny(void) const { return (m_Weather == wSunny); } + bool IsWeatherRain (void) const { return (m_Weather == wRain); } + bool IsWeatherStorm(void) const { return (m_Weather == wStorm); } + + /// Returns true if the current weather has any precipitation - rain or storm + bool IsWeatherWet (void) const { return (m_Weather != wSunny); } + // tolua_end cChunkGenerator & GetGenerator(void) { return m_Generator; } -- cgit v1.2.3 From 8fb80b636984d20327e0bf043e451f4ecbb3e582 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 4 Oct 2013 08:39:59 +0200 Subject: Optimized cBlockFarmlandHandler in wet weather. The area isn't read at all when the weather is wet, since it isn't needed. --- source/Blocks/BlockFarmland.h | 53 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/source/Blocks/BlockFarmland.h b/source/Blocks/BlockFarmland.h index 5aef10556..7bc71f7f3 100644 --- a/source/Blocks/BlockFarmland.h +++ b/source/Blocks/BlockFarmland.h @@ -30,39 +30,38 @@ public: virtual void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override { - // TODO: Rain hydrates farmland, too. Check world weather, don't search for water if raining. - // NOTE: The desert biomes do not get precipitation, so another check needs to be made. - - // Search for water in a close proximity: - // Ref.: http://www.minecraftwiki.net/wiki/Farmland#Hydrated_Farmland_Tiles - cBlockArea Area; - if (!Area.Read(a_World, a_BlockX - 4, a_BlockX + 4, a_BlockY, a_BlockY + 1, a_BlockZ - 4, a_BlockZ + 4)) - { - // Too close to the world edge, cannot check surroudnings; don't tick at all - return; - } bool Found = false; - + int Biome = a_World->GetBiomeAt(a_BlockX, a_BlockZ); - if (a_World->GetWeather() != eWeather_Rain || Biome == biDesert || Biome == biDesertHills) - { - int NumBlocks = Area.GetBlockCount(); - BLOCKTYPE * BlockTypes = Area.GetBlockTypes(); - for (int i = 0; i < NumBlocks; i++) + if (a_World->IsWeatherWet() && (Biome != biDesert) && (Biome != biDesertHills)) { - if ( - (BlockTypes[i] == E_BLOCK_WATER) || - (BlockTypes[i] == E_BLOCK_STATIONARY_WATER) - ) - { - Found = true; - break; - } - } + // Rain hydrates farmland, too, except in Desert biomes. + Found = true; } else { - Found = true; + // Search for water in a close proximity: + // Ref.: http://www.minecraftwiki.net/wiki/Farmland#Hydrated_Farmland_Tiles + cBlockArea Area; + if (!Area.Read(a_World, a_BlockX - 4, a_BlockX + 4, a_BlockY, a_BlockY + 1, a_BlockZ - 4, a_BlockZ + 4)) + { + // Too close to the world edge, cannot check surroudnings; don't tick at all + return; + } + + int NumBlocks = Area.GetBlockCount(); + BLOCKTYPE * BlockTypes = Area.GetBlockTypes(); + for (int i = 0; i < NumBlocks; i++) + { + if ( + (BlockTypes[i] == E_BLOCK_WATER) || + (BlockTypes[i] == E_BLOCK_STATIONARY_WATER) + ) + { + Found = true; + break; + } + } // for i - BlockTypes[] } NIBBLETYPE BlockMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); -- cgit v1.2.3 From a1898521b0debe2c33ea63494208d84317a3cf0c Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 4 Oct 2013 08:49:55 +0200 Subject: APIDump: Added the cWorld:IsWeatherXXX() functions. --- MCServer/Plugins/APIDump/APIDesc.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 643214de3..6d0b72c14 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1741,7 +1741,7 @@ Sign entities are saved and loaded from disk when the chunk they reside in is sa GetStorageSaveQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks queued up for saving" }, GetTicksUntilWeatherChange = { Params = "", Return = "number", Notes = "Returns the number of ticks that will pass before the weather is changed" }, GetTimeOfDay = { Params = "", Return = "number", Notes = "Returns the number of ticks that have passed from the sunrise, 0 .. 24000." }, - GetWeather = { Params = "", Return = "eWeather", Notes = "Returns the current weather in the world (wSunny, wRain, wStorm)." }, + GetWeather = { Params = "", Return = "eWeather", Notes = "Returns the current weather in the world (wSunny, wRain, wStorm). To check for weather, use IsWeatherXXX() functions instead." }, GetWorldAge = { Params = "", Return = "number", Notes = "Returns the total age of the world, in ticks. The age always grows, cannot be set by plugins and is unrelated to TimeOfDay." }, GrowCactus = { Params = "BlockX, BlockY, BlockZ, NumBlocksToGrow", Return = "", Notes = "Grows a cactus block at the specified coords, by up to the specified number of blocks. Adheres to the world's maximum cactus growth (GetMaxCactusHeight())." }, GrowMelonPumpkin = { Params = "BlockX, BlockY, BlockZ, StemType", Return = "", Notes = "Grows a melon or pumpkin, based on the stem type specified (assumed to be in the coords provided). Checks for normal melon / pumpkin growth conditions - stem not having another produce next to it and suitable ground below." }, @@ -1756,6 +1756,10 @@ Sign entities are saved and loaded from disk when the chunk they reside in is sa IsGameModeCreative = { Params = "", Return = "bool", Notes = "Returns true if the current gamemode is gmCreative." }, IsGameModeSurvival = { Params = "", Return = "bool", Notes = "Returns true if the current gamemode is gmSurvival." }, IsPVPEnabled = { Params = "", Return = "bool", Notes = "Returns whether PVP is enabled in the world settings." }, + IsWeatherRain = { Params = "", Return = "bool", Notes = "Returns true if the current weather is rain." }, + IsWeatherStorm = { Params = "", Return = "bool", Notes = "Returns true if the current weather is a storm." }, + IsWeatherSunny = { Params = "", Return = "bool", Notes = "Returns true if the current weather is sunny." }, + IsWeatherWet = { Params = "", Return = "bool", Notes = "Returns true if the current weather has any precipitation (rain or storm)." }, QueueBlockForTick = { Params = "BlockX, BlockY, BlockZ, TicksToWait", Return = "", Notes = "Queues the specified block to be ticked after the specified number of gameticks." }, QueueSaveAllChunks = { Params = "", Return = "", Notes = "Queues all chunks to be saved in the world storage thread" }, QueueSetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta, TickDelay", Return = "", Notes = "Queues the block to be set to the specified blocktype and meta after the specified amount of game ticks. Uses SetBlock() for the actual setting, so simulators are woken up and block entities are handled correctly." }, -- cgit v1.2.3 From fdc67142fd589a93840308a3eb1845a203d2cbec Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 4 Oct 2013 20:58:25 +0200 Subject: APIDump: Documented cPlugin --- MCServer/Plugins/APIDump/APIDesc.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 6d0b72c14..5779e18bc 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1347,14 +1347,18 @@ a_Player:OpenWindow(Window); cPlugin = { - Desc = [[cPlugin describes a Lua plugin. This page is dedicated to new-style plugins and contain their functions. + Desc = [[cPlugin describes a Lua plugin. This page is dedicated to new-style plugins and contain their functions. Each plugin has its own Plugin object. ]], Functions = { - GetName = { Return = "string" }, - SetName = { Return = "" }, - GetVersion = { Notes = "int" }, - SetVersion = { Return = "" }, + Call = { Params = "Function name, [All the parameters divided with commas]", Notes = "This function allows you to call a function from another plugin. It can only use pass: integers, booleans, strings and usertypes (cPlayer, cEntity, cCuboid, etc.)." }, + GetDirectory = { Return = "string", Notes = "Returns the name of the folder where the plugin's files are. (APIDump)" }, + GetLocalDirectory = { Notes = "OBSOLETE 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." }, + SetName = { Params = "string", Notes = "Sets the name of the Plugin." }, + GetVersion = { Return = "number", Notes = "Returns the version of the plugin." }, + SetVersion = { Params = "number", Notes = "Sets the version of the plugin." }, GetFileName = { Return = "string" }, CreateWebPlugin = { Notes = "{{cWebPlugin|cWebPlugin}}" }, }, -- cgit v1.2.3 From a7401fa8329be3c9b33935ebffd1088f9e6088e4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 4 Oct 2013 21:53:14 +0200 Subject: APIDump: Added cLineBlockTracer documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 90 ++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 4 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 5779e18bc..c849e0e3d 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1168,10 +1168,92 @@ These ItemGrids are available in the API and can be manipulated by the plugins, cLineBlockTracer = { - Desc = "", - Functions = {}, - Constants = {}, - }, + Desc = [[Objects of this class provide an easy-to-use interface to tracing lines through individual +blocks in the world. It will call the provided callbacks according to what events it encounters along the +way.

    +

    +For the Lua API, there's only one function exported that takes all the parameters necessary to do the +tracing. The Callbacks parameter is a table containing all the functions that will be called upon the +various events. See below for further information. + ]], + Functions = + { + Trace = { Params = "{{cWorld}}, Callbacks, StartX, StartY, StartZ, EndX, EndY, EndZ", Return = "bool", Notes = "(STATIC) Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)" }, + }, + + AdditionalInfo = + { + { + Header = "Callbacks", + Contents = [[ +The Callbacks in the Trace() function is a table that contains named functions. MCServer will call +individual functions from that table for the events that occur on the line - hitting a block, going out of +valid world data etc. The following table lists all the available callbacks. If the callback function is +not defined, MCServer skips it. Each function can return a bool value, if it returns true, the tracing is +aborted and Trace() returns false.

    +

    + + + + + + + + + + + + + +
    NameParametersNotes
    OnNextBlockBlockX, BlockY, BlockZ, BlockType, BlockMeta, EntryFaceCalled when the ray hits a new valid block. The block type and meta is given. EntryFace is one of the + BLOCK_FACE_ constants indicating which "side" of the block got hit by the ray.
    OnNextBlockNoDataBlockX, BlockY, BlockZ, EntryFaceCalled when the ray hits a new block, but the block is in an unloaded chunk - no valid data is + available. Only the coords and the entry face are given.
    OnOutOfWorldX, Y, ZCalled when the ray goes outside of the world (Y-wise); the coords specify the exact exit point. Note + that for other paths than lines (considered for future implementations) the path may leave the world and + go back in again later, in such a case this callback is followed by OnIntoWorld() and further + OnNextBlock() calls.
    OnIntoWorldX, Y, ZCalled when the ray enters the world (Y-wise); the coords specify the exact entry point.
    OnNoMoreHits Called when the path is sure not to hit any more blocks. This is the final callback, no more + callbacks are called after this function. Unlike the other callbacks, this function doesn't have a return + value.
    OnNoChunk Called when the ray enters a chunk that is not loaded. This usually means that the tracing is aborted. + Unlike the other callbacks, this function doesn't have a return value.
    + ]], + }, + { + Header = "Example", + Contents = [[ +

    The following example is taken from the Debuggers plugin. It is a command handler function for the +"/spidey" command that creates a line of cobweb blocks from the player's eyes up to 50 blocks away in +the direction they're looking, but only through the air. +

    +function HandleSpideyCmd(a_Split, a_Player)
    +	local World = a_Player:GetWorld();
    +
    +	local Callbacks = {
    +		OnNextBlock = function(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta)
    +			if (a_BlockType ~= E_BLOCK_AIR) then
    +				-- abort the trace
    +				return true;
    +			end
    +			World:SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COBWEB, 0);
    +		end
    +	};
    +	
    +	local EyePos = a_Player:GetEyePosition();
    +	local LookVector = a_Player:GetLookVector();
    +	LookVector:Normalize();  -- Make the vector 1 m long
    +	
    +	-- Start cca 2 blocks away from the eyes
    +	local Start = EyePos + LookVector + LookVector;
    +	local End = EyePos + LookVector * 50;
    +	
    +	cLineBlockTracer.Trace(World, Callbacks, Start.x, Start.y, Start.z, End.x, End.y, End.z);
    +	
    +	return true;
    +end
    +
    +

    + ]], + }, + }, -- AdditionalInfo + }, -- cLineBlockTracer cLuaWindow = { -- cgit v1.2.3 From d41f3a1b0ce4eb2f7fceef8ad91468da443aab05 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 5 Oct 2013 12:01:51 +0200 Subject: APIDump: Brought cItem docs up-to-date. --- MCServer/Plugins/APIDump/APIDesc.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index c849e0e3d..6578e6d8b 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1034,27 +1034,29 @@ These ItemGrids are available in the API and can be manipulated by the plugins, { Desc = [[ cItem is what defines an item or stack of items in the game, it contains the item ID, damage, - quantity and enchantments. Each slot in a {{cInventory|cInventory}} class or a - {{cItemGrid|cItemGrid}} class is a cItem and each cPickup contains a cItem. The enchantments - are contained in a {{cEnchantments|cEnchantments}} class + quantity and enchantments. Each slot in a {{cInventory}} class or a {{cItemGrid}} class is a cItem + and each {{cPickup}} contains a cItem. The enchantments are contained in a separate + {{cEnchantments}} class and are accessible through the m_Enchantments variable. ]], Functions = { constructor = { - { Params = "", Return = "cItem", Notes = "Creates a new empty cItem obje" }, + { Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" }, { Params = "ItemType, Count, Damage, EnchantmentString", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default) and enchantments (non-enchanted by default)" }, { Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" }, } , + AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." }, Clear = { Params = "", Return = "", Notes = "Resets the instance to an empty item" }, CopyOne = { Params = "", Return = "cItem", Notes = "Creates a copy of this object, with its count set to 1" }, DamageItem = { Params = "[Amount]", Return = "bool", Notes = "Adds the specified damage. Returns true when damage reaches max value and the item should be destroyed (but doesn't destroy the item)" }, Empty = { Params = "", Return = "", Notes = "Resets the instance to an empty item" }, GetMaxDamage = { Params = "", Return = "number", Notes = "Returns the maximum value for damage that this item can get before breaking; zero if damage is not accounted for for this item type" }, IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" }, - IsEnchantable = { Params = "ItemType", Return = "bool", Notes = "(static) Returns true if the specified ItemType is an enchantable item, as defined by the 1.2.5 network protocol (deprecated)" }, + IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" }, IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage and enchantments)" }, + IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" }, IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object" }, IsStackableWith = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is stackable with the one stored in the object" }, }, -- cgit v1.2.3