update void_chest: particle optimizations, particle switch, animated.

This commit is contained in:
MeseCraft 2022-07-18 23:36:34 -05:00
parent dccf0ab015
commit 511ddd8263
5 changed files with 18 additions and 9 deletions

@ -1,6 +1,6 @@
saras_simple_survival mod: void_chest
mesecraft mod: void_chest
=====================================
Copyright 2020 freegamers.org
Copyright 2022 mesecraft.com
Description
@ -45,4 +45,4 @@ This mod is a fork of morechests, which itself is a fork of 0gb.us's mod called
https://forum.minetest.net/viewtopic.php?f=11&t=4366
The textures used for void chests are from jp's "xdecor" mod, which in turn are from the PixelBOX Reloaded texture pack for Minetest.
https://github.com/minetest-mods/xdecor
https://github.com/minetest-mods/xdecor

@ -46,11 +46,12 @@ minetest.register_node("void_chest:void_chest", {
on_timer = function(pos)
if void_chest.show_particles then
-- Particles for the void effect, implemented by MisterE, thanks!
for i=1,10 do -- number of particles spawned every on_timer
for i=1,2 do -- number of particles spawned every on_timer
local spin_speed = math.random(80,175)/1000 --controls how fast a particular particle spins
local vel_scalar = math.random(0,5)/10 -- multiplied by the particle's velocity vector of 1
local accel_scalar = math.random(1,5)/10 -- multiplied by the particle's accel vector of 1
local expir = math.random(1,10) -- number of sec particle will last, if it doesn't hit a node
local particle_pos = {x=pos.x + ((math.random(-10,10)/10)*(math.random(6,15)/10)), y=pos.y + ((math.random(-10,10)/10)*(math.random(6,15)/10)), z=pos.z+ ((math.random(-10,10)/10)*(math.random(6,15)/10))}
local expir = math.random(1,5) -- number of sec particle will last, if it doesn't hit a node
local particle_pos = {x=pos.x + ((math.random(-15,15)/10)*(math.random(6,15)/10)), y=pos.y + ((math.random(-15,15)/10)*(math.random(6,15)/10)), z=pos.z+ ((math.random(-15,15)/10)*(math.random(6,15)/10))}
local part_vel = vector.direction(particle_pos, pos)
part_vel = {x= vel_scalar*part_vel.x, y= vel_scalar*part_vel.y, z= vel_scalar*part_vel.z}
local part_accel = vector.direction(particle_pos, pos)
@ -60,11 +61,17 @@ minetest.register_node("void_chest:void_chest", {
velocity = part_vel,
acceleration = part_accel,
expirationtime = expir,
size = math.random(7,10)/10,
size = math.random(5,15)/10,
collisiondetection = true,
collision_removal = true,
vertical = false,
texture = "void_chest_void_particle.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = spin_speed,
},
glow = 5,
})
end
@ -100,3 +107,4 @@ minetest.register_on_joinplayer(function(player)
local inv = player:get_inventory()
inv:set_size("void_chest:void_chest", 8*4)
end)

@ -1,5 +1,5 @@
name = void_chest
description = Access your belongings anywhere by using the power of the void chest!
author = FreeGamers.org
author = MeseCraft
depends = default
optional_depends = magic_materials
optional_depends = magic_materials

@ -2,6 +2,7 @@
# VOID CHEST:
# on low performance servers the particles can cause a drop in performance.
# Default: true
void_chest.show_particles (Show Particles) bool true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB