summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua1
m---------MCServer/Plugins/Core0
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua73
-rw-r--r--MCServer/Plugins/MagicCarpet/coremessaging.lua19
-rw-r--r--MCServer/Plugins/MagicCarpet/plugin.lua8
-rwxr-xr-x[-rw-r--r--]MCServer/hg0
-rw-r--r--MCServer/items.ini3
-rw-r--r--MCServer/monsters.ini44
-rwxr-xr-x[-rw-r--r--]MCServer/vg0
9 files changed, 102 insertions, 46 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 19553ea80..e877ec446 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2035,6 +2035,7 @@ end
BroadcastSoundParticleEffect = { Params = "EffectID, X, Y, Z, EffectData, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient" },
CastThunderbolt = { Params = "X, Y, Z", Return = "", Notes = "Creates a thunderbolt at the specified coords" },
ChangeWeather = { Params = "", Return = "", Notes = "Forces the weather to change in the next game tick. Weather is changed according to the normal rules: wSunny <-> wRain <-> wStorm" },
+ ChunkStay = { Params = "ChunkCoordTable, OnChunkAvailable, OnAllChunksAvailable", Return = "", Notes = "Queues the specified chunks to be loaded or generated and calls the specified callbacks once they are loaded. ChunkCoordTable is an arra-table of chunk coords, each coord being a table of 2 numbers: { {Chunk1x, Chunk1z}, {Chunk2x, Chunk2z}, ...}. When any of those chunks are made available (including being available at the start of this call), the OnChunkAvailable() callback is called. When all the chunks are available, the OnAllChunksAvailable() callback is called. The function signatures are: <pre class=\"prettyprint lang-lua\">function OnChunkAvailable(ChunkX, ChunkZ)\nfunction OnAllChunksAvailable()</pre> All return values from the callbacks are ignored." },
CreateProjectile = { Params = "X, Y, Z, {{cProjectileEntity|ProjectileKind}}, {{cEntity|Creator}}, [{{Vector3d|Speed}}]", Return = "", Notes = "Creates a new projectile of the specified kind at the specified coords. The projectile's creator is set to Creator (may be nil). Optional speed indicates the initial speed for the projectile." },
DigBlock = { Params = "X, Y, Z", Return = "", Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors." },
DoExplosionAt = { Params = "Force, X, Y, Z, CanCauseFire, Source, SourceData", Return = "", Notes = "Creates an explosion of the specified relative force in the specified position. If CanCauseFire is set, the explosion will set blocks on fire, too. The Source parameter specifies the source of the explosion, one of the esXXX constants. The SourceData parameter is specific to each source type, usually it provides more info about the source." },
diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core
-Subproject 51aa4290d7cef2aff68a35c66339535d9068f79
+Subproject 0e53588713215f0a9557ef55295e8aa22f265cb
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 624261cbf..8345e2169 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -53,6 +53,7 @@ function Initialize(Plugin)
PM:BindCommand("/fr", "debuggers", HandleFurnaceRecipe, "- Shows the furnace recipe for the currently held item");
PM:BindCommand("/ff", "debuggers", HandleFurnaceFuel, "- Shows how long the currently held item would burn in a furnace");
PM:BindCommand("/sched", "debuggers", HandleSched, "- Schedules a simple countdown using cWorld:ScheduleTask()");
+ PM:BindCommand("/cs", "debuggers", HandleChunkStay, "- Tests the ChunkStay Lua integration for the specified chunk coords");
Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers);
@@ -64,7 +65,7 @@ function Initialize(Plugin)
-- TestBlockAreas();
-- TestSQLiteBindings();
-- TestExpatBindings();
- TestPluginCalls();
+ -- TestPluginCalls();
return true
end;
@@ -1061,3 +1062,73 @@ end
+
+function HandleChunkStay(a_Split, a_Player)
+ -- As an example of using ChunkStay, this call will load 3x3 chunks around the specified chunk coords,
+ -- then build an obsidian pillar in the middle of each one.
+ -- Once complete, the player will be teleported to the middle pillar
+
+ if (#a_Split ~= 3) then
+ a_Player:SendMessageInfo("Usage: /cs <ChunkX> <ChunkZ>")
+ return true
+ end
+
+ local ChunkX = tonumber(a_Split[2])
+ local ChunkZ = tonumber(a_Split[3])
+ if ((ChunkX == nil) or (ChunkZ == nil)) then
+ a_Player:SendMessageFailure("Invalid chunk coords.")
+ return true
+ end
+
+ local World = a_Player:GetWorld()
+ local PlayerID = a_Player:GetUniqueID()
+ a_Player:SendMessageInfo("Loading chunks, stand by...");
+
+ -- Set the wanted chunks:
+ local Chunks = {}
+ for z = -1, 1 do for x = -1, 1 do
+ table.insert(Chunks, {ChunkX + x, ChunkZ + z})
+ end end
+
+ -- The function that is called when all chunks are available
+ -- Will perform the actual action with all those chunks
+ -- Note that the player needs to be referenced using their EntityID - in case they disconnect before the chunks load
+ local OnAllChunksAvailable = function()
+ LOGINFO("ChunkStay all chunks now available")
+ -- Build something on the neighboring chunks, to verify:
+ for z = -1, 1 do for x = -1, 1 do
+ local BlockX = (ChunkX + x) * 16 + 8
+ local BlockZ = (ChunkZ + z) * 16 + 8
+ for y = 20, 80 do
+ World:SetBlock(BlockX, y, BlockZ, E_BLOCK_OBSIDIAN, 0)
+ end
+ end end
+
+ -- Teleport the player there for visual inspection:
+ World:DoWithEntityByID(PlayerID,
+ function (a_CallbackPlayer)
+ a_CallbackPlayer:TeleportToCoords(ChunkX * 16 + 8, 85, ChunkZ * 16 + 8)
+ a_CallbackPlayer:SendMessageSuccess("ChunkStay fully available")
+ end
+ )
+ end
+
+ -- This function will be called for each chunk that is made available
+ -- Note that the player needs to be referenced using their EntityID - in case they disconnect before the chunks load
+ local OnChunkAvailable = function(a_ChunkX, a_ChunkZ)
+ LOGINFO("ChunkStay now has chunk [" .. a_ChunkX .. ", " .. a_ChunkZ .. "]")
+ World:DoWithEntityByID(PlayerID,
+ function (a_CallbackPlayer)
+ a_CallbackPlayer:SendMessageInfo("ChunkStay now has chunk [" .. a_ChunkX .. ", " .. a_ChunkZ .. "]")
+ end
+ )
+ end
+
+ -- Process the ChunkStay:
+ World:ChunkStay(Chunks, OnChunkAvailable, OnAllChunksAvailable)
+ return true
+end
+
+
+
+
diff --git a/MCServer/Plugins/MagicCarpet/coremessaging.lua b/MCServer/Plugins/MagicCarpet/coremessaging.lua
deleted file mode 100644
index 9fb2c0db1..000000000
--- a/MCServer/Plugins/MagicCarpet/coremessaging.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-Core = cPluginManager:Get():GetPlugin("Core")
-
-function SendMessage(a_Player, a_Message)
- if (Core ~= nil) then
- Core:Call("SendMessage", a_Player, a_Message)
- end
-end
-
-function SendMessageSuccess(a_Player, a_Message)
- if (Core ~= nil) then
- Core:Call("SendMessageSuccess", a_Player, a_Message)
- end
-end
-
-function SendMessageFailure(a_Player, a_Message)
- if (Core ~= nil) then
- Core:Call("SendMessageFailure", a_Player, a_Message)
- end
-end
diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua
index b05816e48..417ea0e02 100644
--- a/MCServer/Plugins/MagicCarpet/plugin.lua
+++ b/MCServer/Plugins/MagicCarpet/plugin.lua
@@ -6,7 +6,7 @@ function Initialize( Plugin )
Plugin:SetVersion( 2 )
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
- cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect)
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnDisconnect)
local PluginManager = cPluginManager:Get()
PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet");
@@ -37,12 +37,12 @@ function HandleCarpetCommand( Split, Player )
if( Carpet == nil ) then
Carpets[ Player ] = cCarpet:new()
- SendMessageSuccess(Player, "You're on a magic carpet!")
- SendMessage(Player, "Look straight down to descend. Jump to ascend.")
+ Player:SendMessageSuccess("You're on a magic carpet!")
+ Player:SendMessageInfo("Look straight down to descend. Jump to ascend.")
else
Carpet:remove()
Carpets[ Player ] = nil
- SendMessageSuccess(Player, "The carpet vanished!")
+ Player:SendMessageSuccess("The carpet vanished!")
end
return true
diff --git a/MCServer/hg b/MCServer/hg
index 93593de8d..93593de8d 100644..100755
--- a/MCServer/hg
+++ b/MCServer/hg
diff --git a/MCServer/items.ini b/MCServer/items.ini
index c09b32f17..7b8fcf4ee 100644
--- a/MCServer/items.ini
+++ b/MCServer/items.ini
@@ -1,4 +1,5 @@
[Items]
+air=0
rock=1
stone=1
grass=2
@@ -177,6 +178,8 @@ workbench=58
crop=59
crops=59
soil=60
+farmland=60
+tilleddirt=60
furnace=61
litfurnace=62
signblock=63
diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini
index a1b63423e..8cd956157 100644
--- a/MCServer/monsters.ini
+++ b/MCServer/monsters.ini
@@ -1,61 +1,61 @@
[Spider]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=2.0
SightDistance=25.0
MaxHealth=16
[Chicken]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=4
[Cow]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=10
[Pig]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=10
[Sheep]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=8
[Squid]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
MaxHealth=10
[Enderman]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=4.0
SightDistance=25.0
MaxHealth=40
[Zombiepigman]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=7.0
SightDistance=25.0
MaxHealth=20
[Cavespider]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=2.0
SightDistance=25.0
@@ -76,7 +76,7 @@ SightDistance=50.0
MaxHealth=10
[Silverfish]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=1.0
SightDistance=25.0
@@ -89,21 +89,21 @@ SightDistance=40.0
MaxHealth=20
[Slime]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=4.0
SightDistance=25.0
MaxHealth=16
[Zombie]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=4.0
SightDistance=25.0
MaxHealth=20
[Wolf]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=4.0
SightDistance=25.0
@@ -117,14 +117,14 @@ SightDistance=25.0
MaxHealth=20
[Villager]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=20
[Witch]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
@@ -132,49 +132,49 @@ MaxHealth=26
[Ocelot]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Mooshroom]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=10
[Magmacube]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=16
[Horse]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=30
[EnderDragon]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=200
[Giant]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=100
[IronGolem]
-AttackRange=5.0
+AttackRange=2.0
AttackRate=1
AttackDamage=6.0
SightDistance=25.0
diff --git a/MCServer/vg b/MCServer/vg
index fcc8270d0..fcc8270d0 100644..100755
--- a/MCServer/vg
+++ b/MCServer/vg