- Which parts of the code would I need to change to extend an existing server -> client message (add particle spawner)?
- Are the ids for corresponding CAOs and SAOs equal?
- I am planning on having SAOs have a std::set of the ids of the particle spawners that are attached to them, so that they can be removed when they are unloaded. Is this a good idea?
Attached Particle Spawners and associated questions
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Attached Particle Spawners and associated questions
I was thinking of implementing attached particle spawners (https://github.com/minetest/minetest/issues/567), and had a few questions.
Every time a mod API is left undocumented, a koala dies.
Re: Attached Particle Spawners and associated questions
ad 1: You would change the sending code (Server::SendAddParticleSpawner in server.cpp) and the receiving code (Client::handleCommand_AddParticleSpawner in network/clientpackethandler.cpp). Make sure to wrap the receiving part in a try-catch block so that clients remain compatible with old servers.
ad 2: Yes.
ad 3: Seems fine to me, though I might be missing a potential problem as I haven't worked on the active object code in a long time.
ad 2: Yes.
ad 3: Seems fine to me, though I might be missing a potential problem as I haven't worked on the active object code in a long time.
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Attached Particle Spawners and associated questions
Thanks kahrl. Do you also know whether there is a function for getting userdata fields from a table, similar to getintfield etc.?kahrl wrote:ad 1: You would change the sending code (Server::SendAddParticleSpawner in server.cpp) and the receiving code (Client::handleCommand_AddParticleSpawner in network/clientpackethandler.cpp). Make sure to wrap the receiving part in a try-catch block so that clients remain compatible with old servers.
ad 2: Yes.
ad 3: Seems fine to me, though I might be missing a potential problem as I haven't worked on the active object code in a long time.
Every time a mod API is left undocumented, a koala dies.
Re: Attached Particle Spawners and associated questions
Use lua_getfield to retrieve the field value and push it to the Lua stack, then a function like ObjectRef::checkobject or LuaItemStack::checkobject (etc...) to convert it to a pointer to some type that's usable from C++.Byakuren wrote: Thanks kahrl. Do you also know whether there is a function for getting userdata fields from a table, similar to getintfield etc.?
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Attached Particle Spawners and associated questions
Alright, I did that. Thank you again.kahrl wrote:Use lua_getfield to retrieve the field value and push it to the Lua stack, then a function like ObjectRef::checkobject or LuaItemStack::checkobject (etc...) to convert it to a pointer to some type that's usable from C++.Byakuren wrote: Thanks kahrl. Do you also know whether there is a function for getting userdata fields from a table, similar to getintfield etc.?
Every time a mod API is left undocumented, a koala dies.
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Attached Particle Spawners and associated questions
Here is the PR: https://github.com/minetest/minetest/pull/4409
Every time a mod API is left undocumented, a koala dies.
Who is online
Users browsing this forum: No registered users and 5 guests