Compare commits

..

No commits in common. "protiteen-dev" and "master" have entirely different histories.

4 changed files with 32 additions and 75 deletions

View File

@ -1,5 +1,5 @@
local PARTICLES_COUNT_RAIN = 500 local PARTICLES_COUNT_RAIN = 100
local PARTICLES_COUNT_THUNDER = 1000 local PARTICLES_COUNT_THUNDER = 300
local get_connected_players = minetest.get_connected_players local get_connected_players = minetest.get_connected_players
@ -20,46 +20,39 @@ mcl_weather.rain = {
init_done = false, init_done = false,
} }
local update_sound={} local update_sound={}
local vel= 0 local vel=math.random(0,3)
local falling_speed= 15 local falling_speed=math.random(10,15)
local size = math.random(1,3) local size = math.random(1,3)
local emitter_width = 20
local emitter_height = 20
local emitter_vertical_spread = 5
local psdef= { local psdef= {
amount = mcl_weather.rain.particles_count, amount = mcl_weather.rain.particles_count,
time=0, time=0,
minpos = vector.new(-emitter_width,emitter_height,-emitter_width), minpos = vector.new(-6,3,-6),
maxpos = vector.new( maxpos = vector.new(6,15,6),
emitter_width,
emitter_height+emitter_vertical_spread,
emitter_width
),
minvel = vector.new(-vel,-falling_speed,-vel), minvel = vector.new(-vel,-falling_speed,-vel),
maxvel = vector.new(vel,-falling_speed,vel), maxvel = vector.new(vel,-falling_speed+vel,vel),
minacc = vector.new(0,-0.2,0), minacc = vector.new(0,0,0),
maxacc = vector.new(0,-0.5,0), maxacc = vector.new(0,-0.4,0),
minexptime = 0.5, minexptime = 0.5,
maxexptime = 2, maxexptime = 2,
minsize = size, minsize = size,
maxsize= size*3, maxsize= size*2,
collisiondetection = true, collisiondetection = true,
collision_removal = true, collision_removal = true,
vertical = true, vertical = true,
} }
local psdef_backsplash= { local psdef_backsplash= {
amount = mcl_weather.rain.particles_count * 5, amount = 10,
time=0, time=0,
minpos = vector.new(-emitter_width,0.1,-emitter_width), minpos = vector.new(-3,-1,-3),
maxpos = vector.new(emitter_width,0.1,emitter_width), maxpos = vector.new(3,0,3),
minvel = vector.new(0,falling_speed,0), minvel = vector.new(-vel,falling_speed*2,-vel),
maxvel = vector.new(0,falling_speed+vel,0), maxvel = vector.new(vel,falling_speed*2+vel,vel),
minacc = vector.new(0,-falling_speed*7,0), minacc = vector.new(0,0,0),
maxacc = vector.new(0,-falling_speed*7,0), maxacc = vector.new(0,0,0),
minexptime = 0.5, minexptime = 0.1,
maxexptime = 1, maxexptime = 0.2,
minsize = 1, minsize = size*0.1,
maxsize= 3, maxsize= size*0.5,
collisiondetection = true, collisiondetection = true,
collision_removal = true, collision_removal = true,
vertical = true, vertical = true,
@ -97,7 +90,7 @@ function mcl_weather.rain.add_rain_particles(player)
psdef.texture=v psdef.texture=v
mcl_weather.add_spawner_player(player,"rain"..k,psdef) mcl_weather.add_spawner_player(player,"rain"..k,psdef)
end end
psdef_backsplash.texture= "weather_pack_rain_raindrop_backsplash_1.png" psdef_backsplash.texture=textures[math.random(1,#textures)]
local l=mcl_weather.add_spawner_player(player,"rainbacksplash",psdef_backsplash) local l=mcl_weather.add_spawner_player(player,"rainbacksplash",psdef_backsplash)
if l then if l then
update_sound[player:get_player_name()]=true update_sound[player:get_player_name()]=true

View File

@ -5,27 +5,19 @@ mcl_weather.snow = {}
mcl_weather.snow.particles_count = 15 mcl_weather.snow.particles_count = 15
mcl_weather.snow.init_done = false mcl_weather.snow.init_done = false
local emitter_width = 20
local emitter_height = 20
local emitter_vertical_spread = 5
local psdef= { local psdef= {
amount = 99, amount = 99,
time = 0, --stay on til we turn it off time = 0, --stay on til we turn it off
minpos = vector.new(-emitter_width,emitter_height,-emitter_width), minpos = vector.new(-15,-5,-15),
maxpos = vector.new( maxpos =vector.new(15,10,15),
emitter_width, minvel = vector.new(0,-1,0),
emitter_height+emitter_vertical_spread, maxvel = vector.new(0,-4,0),
emitter_width minacc = vector.new(0,-1,0),
), maxacc = vector.new(0,-4,0),
minvel = vector.new(0,-2,0), minexptime = 1,
maxvel = vector.new(0,-3,0), maxexptime = 1,
minacc = vector.new(0,0,0),
maxacc = vector.new(0,0,0),
minexptime = 15,
maxexptime = 15,
minsize = 0.5, minsize = 0.5,
maxsize = 4, maxsize = 5,
collisiondetection = true, collisiondetection = true,
collision_removal = true, collision_removal = true,
object_collision = true, object_collision = true,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -100,35 +100,7 @@ end
function mcl_weather.is_outdoor(pos) function mcl_weather.is_outdoor(pos)
local cpos = {x=pos.x, y=pos.y+1, z=pos.z} local cpos = {x=pos.x, y=pos.y+1, z=pos.z}
local dim = mcl_worlds.pos_to_dimension(cpos) local dim = mcl_worlds.pos_to_dimension(cpos)
if minetest.get_node_light(cpos, 0.5) == 15 and dim == "overworld" then
local probe_is_outdoors = function ()
-- Place probes in a square around the player just above their head.
local probe_distance = {
x = 7,
y = 1,
z = 7
}
local probe_offsets = { -1, 0, 1 }
for _, x in ipairs(probe_offsets) do
for _, z in ipairs(probe_offsets) do
local probe_pos = {
x = cpos.x + x * probe_distance.x,
y = cpos.y + probe_distance.y,
z = cpos.z + z * probe_distance.z
}
local light = minetest.get_node_light(probe_pos, 0.5)
if light ~= nil and light == 15 then
return true
end
end
end
return false
end
-- If at least one probe is "outdoors", the player is considered outdoors.
if probe_is_outdoors() and dim == "overworld" then
return true return true
end end
return false return false