From 196569682930128a16821abdb621ac6c75895f69 Mon Sep 17 00:00:00 2001 From: kay27 Date: Sat, 24 Oct 2020 21:49:11 +0400 Subject: [PATCH] Merge kay27_textures branch: more recongizable obsidian texture; better NP texture; Nether particles --- mods/CORE/mcl_worlds/init.lua | 6 ++ mods/ENVIRONMENT/mcl_weather/init.lua | 1 + mods/ENVIRONMENT/mcl_weather/nether_dust.lua | 39 +++++++ .../textures/mcl_particles_nether_dust1.png | Bin 0 -> 99 bytes .../textures/mcl_particles_nether_dust2.png | Bin 0 -> 99 bytes .../textures/mcl_particles_nether_dust3.png | Bin 0 -> 101 bytes .../mcl_core/textures/default_obsidian.png | Bin 188 -> 324 bytes .../textures/mcl_portals_portal.png | Bin 1086 -> 561 bytes tools/create_texture__mcl_portals_portal.py | 96 ++++++++++++++---- tools/create_texture__nether_dust.py | 25 +++++ 10 files changed, 147 insertions(+), 20 deletions(-) create mode 100644 mods/ENVIRONMENT/mcl_weather/nether_dust.lua create mode 100644 mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust1.png create mode 100644 mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust2.png create mode 100644 mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust3.png create mode 100644 tools/create_texture__nether_dust.py diff --git a/mods/CORE/mcl_worlds/init.lua b/mods/CORE/mcl_worlds/init.lua index d032426db..35549ffad 100644 --- a/mods/CORE/mcl_worlds/init.lua +++ b/mods/CORE/mcl_worlds/init.lua @@ -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 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 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 diff --git a/mods/ENVIRONMENT/mcl_weather/init.lua b/mods/ENVIRONMENT/mcl_weather/init.lua index e31331f5e..c7b8fb6de 100644 --- a/mods/ENVIRONMENT/mcl_weather/init.lua +++ b/mods/ENVIRONMENT/mcl_weather/init.lua @@ -10,6 +10,7 @@ end dofile(modpath.."/weather_core.lua") dofile(modpath.."/snow.lua") dofile(modpath.."/rain.lua") +dofile(modpath.."/nether_dust.lua") if minetest.get_modpath("lightning") ~= nil then dofile(modpath.."/thunder.lua") diff --git a/mods/ENVIRONMENT/mcl_weather/nether_dust.lua b/mods/ENVIRONMENT/mcl_weather/nether_dust.lua new file mode 100644 index 000000000..2fc7e5dd4 --- /dev/null +++ b/mods/ENVIRONMENT/mcl_weather/nether_dust.lua @@ -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) diff --git a/mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust1.png b/mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust1.png new file mode 100644 index 0000000000000000000000000000000000000000..25c71fba3be78495330f1a24b12ce04b2b9ed1bf GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)gaYymzYu0Xm!GcEqX$B#f3Q%R6t qFvEN?W#_j*9+#(!V@SoE?&t;ucLK6VwR~MTA literal 0 HcmV?d00001 diff --git a/mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust2.png b/mods/ENVIRONMENT/mcl_weather/textures/mcl_particles_nether_dust2.png new file mode 100644 index 0000000000000000000000000000000000000000..73135f3bb6fbb7b6ad2111e3eb9667f6dfab054e GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^OhC-Y$P6UUy?J{QNU;U@gt!9f{>-%a2OmEISxhBC re!&d$#gv`j0(o4XE{-7;bCNB9>_ZF(gW|#ifh-13S3j3^P6TY2?c(s&I7%0x*>FVdQ&MBb@08s-OGXMYp literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/textures/default_obsidian.png b/mods/ITEMS/mcl_core/textures/default_obsidian.png index 32b3371cef4b884e38755fc5c755bd368f282e01..a7f1d8896e2ec390565519fb55b66b5f2eb10bad 100644 GIT binary patch delta 309 zcmV-50m}Zo0mK537=H)?0001xk!Usm000SaNLh0L01m?d01m?e$8V@)0002?NklZ$=M!UKU|?gAVqjqS#qf*)FOcA|XXaq%P7COK^yJ<5U+=zrd-dn{A2h_xD$mTo z3z7Q#<1sS_JNMHkzwf`=@$>h4Oe5EK-Z^yk?K=Z;;NSnh zOlU%iVjlcl%9u*|xs)N|=o;?7+VSz*T}%x^JgN`|xlV%HNYI5$5K*{|Xu!|KONd7m zSq~Ef14Cc&6kKkYxGeA8m)pp`!r})-F%L9F$bMkvVCR+tcrI{Z_X7h116FT9ZTR>9FC0NsL&6O%h^z+y69=Cysm7><00000NkvXX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?d?> z4x4|c<|!7~5UwGq&X?K95^#NOUf=Avw8q+4a;(;~*?YeIDDwPOQ-Z|2O>zEg zzAoMSTO_f82QR1kd$+q@a;p^whkCE`?xz)pW`8?YWCTi=Y0(@w+kJhMEjEP2OHSY2 z?U%bQ%FwdVz1iSOf4 zx!_3QBMPbsrvlb45R3uha8%F3aX1jy<<7u^AR1g_tpKPbL?M>8UjvQ^V$v#v62JIv zzkjVU#+GCI_GL13&BAm1I|O`AQZ+J1xZm8#((;MBZm@&zDNN+VgeIXzn2ec8tc}DF+$<}e9_M+Hj=>$GT`!vDVpa6fzK4H#N_Y404|?4G{jCN)?gCvm z(RL7MP^`Ng{?vEHdI?YGb9SifK|3Ot0j%mo@KV}qH1ZnJC2LJ#707*qoM6N<$f-|7=wg3PC diff --git a/tools/create_texture__mcl_portals_portal.py b/tools/create_texture__mcl_portals_portal.py index f2b1e1524..6f0725f69 100644 --- a/tools/create_texture__mcl_portals_portal.py +++ b/tools/create_texture__mcl_portals_portal.py @@ -1,7 +1,44 @@ import png -w, h = 64, 256; +w, h = 16, 128; 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): signx = 1 signy = 1 @@ -19,10 +56,14 @@ def line(y1, x1, y2, x2, v): if dx >= dy: dir1 = 1 for i in range(max(dx, dy)+1): - if v==2: - s[x1][y1]=1-s[x1][y1] - else: - s[x1][y1] = v + if(v == 1): + s[x1][y1] = 1 + elif v==2: + s[x1][y1] = 1 - s[x1][y1] + 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] = s[x1][y1] + 1 + if s[x1][y1] > 3: + s[x1][y1] = s[x1][y1] - 4 if dir1 == 1: x1 += signx offsy += dy @@ -37,22 +78,37 @@ def line(y1, x1, y2, x2, v): offsx -= dy # 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): - i = j * 4 - line(i, 0, 63-i, 63, 2) - line(63, i, 0, 63-i, 2) - i+=1 - line(i, 64, 63-i, 127, 2) - 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) +circles = h//w +maxr = w//2 +for i in [1,2,3,5,9,10,11,13]: + for c in range(circles): + q = ((circles-c-1)+i)%w + circle(maxr, maxr+c*w, q, 3) -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') w.write(f, s) diff --git a/tools/create_texture__nether_dust.py b/tools/create_texture__nether_dust.py new file mode 100644 index 000000000..f1b8e27f2 --- /dev/null +++ b/tools/create_texture__nether_dust.py @@ -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)