diff options
Diffstat (limited to 'Server/Plugins')
-rw-r--r-- | Server/Plugins/Debuggers/Debuggers.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index 4cf825f12..1505904a8 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -30,6 +30,7 @@ function Initialize(a_Plugin) PM:AddHook(cPluginManager.HOOK_CHUNK_UNLOADING, OnChunkUnloading); PM:AddHook(cPluginManager.HOOK_WORLD_STARTED, OnWorldStarted); PM:AddHook(cPluginManager.HOOK_PROJECTILE_HIT_BLOCK, OnProjectileHitBlock); + PM:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick) -- _X: Disabled WECUI manipulation: -- PM:AddHook(cPluginManager.HOOK_PLUGIN_MESSAGE, OnPluginMessage); @@ -714,6 +715,26 @@ end +function OnPlayerRightClick(a_Player) + -- If the player is holding a cake item, make them throw a cake block, using a FallingBlock entity: + if (a_Player:GetInventory():GetEquippedItem().m_ItemType == E_ITEM_CAKE) then + local World = a_Player:GetWorld() + local Position = a_Player:GetPosition() + Vector3d(0, 1.5, 0) + local EntityID = World:SpawnFallingBlock(Vector3i(Position), E_BLOCK_CAKE, 0) + + World:DoWithEntityByID(EntityID, + function (Entity) + Entity:TeleportToCoords(Position.x, Position.y, Position.z) + Entity:SetSpeed(a_Player:GetLookVector() * 30) + end + ) + end +end + + + + + function OnPlayerRightClickingEntity(a_Player, a_Entity) LOG("Player " .. a_Player:GetName() .. " right-clicking entity ID " .. a_Entity:GetUniqueID() .. ", a " .. a_Entity:GetClass()); return false; |