1
0
Fork 0

Merge kay27_textures branch: more recongizable obsidian texture; better NP texture; Nether particles

This commit is contained in:
kay27 2020-10-24 21:49:11 +04:00
parent c4f038ab77
commit 1965696829
10 changed files with 147 additions and 20 deletions

View File

@ -70,6 +70,12 @@ function mcl_worlds.has_weather(pos)
return pos.y <= mcl_vars.mg_overworld_max and pos.y >= mcl_vars.mg_overworld_min - 64 return pos.y <= mcl_vars.mg_overworld_max and pos.y >= mcl_vars.mg_overworld_min - 64
end end
-- Takes a position and returns true if this position can have Nether dust
function mcl_worlds.has_dust(pos)
-- Weather in the Overworld and the high part of the void below
return pos.y <= mcl_vars.mg_nether_max + 64 and pos.y >= mcl_vars.mg_nether_min - 64
end
-- Takes a position (pos) and returns true if compasses are working here -- Takes a position (pos) and returns true if compasses are working here
function mcl_worlds.compass_works(pos) function mcl_worlds.compass_works(pos)
-- It doesn't work in Nether and the End, but it works in the Overworld and in the high part of the void below -- It doesn't work in Nether and the End, but it works in the Overworld and in the high part of the void below

View File

@ -10,6 +10,7 @@ end
dofile(modpath.."/weather_core.lua") dofile(modpath.."/weather_core.lua")
dofile(modpath.."/snow.lua") dofile(modpath.."/snow.lua")
dofile(modpath.."/rain.lua") dofile(modpath.."/rain.lua")
dofile(modpath.."/nether_dust.lua")
if minetest.get_modpath("lightning") ~= nil then if minetest.get_modpath("lightning") ~= nil then
dofile(modpath.."/thunder.lua") dofile(modpath.."/thunder.lua")

View File

@ -0,0 +1,39 @@
mcl_weather.nether_dust = {}
mcl_weather.nether_dust.particles_count = 99
-- calculates coordinates and draw particles for Nether dust
mcl_weather.nether_dust.add_dust_particles = function(player)
for i=mcl_weather.nether_dust.particles_count, 1,-1 do
local rpx, rpy, rpz = mcl_weather.get_random_pos_by_player_look_dir(player)
minetest.add_particle({
pos = {x = rpx, y = rpy - math.random(6, 18), z = rpz},
velocity = {x = math.random(-30,30)*0.01, y = math.random(-15,15)*0.01, z = math.random(-30,30)*0.01},
acceleration = {x = math.random(-50,50)*0.02, y = math.random(-20,20)*0.02, z = math.random(-50,50)*0.02},
expirationtime = 3,
size = math.random(6,20)*0.01,
collisiondetection = false,
object_collision = false,
vertical = false,
glow = math.random(0,minetest.LIGHT_MAX),
texture = "mcl_particles_nether_dust"..tostring(i%3+1)..".png",
playername = player:get_player_name()
})
end
end
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer >= 0.7 then
timer = 0
else
return
end
for _, player in ipairs(minetest.get_connected_players()) do
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_dust(player:get_pos())) then
return false
end
mcl_weather.nether_dust.add_dust_particles(player)
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 561 B

View File

