Torch particle, item magnet fix

Disable the torch particles temporarily to move to another fix with abms.
Make the item magnet move with the player as to not break the animation flow when a player is moving fast.
This commit is contained in:
oilboi 2020-02-22 10:27:33 -05:00
parent 8b20c9cfc4
commit c354bbfe59
4 changed files with 28 additions and 20 deletions

View File

@ -237,10 +237,12 @@ minetest.register_entity(":__builtin:item", {
--get the variables --get the variables
local pos = self.object:getpos() local pos = self.object:getpos()
local pos2 = collector:getpos() local pos2 = collector:getpos()
local player_velocity = collector:get_player_velocity()
pos2.y = pos2.y + self.collection_height pos2.y = pos2.y + self.collection_height
local direction = vector.normalize(vector.subtract(pos2,pos)) local direction = vector.normalize(vector.subtract(pos2,pos))
local distance = vector.distance(pos2,pos) local distance = vector.distance(pos2,pos)
--remove if too far away --remove if too far away
if distance > self.radius then if distance > self.radius then
@ -250,6 +252,7 @@ minetest.register_entity(":__builtin:item", {
local multiplier = (self.radius*5) - distance local multiplier = (self.radius*5) - distance
local velocity = vector.multiply(direction,multiplier) local velocity = vector.multiply(direction,multiplier)
local velocity = vector.add(player_velocity,velocity)
self.object:setvelocity(velocity) self.object:setvelocity(velocity)

View File

@ -76,6 +76,7 @@ local function create_ps(pos)
end end
--reload smoke and flame on load --reload smoke and flame on load
--[[
minetest.register_lbm({ minetest.register_lbm({
name = "redstone:torch", name = "redstone:torch",
nodenames = {"redstone:torch_floor","redstone:torch_wall"}, nodenames = {"redstone:torch_floor","redstone:torch_wall"},
@ -84,7 +85,7 @@ minetest.register_lbm({
create_ps(pos) create_ps(pos)
end, end,
}) })
]]--
-- Item definitions -- Item definitions
minetest.register_craftitem("redstone:torch", { minetest.register_craftitem("redstone:torch", {
description = "Redstone Torch", description = "Redstone Torch",
@ -144,14 +145,14 @@ minetest.register_node("redstone:torch_floor", {
fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16}, fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
}, },
on_construct = function(pos) on_construct = function(pos)
create_ps(pos) --create_ps(pos)
redstone.update(pos) redstone.update(pos)
end, end,
after_destruct = function(pos, oldnode) after_destruct = function(pos, oldnode)
redstone.update(pos,oldnode) redstone.update(pos,oldnode)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
delete_ps(pos) --delete_ps(pos)
end, end,
sounds = main.woodSound(), sounds = main.woodSound(),
}) })
@ -178,11 +179,11 @@ minetest.register_node("redstone:torch_wall", {
wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1}, wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
}, },
on_construct = function(pos) on_construct = function(pos)
create_ps(pos) --create_ps(pos)
redstone.update(pos) redstone.update(pos)
end, end,
after_destruct = function(pos, oldnode) after_destruct = function(pos, oldnode)
redstone.update(pos,oldnode) --redstone.update(pos,oldnode)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
delete_ps(pos) delete_ps(pos)

View File

@ -75,6 +75,7 @@ local function create_ps(pos)
meta:set_int("pss", pss) meta:set_int("pss", pss)
end end
--[[
--reload smoke and flame on load --reload smoke and flame on load
minetest.register_lbm({ minetest.register_lbm({
name = "torch:torch", name = "torch:torch",
@ -84,7 +85,7 @@ minetest.register_lbm({
create_ps(pos) create_ps(pos)
end, end,
}) })
]]--
-- Item definitions -- Item definitions
minetest.register_craftitem("torch:torch", { minetest.register_craftitem("torch:torch", {
description = "Torch", description = "Torch",
@ -142,10 +143,10 @@ minetest.register_node("torch:floor", {
fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16}, fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
}, },
on_construct = function(pos) on_construct = function(pos)
create_ps(pos) --create_ps(pos)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
delete_ps(pos) --delete_ps(pos)
end, end,
sounds = main.woodSound(), sounds = main.woodSound(),
}) })
@ -171,10 +172,10 @@ minetest.register_node("torch:wall", {
wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1}, wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
}, },
on_construct = function(pos) on_construct = function(pos)
create_ps(pos) -- create_ps(pos)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
delete_ps(pos) -- delete_ps(pos)
end, end,
sounds = main.woodSound(), sounds = main.woodSound(),
}) })

View File

@ -1,3 +1,5 @@
ALPHA STATE CHANGELOG
0.1
--make a grass biome --make a grass biome
--make trees --make trees
--make hand - mod another mod --make hand - mod another mod
@ -19,23 +21,19 @@
--water flow faster --water flow faster
--torches with particle --torches with particle
--make a mob --make a mob
--0.2
--fix tools causing crash on pigs with no fleshy definition --fix tools causing crash on pigs with no fleshy definition
--ladders - only placeable on walls --ladders - only placeable on walls
--eating animation - particles? - entity? --eating animation - particles? - entity?
--boats --boats
--make falling item have fall soundspec --make falling item have fall soundspec
--rebalance sand audio --rebalance sand audio
--rewrite the item collection better
(not finished) redstone - make nodes drop multiple items individually
make item collection move with the player's speed too
saplings
redstone - make nodes drop multiple items individually
make entities push against players make entities push against players
rewrite the item collection to magnetize using the possible application below
crafting bench crafting bench
fishing fishing
bows bows
@ -54,11 +52,16 @@ colored chat messages
check if everyone is in bed before going to next night check if everyone is in bed before going to next night
also lock player in bed until they get out or daytime also lock player in bed until they get out or daytime
open bugs: open bugs:
fix torches not deleting particles when mounted node dug <- meta glitch? fix torches not deleting particles when mounted node dug <- meta glitch?
--fixing with abm
possible applications: possible applications:
causes object to magnetize towards player or other objects and stop after an inner radius causes object to magnetize towards player or other objects and stop after an inner radius
use for better item magnet? use for better item magnet?