Try to reduce spawn star memory leak near spawn
Use grid-aligned pixel locaiton for calculating opacity so each star pixel position has only one opacity level associated with it, rather than the multiple that can currently occupy that opacity range.
This commit is contained in:
parent
7f76c50b7d
commit
2c2e705938
@ -63,13 +63,12 @@ nodecore.register_playerstep({
|
|||||||
local dist = vector.length(pos)
|
local dist = vector.length(pos)
|
||||||
local log = math_log(dist + 1) * posscale
|
local log = math_log(dist + 1) * posscale
|
||||||
pos = vector.multiply(pos, log / dist)
|
pos = vector.multiply(pos, log / dist)
|
||||||
local px = pos.z
|
local px = math_ceil(pos.z)
|
||||||
local py = -pos.x
|
local py = math_ceil(-pos.x)
|
||||||
local opac = (px * px + py * py) / 8 - 200
|
local opac = (px * px + py * py) / 8 - 200
|
||||||
if opac > 0 then
|
if opac > 0 then
|
||||||
if opac > 255 then opac = 255 end
|
if opac > 255 then opac = 255 end
|
||||||
top = top .. ":" .. (123 + math_ceil(px))
|
top = top .. ":" .. (123 + px) .. "," .. (123 + py)
|
||||||
.. "," .. (123 + math_ceil(py))
|
|
||||||
.. "=" .. esc("nc_player_sky_star.png^[resize:11x11"
|
.. "=" .. esc("nc_player_sky_star.png^[resize:11x11"
|
||||||
.. "^[opacity:" .. math_ceil(opac))
|
.. "^[opacity:" .. math_ceil(opac))
|
||||||
data.sky.textures[1] = top .. data.sky.darken
|
data.sky.textures[1] = top .. data.sky.darken
|
||||||
|
Loading…
x
Reference in New Issue
Block a user