forked from luanti-org/minetest_game
		
	Set blend = "clip" on spawned particles
This commit is contained in:
		| @@ -9,6 +9,28 @@ if not builtin_item or type(builtin_item.set_item) ~= "function" or type(builtin | ||||
| 	return | ||||
| end | ||||
|  | ||||
| local smoke_particles = { | ||||
| 	amount = 3, | ||||
| 	time = 0.1, | ||||
| 	minpos = vector.new(-0.1, -0.1, -0.1), | ||||
| 	maxpos = vector.new(0.1, 0.1, 0.1), | ||||
| 	minvel = vector.new(0, 2.5, 0), | ||||
| 	maxvel = vector.new(0, 2.5, 0), | ||||
| 	minacc = vector.new(-0.15, -0.02, -0.15), | ||||
| 	maxacc = vector.new(0.15, -0.01, 0.15), | ||||
| 	minexptime = 4, | ||||
| 	maxexptime = 6, | ||||
| 	minsize = 5, | ||||
| 	maxsize = 5, | ||||
| 	collisiondetection = true, | ||||
| 	texture = { | ||||
| 		name = "default_item_smoke.png" | ||||
| 	} | ||||
| } | ||||
| if minetest.features.particle_blend_clip then | ||||
| 	smoke_particles.texture.blend = "clip" | ||||
| end | ||||
|  | ||||
| local item = { | ||||
| 	set_item = function(self, itemstring, ...) | ||||
| 		builtin_item.set_item(self, itemstring, ...) | ||||
| @@ -29,22 +51,10 @@ local item = { | ||||
| 			gain = 1.0, | ||||
| 			max_hear_distance = 8, | ||||
| 		}, true) | ||||
| 		minetest.add_particlespawner({ | ||||
| 			amount = 3, | ||||
| 			time = 0.1, | ||||
| 			minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 }, | ||||
| 			maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.z + 0.1 }, | ||||
| 			minvel = {x = 0, y = 2.5, z = 0}, | ||||
| 			maxvel = {x = 0, y = 2.5, z = 0}, | ||||
| 			minacc = {x = -0.15, y = -0.02, z = -0.15}, | ||||
| 			maxacc = {x = 0.15, y = -0.01, z = 0.15}, | ||||
| 			minexptime = 4, | ||||
| 			maxexptime = 6, | ||||
| 			minsize = 5, | ||||
| 			maxsize = 5, | ||||
| 			collisiondetection = true, | ||||
| 			texture = "default_item_smoke.png" | ||||
| 		}) | ||||
| 		local ps = table.copy(smoke_particles) | ||||
| 		ps.minpos = vector.add(ps.minpos, p) | ||||
| 		ps.maxpos = vector.add(ps.maxpos, p) | ||||
| 		minetest.add_particlespawner(ps) | ||||
| 	end, | ||||
|  | ||||
| 	on_step = function(self, dtime, ...) | ||||
|   | ||||
| @@ -27,6 +27,14 @@ minetest.register_on_mods_loaded(function() | ||||
| 	end | ||||
| end) | ||||
|  | ||||
| local function particle_texture(name) | ||||
| 	local ret = {name = name} | ||||
| 	if minetest.features.particle_blend_clip then | ||||
| 		ret.blend = "clip" | ||||
| 	end | ||||
| 	return ret | ||||
| end | ||||
|  | ||||
| local function rand_pos(center, pos, radius) | ||||
| 	local def | ||||
| 	local reg_nodes = minetest.registered_nodes | ||||
| @@ -211,7 +219,7 @@ local function add_effects(pos, radius, drops) | ||||
| 		size = radius * 10, | ||||
| 		collisiondetection = false, | ||||
| 		vertical = false, | ||||
| 		texture = "tnt_boom.png", | ||||
| 		texture = particle_texture("tnt_boom.png"), | ||||
| 		glow = 15, | ||||
| 	}) | ||||
| 	minetest.add_particlespawner({ | ||||
| @@ -227,12 +235,12 @@ local function add_effects(pos, radius, drops) | ||||
| 		maxexptime = 2.5, | ||||
| 		minsize = radius * 3, | ||||
| 		maxsize = radius * 5, | ||||
| 		texture = "tnt_smoke.png", | ||||
| 		texture = particle_texture("tnt_smoke.png"), | ||||
| 	}) | ||||
|  | ||||
| 	-- we just dropped some items. Look at the items entities and pick | ||||
| 	-- one of them to use as texture | ||||
| 	local texture = "tnt_blast.png" --fallback texture | ||||
| 	-- we just dropped some items. Look at the items and pick | ||||
| 	-- one of them to use as texture. | ||||
| 	local texture = "tnt_blast.png" -- fallback | ||||
| 	local node | ||||
| 	local most = 0 | ||||
| 	for name, stack in pairs(drops) do | ||||
|   | ||||
		Reference in New Issue
	
	Block a user