@ -1,7 +1,44 @@
import png import png
w, h = 64, 256; w, h = 16, 128;
s = [[int(0) for c in range(w)] for c in range(h)] s = [[int(0) for c in range(w)] for c in range(h)]
def drawpixel(x, y, t):
if (x >= 0) and (x < w) and (y >= 0) and (y < h):
if(t == 1):
s[y][x] = 1
elif t==2:
s[y][x] = 1 - s[y][x]
elif t==3:
s[y][x] = s[y][x] + 1
if s[y][x] > 3:
s[y][x] =s[y][x]-4
def circle(X1, Y1, R, t):
x = 0
y = R
delta = 1 - 2 * R
error = 0
while y >= 0:
if Y1%w + y < w:
drawpixel(X1 + x, Y1 + y, t)
if Y1%w - y >= 0:
drawpixel(X1 + x, Y1 - y, t)
if Y1%w + y < w:
drawpixel(X1 - x, Y1 + y, t)
if Y1%w - y >= 0:
drawpixel(X1 - x, Y1 - y, t)
error = 2 * (delta + y) - 1
if ((delta < 0) and (error <= 0)):
x = x + 1
delta = delta + 2 * x + 1
elif ((delta > 0) and (error > 0)):
y = y - 1
delta = delta - 2 * y + 1
else:
x = x + 1
y = y - 1
delta = delta + 2 * (x - y)
def line(y1, x1, y2, x2, v): def line(y1, x1, y2, x2, v):
signx = 1 signx = 1
signy = 1 signy = 1
@ -19,10 +56,14 @@ def line(y1, x1, y2, x2, v):
if dx >= dy: if dx >= dy:
dir1 = 1 dir1 = 1
for i in range(max(dx, dy)+1): for i in range(max(dx, dy)+1):
if v==2: if(v == 1):
s[x1][y1] = 1
elif v==2:
s[x1][y1] = 1 - s[x1][y1] s[x1][y1] = 1 - s[x1][y1]
else: elif v==3 or (v==4 and ((x1^y1)&1)) or (v==5 and (((x1|y1)&1)==0)) or (v==7 and ((((x1+1)|y1)&1)==0)) or (v==8 and ((((x1+1)|(y1+1))&1)==0)) or (v==6 and (((x1|(y1+1))&1)==0)):
s[x1][y1] = v s[x1][y1] = s[x1][y1] + 1
if s[x1][y1] > 3:
s[x1][y1] = s[x1][y1] - 4
if dir1 == 1: if dir1 == 1:
x1 += signx x1 += signx
offsy += dy offsy += dy
@ -37,22 +78,37 @@ def line(y1, x1, y2, x2, v):
offsx -= dy offsx -= dy
# R, G, B, Alpha (0xFF = opaque): # R, G, B, Alpha (0xFF = opaque):
palette=[(0x00,0x00,0xaf,0xa0), (0x7f,0x0f,0xaf,0xb8)] palette=[
(0x30,0x03,0xaf,0xa4),
(0x4f,0x1c,0xaf,0xb4),
(0x7f,0x3d,0xa0,0xc8),
(0x6d,0x5d,0x99,0xb1)
]
for j in range(16): circles = h//w
i = j * 4 maxr = w//2
line(i, 0, 63-i, 63, 2) for i in [1,2,3,5,9,10,11,13]:
line(63, i, 0, 63-i, 2) for c in range(circles):
i+=1 q = ((circles-c-1)+i)%w
line(i, 64, 63-i, 127, 2) circle(maxr, maxr+c*w, q, 3)
line(63, 64+i, 0, 127-i, 2)
i+=1
line(i, 128, 63-i, 191, 2)
line(63, 128+i, 0, 191-i, 2)
i+=1
line(i, 192, 63-i, 255, 2)
line(63, 192+i, 0, 255-i, 2)
w = png.Writer(len(s[0]), len(s), palette=palette, bitdepth=1)
linesperside = 2
linestarts = round(w / linesperside) # 8
lineoffset = round(w / linestarts) # 2
wminus = w - 1
for j in range(linesperside):
for k in range(linestarts):
offset = k * w
for q in [0,1,3,4]:
# for q in [1]:
i = j*linestarts + ((k+q)%linestarts)
line(i, offset, wminus-i, offset+wminus, 5+(k&3))
line(wminus, offset+i, 0, offset+wminus-i, 5+(k&3))
w = png.Writer(len(s[0]), len(s), palette=palette, bitdepth=2)
f = open('mcl_portals_portal.png', 'wb') f = open('mcl_portals_portal.png', 'wb')
w.write(f, s) w.write(f, s)

View File

@ -0,0 +1,25 @@
import png
s = [
[
'1',
],
[
'11',
],
[
'111',
'111',
],
]
# R, G, B, Alpha (0xFF = opaque):
palette=[(0x00,0x00,0x00,0x00), (0x8F,0x69,0x66,0x9F)]
#palette=[(0x00,0x00,0x00,0x00), (0xF0,0xF0,0xF0,0x80)]
for i in range(0, len(s)):
print(str(i)+"/"+str(len(s)))
q = [[int(c) for c in row] for row in s[i]]
w = png.Writer(len(q[0]), len(q), palette=palette, bitdepth=1)
f = open('mcl_particles_nether_dust'+str(i+1)+'.png', 'wb')
w.write(f, q)