Cuberite Forum
cLuaProjectile - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: cLuaProjectile (/thread-1407.html)



cLuaProjectile - NiLSPACE - 03-13-2014

Just like with the cChunkStay I think we should also have an cLuaProjectile. You can create an projectile with it with custom functions like OnHitEntity and OnHitSolidBlock.
the cWorld function would look something like this:
cWorld:CreateLuaProjectile(a_X, a_Y, a_Z, ProjectileKind, a_Creator, a_Speed, a_OnHitSolidBlockCallback, a_OnHitEntityCallback)

If the callback returns true the entity or block would be ignored and the projectile would fly through it.


Any thoughts?


RE: cLuaProjectile - xoft - 03-13-2014

Trouble with serialization - what happens if the chunk in which the projectile is gets saved and unloaded, then later re-loaded? There's no way to persist the callbacks and saving the entiti will effectively convert it to regular type.


RE: cLuaProjectile - NiLSPACE - 03-13-2014

I guess we don't save it.
What we could do as well is creating two hooks: HOOK_PROJECTILE_HIT_ENTITY and HOOK_PROJECTILE_HIT_GROUND that do the callbacks.


RE: cLuaProjectile - xoft - 03-13-2014

The hooks seem like a better solution to me.