summaryrefslogtreecommitdiffstats
path: root/Plugins/MagicCarpet/objects.lua
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 20:19:51 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 20:19:51 +0100
commit28ff03fcfe727f827c00078c4fa0319cb3c03421 (patch)
tree79a961e2c3bf9005556cbd7276dd4af2728fd76b /Plugins/MagicCarpet/objects.lua
parentVC2008: removed an unneeded file from zlib project (diff)
downloadcuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.gz
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.bz2
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.lz
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.xz
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.tar.zst
cuberite-28ff03fcfe727f827c00078c4fa0319cb3c03421.zip
Diffstat (limited to '')
-rw-r--r--Plugins/MagicCarpet/objects.lua (renamed from Plugins/MagicCarpet.lua)78
1 files changed, 3 insertions, 75 deletions
diff --git a/Plugins/MagicCarpet.lua b/Plugins/MagicCarpet/objects.lua
index 69ccd0d5c..30528cc42 100644
--- a/Plugins/MagicCarpet.lua
+++ b/Plugins/MagicCarpet/objects.lua
@@ -92,78 +92,6 @@ function cCarpet:moveTo( NewPos )
end
end
-
-MagicCarpetPlugin = {}
-MagicCarpetPlugin.__index = MagicCarpetPlugin
-
-function MagicCarpetPlugin:new()
- local t = {}
- setmetatable(t, MagicCarpetPlugin)
- local w = Lua__cPlugin:new()
- tolua.setpeer(w, t)
- w:tolua__set_instance(w)
- return w
-end
-
-function MagicCarpetPlugin:Initialize()
- self:SetName( "MagicCarpet" )
- self:SetVersion( 1 )
-
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook( self, cPluginManager.E_PLUGIN_PLAYER_MOVE)
- PluginManager:AddHook( self, cPluginManager.E_PLUGIN_DISCONNECT)
-
- self:AddCommand("/mc", " - Spawns a magical carpet!", "magiccarpet")
- self:BindCommand( "/mc", "magiccarpet", HandleCarpetCommand )
-
- self.Carpets = {}
-
- Log( "Initialized " .. self:GetName() .. " v." .. self:GetVersion() )
- return true
-end
-
-function MagicCarpetPlugin:OnDisable()
- Log( self:GetName() .. " v." .. self:GetVersion() .. " is shutting down..." )
- for i, Carpet in pairs( self.Carpets ) do
- Carpet:remove()
- end
-end
-
-function HandleCarpetCommand( Split, Player )
- Carpet = self.Carpets[ Player ]
- if( Carpet == nil ) then
- self.Carpets[ Player ] = cCarpet:new()
- Player:SendMessage("You're on a magic carpet!" )
- else
- Carpet:remove()
- self.Carpets[ Player ] = nil
- Player:SendMessage("The carpet vanished!" )
- end
-
- return true
-end
-
-function MagicCarpetPlugin:OnDisconnect( Reason, Player )
- local Carpet = self.Carpets[ Player ]
- if( Carpet ~= nil ) then
- Carpet:remove()
- end
- self.Carpets[ Player ] = nil
-end
-
-function MagicCarpetPlugin:OnPlayerMove( Player )
- local Carpet = self.Carpets[ Player ]
- if( Carpet == nil ) then
- return
- end
-
- if( Player:GetPitch() == 90 ) then
- Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY()-1, Player:GetPosZ() ) )
- else
- Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
- end
-end
-
-Plugin = MagicCarpetPlugin:new()
-cRoot:Get():GetPluginManager():AddPlugin( Plugin )
-
+function cCarpet:getY()
+ return self.Location.y
+end \ No newline at end of file