cLuaProjectile
#1
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?
Reply
Thanks given by:
#2
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.
Reply
Thanks given by:
#3
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.
Reply
Thanks given by:
#4
The hooks seem like a better solution to me.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)