1
0

Added cBlockArea:CopyTo() and :CopyFrom(), so now block areas can be duplicated easily.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1199 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-02-07 10:45:30 +00:00
parent ed47a8e409
commit fe7e07d69d
5 changed files with 127 additions and 5 deletions

View File

@@ -150,7 +150,7 @@ function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, C
end
-- Rclk with an ender pearl saves a predefined area around the cursor into a .schematic file
-- Rclk with an ender pearl saves a predefined area around the cursor into a .schematic file. Also tests area copying
if (Player:GetEquippedItem().m_ItemType == E_ITEM_ENDER_PEARL) then
local Area = cBlockArea();
if not(Area:Read(Player:GetWorld(),
@@ -159,8 +159,11 @@ function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, C
LOG("LUA: Area couldn't be read");
return false;
end
LOG("LUA: Area read, saving now.");
if not(Area:SaveToSchematicFile("schematics/out.schematic")) then
LOG("LUA: Area read, copying now.");
local Area2 = cBlockArea();
Area2:CopyFrom(Area);
LOG("LUA: Copied, now saving.");
if not(Area2:SaveToSchematicFile("schematics/test.schematic")) then
LOG("LUA: Cannot save schematic file.");
return false;
end