1
0

Merge remote-tracking branch 'upstream/master' into playerxp

This commit is contained in:
Daniel O'Brien
2013-11-16 00:07:42 +11:00
20 changed files with 205 additions and 793 deletions

View File

@@ -26,6 +26,7 @@ function Initialize(Plugin)
cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat);
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
PluginManager = cRoot:Get():GetPluginManager();
PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities");
@@ -500,21 +501,6 @@ end
function OnChunkGenerated(World, ChunkX, ChunkZ, ChunkDesc)
-- Test ChunkDesc / BlockArea interaction
local BlockArea = cBlockArea();
ChunkDesc:ReadBlockArea(BlockArea, 0, 15, 50, 70, 0, 15);
-- BlockArea:SaveToSchematicFile("ChunkBlocks_" .. ChunkX .. "_" .. ChunkZ .. ".schematic");
ChunkDesc:WriteBlockArea(BlockArea, 5, 115, 5);
return false;
end
function OnChat(a_Player, a_Message)
return false, "blabla " .. a_Message;
end
@@ -532,6 +518,27 @@ end
function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
-- Get the topmost block coord:
local Height = a_ChunkDesc:GetHeight(0, 0);
-- Create a sign there:
a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0);
local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0);
if (BlockEntity ~= nil) then
LOG("Setting sign lines...");
local SignEntity = tolua.cast(BlockEntity, "cSignEntity");
SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)");
end
-- Update the heightmap:
a_ChunkDesc:SetHeight(0, 0, Height + 1);
end
-- Function "round" copied from http://lua-users.org/wiki/SimpleRound
function round(num, idp)
local mult = 10^(idp or 0)
@@ -844,4 +851,4 @@ function HandleAddExperience(a_Split, a_Player)
a_Player:AddExperience(200);
return true;
end
end