Compare commits

...

5 Commits

Author SHA1 Message Date
Aaron Suen 2b34093715 Add now-required mod.conf 2021-03-01 19:56:12 -05:00
Aaron Suen 6a459e88be Add required mod.conf 2021-03-01 19:54:50 -05:00
Aaron Suen ceb81249b3 Explain the value added by the more complex API. 2019-12-30 11:55:58 -05:00
Aaron Suen 791087d7f1 Add labels, fix tornado effect. 2019-12-30 10:59:13 -05:00
Aaron Suen fcb4009ce3 MIT license. 2019-12-30 10:47:52 -05:00
4 changed files with 50 additions and 13 deletions

18
LICENSE Normal file
View File

@ -0,0 +1,18 @@
Copyright (C)2019 by Aaron Suen <warr1024@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
README
View File

@ -12,6 +12,15 @@ sending a swarm of add_particle packets to the client (individually for
each particle) BUT it could be done much more efficiently in the engine
by sending a single add_particlespawner_advanced packet to the client.
The key difference from this API compared to the standard particle
spawner one is that you can define the particle's parameters as a
linear function of a constant, time, and 12 random variables. The
12 random numbers are enough for each of the original random variables
to have an independent/uncorrelated random value (i.e. you can implement
a standard particle spawner's behavior using the advanced one) but
interesting things happen when you reuse a single random value between
different parameters.
Included are a bunch of demo nodes, each of which creates a special
particle effect that cannot be achieved with ordinary particlspawners
every 2 seconds. Use a /giveme command to give yourself demo nodes:

View File

@ -12,13 +12,17 @@ local bdesc = blackdot:gsub("%^", "\\^"):gsub(":", "\\:")
local frame = "[combine:16x16:0,0=" .. bdesc .. ":15,0=" .. bdesc
.. ":0,15=" .. bdesc .. ":15,15=" .. bdesc
local function regdemo(num, func)
local function regdemo(num, desc, func)
return minetest.register_node(modname .. ":demo" .. num, {
description = desc,
drawtype = "allfaces",
tiles = {{name = frame, backface_culling = false}},
groups = {[modname] = 1},
paramtype = "light",
sunlight_propagates = true,
on_construct = function(pos)
return minetest.get_meta(pos):set_string("infotext", desc)
end,
on_punch = function(pos) return minetest.remove_node(pos) end,
on_demo = func
})
@ -34,7 +38,7 @@ minetest.register_abm({
end
})
regdemo(1, function(pos)
regdemo(1, "ASMD ShockRifle Effect", function(pos)
local endpos = {
x = pos.x + math_random() * 20 - 10,
y = pos.y + math_random() * 20 - 10,
@ -59,9 +63,9 @@ regdemo(1, function(pos)
})
end)
regdemo(2, function(pos)
regdemo(2, "Implosion / Teleport Arrive", function(pos)
minetest.add_particlespawner_advanced({
amount = 25,
amount = 100,
time = 0,
pos = {
x = {pos.x, -10, 20},
@ -84,21 +88,26 @@ regdemo(2, function(pos)
})
end)
regdemo(3, function(pos)
regdemo(3, "Tornado", function(pos)
minetest.add_particlespawner_advanced({
amount = 200,
time = 0,
time = 2,
pos = {
x = {pos.x, -10, 20},
y = {pos.y, -10, 0, 20},
z = {pos.z, -10, 0, 0, 20}
x = {pos.x - 10, 0, 20},
y = {pos.y, 0, 0, 10},
z = {pos.z - 10, 0, 0, 0, 20}
},
velocity = {
x = {0, -5, 0, 0, 10},
y = {0, -5, 0, 10},
z = {0, 5, -10}
x = {-5, 0, 0, 0, 10},
y = {0, 0, 0, 10},
z = {5, 0, -10}
},
expirationtime = {1},
acceleration = {
x = {2.5, 0, -5},
y = {5},
z = {2.5, 0, 0, 0, -5}
},
expirationtime = {2},
texture = blackdot,
size = {1, 0, 0, 0, 0, 4}
})

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = advparticles