Cuberite Forum
Lua hooks needed! - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Lua hooks needed! (/thread-464.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Lua hooks needed! - xoft - 01-21-2013

That would be reasonable. Pity that I cannot do that myself.


RE: Lua hooks needed! - FakeTruth - 01-21-2013

Really? I could also just add another category, makes more sense to me, it's still the same project.


RE: Lua hooks needed! - xoft - 01-22-2013

True, that's what I meant all the time, just didn't realise the difference between a project and a category, sorry.
Still, no submissions?


RE: Lua hooks needed! - FakeTruth - 01-23-2013

well I added the "Plugin API" category now


RE: Lua hooks needed! - xoft - 02-01-2013

An idea: how about changing the OnChunkGenerated hook to trigger *before* the chunk is added to the world, and having the same parameter set, as OnChunkGenerating - ChunkX, ChunkZ and ChunkDesc. It could then use ChunkDesc to do some last-minute changes to the generated chunk.

Why: If a plugin uses OnChunkGenerated() and modifies the chunk, the changes sometimes don't get propagated to clients that already queued that chunk for sending. This is the easy fix. Also it makes the API a bit more flexible.
Another reason: I'd like to add new hooks, OnChunkUnloading (self-explanatory name) and OnChunkAdded, that would trigger each time the chunk is loaded or generated (in cWorld:SetChunkData() ). And it would be quite ugly if the hook fired in this sequence: OnChunkGenerating - OnChunkAdded - OnChunkGenerated. It'd be much more logical to have OnChunkGenerating - OnChunkGenerated - OnChunkAdded. But that is possible only if we change the logic of the OnChunkGenerated that the chunk is not yet added to the world.

How many headaches have I just caused? Smile


RE: Lua hooks needed! - Taugeshtu - 02-01-2013

I suppose, nil of them Smile Actually, now I'm wondering why it wasn't done this way in the first placeBig Grin


RE: Lua hooks needed! - xoft - 02-01-2013

Because OnChunkGenerated was done before we had cChunkDesc (cLuaChunk at that time), it was easy to add, unlike the cChunkDesc class. Smile


RE: Lua hooks needed! - xoft - 02-06-2013

Done in rev 1193. Now the wiki...


RE: Lua hooks needed! - xoft - 02-12-2013

The wiki is almost done, hook-wise, so it's about time we get new hook requests Smile
I, for one, am thinking about a HOOK_WEATHER_CHANGING hook that would be called *before* the weather is changed and will allow plugins to refuse the change.
Got any new ideas? Go put them in the flyspray bugtracker.


RE: Lua hooks needed! - bearbin - 02-13-2013

Seems good Smile