Add color swappers, color swapping, and color targets.
This commit is contained in:
parent
9acd605c86
commit
5fd67703c0
34 changed files with 688 additions and 29 deletions
|
|
@ -6,7 +6,7 @@ minetest.register_entity(":artifact:burst", {
|
|||
textures = {"blank.png"},
|
||||
pointable = false,
|
||||
physical = true,
|
||||
-- collide_with_objects = false,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {
|
||||
-0.2, -0.2, -0.2,
|
||||
0.2, 0.2, 0.2
|
||||
|
|
@ -22,7 +22,20 @@ minetest.register_entity(":artifact:burst", {
|
|||
end
|
||||
end,
|
||||
on_step = function(e, dtime, movement)
|
||||
if movement.collides then
|
||||
-- Minetest's collision is rather bad, but we also shouldn't collide with players,
|
||||
-- hence we must implement our own rudimentary collision detection.
|
||||
-- In this case, any intersection on the segment betwee our last position and our
|
||||
-- current one should be considered a collision and result in detonation (and
|
||||
-- at the exact intersection point, if available).
|
||||
local collision
|
||||
for x in minetest.raycast(e.old_pos or e.object:get_pos(), e.object:get_pos(), true, true, {nodes = {}, objects = {playser = false}}) do
|
||||
collision = x
|
||||
break
|
||||
end
|
||||
if collision or movement.collides then
|
||||
if collision then
|
||||
e.object:set_pos(collision.intersection_point)
|
||||
end
|
||||
minetest.add_particlespawner {
|
||||
pos = e.object:get_pos(),
|
||||
radius = 0.1,
|
||||
|
|
@ -49,14 +62,16 @@ minetest.register_entity(":artifact:burst", {
|
|||
time = 0.1,
|
||||
}
|
||||
e.object:remove()
|
||||
if movement.collisions[1].type == "node" then
|
||||
if movement and movement.collisions[1] and movement.collisions[1].type == "node" then
|
||||
local pos = movement.collisions[1].node_pos
|
||||
local name = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[name].on_impact then
|
||||
minetest.registered_nodes[name].on_impact(pos)
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
e.old_pos = e.object:get_pos()
|
||||
end,
|
||||
impulse = function(e, vel)
|
||||
-- The documentation said that `vel` is relative to the parent entity...
|
||||
|
|
@ -90,7 +105,7 @@ minetest.register_entity(":artifact:burst", {
|
|||
pos = vector.zero(),
|
||||
vel = vel,
|
||||
texture = "[fill:16x16:0,0:#fff",
|
||||
size = 3,
|
||||
size_tween = {3, 0},
|
||||
glow = 14,
|
||||
amount = 150,
|
||||
time = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue