]> git.lizzy.rs Git - crafter_client.git/commitdiff
Grab a few FPS by making the heavy particle system spawn radially
authoroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 24 Jun 2020 03:40:10 +0000 (23:40 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 24 Jun 2020 03:40:10 +0000 (23:40 -0400)
version_send.lua
weather_handling.lua

index 2d286932fd6bbba32f783f6585495bafdaf95aeb..90cdf5204ee1c9bf65fe59478489f6a5ba9e9960 100644 (file)
@@ -1,5 +1,5 @@
 local minetest,name = minetest,minetest.localplayer:get_name()
 local version_channel = minetest.mod_channel_join(name..":client_version_channel")
 minetest.after(2,function() -- this needs a few seconds for the mod channel to open up
-    version_channel:send_all("0.05008")
+    version_channel:send_all("0.05009")
 end)
\ No newline at end of file
index 40ceb50b5a7fa8ea23857f127cf40280eac7bcc8..0c318c74d60d2a38aa4eed3da2fb7b303baaaecf 100644 (file)
@@ -1,4 +1,7 @@
-local minetest,name,vector,math,pairs = minetest,minetest.localplayer:get_name(),vector,math,pairs
+local
+minetest,name,vector,math,pairs
+=
+minetest,minetest.localplayer:get_name(),vector,math,pairs
 
 local weather_intake = minetest.mod_channel_join("weather_intake")
 local weather = minetest.mod_channel_join("weather_nodes")
@@ -27,6 +30,7 @@ local spawn_table
 local lightlevel
 local null
 local curr_light
+local distance = vector.distance
 local weather_effects = function(player,defined_type)
        pos = vector.round(player:get_pos())
        area = vector.new(10,10,10)
@@ -62,8 +66,8 @@ local weather_effects = function(player,defined_type)
        particle_table = {
                amount = 3,
                time = 0.5,
-               minvel = {x=0, y=-20, z=0},
-               maxvel = {x=0, y=-20, z=0},
+               minvel = {x=0, y=-30, z=0},
+               maxvel = {x=0, y=-30, z=0},
                minacc = {x=0, y=0, z=0},
                maxacc = {x=0, y=0, z=0},
                minexptime = 0.5,
@@ -115,18 +119,20 @@ local weather_effects = function(player,defined_type)
 
        for x = min.x,max.x do
                for z = min.z,max.z do
-                       y = pos.y - 5
-                       if spawn_table[x] and spawn_table[x][z] then
-                               y = spawn_table[x][z]
-                       end
-                       if minetest.get_node_or_nil(vector.new(x,y+1,z)) ~= nil then
-                               lightlevel = minetest.get_node_light(vector.new(x,y+1,z), 0.5)
-                               if lightlevel >= 14 or defined_type == "ichor" then
+                       if distance({x=x,y=0,z=z},{x=pos.x,y=0,z=pos.z}) <= 10 then
+                               y = pos.y - 5
+                               if spawn_table[x] and spawn_table[x][z] then
+                                       y = spawn_table[x][z]
+                               end
+                               if minetest.get_node_or_nil(vector.new(x,y+1,z)) ~= nil then
+                                       lightlevel = minetest.get_node_light(vector.new(x,y+1,z), 0.5)
+                                       if lightlevel >= 14 or defined_type == "ichor" then
 
-                                       particle_table.minpos = vector.new(x-0.5,y,z-0.5)
-                                       particle_table.maxpos = vector.new(x+0.5,y+20,z+0.5)
+                                               particle_table.minpos = vector.new(x-0.5,y,z-0.5)
+                                               particle_table.maxpos = vector.new(x+0.5,y+20,z+0.5)
 
-                                       null = minetest.add_particlespawner(particle_table)
+                                               null = minetest.add_particlespawner(particle_table)
+                                       end
                                end
                        end
                end