Compare commits
5 Commits
21b9b595bd
...
2b34093715
Author | SHA1 | Date |
---|---|---|
Aaron Suen | 2b34093715 | |
Aaron Suen | 6a459e88be | |
Aaron Suen | ceb81249b3 | |
Aaron Suen | 791087d7f1 | |
Aaron Suen | fcb4009ce3 |
|
@ -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
9
README
|
@ -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:
|
||||
|
|
35
demo.lua
35
demo.lua
|
@ -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}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue