Compare commits

...

5 Commits

Author SHA1 Message Date
Adam Macumber ced005bf98 feat: Add extra probes for snow, start particles higher, make them slower. 2022-09-25 16:19:42 -04:00
Adam Macumber 73e5e55ff7 feat: Include backsplash sprite. 2022-09-18 20:25:24 -04:00
Adam Macumber d4c92b0340 feat: Increase rain particle count. 2022-09-18 20:24:34 -04:00
Adam Macumber cc83e63257 feat: Make rain behave a little more consistantly. 2022-09-18 20:24:01 -04:00
Adam Macumber 609c60cc73 feat: Use probes to determine whether outdoors or not. 2022-09-18 20:16:10 -04:00
4 changed files with 75 additions and 32 deletions

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -100,7 +100,35 @@ end
function mcl_weather.is_outdoor(pos)
local cpos = {x=pos.x, y=pos.y+1, z=pos.z}
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
end
return false